Skip to content

Commit db1892e

Browse files
committed
Restore antrun git-clone mechanism and add missing codegen files
Revert pom.xml to preserve the git-clone-based test harness setup (copilot.sdk.clone.dir = target/copilot-sdk/) instead of pointing at the monorepo root. Add scripts/codegen/package-lock.json (pins @github/copilot@1.0.49-3) and .gitignore that were missed in the initial file copy.
1 parent 57c85b3 commit db1892e

3 files changed

Lines changed: 731 additions & 21 deletions

File tree

java/pom.xml

Lines changed: 115 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<name>GitHub Copilot SDK :: Java</name>
1414
<description>SDK for programmatic control of GitHub Copilot CLI</description>
15-
<url>https://github.com/github/copilot-sdk</url>
15+
<url>https://github.com/github/copilot-sdk-java</url>
1616

1717
<licenses>
1818
<license>
@@ -30,9 +30,9 @@
3030
</developers>
3131

3232
<scm>
33-
<connection>scm:git:https://github.com/github/copilot-sdk.git</connection>
34-
<developerConnection>scm:git:https://github.com/github/copilot-sdk.git</developerConnection>
35-
<url>https://github.com/github/copilot-sdk</url>
33+
<connection>scm:git:https://github.com/github/copilot-sdk-java.git</connection>
34+
<developerConnection>scm:git:https://github.com/github/copilot-sdk-java.git</developerConnection>
35+
<url>https://github.com/github/copilot-sdk-java</url>
3636
<tag>HEAD</tag>
3737
</scm>
3838

