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.
pull/11362/head
Tristan Partin 2 years ago committed by Eli Schwartz
parent f06c0e9409
commit 37ef5bfdde
  1. 9
      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)

Loading…
Cancel
Save