@@ -113,26 +113,96 @@ git submodule update --init
113113mvn clean install
114114```
115115
116- Also see [ jdk.compiler.home] ( https://github.com/kohlschutter/jdk.compiler.home ) for the corresponding
117- JDK home artifact.
116+ Also see [ jdk.compiler.home] ( https://github.com/kohlschutter/jdk.compiler.home ) for the
117+ corresponding JDK home artifact.
118+
119+ ### Jar with dependencies
120+
121+ An executable jar with all dependencies is built automatically, and placed in
122+ ` standalone-jdk11/target/standalone-jdk11-VERSION-jar-with-dependencies.jar ` (for JDK11) and
123+ ` standalone-jdk21/target/standalone-jdk21-VERSION-jar-with-dependencies.jar ` (for JDK21).
124+
125+ ### GraalVM native image
126+
127+ Executable [ GraalVM native images] ( https://www.graalvm.org/22.0/reference-manual/native-image/ )
128+ are built with ` -Dnative ` enabled (this expects ` GRAALVM_HOME ` to be set to the home directory of
129+ a recent GraalVM SDK):
130+
131+ ```
132+ mvn clean install -Dnative
133+ ```
134+
135+ An executable jar with all dependencies is built automatically, and placed in
136+ ` standalone-jdk11/target/standalone-jdk11-VERSION-javac ` (for JDK11) and
137+ ` standalone-jdk21/target/standalone-jdk21-VERSION-javac ` (for JDK21).
138+
139+ ### Compiling with itself
140+
141+ #### Using native-image
142+ Obtain the GraalVM native-image from the step above and copy it to an external path, e.g.
143+ ` $HOME/standalone-jdk21-javac ` . If you want to compile everything, you need the ` jdk21 ` version,
144+ otherwise ` jdk11 ` works as well.
145+
146+ All you then need is to specify the path to this binary when building the project:
147+
148+ ```
149+ mvn clean install -Dcustom-javac=$HOME/standalone-jdk21-javac
150+ ```
151+
152+ #### Using jar-with-dependencies
153+
154+ You can also use the regular jar-with-dependencies jars, but then you need to write a little
155+ wrapper script that can be executed by Maven:
156+
157+ ```
158+ #!/bin/sh
159+
160+ /path/to/some/java-home-directory/bin/java -jar $HOME/standalone-jdk21-jar-with-dependencies.jar $@
161+ ```
162+
163+ Save the script to an external place like ` $HOME/standalone-jdk21-javac-jar-with-dependencies `
164+ and build the project:
165+
166+ ```
167+ mvn clean install -Dcustom-javac=$HOME/standalone-jdk21-javac-jar-with-dependencies
168+ ```
169+
170+ You can experiment with using different Java JDKs/JREs to host the compiler. Anything Java 11 or
171+ newer should work.
118172
119173## When
120174
121175### Future enhancements
122176
123- - Next up is adding support for the compiler in Java 21.
124- - With a little bit of luck, we may be able to modify the compiler code enough so we can actually run
125- it from Java 11.
126- - We could even support multiple different compiler versions to run side-by-side in the same VM.
127- - By adding support for GraalVM native image, we could build ` javac ` binaries with custom
128- configurations
177+ - We could support multiple different compiler versions to run side-by-side in the same VM.
178+ - We could build ` javac ` binaries (via GraalVM native-image) with custom configurations
129179- This approach may be used for other jdk-internal components as well.
130180
131181If you have an idea, please reach out!
132182
183+ ## When (Changelog)
184+
185+ ### _ (2023-10-13)_ jdk.compiler.home 1.1.0
186+
187+ - Add the compiler from JDK21, and backport it to Java 11 (!).
188+ - Add GraalVM native-image support.
189+ - Add self-contained jar-with-dependencies for both JDK11 and JDK21.
190+ - Various fixes. The standalone compiler can now compile itself.
191+
192+ ### _ (2023-10-10)_ jdk.compiler.home 1.0.0
193+
194+ - Initial release.
195+
133196## Who
134197
135- This repository has been put together by Christian Kohlschütter.
198+ This repository has been put together by [ Christian Kohlschütter] ( https://kohlschuetter.github.io/blog/ ) .
199+
200+ ### Getting involved
201+
202+ If you encounter a bug, please file a [ bug report] ( https://github.com/kohlschutter/jdk.compiler.standalone/issues ) .
203+
204+ If you want to contribute, please open a [ pull request] ( https://github.com/kohlschutter/jdk.compiler.standalone/pulls )
205+ or reach out directly.
136206
137207### License
138208
0 commit comments