Skip to content

Commit 5edcf7e

Browse files
committed
Enhance Maven build process to clone or update the copilot-sdk repository for test resources; update maven-antrun-plugin version and add necessary dependencies
1 parent de33889 commit 5edcf7e

1 file changed

Lines changed: 53 additions & 24 deletions

File tree

pom.xml

Lines changed: 53 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,54 @@
9292
<artifactId>maven-compiler-plugin</artifactId>
9393
<version>3.14.1</version>
9494
</plugin>
95-
<!-- Copy image.png to site resources directory -->
95+
<!-- Clone or update the official copilot-sdk repository for test resources, and copy image to site -->
9696
<plugin>
9797
<groupId>org.apache.maven.plugins</groupId>
9898
<artifactId>maven-antrun-plugin</artifactId>
99-
<version>3.1.0</version>
99+
<version>3.2.0</version>
100100
<executions>
101+
<execution>
102+
<id>clone-or-update-copilot-sdk</id>
103+
<phase>generate-test-resources</phase>
104+
<goals>
105+
<goal>run</goal>
106+
</goals>
107+
<configuration>
108+
<target xmlns:if="ant:if" xmlns:unless="ant:unless">
109+
<!-- Check if .git directory exists -->
110+
<condition property="repo.exists">
111+
<available file="${copilot.sdk.clone.dir}/.git" type="dir" />
112+
</condition>
113+
114+
<!-- If repo exists, fetch and reset -->
115+
<sequential if:set="repo.exists">
116+
<echo message="Updating existing copilot-sdk repository..." />
117+
<exec executable="git" dir="${copilot.sdk.clone.dir}" failonerror="true">
118+
<arg value="fetch" />
119+
<arg value="origin" />
120+
</exec>
121+
<exec executable="git" dir="${copilot.sdk.clone.dir}" failonerror="true">
122+
<arg value="reset" />
123+
<arg value="--hard" />
124+
<arg value="origin/main" />
125+
</exec>
126+
</sequential>
127+
128+
<!-- If repo doesn't exist, clone it -->
129+
<sequential unless:set="repo.exists">
130+
<echo message="Cloning copilot-sdk repository..." />
131+
<delete dir="${copilot.sdk.clone.dir}" quiet="true" />
132+
<exec executable="git" failonerror="true">
133+
<arg value="clone" />
134+
<arg value="--depth" />
135+
<arg value="1" />
136+
<arg value="https://github.com/github/copilot-sdk.git" />
137+
<arg value="${copilot.sdk.clone.dir}" />
138+
</exec>
139+
</sequential>
140+
</target>
141+
</configuration>
142+
</execution>
101143
<execution>
102144
<id>copy-image-to-site</id>
103145
<phase>pre-site</phase>
@@ -111,34 +153,21 @@
111153
</configuration>
112154
</execution>
113155
</executions>
156+
<dependencies>
157+
<!-- Required for if:set and unless:set -->
158+
<dependency>
159+
<groupId>org.apache.ant</groupId>
160+
<artifactId>ant</artifactId>
161+
<version>1.10.15</version>
162+
</dependency>
163+
</dependencies>
114164
</plugin>
115-
<!-- Clone the official copilot-sdk repository for test resources -->
165+
<!-- Install harness dependencies -->
116166
<plugin>
117167
<groupId>org.codehaus.mojo</groupId>
118168
<artifactId>exec-maven-plugin</artifactId>
119169
<version>3.6.2</version>
120170
<executions>
121-
<execution>
122-
<id>clone-copilot-sdk</id>
123-
<phase>generate-test-resources</phase>
124-
<goals>
125-
<goal>exec</goal>
126-
</goals>
127-
<configuration>
128-
<executable>git</executable>
129-
<arguments>
130-
<argument>clone</argument>
131-
<argument>--depth</argument>
132-
<argument>1</argument>
133-
<argument>https://github.com/github/copilot-sdk.git</argument>
134-
<argument>${copilot.sdk.clone.dir}</argument>
135-
</arguments>
136-
<successCodes>
137-
<successCode>0</successCode>
138-
<successCode>128</successCode> <!-- Already exists -->
139-
</successCodes>
140-
</configuration>
141-
</execution>
142171
<execution>
143172
<id>install-harness-dependencies</id>
144173
<phase>generate-test-resources</phase>

0 commit comments

Comments
 (0)