Compiling Java code for all target platforms at once
some-java-user-99206970363698485155 at vodafonemail.de
some-java-user-99206970363698485155 at vodafonemail.de
Thu Aug 25 23:11:14 UTC 2022
Hello,
the JDK source code contains many Java classes which are specific to one platform / operating system, for example
classes to interact with the file system or the AWT and Swing related classes are different for Windows and Linux.
Is there a way to compile the Java source code for all platforms supported by the JDK at once? My goal is not to build
a functional JDK, but to use the class files (or rather the compilation process) for static code analysis, specifically
for analysis with CodeQL. I assume this might also be useful for other code analysis tools, and maybe also in general
to detect Java compilation errors with the JDK source code.
It appears the OpenJDK building instructions are always for building for a specific target platform and therefore
skip compiling the Java code for other platforms. Additionally the `configure` command checks also check for tools
needed to compile native code (e.g. Xcode or Visual Studio), even though for pure Java compilation they would not be
needed (?). Therefore when you try to use multiple configurations (as described in the build instructions) it would
require you to install all the tools for all platforms (if that is even possible on the same host operating system).
Ideally I am looking for a solution which satisfies the following:
- Compiles the Java source code for all supported platforms
- Compiles all the Java source code in one build command execution
- Or at least compiles the Java source code with separate build command executions, but which can all be
run from the same host operating system (no need to use separate operating systems)
- Does not require any of the tools for native compilation to be installed
Though I am happy about any solution which gets as close as possible to this. Thanks already in advance!
Kind regards
More information about the build-dev
mailing list