More examples testing.

This commit is contained in:
Erik C. Thauvin 2018-07-03 19:24:30 -07:00
parent c7d46bfd7a
commit f4f0ce42ae
12 changed files with 50 additions and 38 deletions

View file

@ -3,9 +3,7 @@
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output-test url="file://$MODULE_DIR$/../../../../examples/annotation-processor/java/out/test/classes" /> <output-test url="file://$MODULE_DIR$/../../../../examples/annotation-processor/java/out/test/classes" />
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$/../../../../examples/annotation-processor/java/src/test"> <content url="file://$MODULE_DIR$/../../../../examples/annotation-processor/java/src/test" />
<sourceFolder url="file://$MODULE_DIR$/../../../../examples/annotation-processor/java/src/test/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="annotation-processor-java_main" /> <orderEntry type="module" module-name="annotation-processor-java_main" />

View file

@ -3,9 +3,7 @@
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output-test url="file://$MODULE_DIR$/../../examples/annotation-processor/java/out/test/classes" /> <output-test url="file://$MODULE_DIR$/../../examples/annotation-processor/java/out/test/classes" />
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$/../../examples/annotation-processor/java/src/test"> <content url="file://$MODULE_DIR$/../../examples/annotation-processor/java/src/test" />
<sourceFolder url="file://$MODULE_DIR$/../../examples/annotation-processor/java/src/test/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="ap-examples-java_main" /> <orderEntry type="module" module-name="ap-examples-java_main" />

View file

@ -8,5 +8,6 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="groovy-2.5.0" level="application" />
</component> </component>
</module> </module>

View file

@ -3,8 +3,9 @@
**/.idea/libraries **/.idea/libraries
**/.idea/tasks.xml **/.idea/tasks.xml
**/.idea/workspace.xml **/.idea/workspace.xml
*.sublime-*
*.iws *.iws
*.properties
*.sublime-*
.classpath .classpath
.DS_Store .DS_Store
.gradle .gradle

View file

@ -1,9 +1,14 @@
// plugins {
// id 'java'
// id 'application'
// id "net.thauvin.erik.gradle.semver" version "0.9.4-beta"
// }
buildscript { buildscript {
repositories { repositories {
mavenLocal() mavenLocal()
} }
dependencies { dependencies {
classpath "net.thauvin.erik.gradle:semver:0.9.4-beta" classpath "net.thauvin.erik.gradle:semver:0.9.5-beta"
} }
} }
@ -15,6 +20,8 @@ mainClassName = 'App'
version = 1.0 version = 1.0
def f = new File("test.properties")
dependencies { dependencies {
} }
@ -23,21 +30,26 @@ repositories {
jcenter() jcenter()
} }
task cleanVersion { clean {
delete "test.properties" delete fileTree(dir: "$projectDir", include: "*.properties")
} }
clean.dependsOn("cleanVersion") incrementPatch {
doFirst {
println("[Gradle] exists: " + f.exists() + ", canRead: " + f.canRead())
}
}
run { run {
//dependsOn("incrementPatch") //dependsOn("incrementPatch")
doFirst { doFirst {
println("Version: $version") println("Version: $version")
args = [f.name]
} }
} }
semver { semver {
properties = "$projectDir/example.properties" properties = "$projectDir/${f.name}"
keysPrefix = "example." keysPrefix = f.name.substring(0, f.name.indexOf(".") + 1)
buildMetaKey = "meta" buildMetaKey = "meta"
} }

View file

@ -1,7 +0,0 @@
#Generated by the Semver Plugin for Gradle
#Tue Jul 03 13:33:49 PDT 2018
example.major=2
example.meta=007
example.prerelease=beta
example.minor=1
example.patch=12

View file

@ -1,12 +1,21 @@
/* import java.io.IOException;
* This Java source file was generated by the Gradle 'init' task. import java.nio.file.Files;
*/ import java.nio.file.Paths;
import java.util.List;
public class App { public class App {
public String getGreeting() { public static void main(String[] args) {
return "Hello world."; new App().cat(args[0]);
} }
public static void main(String[] args) { public void cat(String name) {
System.out.println(new App().getGreeting()); try {
final List<String> content = Files.readAllLines(Paths.get(name));
for (String line : content) {
if (!line.startsWith("#")) System.out.println(line);
}
} catch (IOException e) {
System.out.println(e);
}
} }
} }

View file

@ -1,11 +1,14 @@
/* /*
* This Java source file was generated by the Gradle 'init' task. * This Java source file was generated by the Gradle 'init' task.
*/ */
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class AppTest { public class AppTest {
@Test public void testAppHasAGreeting() { @Test
public void testAppHasAGreeting() {
App classUnderTest = new App(); App classUnderTest = new App();
assertNotNull("app should have a greeting", classUnderTest.getGreeting()); assertNotNull("app should have a greeting", classUnderTest.getGreeting());
} }

View file

@ -0,0 +1,4 @@
f = new File("K:\\kotlin\\semver-gradle\\examples\\test\\examples.properties")
println(f.absoluteFile)
println(f.exists())
println(f.canRead())

View file

@ -1,7 +0,0 @@
#Generated by the Semver Plugin for Gradle
#Mon Jul 02 22:37:14 PDT 2018
version.prerelease=
version.buildmeta=
version.patch=3
version.major=1
version.minor=0

View file

@ -1,5 +1,5 @@
#Generated by the Semver Plugin for Gradle #Generated by the Semver Plugin for Gradle
#Tue Jul 03 13:33:49 PDT 2018 #Tue Jul 03 14:16:07 PDT 2018
version.prerelease= version.prerelease=
version.buildmeta= version.buildmeta=
version.patch=0 version.patch=0