-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathpom.xml
More file actions
412 lines (405 loc) · 19 KB
/
Copy pathpom.xml
File metadata and controls
412 lines (405 loc) · 19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) Microsoft Corporation. All rights reserved.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github</groupId>
<artifactId>copilot-sdk-java-parent</artifactId>
<version>1.0.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.github</groupId>
<artifactId>copilot-sdk-java-runtime</artifactId>
<packaging>jar</packaging>
<name>GitHub Copilot SDK :: Java :: Native Runtime</name>
<description>Native runtime artifacts for the GitHub Copilot Java SDK, with host-matched platform classifier JARs</description>
<url>https://github.com/github/copilot-sdk</url>
<scm>
<connection>scm:git:https://github.com/github/copilot-sdk.git</connection>
<developerConnection>scm:git:https://github.com/github/copilot-sdk.git</developerConnection>
<url>https://github.com/github/copilot-sdk</url>
<tag>HEAD</tag>
</scm>
<properties>
<!--
Root of the monorepo. This module lives at java/copilot-native/, so
two levels up reaches the monorepo root. Used to locate
nodejs/package-lock.json, which pins both the runtime version and
its SHA-512 integrity hash.
-->
<copilot.sdk.root>${project.basedir}/../..</copilot.sdk.root>
<copilot.native.staging>${project.build.directory}/native-staging</copilot.native.staging>
<!--
The native runtime is downloaded from npm; this module is published
to Maven Central alongside the sdk module.
-->
<maven.deploy.skip>false</maven.deploy.skip>
</properties>
<build>
<resources>
<!--
Placeholder resource for the primary JAR. Filtered so that
${project.version} is substituted. Deliberately contains no
native binaries: the primary JAR exists only to satisfy Maven
Central validation, which requires a main artifact.
-->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!--
On a supported build host, download and verify the matching native
runtime binary. The helper script reads the pinned version and
SHA-512 integrity hash for @github/copilot-<classifier> from
nodejs/package-lock.json, runs `npm pack`, verifies the tarball
against that hash, and extracts runtime.node into the staging
directory. Requires Node.js and npm — already required for the
Java E2E tests.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>validate-native-host</id>
<phase>none</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<arguments>
<argument>${project.basedir}/scripts/validate-native-host.mjs</argument>
<argument>${copilot.native.classifier}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>fetch-native</id>
<phase>none</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<arguments>
<argument>${project.basedir}/scripts/fetch-native.mjs</argument>
<argument>${copilot.sdk.root}</argument>
<argument>${copilot.native.staging}</argument>
<argument>${copilot.native.classifier}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>test-fetch-native</id>
<phase>none</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<executable>node</executable>
<arguments>
<argument>--test</argument>
<argument>${project.basedir}/scripts/fetch-native.test.mjs</argument>
<argument>${project.basedir}/scripts/validate-native-host.test.mjs</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<!--
Additional classifier JAR containing
native/<classifier>/runtime.node,
native/<classifier>/copilot, and
native/<classifier>/platform.properties.
-->
<execution>
<id>jar-native</id>
<phase>none</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>${copilot.native.classifier}</classifier>
<classesDirectory>${copilot.native.staging}/${copilot.native.classifier}</classesDirectory>
<excludes>
<exclude>.version</exclude>
</excludes>
</configuration>
</execution>
<!--
Empty javadoc JAR required by Maven Central. This module
has no Java sources so maven-javadoc-plugin produces nothing.
-->
<execution>
<id>empty-javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>javadoc</classifier>
<classesDirectory>${project.basedir}/src/main/javadoc</classesDirectory>
</configuration>
</execution>
<!--
Empty sources JAR required by Maven Central.
-->
<execution>
<id>empty-sources-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<classesDirectory>${project.basedir}/src/main/java</classesDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!--
Structural guards: assert that the classifier JAR carries the
complete native artifact set and that the placeholder JAR does
not carry the native binary.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>verify-native-jars</id>
<phase>none</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<condition property="native.binary.present">
<resourceexists>
<zipentry zipfile="${project.build.directory}/${project.build.finalName}-${copilot.native.classifier}.jar" name="native/${copilot.native.classifier}/runtime.node" />
</resourceexists>
</condition>
<fail unless="native.binary.present" message="Classifier JAR is missing native/${copilot.native.classifier}/runtime.node" />
<condition property="native.properties.present">
<resourceexists>
<zipentry zipfile="${project.build.directory}/${project.build.finalName}-${copilot.native.classifier}.jar" name="native/${copilot.native.classifier}/platform.properties" />
</resourceexists>
</condition>
<fail unless="native.properties.present" message="Classifier JAR is missing native/${copilot.native.classifier}/platform.properties" />
<condition property="native.cli.present">
<resourceexists>
<zipentry zipfile="${project.build.directory}/${project.build.finalName}-${copilot.native.classifier}.jar" name="native/${copilot.native.classifier}/${copilot.native.cli.filename}" />
</resourceexists>
</condition>
<fail unless="native.cli.present" message="Classifier JAR is missing native/${copilot.native.classifier}/${copilot.native.cli.filename}" />
<condition property="placeholder.jar.polluted">
<resourceexists>
<zipentry zipfile="${project.build.directory}/${project.build.finalName}.jar" name="native/${copilot.native.classifier}/runtime.node" />
</resourceexists>
</condition>
<fail if="placeholder.jar.polluted" message="Placeholder primary JAR must not contain native binaries" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!--
Bind native packaging only when the build host matches an implemented
classifier. Add sibling profiles as additional platforms are supported.
-->
<profile>
<id>native-linux-x64</id>
<activation>
<os>
<name>Linux</name>
<arch>amd64</arch>
</os>
<property>
<name>copilot.native.libc</name>
<value>glibc</value>
</property>
</activation>
<properties>
<copilot.native.classifier>linux-x64</copilot.native.classifier>
<copilot.native.cli.filename>copilot</copilot.native.cli.filename>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>validate-native-host</id>
<phase>validate</phase>
</execution>
<execution>
<id>fetch-native</id>
<phase>generate-resources</phase>
</execution>
<execution>
<id>test-fetch-native</id>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>jar-native</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>verify-native-jars</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!--
The SDK's inprocess test profile requires this module's classifier
artifact. Bind the same guarded native lifecycle so `-Pinprocess`
works without a separate libc property. Host validation fails
before download or packaging on non-glibc and unsupported hosts.
-->
<profile>
<id>inprocess</id>
<properties>
<copilot.native.classifier>linux-x64</copilot.native.classifier>
<copilot.native.cli.filename>copilot</copilot.native.cli.filename>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>validate-native-host</id>
<phase>validate</phase>
</execution>
<execution>
<id>fetch-native</id>
<phase>generate-resources</phase>
</execution>
<execution>
<id>test-fetch-native</id>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>jar-native</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>verify-native-jars</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!--
Skip the npm download when building offline or when only the
placeholder JAR is needed: mvn -Dcopilot.native.skip.download=true
-->
<profile>
<id>skip-native-download</id>
<activation>
<property>
<name>copilot.native.skip.download</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>validate-native-host</id>
<phase>none</phase>
</execution>
<execution>
<id>fetch-native</id>
<phase>none</phase>
</execution>
<execution>
<id>test-fetch-native</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>jar-native</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>verify-native-jars</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>