Skip to content

Commit 08d254f

Browse files
committed
Let Github Action compile for each platform individually
This enables compiling for a dedicated platform and configures the test projects to use their explicit environment.
1 parent 822b2a1 commit 08d254f

File tree

7 files changed

+127
-31
lines changed

7 files changed

+127
-31
lines changed

.github/workflows/maven.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
config:
22-
- { name: Linux, os: ubuntu-latest, native: gtk.linux.x86_64 }
23-
- { name: Windows, os: windows-latest, native: win32.win32.x86_64 }
24-
- { name: MacOS, os: macos-latest, native: cocoa.macosx.x86_64 }
22+
- { name: Linux, os: ubuntu-latest, native: gtk.linux.x86_64, cp: .classpath_gtk }
23+
- { name: Windows, os: windows-latest, native: win32.win32.x86_64, cp: .classpath_win32 }
24+
- { name: MacOS, os: macos-latest, native: cocoa.macosx.x86_64, cp: .classpath_cocoa }
2525
name: Verify ${{ matrix.config.name }}
2626
steps:
2727
- name: checkout swt
@@ -41,5 +41,14 @@ jobs:
4141
- name: Build with Maven
4242
uses: GabrielBB/xvfb-action@v1
4343
with:
44-
run: mvn --batch-mode -Pbuild-individual-bundles -DcheckAllWS=true -DforkCount=0 -Dcompare-version-with-baselines.skip=false -Dmaven.compiler.failOnWarning=true -DskipTests clean verify
44+
run: >-
45+
mvn --batch-mode
46+
-Pbuild-individual-bundles
47+
-Pbuild-individual-platform
48+
-Dswt.build.platform_cp=${{ matrix.config.cp }}
49+
-DforkCount=0
50+
-Dcompare-version-with-baselines.skip=false
51+
-Dmaven.compiler.failOnWarning=true
52+
-DskipTests
53+
clean verify
4554
working-directory: eclipse.platform.swt

bundles/org.eclipse.swt/buildSWT.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,19 @@
259259
<antcall target="check_preprocessing"/>
260260
</target>
261261

262+
<target name="check_compilation_one_platform">
263+
<mkdir dir="${tmphome}"/>
264+
<!-- <property name="tmpdir" value="${tmphome}/check.compile.${TAG}"/> -->
265+
<property name="buildDir" value="${tmpdir}/build"/>
266+
<property name="projectDir" value="${repo.src}/bundles/org.eclipse.swt"/>
267+
268+
<!-- 64 bit -->
269+
<antcall target="build_classes">
270+
<param name="cp" value="${platform_cp}"/>
271+
</antcall>
272+
<antcall target="check_preprocessing"/>
273+
</target>
274+
262275
<target name="update_sha1_file">
263276
<!-- Update build.sha1 file -->
264277
<exec dir="${repo.src}" executable="git" failonerror="true" outputproperty="HEAD_TAG">

bundles/org.eclipse.swt/pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,38 @@
9696
</plugins>
9797
</build>
9898
</profile>
99+
<profile>
100+
<id>build-individual-platform</id>
101+
<build>
102+
<plugins>
103+
<plugin>
104+
<artifactId>maven-antrun-plugin</artifactId>
105+
<executions>
106+
<execution>
107+
<id>buildAll</id>
108+
<phase>process-resources</phase>
109+
<configuration>
110+
<target>
111+
<property name="repo.src" value="../../"/>
112+
<property name="platform_cp" value="${swt.build.platform_cp}"/>
113+
<ant antfile="buildSWT.xml" target="check_compilation_one_platform"/>
114+
</target>
115+
</configuration>
116+
<goals>
117+
<goal>run</goal>
118+
</goals>
119+
</execution>
120+
</executions>
121+
<dependencies>
122+
<dependency>
123+
<groupId>org.apache.ant</groupId>
124+
<artifactId>ant</artifactId>
125+
<version>[1.10.11,)</version>
126+
</dependency>
127+
</dependencies>
128+
</plugin>
129+
</plugins>
130+
</build>
131+
</profile>
99132
</profiles>
100133
</project>

