From 3ba365be64b9e71ec799374b6fcae6e0879812a4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 26 Aug 2026 23:05:45 +0000 Subject: [PATCH 1/3] Initial plan From 3fb34ab0ac6e9f986c392279624b86ec94a9f93f Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Aug 2026 14:39:00 -0700 Subject: [PATCH 2/3] [Java] Add darwin-x64 native runtime support (#2429) * Initial plan * Add Java darwin-x64 native support Co-authored-by: edburns <75821+edburns@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> --- .github/workflows/java-sdk-tests.yml | 76 +++++++++++ java/README.md | 12 +- java/copilot-native/pom.xml | 119 +++++++++++++++++- .../scripts/fetch-native.test.mjs | 2 +- .../scripts/validate-local-publication.mjs | 9 +- .../scripts/validate-native-artifact.test.mjs | 28 +++++ .../scripts/validate-native-host.mjs | 8 +- .../scripts/validate-native-host.test.mjs | 23 ++++ .../adr/adr-007-native-bundling-strategy.md | 6 +- java/sdk/pom.xml | 12 ++ 10 files changed, 280 insertions(+), 15 deletions(-) diff --git a/.github/workflows/java-sdk-tests.yml b/.github/workflows/java-sdk-tests.yml index 2c4d20cdc1..c51d56cc1f 100644 --- a/.github/workflows/java-sdk-tests.yml +++ b/.github/workflows/java-sdk-tests.yml @@ -30,6 +30,8 @@ jobs: classifier: win32-x64 - os: windows-11-arm classifier: win32-arm64 + - os: macos-15-intel + classifier: darwin-x64 - os: macos-26 classifier: darwin-arm64 runs-on: ${{ matrix.os }} @@ -310,6 +312,64 @@ jobs: overwrite: true retention-days: 1 + java-native-publication-darwin-x64: + name: "Java Native Publication Input (darwin-x64)" + if: github.event.repository.fork == false + runs-on: macos-15-intel + permissions: + contents: read + outputs: + source_sha: ${{ steps.build.outputs.source_sha }} + version: ${{ steps.build.outputs.version }} + defaults: + run: + shell: bash + working-directory: ./java + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 + with: + java-version: "25" + distribution: "microsoft" + cache: "maven" + + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + with: + node-version: 22 + + - name: Build and validate darwin-x64 classifier + id: build + run: | + set -euo pipefail + VERSION="$JAVA_PUBLICATION_REVISION" + node copilot-native/scripts/validate-native-host.mjs darwin-x64 + mvn -B -pl copilot-native package -DskipTests "-Drevision=$VERSION" + JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION-darwin-x64.jar" + PRIMARY_JAR="copilot-native/target/copilot-sdk-java-runtime-$VERSION.jar" + test -f "$JAR" + node copilot-native/scripts/validate-native-artifact.mjs \ + classifier darwin-x64 "$JAR" "$(basename "$JAR")" .. + node copilot-native/scripts/validate-native-artifact.mjs placeholder "$PRIMARY_JAR" + MANIFEST="copilot-native/target/darwin-x64-$VERSION.sha256" + HASH=$(shasum -a 256 "$JAR" | cut -d ' ' -f 1) + printf '%s %s' "$HASH" "$(basename "$JAR")" > "$MANIFEST" + node copilot-native/scripts/validate-native-artifact.mjs \ + checksum "$JAR" "$MANIFEST" "$(basename "$JAR")" + echo "source_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: java-native-publication-darwin-x64-${{ github.run_id }}-${{ github.run_attempt }} + path: | + java/copilot-native/target/copilot-sdk-java-runtime-${{ steps.build.outputs.version }}-darwin-x64.jar + java/copilot-native/target/darwin-x64-${{ steps.build.outputs.version }}.sha256 + if-no-files-found: error + retention-days: 1 + java-native-publication-assembly: name: "Java Native Publication Assembly" if: github.event.repository.fork == false @@ -319,6 +379,7 @@ jobs: java-native-publication-windows, java-native-publication-windows-arm64, java-native-publication-darwin, + java-native-publication-darwin-x64, ] runs-on: ubuntu-latest defaults: @@ -361,6 +422,11 @@ jobs: name: java-native-publication-darwin-arm64-${{ github.run_id }} path: ${{ github.workspace }}/java/native-publication-input/darwin + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: java-native-publication-darwin-x64-${{ github.run_id }}-${{ github.run_attempt }} + path: ${{ github.workspace }}/java/native-publication-input/darwin-x64 + - name: Verify native inputs and install the complete local release run: | set -euo pipefail @@ -368,15 +434,18 @@ jobs: test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-windows.outputs.source_sha }}" test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-windows-arm64.outputs.source_sha }}" test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-darwin.outputs.source_sha }}" + test "$(git rev-parse HEAD)" = "${{ needs.java-native-publication-darwin-x64.outputs.source_sha }}" VERSION="${{ needs.java-native-publication-windows.outputs.version }}" test "$VERSION" = "$JAVA_PUBLICATION_REVISION" test "$VERSION" = "${{ needs.java-native-publication-linux-arm64.outputs.version }}" test "$VERSION" = "${{ needs.java-native-publication-windows-arm64.outputs.version }}" test "$VERSION" = "${{ needs.java-native-publication-darwin.outputs.version }}" + test "$VERSION" = "${{ needs.java-native-publication-darwin-x64.outputs.version }}" LINUX_ARM64_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/linux-arm64" WINDOWS_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/windows" WINDOWS_ARM64_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/windows-arm64" DARWIN_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/darwin" + DARWIN_X64_DIRECTORY="$GITHUB_WORKSPACE/java/native-publication-input/darwin-x64" LINUX_ARM64_JAR="$LINUX_ARM64_DIRECTORY/copilot-sdk-java-runtime-$VERSION-linux-arm64.jar" LINUX_ARM64_MANIFEST="$LINUX_ARM64_DIRECTORY/linux-arm64-$VERSION.sha256" WINDOWS_JAR="$WINDOWS_DIRECTORY/copilot-sdk-java-runtime-$VERSION-win32-x64.jar" @@ -385,6 +454,8 @@ jobs: WINDOWS_ARM64_MANIFEST="$WINDOWS_ARM64_DIRECTORY/win32-arm64-$VERSION.sha256" DARWIN_JAR="$DARWIN_DIRECTORY/copilot-sdk-java-runtime-$VERSION-darwin-arm64.jar" DARWIN_MANIFEST="$DARWIN_DIRECTORY/darwin-arm64-$VERSION.sha256" + DARWIN_X64_JAR="$DARWIN_X64_DIRECTORY/copilot-sdk-java-runtime-$VERSION-darwin-x64.jar" + DARWIN_X64_MANIFEST="$DARWIN_X64_DIRECTORY/darwin-x64-$VERSION.sha256" node copilot-native/scripts/validate-native-artifact.mjs \ checksum "$LINUX_ARM64_JAR" "$LINUX_ARM64_MANIFEST" "$(basename "$LINUX_ARM64_JAR")" node copilot-native/scripts/validate-native-artifact.mjs \ @@ -401,6 +472,10 @@ jobs: checksum "$DARWIN_JAR" "$DARWIN_MANIFEST" "$(basename "$DARWIN_JAR")" node copilot-native/scripts/validate-native-artifact.mjs \ classifier darwin-arm64 "$DARWIN_JAR" "$(basename "$DARWIN_JAR")" .. + node copilot-native/scripts/validate-native-artifact.mjs \ + checksum "$DARWIN_X64_JAR" "$DARWIN_X64_MANIFEST" "$(basename "$DARWIN_X64_JAR")" + node copilot-native/scripts/validate-native-artifact.mjs \ + classifier darwin-x64 "$DARWIN_X64_JAR" "$(basename "$DARWIN_X64_JAR")" .. export GNUPGHOME="$GITHUB_WORKSPACE/java/copilot-native/target/local-publication-gpg" rm -rf "$GNUPGHOME" mkdir -p "$GNUPGHOME" @@ -416,6 +491,7 @@ jobs: "-Dcopilot.native.external.win32.classifier.path=$WINDOWS_JAR" \ "-Dcopilot.native.external.win32.arm64.classifier.path=$WINDOWS_ARM64_JAR" \ "-Dcopilot.native.external.darwin.classifier.path=$DARWIN_JAR" \ + "-Dcopilot.native.external.darwin.x64.classifier.path=$DARWIN_X64_JAR" \ "-Dmaven.repo.local=$LOCAL_REPOSITORY" node copilot-native/scripts/validate-local-publication.mjs \ "$LOCAL_REPOSITORY" copilot-sdk-java-runtime "$VERSION" .. --signatures diff --git a/java/README.md b/java/README.md index 373a48c1f0..af4cf4973f 100644 --- a/java/README.md +++ b/java/README.md @@ -74,7 +74,7 @@ implementation 'com.github:copilot-sdk-java:1.0.15-preview.1-SNAPSHOT' ## In-process mode (experimental) -The SDK supports running the Copilot runtime **in-process** as a native library instead of spawning a separate CLI process. This eliminates process management overhead and simplifies deployment. In-process mode is currently experimental and supported on **linux-x64** (glibc), **linux-arm64** (glibc), **win32-x64**, **win32-arm64**, and **darwin-arm64**. +The SDK supports running the Copilot runtime **in-process** as a native library instead of spawning a separate CLI process. This eliminates process management overhead and simplifies deployment. In-process mode is currently experimental and supported on **linux-x64** (glibc), **linux-arm64** (glibc), **win32-x64**, **win32-arm64**, **darwin-x64**, and **darwin-arm64**. Because in-process mode is experimental, see the [Using experimental APIs](#using-experimental-apis) section for how to opt in. @@ -97,7 +97,7 @@ Add both the SDK and the platform-specific native runtime to your project: ${copilot.version} linux-x64 - + net.java.dev.jna @@ -609,7 +609,7 @@ CI enforces both checks. Spotless runs explicitly in CI; `mvn verify` alone does Run native-runtime Maven commands from the `java` directory. Native packaging requires Node.js in addition to JDK 25 and Maven because `copilot-native/scripts/fetch-native.mjs` retrieves the pinned runtime package from the corresponding GitHub release. -On a native Linux glibc host, Maven activates `native-linux-x64` or `native-linux-arm64` for the matching architecture when `copilot.native.libc=glibc` is set. On Windows x64, Windows ARM64, and Apple Silicon macOS, Maven activates `native-win32-x64`, `native-win32-arm64`, or `native-darwin-arm64` automatically. The matching profile validates the host, runs the native script tests, fetches the pinned platform package from the corresponding `github/copilot-cli` release during `generate-resources`, packages the classifier JAR during `package`, and verifies its native contents. +On a native Linux glibc host, Maven activates `native-linux-x64` or `native-linux-arm64` for the matching architecture when `copilot.native.libc=glibc` is set. On Windows x64, Windows ARM64, Intel macOS, and Apple Silicon macOS, Maven activates `native-win32-x64`, `native-win32-arm64`, `native-darwin-x64`, or `native-darwin-arm64` automatically. The matching profile validates the host, runs the native script tests, fetches the pinned platform package from the corresponding `github/copilot-cli` release during `generate-resources`, packages the classifier JAR during `package`, and verifies its native contents. Before opting in, validate that Node.js reports glibc for the build host: @@ -630,10 +630,10 @@ On Windows x64 or ARM64 PowerShell, initialize Java and run the same profile: mvn -Pinprocess clean verify ``` -The same command validates in-process mode on Apple Silicon macOS: +The same command validates in-process mode on macOS; use the classifier for the host architecture: ```bash -node copilot-native/scripts/validate-native-host.mjs darwin-arm64 +node copilot-native/scripts/validate-native-host.mjs darwin-x64 # Use darwin-arm64 on Apple Silicon mvn -Pinprocess clean verify ``` @@ -644,7 +644,7 @@ node copilot-native/scripts/validate-native-host.mjs linux-arm64 mvn -Pinprocess clean verify -Dcopilot.native.libc=glibc ``` -On Intel macOS, Linux musl, and other unsupported hosts, do not set `copilot.native.libc=glibc`. A normal build produces only the OS-neutral primary, sources, and Javadoc JARs; it does not run native script tests, download or stage native files, or produce a platform classifier JAR. +On Linux musl and other unsupported hosts, do not set `copilot.native.libc=glibc`. A normal build produces only the OS-neutral primary, sources, and Javadoc JARs; it does not run native script tests, download or stage native files, or produce a platform classifier JAR. To build only the OS-neutral artifacts on any host, or override the glibc opt-in, disable native download and packaging: diff --git a/java/copilot-native/pom.xml b/java/copilot-native/pom.xml index c4d244365b..f4ac485862 100644 --- a/java/copilot-native/pom.xml +++ b/java/copilot-native/pom.xml @@ -518,6 +518,61 @@ + + native-darwin-x64 + + + mac + x86_64 + + + + darwin-x64 + copilot + + + + + org.codehaus.mojo + exec-maven-plugin + + + validate-native-host + validate + + + fetch-native + generate-resources + + + test-fetch-native + test + + + + + org.apache.maven.plugins + maven-jar-plugin + + + jar-native + package + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + verify-native-jars + package + + + + + + native-darwin-arm64 @@ -760,7 +815,7 @@ @@ -821,6 +876,68 @@ + + + attach-external-darwin-x64-classifier + + + copilot.native.external.darwin.x64.classifier.path + + + + + + org.codehaus.mojo + exec-maven-plugin + + + validate-external-darwin-x64-classifier + validate + + exec + + + node + + ${project.basedir}/scripts/validate-native-artifact.mjs + classifier + darwin-x64 + ${copilot.native.external.darwin.x64.classifier.path} + ${project.build.finalName}-darwin-x64.jar + ${copilot.sdk.root} + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-external-darwin-x64-classifier + package + + attach-artifact + + + + + ${copilot.native.external.darwin.x64.classifier.path} + jar + darwin-x64 + + + + + + + + +