Commit Graph

30 Commits

Author SHA1 Message Date
Eli Schwartz cf07596cf6 test cases: use best practices method to find the python3 program
We do not need the python module's find_installation() for this, as this
does various things to set up building and installing python modules
(pure python and C-API). This functionality is already tested in the
python tests.

Elsewhere, when we just need an interpreter capable of running python
scripts in order to guarantee a useful scripting language for custom
commands, it suffices to use find_program(), which does not run an
introspection script or do module imports, and is thus faster and
a bit cleaner.

Either way, both methods are guaranteed to find the python3 interpreter,
deferring to mesonlib.python_command for that guarantee.

test "71 summary" can sometimes return the python command with the
".exe" part all uppercased for mysterious Windows reasons. Smooth this
over with ExternalProgram.
2023-02-24 20:45:00 -05:00
Tristan Partin 7254db36a7
Try to find the jni dependency when javac is a Darwin stub
Darwin-based systems, at least macOS, provide various JDK executable
stubs in
/System/Library/Frameworks/JavaVM.framework/Versions/*/Commands.
These stubs are placed in such a way that they break the heuristics of
the JNI system dependency. If a javac being analyzed to find a Java home
is a stub, use /usr/libexec/java_home.

See https://stackoverflow.com/a/15133344/7572728 for more details.

Closes #11173
2022-12-15 20:24:25 -06:00
Tristan Partin 2e600ef710
Rename java.generate_native_headers to java.native_headers
This follows the Meson naming scheme which typically leaves off a verb
like generate.
2022-12-11 14:50:26 -06:00
Tristan Partin 39f1d52e4a Add ability to add resources to jars
Previously Meson lacked the ability to add resources to jar files.

Fixes #9945
2022-03-22 13:21:26 +02:00
Tristan Partin d072ebc955 Fix @typed_pos_args on java.generate_native_headers 2022-03-07 15:42:07 -08:00
Tristan Partin 498db2764c Add modules kwarg to JNI system dep
This allows someone to link against libjvm.so and libjawt.so.
2022-03-04 13:52:21 -05:00
Tristan Partin 96b2469544 Rename JDK system dep to JNI
JNI is a more apt name because it currently only supports the JNI. I
also believe that CMake uses the terminology JNI here as well.

JNI is currently the only way to interact with the JVM through native
code, but there is a project called "Project Panama" which aims to be
another way for native code to interact with the JVM.
2022-03-02 16:23:09 -05:00
Tristan Partin 18147b91ff Deprecate java.generate_native_header() in favor of java.generate_native_headers()
After implementing a much more extensive Java native module than what
currently exists in the tests, I found shortcomings.

1. You need to be able to pass multiple Java files.
2. Meson needs more information to better track the generated native
   headers.
3. Meson wasn't tracking the header files generated from inner classes.

This new function should fix all the issues the old function had with
room to grow should more functionality need to be added. What I
implemented here in this new function is essentially what I have done in
the Heterogeneous-Memory Storage Engine's Java bindings.
2022-03-01 13:18:50 -08:00
Tristan Partin be92e37837 Add Java module
The Java module will serve as a source for easing Java development
within Meson. Currently it only supports generating native header files.
2021-08-22 07:57:29 -07:00
Eli Schwartz 59d4f771d2
editorconfig: add setting to trim trailing whitespace
and clean up all outstanding issues

Skip 'test cases/common/141 special characters/meson.build' since it
intentionally uses trailing newlines.
2021-08-15 09:36:18 -04:00
Tristan Partin 4c13aa30a1 dependency: Add JDK system dependency
The JDK system dependency is important for detecting JDK include paths
that may be useful when developing a JNI interface.
2021-04-12 10:43:11 -07:00
Jussi Pakkanen 4c9d57200a Decrease version requirement to work on Xenial. 2020-07-12 00:07:26 +03:00
Dylan Baker 6a5fdbf995 docs: Add Environment variables for compiler/linker selection
We really should be documenting these in an easy to find and reference
place.
2020-03-17 10:40:39 -07:00
Daniel Mensinger 8e60b8c146
test: merge installed_files.txt into test.json 2020-02-25 21:47:42 +01:00
Jussi Pakkanen 95de289d0d Bump Java version in test program. 2020-01-29 23:32:09 +02:00
Dylan Baker 62e1735828 tests/java: force latency in generation to exercise race
Because we are racing here. In reality *all* of the java in that target
may rely on the generated file, so we need to block all of them, like we
would for headers in C/C++.
2018-11-07 14:26:14 -08:00
Aurélien Zanelli 5af84440bc ninjabackend: add generated source files to jar compile target source list
Otherwise, passing result of custom_target() to jar() target is ignored
and won't be compiled resulting in build fail.
2018-11-02 22:27:25 +02:00
Niclas Moeslund Overby bc8239ded0 java: add jar linking test 2018-07-03 21:33:54 +02:00
Niclas Moeslund Overby ef16fb2e97 tests: Remove redundant test and include_directories('.') 2018-05-16 14:53:30 +02:00
Robert Bragg ec7b834b6e ninja: add build dir to javac -sourcepath
To allow the javac -implicit:class behaviour to know where to find
generated .java files then the build directory for the target is also
added to the -sourcefile path.
2018-05-16 14:53:30 +02:00
Robert Bragg 61dd46811b ninja: avoid needing include_directory('.') with jar()
Although only one file is passed to javac at a time, if your code has
any inter-file dependencies javac still needs to know how to find other
source files for its -implicit:class feature to work whereby it will
automatically also compile files that the given file depends on.

-implicit:class is the default, practical, behaviour of javac since
otherwise it would be necessary to declare the class dependencies
for parallel java builds to be feasible.

Passing "include_directory: include_directory('.')" to jar() causes
-souredir <path/to/top/of/java/src> to be passed to javac which then
enables your source code to have inter-file class dependencies -
assuming none of your source code is generated.

This ensures that '.' is included by default.
2018-05-16 14:53:30 +02:00
Robert Bragg 65b730bd59 ninja: pass separated paths to javac -sourcepath
The -sourcepath option can't be passed multiple times to javac, since it
simply overrides prior arguments. Instead -sourcepath takes a colon (or
semi-colon on windows) separated list of paths.
2018-05-16 14:53:30 +02:00
Jussi Pakkanen 14e0529a03 Do not strip jar targets. Closes #1343. 2017-02-06 19:09:22 +01:00
Jussi Pakkanen 5787a4b4fb Make Java compilation work with inner classes. Closes #1157. 2016-12-12 21:01:10 +02:00
Jussi Pakkanen c9a46fcc93 Can set compiler arguments in Java. 2016-11-20 16:57:58 -05:00
Jussi Pakkanen e374b53788 Build Java projects with multiple files and other cleanups. 2016-01-10 22:31:56 +02:00
Jussi Pakkanen c7865cd98f Now with working subdirs for Java. 2014-03-11 23:04:14 +02:00
Jussi Pakkanen efc79fb85e Can run built jar files. 2014-03-11 22:30:05 +02:00
Jussi Pakkanen ed8fd95505 A few tweaks. 2014-03-11 00:48:25 +02:00
Jussi Pakkanen e321345f41 Started work on Java support because why not. 2014-03-10 22:35:00 +02:00