diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 61b3417..abbd822 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,7 +1,7 @@ # This workflow will build a Java project with Maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: Java CI with Maven +name: Maven Build - Java 16 on: push: diff --git a/.github/workflows/maven_java15.yml b/.github/workflows/maven_java15.yml new file mode 100644 index 0000000..72a53af --- /dev/null +++ b/.github/workflows/maven_java15.yml @@ -0,0 +1,24 @@ +# This workflow will build a Java project with Maven +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Maven Build - Java 15 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 15 + - name: Build with Maven + run: mvn -P java15 -B package --file pom.xml diff --git a/README.md b/README.md index 92214f8..9fe380e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ _Details:_ - [Generation Via Includes](#generation-via-includes) - [Usage](#usage) - [Customizing](#customizing) +- [Java 15 Versions](#java-15-versions) ## RecordBuilder Example @@ -361,3 +362,79 @@ Alternatively, you can provide values for each individual meta data (or combinat - `javac ... -AfileComment=foo` - `javac ... -AfileIndent=foo` - `javac ... -AprefixEnclosingClassNames=foo` + +## Java 15 Versions + +Artifacts compiled wth Java 15 are available. The artifact IDs for these are: + +- core: `record-builder-core-java15` +- processor: `record-builder-processor-java15` + +Note: records are a preview feature only in Java 15. You'll need take a number of steps in order to try RecordBuilder: + +- Install and make active Java 15 or later +- Make sure your development tool is using Java 15 or later and is configured to enable preview features (for Maven I've documented how to do this here: [https://stackoverflow.com/a/59363152/2048051](https://stackoverflow.com/a/59363152/2048051)) +- Bear in mind that this is not yet meant for production and there are numerous bugs in the tools and JDKs. + +Note: I've seen some very odd compilation bugs with the current Java 15 and Maven. If you get internal Javac errors I suggest rebuilding with `mvn clean package` and/or `mvn clean install`. + +You will need to enable preview in your build tools: + +### Maven + +``` + + + io.soabase.record-builder + record-builder-core-java15 + set-version-here + + + + + org.apache.maven.plugins + maven-compiler-plugin + set-version-here + + + + io.soabase.record-builder + record-builder-processor-java15 + set-version-here + + + + io.soabase.recordbuilder.processor.RecordBuilderProcessor + + + + + 15 + + --enable-preview + + + ... any other options here ... + + +``` + +Create a file in your project's root named `.mvn/jvm.config`. The file should have 1 line with the value: `--enable-preview`. (see: https://stackoverflow.com/questions/58023240) + +### Gradle + +``` +dependencies { + annotationProcessor 'io.soabase.record-builder:record-builder-processor-java15:$version-goes-here' + compileOnly 'io.soabase.record-builder:record-builder-core-java15:$version-goes-here' +} + +tasks.withType(JavaCompile) { + options.fork = true + options.forkOptions.jvmArgs += '--enable-preview' + options.compilerArgs += '--enable-preview' +} +tasks.withType(Test) { + jvmArgs += "--enable-preview" +} +``` diff --git a/java15.sh b/java15.sh new file mode 100755 index 0000000..4ccfc42 --- /dev/null +++ b/java15.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# Copyright 2019 Jordan Zimmerman +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +jenv local 15 +javahome diff --git a/java16.sh b/java16.sh new file mode 100755 index 0000000..3095aad --- /dev/null +++ b/java16.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# +# Copyright 2019 Jordan Zimmerman +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + + +jenv local 16-ea +javahome diff --git a/pom.xml b/pom.xml index 6808725..92d9573 100644 --- a/pom.xml +++ b/pom.xml @@ -7,12 +7,6 @@ pom 1.17-SNAPSHOT - - record-builder-core - record-builder-processor - record-builder-test - - UTF-8 UTF-8 @@ -106,6 +100,12 @@ ${project.version} + + io.soabase.record-builder + record-builder-core-java15 + ${project.version} + + org.junit.jupiter junit-jupiter @@ -312,6 +312,19 @@ + + main + + true + + + + record-builder-core + record-builder-processor + record-builder-test + + + oss @@ -336,5 +349,18 @@ + + + java15 + + + 15 + + + + record-builder-core-java15 + record-builder-processor-java15 + + diff --git a/record-builder-core-java15/pom.xml b/record-builder-core-java15/pom.xml new file mode 100644 index 0000000..0595b31 --- /dev/null +++ b/record-builder-core-java15/pom.xml @@ -0,0 +1,29 @@ + + + + io.soabase.record-builder + record-builder + 1.17-SNAPSHOT + + 4.0.0 + + record-builder-core-java15 + + + ../record-builder-core/src/main/java + + + + org.apache.maven.plugins + maven-compiler-plugin + + none + ${jdk-version} + + --enable-preview + + + + + + diff --git a/record-builder-core/src/main/java/module-info.java b/record-builder-core/src/main/java/module-info.java deleted file mode 100644 index 8cadede..0000000 --- a/record-builder-core/src/main/java/module-info.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2019 Jordan Zimmerman - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -module io.soabase.record.builder.core { - exports io.soabase.recordbuilder.core; - opens io.soabase.recordbuilder.core; -} diff --git a/record-builder-processor-java15/pom.xml b/record-builder-processor-java15/pom.xml new file mode 100644 index 0000000..0bd1b17 --- /dev/null +++ b/record-builder-processor-java15/pom.xml @@ -0,0 +1,46 @@ + + + + io.soabase.record-builder + record-builder + 1.17-SNAPSHOT + + 4.0.0 + + record-builder-processor-java15 + + + ../record-builder-processor/src/main/java + + + ../record-builder-processor/src/resources/** + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + none + ${jdk-version} + + --enable-preview + + + + + + + + + com.squareup + javapoet + + + + io.soabase.record-builder + record-builder-core-java15 + + + \ No newline at end of file diff --git a/record-builder-processor/src/main/java/module-info.java b/record-builder-processor/src/main/java/module-info.java deleted file mode 100644 index c8f679c..0000000 --- a/record-builder-processor/src/main/java/module-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2019 Jordan Zimmerman - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -module io.soabase.record.builder.processor { - requires com.squareup.javapoet; - requires io.soabase.record.builder.core; - requires java.compiler; - - exports io.soabase.recordbuilder.processor; - opens io.soabase.recordbuilder.processor; -}