pom.xml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,29 @@
7676
<modules>
7777
<module>tests/org.eclipse.swt.tests.cocoa</module>
7878
</modules>
79+
<build>
80+
<plugins>
81+
<plugin>
82+
<groupId>org.eclipse.tycho</groupId>
83+
<artifactId>target-platform-configuration</artifactId>
84+
<version>${tycho.version}</version>
85+
<configuration>
86+
<environments>
87+
<environment>
88+
<os>macosx</os>
89+
<ws>cocoa</ws>
90+
<arch>x86_64</arch>
91+
</environment>
92+
<environment>
93+
<os>macosx</os>
94+
<ws>cocoa</ws>
95+
<arch>aarch64</arch>
96+
</environment>
97+
</environments>
98+
</configuration>
99+
</plugin>
100+
</plugins>
101+
</build>
79102
<properties>
80103
<os-jvm-flags>-XstartOnFirstThread</os-jvm-flags>
81104
</properties>
@@ -91,6 +114,29 @@
91114
<modules>
92115
<module>tests/org.eclipse.swt.tests.gtk</module>
93116
</modules>
117+
<build>
118+
<plugins>
119+
<plugin>
120+
<groupId>org.eclipse.tycho</groupId>
121+
<artifactId>target-platform-configuration</artifactId>
122+
<version>${tycho.version}</version>
123+
<configuration>
124+
<environments>
125+
<environment>
126+
<os>linux</os>
127+
<ws>gtk</ws>
128+
<arch>x86_64</arch>
129+
</environment>
130+
<environment>
131+
<os>linux</os>
132+
<ws>gtk</ws>
133+
<arch>ppc64le</arch>
134+
</environment>
135+
</environments>
136+
</configuration>
137+
</plugin>
138+
</plugins>
139+
</build>
94140
</profile>
95141
<profile>
96142
<id>windows</id>
@@ -102,6 +148,24 @@
102148
<modules>
103149
<module>tests/org.eclipse.swt.tests.win32</module>
104150
</modules>
151+
<build>
152+
<plugins>
153+
<plugin>
154+
<groupId>org.eclipse.tycho</groupId>
155+
<artifactId>target-platform-configuration</artifactId>
156+
<version>${tycho.version}</version>
157+
<configuration>
158+
<environments>
159+
<environment>
160+
<os>win32</os>
161+
<ws>win32</ws>
162+
<arch>x86_64</arch>
163+
</environment>
164+
</environments>
165+
</configuration>
166+
</plugin>
167+
</plugins>
168+
</build>
105169
</profile>
106170
</profiles>
107171

tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/widgets/Test_org_eclipse_swt_widgets_Display.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2021, 2022 Joerg Kubitz
2+
* Copyright (c) 2021 Joerg Kubitz
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,9 +13,6 @@
1313
*******************************************************************************/
1414
package org.eclipse.swt.widgets;
1515

16-
import java.lang.reflect.InvocationTargetException;
17-
import java.lang.reflect.Method;
18-
1916
import org.junit.Test;
2017

2118
public class Test_org_eclipse_swt_widgets_Display {
@@ -24,28 +21,8 @@ public class Test_org_eclipse_swt_widgets_Display {
2421
public void test_isXMouseActive() {
2522
Display display = new Display();
2623
try {
27-
// boolean xMouseActive = display.isXMouseActive();
28-
// System.out.println("org.eclipse.swt.widgets.Display.isXMouseActive(): " + xMouseActive);
29-
30-
// Calling above method using reflection method call.
31-
Method method = Class.forName(Display.class.getName()).getDeclaredMethod("isXMouseActive");
32-
Boolean xMouseActive = null;
33-
if (method != null && method.canAccess(display)) {
34-
xMouseActive = (Boolean) method.invoke(display, (Object[]) null);
35-
}
24+
boolean xMouseActive = display.isXMouseActive();
3625
System.out.println("org.eclipse.swt.widgets.Display.isXMouseActive(): " + xMouseActive);
37-
} catch (NoSuchMethodException e) {
38-
e.printStackTrace();
39-
} catch (SecurityException e) {
40-
e.printStackTrace();
41-
} catch (IllegalAccessException e) {
42-
e.printStackTrace();
43-
} catch (IllegalArgumentException e) {
44-
e.printStackTrace();
45-
} catch (InvocationTargetException e) {
46-
e.printStackTrace();
47-
} catch (ClassNotFoundException e) {
48-
e.printStackTrace();
4926
} finally {
5027
display.dispose();
5128
}

tests/org.eclipse.swt.tests.win32/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.swt.tests.win32
5-
Bundle-Version: 3.107.100.qualifier
5+
Bundle-Version: 3.107.0.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Require-Bundle: org.junit;bundle-version="4.12.0",

tests/org.eclipse.swt.tests.win32/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</parent>
2020
<groupId>org.eclipse.swt</groupId>
2121
<artifactId>org.eclipse.swt.tests.win32</artifactId>
22-
<version>3.107.100-SNAPSHOT</version>
22+
<version>3.107.0-SNAPSHOT</version>
2323
<packaging>eclipse-test-plugin</packaging>
2424
<properties>
2525
<code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>

0 commit comments

Comments
 (0)