Skip to content

Conversation

@headius
Copy link
Contributor

@headius headius commented May 3, 2025

The setup-ruby logic for JRuby on Windows must not be fully choosing Java 21, so when it tries to compile the extension it's still using an older version. This fixes it.

@headius
Copy link
Contributor Author

headius commented May 3, 2025

@kou I'll get that job running and then merge this.

@headius
Copy link
Contributor Author

headius commented May 3, 2025

I mean I'll get it running and then let you merge this. 😀

@headius
Copy link
Contributor Author

headius commented May 3, 2025

@kou Please hold off on release... I may have found one more bug running HexaPDF tests.

@kou kou merged commit a4afd32 into master May 3, 2025
76 checks passed
@kou kou deleted the fix_jruby_ci branch May 3, 2025 01:39
@eregon
Copy link
Member

eregon commented May 4, 2025

The setup-ruby logic for JRuby on Windows must not be fully choosing Java 21, so when it tries to compile the extension it's still using an older version. This fixes it.

@headius Could you make a PR to setup-ruby to fix that? It would be good to avoid adding many actions/setup-java everywhere just to workaround this bug.

@eregon
Copy link
Member

eregon commented May 4, 2025

Mmh, it should work fine since https://github.com/ruby/setup-ruby/blob/eaecf785f6a34567a6d97f686bbb7bccc1ac1e5c/ruby-builder.js#L59 is done on Windows too.
And this is the failing job: https://github.com/ruby/strscan/actions/runs/14805467215/job/41572923725
But as we see on this line JAVA_HOME is set correctly.

I suppose rake compile for Java extensions might need $JAVA_HOME/bin to be in PATH, and not just having JAVA_HOME set then (makes sense if e.g. it calls out to javac).
So I guess then we should add $JAVA_HOME/bin in PATH too in setup-ruby for JRuby (a bit unfortunate as it might cause unintended side effects but I don't see another solution), PR welcome.

@kou
Copy link
Member

kou commented May 5, 2025

@eregon
Copy link
Member

eregon commented May 5, 2025

Good point. Maybe the mix of / and \ then?
i.e. File.join always uses /, even on Windows, IIRC.
So it might be javac_path = 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\21.0.7-6.0\x64/bin/javac' and that might/probably fail the File.exist? check.

In fact in the failed job we do see:

mkdir -p tmp/java/strscan
javac -target 1.8 -source 1.8 -Xlint -d tmp/java/strscan -cp D:/jruby-10.0.0.0/lib/jruby.jar ext/jruby/org/jruby/ext/strscan/RubyStringScanner.java ext/jruby/org/jruby/ext/strscan/StringScannerLibrary.java

clearly that's javac without JAVA_HOME/bin in front.

kou added a commit to rake-compiler/rake-compiler that referenced this pull request May 6, 2025
@kou
Copy link
Member

kou commented May 6, 2025

Ah, RbConfig::CONFIG["EXEEXT"] may be related. Could you try rake-compiler 1.3.1?

eregon added a commit to eregon/strscan that referenced this pull request May 6, 2025
@eregon
Copy link
Member

eregon commented May 6, 2025

#155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants