Skip to content

[Java] Add copilot-native module producing linux-x64 classifier JAR for runtime.node - #2236

Merged
edburns merged 3 commits into
edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02from
copilot/edburns1917-java-embed-rust-cli-runtime-dd-3039924
Aug 3, 2026
Merged

[Java] Add copilot-native module producing linux-x64 classifier JAR for runtime.node#2236
edburns merged 3 commits into
edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02from
copilot/edburns1917-java-embed-rust-cli-runtime-dd-3039924

Conversation

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Task 4.7 of the embedded-runtime plan: create the copilot-native/ Maven module (com.github:copilot-sdk-java-runtime) that obtains the runtime.node native binary for linux-x64 via npm pack, verifies it against the SHA-512 hash pinned in nodejs/package-lock.json, and packages it as a classifier JAR alongside a placeholder primary JAR.

New: java/copilot-native/pom.xml

  • exec-maven-plugin in generate-resources invokes the fetch script for the single linux-x64 classifier (Phase 4 hard invariant).
  • Default maven-jar-plugin execution produces the placeholder primary JAR from src/main/resources; a second execution with <classifier>linux-x64</classifier> packages from target/native-staging/linux-x64/.
  • maven-antrun-plugin guard asserts the classifier JAR contains native/linux-x64/runtime.node and that the primary JAR does not — catches staging/classifier regressions at package time rather than at publish time.
  • skip-native-download profile (-Dcopilot.native.skip.download=true) disables the npm fetch and classifier JAR for offline / placeholder-only builds.

New: java/copilot-native/scripts/fetch-native.mjs

Resolves version and integrity from the same lockfile entry, then fails closed on mismatch:

const entry = lock.packages[`node_modules/@github/copilot-${classifier}`];
const { version, integrity } = entry;           // e.g. 1.0.76-5, sha512-61wm...
// npm pack @github/copilot-<classifier>@<version>
const actual = `sha512-${createHash('sha512').update(tgz).digest('base64')}`;
if (actual !== integrity) process.exit(1);
// extract package/prebuilds/<classifier>/runtime.node -> native/<classifier>/runtime.node

Also writes native/<classifier>/platform.properties (classifier, version) and a .version stamp so repeat builds skip the ~180 MB download.

Deviation from the issue text: the issue specifies npm pack @github/copilot-linux-x64@${project.version}. The Maven version (1.0.10-preview.0-SNAPSHOT) and the npm runtime version (1.0.76-5) are independently versioned, so ${project.version} would not resolve. The script instead reads the version from the same package-lock.json entry as the integrity hash, guaranteeing the two stay consistent. platform.properties records the npm runtime version.

New: src/main/resources/native/lib/copilot-runtime.properties

Filtered placeholder (placeholder=true, version=${project.version}) — satisfies Maven Central's main-artifact requirement without shipping binaries.

Modified

  • java/pom.xmlcopilot-native enabled in <modules>; copilot-native-all comment narrowed to the still-deferred uber-JAR.
  • .gitignore — ignore java/copilot-native/target.

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Copilot AI changed the title [WIP] Create copilot-native Maven module for Rust CLI runtime [Java] Add copilot-native module producing linux-x64 classifier JAR for runtime.node Aug 3, 2026
Copilot AI requested a review from edburns August 3, 2026 21:22
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR adds the java/copilot-native Maven module — Java-specific build infrastructure for downloading and packaging the runtime.node native binary as a classifier JAR for Maven Central distribution.

No cross-SDK consistency issues identified. This change is entirely Java/Maven infrastructure:

  • Native binary packaging is a Java-specific distribution concern (Maven classifier JARs)
  • No new public SDK API surface is introduced
  • The fetch script reads from the existing nodejs/package-lock.json integrity data — it reuses existing infrastructure rather than diverging from it
  • Other SDKs distribute their native runtime differently (npm packages for Node.js, cargo for Rust, etc.) and don't need equivalent changes

The change correctly defers the copilot-native-all uber-JAR to a later task, keeping scope well-defined.

Generated by SDK Consistency Review Agent for #2236 · sonnet46 17.6 AIC · ⌖ 5.34 AIC · ⊞ 6.6K ·

@edburns
edburns marked this pull request as ready for review August 3, 2026 21:42
@edburns
edburns requested a review from a team as a code owner August 3, 2026 21:42
Copilot AI review requested due to automatic review settings August 3, 2026 21:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the Java native-runtime Maven module, packaging the lockfile-pinned linux-x64 runtime.node binary as a classifier JAR.

Changes:

  • Downloads and verifies the npm runtime artifact.
  • Produces placeholder and linux-x64 classifier JARs.
  • Integrates the module into the Java reactor.
Show a summary per file
File Description
java/pom.xml Enables the native module.
java/copilot-native/pom.xml Configures fetching, packaging, and validation.
java/copilot-native/scripts/fetch-native.mjs Fetches, verifies, and stages the runtime.
java/copilot-native/src/main/resources/native/lib/copilot-runtime.properties Defines placeholder artifact metadata.
.gitignore Ignores native-module build output.

Review details

Suppressed comments (1)

java/copilot-native/pom.xml:150

  • The release workflow runs the whole reactor with -Prelease, but that profile exists only in sdk/pom.xml; profiles are not inherited from sibling modules. This module will consequently be deployed without attached source/Javadoc archives or GPG signatures, and this publishing extension does not create them despite the comment, so Maven Central validation will fail. Add equivalent release executions here or move the common release profile to the parent POM.
            <!--
                Required by Maven Central: sources and javadoc artifacts. This
                module has no Java sources, so both produce empty archives.
            -->
            <plugin>
  • Files reviewed: 4/5 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread java/copilot-native/scripts/fetch-native.mjs Outdated
Comment thread java/copilot-native/pom.xml
…s assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot mentioned this pull request Aug 3, 2026
@edburns
edburns merged commit 3390c73 into edburns/1917-java-embed-rust-cli-runtime-dd-3039924-agentic-run-02 Aug 3, 2026
26 checks passed
@edburns
edburns deleted the copilot/edburns1917-java-embed-rust-cli-runtime-dd-3039924 branch August 3, 2026 22:34
edburns added a commit that referenced this pull request Aug 4, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns added a commit that referenced this pull request Aug 4, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns added a commit that referenced this pull request Aug 4, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns added a commit that referenced this pull request Aug 4, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns added a commit that referenced this pull request Aug 4, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns added a commit that referenced this pull request Aug 5, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns added a commit that referenced this pull request Aug 5, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
edburns added a commit that referenced this pull request Aug 5, 2026
…or runtime.node (#2236)

* Initial plan

* Add copilot-native module with linux-x64 classifier JAR

Co-authored-by: edburns <75821+edburns@users.noreply.github.com>

* Address Copilot review: harden cache stamp and add platform.properties assertion

- Persist integrity hash and binary digest in the .version stamp file so
  corrupted binaries or lockfile integrity changes are detected on cache hit.
- Add zipentry assertion for platform.properties in the classifier JAR
  structural guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
Co-authored-by: Ed Burns <edburns@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

[Java] Embed Rust CLI runtime 4.7: Native binary download and classifier JAR module

3 participants