Skip to content

Commit 17d9637

Browse files
Copilotbasilevs
andauthored
Set buildUrl Maven natively using OS-activated profiles and build-helper-maven-plugin (#320)
Set buildUrl Maven natively using profiles Windows builds required specialized handling of `buildUrl` property due to strange path separators. This commit initializes `buildUrl` using build-helper-maven-plugin and platform-specific profiles instead of command line arguments enabling direct use of Maven without `build.cmd` script. Profiles are needed because build-helper-maven-plugin only executes after Tycho reads p2 repositories (during 'afterProjectsRead'). Co-authored-by: Vasili Gulevich <vasili.gulevich@xored.com>
1 parent a895426 commit 17d9637

2 files changed

Lines changed: 44 additions & 4 deletions

File tree

.github/workflows/verify.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: VNC
4444
run: vncserver $DISPLAY -localhost=1 -noxstartup -PasswordFile /root/.vnc/passwd
4545
- name: Build
46-
run: ./build.sh -DforceContextQualifier=`date '+%Y%m%d%H%M'` -DbuildUrl=file://`pwd` --errors --batch-mode --no-transfer-progress
46+
run: ./build.sh -DforceContextQualifier=`date '+%Y%m%d%H%M'` --errors --batch-mode --no-transfer-progress
4747
- name: List all files
4848
if: always()
4949
run: find . > files.txt
@@ -107,7 +107,7 @@ jobs:
107107
- name: VNC
108108
run: vncserver $DISPLAY -localhost=1 -noxstartup -PasswordFile /root/.vnc/passwd
109109
- name: Build
110-
run: ./build.sh -PlatestPlatform -PforceContextQualifier -DforceContextQualifier=`date '+%Y%m%d%H%M'` -DbuildUrl=file://`pwd` --errors --batch-mode --no-transfer-progress
110+
run: ./build.sh -PlatestPlatform -PforceContextQualifier -DforceContextQualifier=`date '+%Y%m%d%H%M'` --errors --batch-mode --no-transfer-progress
111111
- name: List all files
112112
if: always()
113113
run: find . > files.txt

releng/pom.xml

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<ajJavaTarget>1.8</ajJavaTarget>
4040
<ajJavaCompilance>1.8</ajJavaCompilance>
4141
<cbi-version>1.5.4</cbi-version>
42-
<buildUrl>file:/${user.dir}</buildUrl>
42+
<buildUrl>file://${maven.multiModuleProjectDirectory}</buildUrl> <!-- overridden by unix-build-url / windows-build-url profiles -->
4343
</properties>
4444
<prerequisites>
4545
<maven>3.9.0</maven>
@@ -210,7 +210,7 @@
210210
<plugin>
211211
<groupId>org.codehaus.mojo</groupId>
212212
<artifactId>build-helper-maven-plugin</artifactId>
213-
<version>3.0.0</version>
213+
<version>3.6.0</version>
214214
</plugin>
215215
<plugin>
216216
<groupId>org.codehaus.mojo</groupId>
@@ -220,6 +220,26 @@
220220
</plugins>
221221
</pluginManagement>
222222
<plugins>
223+
<plugin>
224+
<groupId>org.codehaus.mojo</groupId>
225+
<artifactId>build-helper-maven-plugin</artifactId>
226+
<executions>
227+
<execution>
228+
<id>set-build-url</id>
229+
<phase>initialize</phase>
230+
<goals>
231+
<goal>regex-property</goal>
232+
</goals>
233+
<configuration>
234+
<name>buildUrl</name>
235+
<value>${buildUrl}</value>
236+
<regex>\\</regex>
237+
<replacement>/</replacement>
238+
<failIfNoMatch>false</failIfNoMatch>
239+
</configuration>
240+
</execution>
241+
</executions>
242+
</plugin>
223243
<plugin>
224244
<groupId>org.eclipse.dash</groupId>
225245
<artifactId>license-tool-plugin</artifactId>
@@ -285,6 +305,26 @@
285305
</plugins>
286306
</build>
287307
<profiles>
308+
<profile>
309+
<!-- On Unix/Linux/macOS the path starts with /, so file:// + /path = file:///path -->
310+
<id>unix-build-url</id>
311+
<activation>
312+
<os><family>unix</family></os>
313+
</activation>
314+
<properties>
315+
<buildUrl>file://${maven.multiModuleProjectDirectory}</buildUrl>
316+
</properties>
317+
</profile>
318+
<profile>
319+
<!-- On Windows the path starts with a drive letter, so file:/// + C:/path = file:///C:/path -->
320+
<id>windows-build-url</id>
321+
<activation>
322+
<os><family>windows</family></os>
323+
</activation>
324+
<properties>
325+
<buildUrl>file:///${maven.multiModuleProjectDirectory}</buildUrl>
326+
</properties>
327+
</profile>
288328
<profile>
289329
<id>update-version</id>
290330
<modules>

0 commit comments

Comments
 (0)