Removed Java 12 syntax.
This commit is contained in:
parent
14a72542ff
commit
1580bfca98
3 changed files with 10 additions and 20 deletions
21
README.md
21
README.md
|
@ -17,7 +17,6 @@ This processor was inspired by Cédric Beust's [version-processor](https://githu
|
|||
- [Gradle](#gradle)
|
||||
- [Class Generation](#class-generation)
|
||||
- [Class & Source Generation](#class--source-generation)
|
||||
- [Java 12](#java-12)
|
||||
- [Kotlin](#kotlin)
|
||||
- [Kotlin & Gradle](#kotlin--gradle)
|
||||
- [Kobalt](#kobalt)
|
||||
|
@ -206,8 +205,14 @@ dependencies {
|
|||
annotationProcessor 'net.thauvin.erik:semver:1.2.0'
|
||||
implementation 'net.thauvin.erik:semver:1.2.0'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
||||
}
|
||||
```
|
||||
|
||||
The directory containing the configuration files (`version.properties`, `version.mustache`) must be specified using the `semver.project.dir` processor argument.
|
||||
|
||||
The [`GeneratedVersion.java`](https://github.com/ethauvin/semver/blob/master/examples/java/src/generated/java/com/example/GeneratedVersion.java) class will be automatically created in the `build/generated` directory upon compiling.
|
||||
|
||||
Please look at [build.gradle](https://github.com/ethauvin/semver/blob/master/examples/java/build.gradle) in the [examples/java](https://github.com/ethauvin/semver/tree/master/examples/java) directory for a sample.
|
||||
|
@ -224,20 +229,6 @@ tasks.withType(JavaCompile) {
|
|||
|
||||
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
|
||||
|
||||
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 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) {
|
||||
if (JavaVersion.current().isJava12Compatible()) {
|
||||
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Kotlin
|
||||
|
||||
The annotation processor also supports [Kotlin](https://kotlinlang.org/).
|
||||
|
|
|
@ -28,9 +28,7 @@ dependencies {
|
|||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
||||
if (JavaVersion.current().isJava12Compatible()) {
|
||||
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
||||
}
|
||||
options.compilerArgs += [ "-Asemver.project.dir=$projectDir" ]
|
||||
}
|
||||
|
||||
task runExample(type: JavaExec) {
|
||||
|
|
|
@ -14,7 +14,7 @@ final def semverProcessor = 'net.thauvin.erik:semver:1.2.0'
|
|||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
||||
compileJava.
|
||||
|
||||
mainClassName = 'com.example.Example'
|
||||
|
||||
|
@ -29,5 +29,6 @@ dependencies {
|
|||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs += [ "-Asemver.project.dir=${projectDir}/example" ]
|
||||
options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
||||
options.compilerArgs += [ "-Asemver.project.dir=${projectDir}/example" ]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue