Updated compiler option syntax.
This commit is contained in:
parent
ae44b36283
commit
14a72542ff
2 changed files with 8 additions and 7 deletions
12
README.md
12
README.md
|
@ -214,19 +214,21 @@ Please look at [build.gradle](https://github.com/ethauvin/semver/blob/master/exa
|
||||||
|
|
||||||
### Class & Source Generation
|
### 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
|
```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`.
|
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
|
### 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
|
```gradle
|
||||||
tasks.withType(JavaCompile) {
|
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
|
## Kobalt
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ final def semverProcessor = 'net.thauvin.erik:semver:1.2.0'
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
targetCompatibility = 1.8
|
targetCompatibility = 1.8
|
||||||
|
|
||||||
compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
|
||||||
|
|
||||||
mainClassName = 'com.example.App'
|
mainClassName = 'com.example.App'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -29,6 +27,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
|
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
||||||
if (JavaVersion.current().isJava12Compatible()) {
|
if (JavaVersion.current().isJava12Compatible()) {
|
||||||
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue