diff --git a/.idea/modules/annotation-processor/java/annotation-processor-java_test.iml b/.idea/modules/annotation-processor/java/annotation-processor-java_test.iml index bb2229c..684de73 100644 --- a/.idea/modules/annotation-processor/java/annotation-processor-java_test.iml +++ b/.idea/modules/annotation-processor/java/annotation-processor-java_test.iml @@ -3,9 +3,7 @@ - - - + diff --git a/.idea/modules/ap-examples-java_test.iml b/.idea/modules/ap-examples-java_test.iml index 1cf4c8d..0a8d509 100644 --- a/.idea/modules/ap-examples-java_test.iml +++ b/.idea/modules/ap-examples-java_test.iml @@ -3,9 +3,7 @@ - - - + diff --git a/.idea/modules/examples.iml b/.idea/modules/examples.iml index 455d728..7e87d80 100644 --- a/.idea/modules/examples.iml +++ b/.idea/modules/examples.iml @@ -8,5 +8,6 @@ + \ No newline at end of file diff --git a/examples/test/.gitignore b/examples/test/.gitignore index 6322c7f..950c3cc 100644 --- a/examples/test/.gitignore +++ b/examples/test/.gitignore @@ -3,8 +3,9 @@ **/.idea/libraries **/.idea/tasks.xml **/.idea/workspace.xml -*.sublime-* *.iws +*.properties +*.sublime-* .classpath .DS_Store .gradle diff --git a/examples/test/build.gradle b/examples/test/build.gradle index 1c7642d..3990638 100644 --- a/examples/test/build.gradle +++ b/examples/test/build.gradle @@ -1,9 +1,14 @@ +// plugins { +// id 'java' +// id 'application' +// id "net.thauvin.erik.gradle.semver" version "0.9.4-beta" +// } buildscript { repositories { mavenLocal() } 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 +def f = new File("test.properties") + dependencies { } @@ -23,21 +30,26 @@ repositories { jcenter() } -task cleanVersion { - delete "test.properties" +clean { + delete fileTree(dir: "$projectDir", include: "*.properties") } -clean.dependsOn("cleanVersion") +incrementPatch { + doFirst { + println("[Gradle] exists: " + f.exists() + ", canRead: " + f.canRead()) + } +} run { - //dependsOn("incrementPatch") + //dependsOn("incrementPatch") doFirst { println("Version: $version") + args = [f.name] } } semver { - properties = "$projectDir/example.properties" - keysPrefix = "example." + properties = "$projectDir/${f.name}" + keysPrefix = f.name.substring(0, f.name.indexOf(".") + 1) buildMetaKey = "meta" } \ No newline at end of file diff --git a/examples/test/example.properties b/examples/test/example.properties deleted file mode 100644 index 4deccfb..0000000 --- a/examples/test/example.properties +++ /dev/null @@ -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 diff --git a/examples/test/src/main/java/App.class b/examples/test/src/main/java/App.class index 08ab694..04cd607 100644 Binary files a/examples/test/src/main/java/App.class and b/examples/test/src/main/java/App.class differ diff --git a/examples/test/src/main/java/App.java b/examples/test/src/main/java/App.java index bd9132e..d1cb582 100644 --- a/examples/test/src/main/java/App.java +++ b/examples/test/src/main/java/App.java @@ -1,12 +1,21 @@ -/* - * This Java source file was generated by the Gradle 'init' task. - */ +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; + public class App { - public String getGreeting() { - return "Hello world."; + public static void main(String[] args) { + new App().cat(args[0]); } - public static void main(String[] args) { - System.out.println(new App().getGreeting()); + public void cat(String name) { + try { + final List content = Files.readAllLines(Paths.get(name)); + for (String line : content) { + if (!line.startsWith("#")) System.out.println(line); + } + } catch (IOException e) { + System.out.println(e); + } } -} +} \ No newline at end of file diff --git a/examples/test/src/test/java/AppTest.java b/examples/test/src/test/java/AppTest.java index e611fc7..7bd2702 100644 --- a/examples/test/src/test/java/AppTest.java +++ b/examples/test/src/test/java/AppTest.java @@ -1,11 +1,14 @@ /* * This Java source file was generated by the Gradle 'init' task. */ + import org.junit.Test; + import static org.junit.Assert.*; public class AppTest { - @Test public void testAppHasAGreeting() { + @Test + public void testAppHasAGreeting() { App classUnderTest = new App(); assertNotNull("app should have a greeting", classUnderTest.getGreeting()); } diff --git a/examples/test/test.groovy b/examples/test/test.groovy new file mode 100644 index 0000000..5efb64a --- /dev/null +++ b/examples/test/test.groovy @@ -0,0 +1,4 @@ +f = new File("K:\\kotlin\\semver-gradle\\examples\\test\\examples.properties") +println(f.absoluteFile) +println(f.exists()) +println(f.canRead()) \ No newline at end of file diff --git a/examples/test/version.properties b/examples/test/version.properties deleted file mode 100644 index 0a909a3..0000000 --- a/examples/test/version.properties +++ /dev/null @@ -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 diff --git a/examples/version.properties b/examples/version.properties index dafedd7..69cf961 100644 --- a/examples/version.properties +++ b/examples/version.properties @@ -1,5 +1,5 @@ #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.buildmeta= version.patch=0