diff options
author | Tristan Partin <tristan@partin.io> | 2023-02-07 17:20:39 -0600 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-02-08 13:39:28 -0500 |
commit | 37ef5bfdde90187174f56a02ac2700703c46c226 (patch) | |
tree | dfe72d5022d4f70e7907c6cbd427454c46c437ba /mesonbuild | |
parent | f06c0e940945785583ff209ae2619fc814bc8b36 (diff) | |
download | meson-37ef5bfdde90187174f56a02ac2700703c46c226.zip meson-37ef5bfdde90187174f56a02ac2700703c46c226.tar.gz meson-37ef5bfdde90187174f56a02ac2700703c46c226.tar.bz2 |
Replace dashes in Java package names with underscores when generating native headers
This was causing a ninja issue where the native headers were always
being generated because io.github.hse-project.hse_Hse.h was being
expected, but io.github.hse_project.hse_Hse.h was actually generated.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/modules/java.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mesonbuild/modules/java.py b/mesonbuild/modules/java.py index 792d70b..6861ee0 100644 --- a/mesonbuild/modules/java.py +++ b/mesonbuild/modules/java.py @@ -75,13 +75,16 @@ class JavaModule(NewExtensionModule): classes = T.cast('T.List[str]', kwargs.get('classes')) package = kwargs.get('package') + if package: + sanitized_package = package.replace("-", "_").replace(".", "_") + headers: T.List[str] = [] for clazz in classes: - underscore_clazz = clazz.replace(".", "_") + sanitized_clazz = clazz.replace(".", "_") if package: - headers.append(f'{package.replace(".", "_")}_{underscore_clazz}.h') + headers.append(f'{sanitized_package}_{sanitized_clazz}.h') else: - headers.append(f'{underscore_clazz}.h') + headers.append(f'{sanitized_clazz}.h') javac = self.__get_java_compiler(state) |