Skip to content

Commit

Permalink
[Build] Use git-based qualifier in o.e.swt and its native fragments
Browse files Browse the repository at this point in the history
This avoids committing the changes of the 'forceContextQualifier'
properties in the org.eclipse.swt/pom.xml and the binaries/pom.xml after
each change in org.eclipse.swt. Consequently this avoids the noise in
the git-history from these qualifier-change commits and the need to
await the completion of subsequent master-branch builds for consistent
build-qualifiers even for changes that don't change the native binaries.
If not done, this affected the stability of I-builds.

Furthermore this allows further simplifications of the SWT build.

Part of eclipse-platform#513
  • Loading branch information
HannesWell committed Jan 10, 2024
1 parent 0d4fb03 commit 39389a2
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 97 deletions.
9 changes: 4 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pipeline {
when {
anyOf {
expression { return params.forceNativeBuilds }
expression { return fileExists('tmp/build_changed.txt') && fileExists('tmp/natives_changed.txt') }
expression { return fileExists('tmp/natives_changed.txt') }
}
}
matrix {
Expand Down Expand Up @@ -253,7 +253,7 @@ pipeline {
}
stage('Commit SWT-native binaries, if build') {
when {
expression { return params.forceNativeBuilds || fileExists('tmp/build_changed.txt') }
expression { return params.forceNativeBuilds || fileExists('tmp/natives_changed.txt') }
}
steps {
withAnt(installation: 'apache-ant-latest', jdk: 'openjdk-jdk11-latest') { // nashorn javascript-engine required in ant-scripts
Expand All @@ -265,8 +265,7 @@ pipeline {
git status
popd
ant -f eclipse.platform.swt/bundles/org.eclipse.swt/buildInternal.xml write_qualifier -Dlib.dir=${WORKSPACE} -Dbuild_changed=true
ant -f eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml commit_poms_and_binaries
ant -f eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml commit_binaries
ant -f eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml tag_projects
pushd eclipse.platform.swt
Expand Down Expand Up @@ -306,7 +305,7 @@ pipeline {
}
stage('Push SWT-native binaries, if build') {
when {
expression { return params.forceNativeBuilds || fileExists('tmp/build_changed.txt') }
expression { return params.forceNativeBuilds || fileExists('tmp/natives_changed.txt') }
}
steps {
sshagent(['github-bot-ssh']) {
Expand Down
33 changes: 25 additions & 8 deletions binaries/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
<packaging>pom</packaging>

<properties>
<!--
forceContextQualifier gets updated during build input process using
ant script <SWT source repo>/bundles/org.eclipse.swt/buildInternal.xml
-->
<forceContextQualifier>v20240110-1244</forceContextQualifier>
<buildid>${buildId}</buildid>
<maven.compiler.release>17</maven.compiler.release>
</properties>
Expand Down Expand Up @@ -92,13 +87,35 @@
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<configuration>
<forceContextQualifier>${forceContextQualifier}</forceContextQualifier>
</configuration>
<executions>
<execution>
<id>default-build-qualifier</id>
<phase>initialize</phase> <!-- Postpone default-build-qualifier execution from packaging's default-bindings until the qualifier was read below.-->
<goals>
<goal>build-qualifier</goal>
</goals>
<configuration>
<forceContextQualifier>${swtBuildQualifier}</forceContextQualifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>read-build-qualifier</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target> <!-- Read git qualifier of 'org.eclipse.swt' project. -->
<loadfile property="swtBuildQualifier" srcFile="../../bundles/org.eclipse.swt/target/swtBuildQualifier.txt"/>
</target>
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
<execution>
<id>normal</id>
<phase>initialize</phase>
Expand Down
49 changes: 0 additions & 49 deletions bundles/org.eclipse.swt/buildInternal.xml

This file was deleted.

26 changes: 1 addition & 25 deletions bundles/org.eclipse.swt/buildSWT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
<property name="file_library" value="bundles/org.eclipse.swt/Eclipse SWT PI/common/org/eclipse/swt/internal/Library.java"/>
<property name="file_make_common" value="bundles/org.eclipse.swt/Eclipse SWT/common/library/make_common.mak"/>
<property name="file_version" value="bundles/org.eclipse.swt/Eclipse SWT/common/version.txt"/>
<property name="file_src_pom" value="bundles/org.eclipse.swt/pom.xml"/>
<property name="file_bin_parent_pom" value="binaries/pom.xml"/>

<target name="check_fragment_libraries" depends="get_version">
<echo>Checking ${fragment}</echo>
Expand Down Expand Up @@ -99,17 +97,6 @@

<!-- common build tasks -->

<target name="check_build_changed" depends="get_tag" unless="build_changed">
<!-- Check for changes -->
<exec dir="${repo.src}" executable="git" failonerror="false" outputproperty="src_diffs">
<arg line="diff ${swt_tag}"/>
</exec>
<condition property="build_changed">
<length string="${src_diffs}" trim="true" when="greater" length="0"/>
</condition>
<echo>Has build changes: ${build_changed} checked against ${swt_tag}</echo>
</target>

<target name="commit_sources" depends="get_version" if="natives_changed">
<exec dir="${repo.src}" executable="git" failonerror="true">
<arg line="add '${file_library}' '${file_version}' '${file_make_common}' "/>
Expand Down Expand Up @@ -245,13 +232,6 @@
</script>
</target>

<target name="commit_poms_and_binaries">
<exec dir="${repo.src}" executable="git" failonerror="true">
<arg line="add '${file_src_pom}' '${file_bin_parent_pom}'"/>
</exec>
<antcall target="commit_binaries"/>
</target>

<!-- Params: fragment, swt_version -->
<target name="commit_binaries" depends="get_version">
<!-- Get libraries to remove from repo -->
Expand Down Expand Up @@ -402,7 +382,7 @@
<!-- targets to run the builds on the Eclipse Foundation Hudson in master-slave setup -->
<!-- ******************************************************************************** -->

<target name="new_build_with_create_file" depends="check_build_changed, check_natives_changed" if="build_changed">
<target name="new_build_with_create_file" depends="check_natives_changed" if="natives_changed">
<!-- Update the version files -->
<antcall target="increment_version"/>

Expand All @@ -411,10 +391,6 @@

<!-- Create tmp files if the properties are set -->
<mkdir dir="${tmphome}"/>
<antcall target="create_file_if_property_exists">
<param name="property" value="${build_changed}"/>
<param name="fileName" value="${tmphome}/build_changed.txt"/>
</antcall>
<antcall target="create_file_if_property_exists">
<param name="property" value="${natives_changed}"/>
<param name="fileName" value="${tmphome}/natives_changed.txt"/>
Expand Down
26 changes: 16 additions & 10 deletions bundles/org.eclipse.swt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,28 @@
<packaging>eclipse-plugin</packaging>

<properties>
<!--
forceContextQualifier gets updated during build input process using
ant script <SWT source repo>/bundles/org.eclipse.swt/buildInternal.xml
-->
<forceContextQualifier>v20240110-1244</forceContextQualifier>
<sonar.sources>Eclipse SWT Accessibility/cocoa,Eclipse SWT Accessibility/common,Eclipse SWT Accessibility/gtk,Eclipse SWT Accessibility/win32,Eclipse SWT AWT/cocoa,Eclipse SWT AWT/common,Eclipse SWT AWT/gtk,Eclipse SWT AWT/win32,Eclipse SWT Browser/cocoa,Eclipse SWT Browser/common,Eclipse SWT Browser/gtk,Eclipse SWT Browser/win32,Eclipse SWT Custom Widgets/common,Eclipse SWT Drag and Drop/cocoa,Eclipse SWT Drag and Drop/common,Eclipse SWT Drag and Drop/gtk,Eclipse SWT Drag and Drop/win32,Eclipse SWT OLE Win32/win32,Eclipse SWT OpenGL/cocoa,Eclipse SWT OpenGL/common,Eclipse SWT OpenGL/glx,Eclipse SWT OpenGL/gtk,Eclipse SWT OpenGL/win32,Eclipse SWT PI/cairo,Eclipse SWT PI/cocoa,Eclipse SWT PI/common,Eclipse SWT PI/gtk,Eclipse SWT PI/win32,Eclipse SWT Printing/cocoa,Eclipse SWT Printing/common,Eclipse SWT Printing/gtk,Eclipse SWT Printing/win32,Eclipse SWT Program/cocoa,Eclipse SWT Program/common,Eclipse SWT Program/gtk,Eclipse SWT Program/win32,Eclipse SWT WebKit/cocoa,Eclipse SWT WebKit/gtk,Eclipse SWT/cairo,Eclipse SWT/cocoa,Eclipse SWT/common,Eclipse SWT/emulated/bidi,Eclipse SWT/emulated/coolbar,Eclipse SWT/emulated/expand,Eclipse SWT/emulated/taskbar,Eclipse SWT/emulated/tooltip,Eclipse SWT/gtk,Eclipse SWT/win32</sonar.sources>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<configuration>
<forceContextQualifier>${forceContextQualifier}</forceContextQualifier>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>write-build-qualifier</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target> <!-- Write computed qualifier to file so that the native fragments can read it as their qualifier. -->
<echo file="${project.build.directory}/swtBuildQualifier.txt" message="${buildQualifier}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
Expand Down

0 comments on commit 39389a2

Please sign in to comment.