镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Add ant_graph_task to draw Ant target dependencies - #7

Merged
headius merged 2 commits into
jruby:masterfrom
zev:ant-graph-task
Oct 9, 2026
Merged

headius merged 2 commits into
jruby:masterfrom
zev:ant-graph-task

Conversation

@zev

@zev zev commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #6. This branch is stacked on it and uses its minitest setup, so it shows #6's commit until #6 merges. Only the last commit, "Add ant_graph_task to draw Ant target dependencies", is new here.

In jruby/jruby#9761, @headius suggested moving JRuby's graph:viz task here along with the Ant specs. rakelib/graph.rake (8975245913, 2011, "ant target visualizer") loaded JRuby's Ant build.xml and drew its target dependencies with Graphviz. JRuby no longer has an Ant build, so this adds the same idea here as a reusable feature:

  • Rake::Ant.dot(project) (lib/rake/ant/graph.rb) returns Graphviz DOT text, with an edge from each dependency to the target that depends on it. Like graph.rake, it replaces - and . in target names with _.
  • ant_graph_task(name = :'ant:graph', buildfile = 'build.xml', output = 'build_graph.png') (lib/rake/ant/rake.rb, next to ant_task) defines a Rake task that ant_imports the build file and pipes the DOT text to dot -Tpng -x. It uses IO.popen instead of graph.rake's temp file, cat and shell.

For example, with test/graph_example.xml:

digraph ant {
init -> dist_jar
compile -> dist_jar
compile -> test_unit
init -> compile
}

Testing

  • test/test_graph.rb checks the DOT edges for test/graph_example.xml, that the task is defined, and that the task writes a PNG. The PNG test skips when dot isn't installed.
  • The workflow now installs Graphviz. CI on my fork: 33 runs, 70 assertions, 0 failures, 0 skips on jruby and jruby-head.
  • Locally without Graphviz: 33 runs, 0 failures, 1 skip (the PNG test).

Co-authored with Claude Code.

zev and others added 2 commits October 1, 2026 20:13
JRuby tested this gem with RSpec specs under spec/java_integration/ant,
which made Ant a requirement for JRuby's own test suite. Port them here
as minitest tests so JRuby can drop them, and convert the existing
test-unit test to minitest as well.

- test/ant_test_helper.rb replaces ant_spec_helper.rb; the RSpec
  structure matcher becomes assert_structure/assert_configured_structure
- the Ant.load tests stub File.exist? with minitest-mock
- the jarjar examples are dropped, since they needed a third-party jar;
  the jar examples still cover structure matching
- target_spec's "does not support ant" example passed only by accident;
  it now runs Ant's <ant> task against a temporary buildfile
- add a GitHub Actions workflow running `rake test` on JRuby with Ant
- relax the bundler development dependency so current Bundler works

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
@headius

headius commented Oct 2, 2026

Copy link
Copy Markdown
Member

Looks good! Maybe nobody will ever use it, but at least it has a home.

@headius

headius commented Oct 2, 2026

Copy link
Copy Markdown
Member

Still marked as draft; let me know when you're satisfied.

@zev
zev marked this pull request as ready for review October 2, 2026 15:55
@zev

zev commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@headius this is ready. Thanks!

@zev

zev commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@headius friendly ping: this is approved and ready from my side. Could you merge it when you get a chance?

@headius
headius merged commit 08965ba into jruby:master Oct 9, 2026
@headius

headius commented Oct 9, 2026

Copy link
Copy Markdown
Member

Thank you! I think we are basically done with this and jruby-ant?

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.

2 participants