Commit d9a6fab
[java] Add linux-x64 implementation of in process Copilot CLI (#2301)
* feat(java): embed Rust CLI runtime as native module
Squashed from PR #2295 (branch edburns/…-review-02).
Includes Java multi-module Maven restructure, copilot-native
submodule for bundling the Rust CLI runtime, codegen updates,
and related workflow changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 90cbda40-cda3-4ecd-b381-9f9ba0573d0a
* java: add flatten-maven-plugin to produce self-contained deployed POMs
Child modules (copilot-sdk-java, copilot-sdk-java-runtime) inherit from
copilot-sdk-java-parent, which is not published to Maven Central. Without
flattening, consumers resolving a child artifact would fail to resolve the
parent POM. The flatten-maven-plugin (ossrh mode) inlines all inherited
metadata so the deployed POM is fully self-contained.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* java: only release callback GC root after successful connection_close
Previously the tracked callback was removed in a finally block,
releasing its GC root even when native connection_close failed or threw.
Native code could still retain and invoke the stale function pointer,
crashing the JVM after JNA collected the callback.
Now the callback reference is only removed from trackedCallbacks when the
native call succeeds, ensuring the function pointer stays rooted while
native code may still hold it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* java: remove spike test library references, use real native runtime
Remove CallbackTestLib interface and all tests that depended on the
spike libcallback_test.so from the removed
1917-java-embed-rust-cli-runtime-remove-before-merge directory.
Rewrite the 3 duplicate-load guard tests to use NativeRuntimeLoader.resolve()
to locate the real runtime.node binary instead of the spike library.
Remove the startWithSpikeLibrarySupportsLifecycleAndDataFlow integration
test from FfiRuntimeHostTest — this functionality is covered by E2E tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* docs: add JNA dependency to in-process mode README snippet
JNA is declared optional in the SDK POM so subprocess-mode users don't
pull it transitively. The in-process mode section was missing this
required third dependency, which would cause NoClassDefFoundError at
runtime.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* java: add empty javadoc and sources JARs for copilot-native module
Maven Central requires javadoc and sources classifier JARs for every
non-POM artifact. Since copilot-native has no Java sources, the parent's
maven-javadoc-plugin produced nothing. Add explicit empty-archive
executions to maven-jar-plugin so the module passes Central validation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* java: use size_t-width type for native length parameters
The C ABI declares all buffer-length parameters as size_t (8 bytes on
64-bit), but the Java FFI layer was using int (always 4 bytes). While
harmless for current JSON-RPC payloads, this is incorrect on 64-bit
platforms and would be wrong on Windows x64 where NativeLong (C long)
is also only 4 bytes.
Introduce SizeT, a minimal IntegerType subclass sized via
Native.SIZE_T_SIZE, and use it in CopilotRuntimeLibrary and
OutboundCallback. The NativeBinding Java abstraction layer keeps int
parameters; JnaNativeBinding converts at the boundary.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* java: remove global JNA callback exception handler
The process-wide Native.setCallbackExceptionHandler was redundant: the
local catch (Throwable) in createOutboundCallback() already prevents any
exception from escaping across the FFI boundary. The global mutation
affected unrelated JNA callbacks in the same process and was never
restored.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* ci: make java-sdk-inprocess test job blocking
Remove continue-on-error so FFI regressions in the in-process transport
block PRs. The in-process transport is now production code and must not
silently regress.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* fix: update jbang-example.java path after move to sdk/ submodule
The JBang example moved from java/jbang-example.java to
java/sdk/jbang-example.java but two references were not updated:
the runnable JBang URL in README.md and the release workflow's
update-documentation-versions script invocation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* docs: fix ADR relative links in README
The ADRs are at java/docs/adr/, not java/sdk/docs/adr/. Fix the
relative links for ADR-006 and ADR-004.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
* Regenerate Java codegen output
Auto-committed by java-codegen-check workflow.
* fix(java): retain JNA callbacks for process lifetime
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de
* fix(java): publish executable CLI atomically
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de
* docs(java): align native runtime ADR
Document strict in-process selection, the implemented runtime resolution order, current artifact contents, and the intentionally narrow PATH compatibility fallback.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de
* fix(java): key native cache by runtime version
Read the packaged native version before cache lookup so mutable SDK snapshot builds cannot reuse stale runtime and CLI artifacts.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de
* fix(java): validate staged native artifacts
Include the bundled CLI digest in the incremental staging stamp, require complete platform metadata, and verify the classifier JAR contains the CLI.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de
* fix(java): complete Maven module migration
Restore pre-migration dependency and plugin versions, publish correct child project metadata, and update repository consumers to the moved SDK paths.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copilot-Session: 90cbda40-cda3-4ecd-b381-9f9ba0573d0a
Copilot-Session: 3a69f33e-eea6-4b8c-9ef0-8b4d56d53a9c
Copilot-Session: 108d08d4-0724-4414-bed8-2771b12b58de1 parent a6d3ed1 commit d9a6fab
1,607 files changed
Lines changed: 7019 additions & 982 deletions
File tree
- .githooks
- .github
- actions/java-test-report
- skills/new-java-e2e-test-yaml-and-test
- workflows
- java
- copilot-native
- scripts
- src/main
- javadoc
- java
- resources/native/lib
- docs/adr
- scripts/codegen
- sdk
- config
- checkstyle
- spotbugs
- src
- generated/java/com/github/copilot/generated
- rpc
- main
- java25/com/github/copilot
- ffi
- java
- com/github/copilot
- ffi
- rpc
- tool
- resources
- META-INF/services
- test
- java/com/github/copilot
- e2e
- ffi
- generated
- rpc
- rpc
- fixtures
- tool
- prompts
- resources
- scripts/docs-validation
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
| 144 | + | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments