Skip to content

feat: bin wrappers for java and csharp - #47

Open
jgrodziski wants to merge 1 commit into
mainfrom
feat/bin-java-csharp
Open

jgrodziski wants to merge 1 commit into
mainfrom
feat/bin-java-csharp

Conversation

@jgrodziski

Copy link
Copy Markdown
Contributor

Why

build.sh builds every extractor, and five of them already have a bin/ command: committed wrapper scripts that run their build output, resolved relative to themselves. The Java jar and the C# binary had none, yet docs/metrics.md tells clone users to run ./bin/codegraph-java, which failed with "no such file".

What

  • bin/codegraph-java runs extractors/java/target/codegraph-java.jar on the first Java at or above pom.xml's maven.compiler.release (17), looking in JAVA_HOME, on PATH, under ~/.sdkman, then macOS's java_home. A JRE is enough, since ECJ only needs the JVM's class library. Non-interactive shells never source sdkman, so no export is needed. The floor is read from the pom, not hard-coded.
  • bin/codegraph-csharp runs extractors/csharp/dist/<host rid>/codegraph-csharp, with the .exe fallback the ruby and metrics wrappers use.
  • test.sh: a new gate runs the jar through ./bin/codegraph-java and must reproduce fixtures/java/expected/model.jsonl, with the same root rewrite as the native gate. The published-C# gate now goes through ./bin/codegraph-csharp, as the Elixir and Ruby gates already do with their wrappers.
  • ci.yml csharp-smoke downloaded its artifact into bin/. On the four Unix runners that would overwrite the committed bin/codegraph-csharp wrapper. The download now lands in extractors/csharp/dist/<rid>/, where build.sh publishes it, and the job still runs the binary directly.
  • Docs: CLAUDE.md, the build.sh header, extractors/java/README.md, docs/cli.md, docs/csharp-extractor.md and the site's install and Java/C# reference pages now name the two commands.

Verification

  • Red first: before the wrappers existed, both gate commands exited 127.
  • ./test.sh --java: green. That covers 220 Maven tests, the jar via bin/codegraph-java matching the snapshot, and the native binary matching it.
  • ./test.sh --csharp: green. That covers 84 tests and the published binary via bin/codegraph-csharp, byte for byte.
  • Java selection, by hand:
    • A missing jar or binary prints the ./build.sh --… hint and exits 1.
    • When only a Java 11 is available, the wrapper refuses with a clear message.
    • A Java 11 in JAVA_HOME is skipped in favor of sdkman's Java 25, which extracts the fixture.
    • JAVA_HOME=21 takes precedence.
    • Version strings parse correctly: 1.8.0_392→8, 21→21, 17-ea→17, 21+35→21.
  • Not verified locally:
    • The csharp-smoke change runs only in CI on five runners, so this PR is its test.
    • The website pages were not built with Hugo.

Noticed, not changed

scripts/lib.sh's _java_major matches only N.N versions, so a JDK printing a bare openjdk version "21" (an initial GA release) is silently skipped by build.sh and test.sh. The new wrapper's parser handles that case.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PKCVh1pKrt8Z17Ln1pEEkq

build.sh builds the Java jar and the C# binary, but bin/ had no
command for either, and docs/metrics.md already told clone users to run
./bin/codegraph-java.

- bin/codegraph-java runs extractors/java/target/codegraph-java.jar on
  the first Java at or above pom.xml's maven.compiler.release, searched
  in JAVA_HOME, on PATH, under ~/.sdkman, then macOS's java_home.
- bin/codegraph-csharp runs extractors/csharp/dist/<host rid>/, with
  the .exe fallback the ruby and metrics wrappers use.
- test.sh: a new gate runs the jar through bin/codegraph-java against
  fixtures/java (same root rewrite as the native gate); the published
  C# gate now runs through bin/codegraph-csharp, like elixir and ruby.
- ci.yml csharp-smoke downloaded its artifact into bin/, which would
  overwrite the committed wrapper; it now lands in
  extractors/csharp/dist/<rid>/, where build.sh publishes it.
- CLAUDE.md, build.sh header, extractor READMEs and docs, and the site's
  install and reference pages name the two commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKCVh1pKrt8Z17Ln1pEEkq
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
codegraph f32c62d Commit Preview URL

Branch Preview URL
Nov 05 2026, 11:54 AM

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.

1 participant