From 14a72542ff3e17693be29a68eff28b294d7688a9 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 27 Jul 2019 14:11:43 -0700 Subject: [PATCH] Updated compiler option syntax. --- README.md | 12 +++++++----- examples/java/build.gradle | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 40d0c89..e6080af 100644 --- a/README.md +++ b/README.md @@ -214,19 +214,21 @@ Please look at [build.gradle](https://github.com/ethauvin/semver/blob/master/exa ### Class & Source Generation -In order to also incorporate the generated source code into the `source tree`, add the following to the very top of [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle): +In order to also incorporate the generated source code into the `source tree`, add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle): ```gradle -compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java") +tasks.withType(JavaCompile) { + options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java") +} ``` The [`GeneratedVersion.java`](https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java) file will now be located in `src/generated`. ### Java 12 -When using properties file (`version.properties`) under Java 12+ and Gradle 5.4.1+, the directory containing the properties file must be specified using the `semver.project.dir` processor argument. +Under Java 12+ (Gradle 5.4.1+), the directory containing the configuration files (`version.properties`, `version.mustache`) must be specified using the `semver.project.dir` processor argument. -For example, if the properties file is in the Gradle project directory, add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle): +For example, if the configuration files are in the Gradle project directory, add the following to [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle): ```gradle tasks.withType(JavaCompile) { @@ -272,7 +274,7 @@ kapt { } ``` -The directory containing the properties file (`version.properties`) must be specified using the `semver.project.dir` processor argument. +The directory containing the configuration files (`version.properties`, `version.mustache`) must be specified using the `semver.project.dir` processor argument. ## Kobalt diff --git a/examples/java/build.gradle b/examples/java/build.gradle index 20d7757..da23155 100644 --- a/examples/java/build.gradle +++ b/examples/java/build.gradle @@ -14,8 +14,6 @@ final def semverProcessor = 'net.thauvin.erik:semver:1.2.0' sourceCompatibility = 1.8 targetCompatibility = 1.8 -compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java") - mainClassName = 'com.example.App' repositories { @@ -29,6 +27,7 @@ dependencies { } tasks.withType(JavaCompile) { + options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java") if (JavaVersion.current().isJava12Compatible()) { options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ] }