@@ -46,21 +46,21 @@
4646
<properties>
4747
<maven.compiler.release>17</maven.compiler.release>
4848
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
49-
<!-- Directory of the monorepo root (one level up from java/) -->
50-
<copilot.sdk.clone.dir>${project.basedir}/..</copilot.sdk.clone.dir>
49+
<!-- Directory where the copilot-sdk repo will be cloned for tests -->
50+
<copilot.sdk.clone.dir>${project.build.directory}/copilot-sdk</copilot.sdk.clone.dir>
5151
<copilot.tests.dir>${copilot.sdk.clone.dir}/test</copilot.tests.dir>
5252
<!--
5353
Path to the Copilot CLI entry point used by the SDK tests. Defaults
54-
to the CLI installed under ../nodejs (the monorepo's nodejs dir) by
55-
the install-nodejs-cli-dependencies execution. Surefire injects this
54+
to the CLI installed under target/copilot-sdk/nodejs by the
55+
install-nodejs-cli-dependencies execution. Surefire injects this
5656
into the test JVM as the COPILOT_CLI_PATH environment variable, so
5757
`mvn verify` is self-contained and the developer never has to set
5858
it manually. Override on the command line to point at a different
5959
CLI build, e.g.:
6060
mvn verify -Dcopilot.cli.path=/some/other/copilot/index.js
6161
-->
6262
<copilot.cli.path>${copilot.sdk.clone.dir}/nodejs/node_modules/@github/copilot/index.js</copilot.cli.path>
63-
<!-- Set to true (via -Pskip-test-harness) to skip npm install of test harness -->
63+
<!-- Set to true (via -Pskip-test-harness) to skip git-clone + npm install of test harness -->
6464
<skip.test.harness>false</skip.test.harness>
6565
<!--
6666
Whether to skip the install-nodejs-cli-dependencies execution
@@ -76,17 +76,23 @@
7676
<!-- Extra JVM args for Surefire; overridden by the jdk21+ profile -->
7777
<surefire.jvm.args />
7878
<!--
79-
The version of the @github/copilot npm package used by the monorepo.
80-
Mirrors the value of dependencies."@github/copilot"
81-
in ../nodejs/package.json.
79+
The version of the @github/copilot npm package that the reference implementation
80+
commit pinned in .lastmerge depends on. Mirrors the value of dependencies."@github/copilot"
81+
in target/copilot-sdk/nodejs/package.json after the reference impl is cloned/reset to the
82+
commit in .lastmerge.
8283
8384
The previously mentioned package.json contains the SINGLE
8485
SOURCE OF TRUTH for the Copilot CLI version that all paths
8586
(build-test.yml, run-smoke-test.yml,
8687
update-copilot-dependency.yml, setup-copilot action) must
87-
pin to.
88+
pin to. It is updated automatically by
89+
.github/scripts/reference-impl-sync/sync-cli-version-from-reference-impl.sh,
90+
which is called from merge-reference-impl-finish.sh
91+
whenever .lastmerge is updated.
8892
89-
DO NOT EDIT MANUALLY.
93+
DO NOT EDIT MANUALLY. To update, run the
94+
reference-impl-sync workflow and deal with the subsequent
95+
PR.
9096
-->
9197
<readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync>^1.0.49-1</readonly-copilot-sdk-ref-impl-version-from-lastmerge-file-updated-by-reference-impl-sync>
9298

@@ -167,6 +173,88 @@
167173
<artifactId>maven-jar-plugin</artifactId>
168174
<version>3.5.0</version>
169175
</plugin>
176+
<!-- Clone or update the official copilot-sdk repository for test resources, and copy image to site -->
177+
<plugin>
178+
<groupId>org.apache.maven.plugins</groupId>
179+
<artifactId>maven-antrun-plugin</artifactId>
180+
<version>3.2.0</version>
181+
<executions>
182+
<execution>
183+
<id>clone-or-update-copilot-sdk</id>
184+
<phase>generate-test-resources</phase>
185+
<goals>
186+
<goal>run</goal>
187+
</goals>
188+
<configuration>
189+
<skip>${skip.test.harness}</skip>
190+
<target xmlns:if="ant:if" xmlns:unless="ant:unless">
191+
<!-- Load the target commit from .lastmerge file -->
192+
<loadfile property="copilot.sdk.commit" srcFile="${project.basedir}/.lastmerge">
193+
<filterchain>
194+
<striplinebreaks />
195+
<trim />
196+
</filterchain>
197+
</loadfile>
198+
199+
<!-- Check if .git directory exists -->
200+
<condition property="repo.exists">
201+
<available file="${copilot.sdk.clone.dir}/.git" type="dir" />
202+
</condition>
203+
204+
<!-- If repo exists, fetch and reset to the target commit -->
205+
<sequential if:set="repo.exists">
206+
<echo message="Updating existing copilot-sdk repository to commit ${copilot.sdk.commit}..." />
207+
<exec executable="git" dir="${copilot.sdk.clone.dir}" failonerror="true">
208+
<arg value="fetch" />
209+
<arg value="--depth" />
210+
<arg value="1" />
211+
<arg value="origin" />
212+
<arg value="${copilot.sdk.commit}" />
213+
</exec>
214+
<exec executable="git" dir="${copilot.sdk.clone.dir}" failonerror="true">
215+
<arg value="reset" />
216+
<arg value="--hard" />
217+
<arg value="FETCH_HEAD" />
218+
</exec>
219+
</sequential>
220+
221+
<!-- If repo doesn't exist, clone it at the specific commit -->
222+
<sequential unless:set="repo.exists">
223+
<echo message="Cloning copilot-sdk repository at commit ${copilot.sdk.commit}..." />
224+
<delete dir="${copilot.sdk.clone.dir}" quiet="true" />
225+
<exec executable="git" failonerror="true">
226+
<arg value="clone" />
227+
<arg value="--depth" />
228+
<arg value="1" />
229+
<arg value="https://github.com/github/copilot-sdk.git" />
230+
<arg value="${copilot.sdk.clone.dir}" />
231+
</exec>
232+
<exec executable="git" dir="${copilot.sdk.clone.dir}" failonerror="true">
233+
<arg value="fetch" />
234+
<arg value="--depth" />
235+
<arg value="1" />
236+
<arg value="origin" />
237+
<arg value="${copilot.sdk.commit}" />
238+
</exec>
239+
<exec executable="git" dir="${copilot.sdk.clone.dir}" failonerror="true">
240+
<arg value="reset" />
241+
<arg value="--hard" />
242+
<arg value="FETCH_HEAD" />
243+
</exec>
244+
</sequential>
245+
</target>
246+
</configuration>
247+
</execution>
248+
</executions>
249+
<dependencies>
250+
<!-- Required for if:set and unless:set -->
251+
<dependency>
252+
<groupId>org.apache.ant</groupId>
253+
<artifactId>ant</artifactId>
254+
<version>1.10.17</version>
255+
</dependency>
256+
</dependencies>
257+
</plugin>
170258
<!-- Install harness dependencies -->
171259
<plugin>
172260
<groupId>org.codehaus.mojo</groupId>
@@ -190,10 +278,16 @@
190278
</execution>
191279
<!--
192280
Install the @github/copilot CLI declared by
193-
../nodejs/package.json. This is the CLI version the SDK
194-
tests must run against (independent of the older pin in
195-
test/harness/package.json which is incidental to harness
196-
internals). Uses npm ci with the ignore-scripts flag.
281+
target/copilot-sdk/nodejs/package.json. This is the CLI
282+
version the SDK tests must run against (independent of
283+
the older pin in test/harness/package.json which is
284+
incidental to harness internals). Mirrors what
285+
.github/workflows/build-test.yml does manually so that
286+
`mvn clean verify` is self-contained: the prior
287+
target/copilot-sdk/nodejs/node_modules is wiped by
288+
clean, but this re-creates it before tests run.
289+
Uses npm ci with the ignore-scripts flag, matching
290+
build-test.yml.
197291
-->
198292
<execution>
199293
<id>install-nodejs-cli-dependencies</id>
@@ -237,8 +331,8 @@
237331
<!--
238332
Set COPILOT_CLI_PATH for the forked test JVM so the SDK
239333
tests transparently use the pinned CLI under
240-
../nodejs/. See the copilot.cli.path property above for
241-
the override mechanism.
334+
target/copilot-sdk/nodejs/. See the copilot.cli.path
335+
property above for the override mechanism.
242336
-->
243337
<environmentVariables>
244338
<COPILOT_CLI_PATH>${copilot.cli.path}</COPILOT_CLI_PATH>
@@ -599,7 +693,7 @@
599693
<surefire.jvm.args>-XX:+EnableDynamicAgentLoading</surefire.jvm.args>
600694
</properties>
601695
</profile>
602-
<!-- Skip npm install of the copilot-sdk test harness -->
696+
<!-- Skip git-clone + npm install of the copilot-sdk test harness -->
603697
<profile>
604698
<id>skip-test-harness</id>
605699
<properties>

java/scripts/codegen/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

0 commit comments

Comments
 (0)