Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jniGen Gradle task getSdl2StaticLibs replacement regex doesn't include _ (underscore) character #30

Open
SonicGDX opened this issue Jun 7, 2024 · 1 comment · May be fixed by #23
Open

Comments

@SonicGDX
Copy link

SonicGDX commented Jun 7, 2024

This line for Windows x32, Windows x64, Linux x32, Linux x64, Linux x32 ARM and Linux x64 ARM matches text that has one or more characters matching this regex [a-zA-Z0-9\\.\\-/] and ending with libSDL2.a and replaces it with libSDL2.a's absolute path.

e.g. libraries += getSdl2StaticLibs('./SDL/build-linux32/').replaceAll("[a-zA-Z0-9\\.\\-/]+libSDL2.a", file("SDL/build-linux32/build/.libs/libSDL2.a").absolutePath)

The problem is, the underscore character (_) isn't included in that regex, so if text has underscore characters at the beginning they won't be replaced.

Here's an example of a problematic replacement result which causes build errors due to being an incorrect path:

Pre Replacement: -L/__w/Jamepad/Jamepad/SDL/lib /__w/Jamepad/Jamepad/SDL/lib/libSDL2.a -lm -ldl -lpthread

Post Replacement: -L/__w/Jamepad/Jamepad/SDL/lib /__/__w/Jamepad/Jamepad/SDL/build-linux32/build/.libs/libSDL2.a -lm -ldl -lpthread

What it probably should be after replacement: -L/__w/Jamepad/Jamepad/SDL/lib /__w/Jamepad/Jamepad/SDL/build-linux32/build/.libs/libSDL2.a -lm -ldl -lpthread

The problem is "/__" at the start of the path isn't being matched and replaced.

This can be solved by adding the _ character to the regex.

Blocking #23

@SonicGDX
Copy link
Author

SonicGDX commented Jun 10, 2024

Resolved in #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant