Replace Ant in rake helpers with Ruby process launching - #9761
Conversation
|
@headius I'd like your call on What it is: a rake port (0104198, 2010) of the old Ant Why it fails on master: all 56 files in This PR doesn't change that. The task now runs through Where the benchmarks are now: Everything else in the task still works on the current stack:
Options:
I lean towards deleting it. Which do you prefer? |
|
Answers and comments before review:
This could move to the rake-ant project, which is where we moved the standard library rake+ant integration about a decade ago. Fine for it to leave jruby/jruby though.
Yes, remove. A future task would be to integrate the benchmarks that Rails (railsbench?) and the CRuby JIT teams use (yjit-bench or something) so we could start setting up a benchmark CI somewhere. CRuby has a very nice performance regression server that I drool over.
Yeah just kill all of that. Specs are synced periodically through a new process, and obviously gem_installers hasn't been functional for a long time without anyone missing it.
Delete. |
I think we should move those specs to rake-ant along with the graphviz thing: https://github.com/jruby/rake-ant. Seems like a waste to do this work and still have one target that needs ant, when nobody in the world uses that integration anymore.
I think Claude is wrong here, because I had to add that to get all of those subprocess runners to work. But once we're free of Ant, this can be removed too.
Not relevant to this PR, but that could certainly be cleaned up in a separate PR. |
headius
left a comment
There was a problem hiding this comment.
Minor changes but it's great to se this Ant requirement go away.
Future PR can make this all more idiomatic.
Throwaway branch on top of jruby#9761 to check the dist verification workflow without Ant: - remove both cedx/SetupAnt steps and hide the Ant preinstalled on ubuntu-latest - let build-installer run on a fork, without install4j, so `rake installer` runs up to the install4j step and skips it - remove the other workflows on this branch only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@headius About the Test branch:
Result: run 36936502331. The two jobs that had There is no "could not load ant" line, since nothing in rake loads Ant any more. Why it was added: this is my reading of the runs from when you added it in 141121f.
Those logs have expired, so I can't show the original error. Also, What the fork can't test: the real install4j build and Should I remove both |
|
Follow-up: run 36936502331 has now finished. All 26 jobs that ran passed, with no Ant on the runner. The only skipped job is |
I get that it's trying to make this job runnable for non-jruby/jruby pushes but obviously that should not be merged. There's not much value in the installer jobs without actually building the installers. Removing all the SetupAnt stuff other than that is fine to include in this PR. |
The jruby and mspec rake helpers used Ant only for its <path> and forked <java> tasks. Replace those with a small Ruby JRuby::Rake::JavaCommand that takes the same nested elements and builds the same java command line, so the spec:ruby:* tasks no longer need Ant. The classpath used by mspec is now returned by JRuby::Rake::JavaCommand.classpaths instead of being registered in shared state. The resultproperty exit codes and spec_run_error are removed: every run fails the task on a non-zero exit, so spec_run_error could never report a failure. Remove rake tasks that have been broken for years and that were the other users of the Ant helpers: - graph:viz drew the targets of the Ant build.xml, removed in 2014 - bench:language ran benchmarks that moved to rubybench in 2012 - gem_installers.rake, plus spec:fetch_latest_specs, spec:fetch_stable_specs, spec:fast_forward_to_rubyspec_head and spec:ci_latest, which depend on build properties commented out in 2013 - jrake and gem_install, which had no remaining callers Remove the Ant integration specs from spec:ji; they test the rake-ant gem and are moving to the rake-ant project. java_method_spec relied on a global `import` defined by one of them, so it now uses java_import. Also stop downloading jarjar for tests, which only those specs used. Remove the cedx/SetupAnt steps from dist-verification-ci.yml; nothing in the build or the rake tasks loads Ant any more. Ant is no longer needed to build or test JRuby. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, done in d4ae53a: this PR now removes only the two |
JRuby's rakelib/graph.rake (graph:viz, added in 2011 as an "ant target visualizer") drew the targets of JRuby's Ant build.xml with Graphviz. JRuby no longer has an Ant build and removes it in jruby/jruby#9761, so move the idea here as a reusable feature: - Rake::Ant.dot(project) returns Graphviz DOT text with an edge from each dependency to the target that depends on it, sanitizing - and . in target names as graph.rake did - ant_graph_task(name, buildfile, output) defines a task that ant_imports the build file and pipes the DOT text to `dot -Tpng -x` - CI installs Graphviz so the PNG test runs; it skips without `dot` Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing in JRuby uses rake-ant any more: the rake helpers no longer load Ant and the Ant integration specs are moving to the rake-ant project. Anyone who still wants the integration can install the gem. Remove it from the default gems in lib/pom.rb and regenerate lib/pom.xml, and drop the .gitignore entries and TestRequireLib excludes for the files it installed into lib/ruby/stdlib. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@headius Should this go in the release notes? One change here is visible to users: Everything else here only affects JRuby's own build: the rake helpers no longer need Ant, and the deleted rake tasks were already broken. If it should be mentioned, a suggested line:
If so, should I add it somewhere in this PR, or do you collect release notes separately at release time? Related: would you like a rake-ant release once jruby/rake-ant#6 and #7 merge, so the gem has a current version when people go to install it? |
The release notes include a generated of all issues and PRs marked for that release milestone, so it will be in there. I handcraft a few call-out notes for the release based on what I think is extra important. Standard library changes always go in those notes. It probably could have a better process, but I enjoy reading through everything we fixed at release time. FWIW we push out master builds daily as
Yes, we'll want to get the rake-ant gem updated soonish now that the rest of the bits are leaving JRuby. |
This removes JRuby's last dependency on Apache Ant for building and testing.
Rake helpers
The
jrubyandmspechelpers inrakelib/commands.rakeused Ant only for its<path>and<java fork="true">tasks. This PR replaces them with a small RubyJRuby::Rake::JavaCommandclass, whoserunmethod takes the same nested elements (classpath,jvmarg,sysproperty,arg,env). The helper bodies are unchanged apart from the line that called Ant.JavaCommand.runbuilds the same command Ant's java task did:javafrom the running JVM'sjava.home, then thejvmargs,-Xmx, the-Dsysproperties,-classpath, the main class and theargs.dir,outputand the extraenvvars, and a non-zero exit fails the task (failonerror).There are no top-level constants or shared state:
test.class.pathclasspath used bymspeccomes fromJRuby::Rake::JavaCommand.classpaths. It used to be registered byinitialize_pathsat the start of everyjrubycall and read straight back by that same call. The other registered path,jruby.execute.classpath, was never used.resultpropertyexit codes andspec_run_errorare removed.failonerroris always on (no caller overrides it), so the first failing mspec run aborts rake beforespec_run_erroris reached, and when every run passes all the codes are0. That was also true under Ant, sospec_run_errorcould never report a failure. There's a comment onspec:taggedexplaining this.Removed
These were the other users of the Ant helpers, and they already fail on master:
graph:viz(rakelib/graph.rake): drew the targets of the Antbuild.xml, which was removed in 2014 (fa2f6da). Also removes itsbuild_graph.pngentry in.gitignore. A reusable version is proposed for rake-ant in Add ant_graph_task to draw Ant target dependencies rake-ant#7.bench:language(rakelib/bench.rake): ranbench/language/bench_all.rb, which moved to rubybench in 2012 (996aedd).rakelib/gem_installers.rake: uses build properties that were commented out in 2013 (ed8fa45). Also removesspec:fetch_latest_specs,spec:fetch_stable_specs,spec:fast_forward_to_rubyspec_headandspec:ci_latest, which depend on it.jrakeandgem_install: had no remaining callers.rake-antdefault gem: removed fromlib/pom.rb(and the regeneratedlib/pom.xml), together with its.gitignoreentries andTestRequireLibexcludes. As headius said on Move JRuby's Ant integration specs here as minitest tests rake-ant#6, it "was just dragged along as a legacy feature for a long time. Anyone who still wants it can use the gem." Existing checkouts will see a leftoverlib/ruby/stdlib/ant.rbandlib/ruby/stdlib/rake/as untracked after rebuilding; they can be deleted.Ant integration specs
spec/java_integration/ant/andant_spec_helper.rbtest therake-antgem, so they are removed here and moved to rake-ant in jruby/rake-ant#6. Two related changes:java_method_spec.rbrelied on a globaldef import(*args); java_import(*args); enddefined by the oldant/rake_spec.rb, which loads in the same rspec process. It now callsjava_importdirectly.test/pom.rbno longer downloads jarjar, which onlyant/task_spec.rbused.BUILDING.mdandCONTRIBUTING.mdno longer list Ant as a prerequisite.The two
cedx/SetupAntsteps in.github/workflows/dist-verification-ci.ymlare removed. A run on my fork passed with Ant removed from the runner; the real install4j build andinstaller-verificationonly run on jruby/jruby.Testing
I ran the helpers on master with Ant's verbose logging to capture the exact
javacommand Ant forks, then compared it with whatJavaCommand.runruns, for anmspeccall (env vars,dir,test.class.path, tags) and ajrubycall (output,jvmarg,sysproperty). Arguments, env vars, working directory and output-file contents were identical.Before is master with Ant; after is this branch with Ant not installed (macOS, Temurin 21):
spec:ruby:fastspec:ruby:debugspec:jispec:ruby:fastfailures are local macOS environment issues that also fail on unmodified master.spec:jifailure (jar_glob_spec.rb:81) also fails locally with master's files and Ant installed.ps, is identical before and after../mvnw -Pbootstrap clean packagepasses with thetest/pom.rbchange.Follow-ups
spec:alldepends on:all_compiled, but that task is named:all_compiled_18. Separate PR.Co-authored with Claude Code.