Skip to content

Commit 861fdf7

Browse files
committed
durian-swt.{platform} now compiles against swt-evolve for each of its platforms
1 parent 722be35 commit 861fdf7

File tree

2 files changed

+53
-20
lines changed

2 files changed

+53
-20
lines changed

build.gradle

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@ group = 'com.diffplug.durian'
66
spotlessChangelog {
77
changelogFile 'CHANGES.md'
88
}
9-
repositories { mavenCentral() }
9+
1010
allprojects {
11+
repositories {
12+
mavenCentral()
13+
if (!VER_SWT_EVOLVE.isEmpty()) {
14+
maven {
15+
url = 'https://gitlab.com/api/v4/projects/72079350/packages/maven'
16+
content {
17+
includeGroup 'dev.equo'
18+
}
19+
}
20+
}
21+
}
1122
apply from: 干.file('base/changelog.gradle')
1223
}
1324
apply from: 干.file('spotless/freshmark.gradle')
@@ -50,34 +61,52 @@ subprojects { subProject ->
5061
main = 'com.diffplug.common.swt.os.OS'
5162
}
5263
} else {
53-
String platformCode = project.name.substring('durian-swt.'.length())
54-
String SWT_TO_USE = platformCode.endsWith("x86") ? VER_ECLIPSE_PLATFORM_X86 : VER_ECLIPSE_PLATFORM
55-
apply plugin: 'dev.equo.p2deps'
56-
p2deps {
57-
into 'api', {
58-
p2repo "https://download.eclipse.org/eclipse/updates/$SWT_TO_USE/"
59-
install "org.eclipse.swt.$platformCode"
60-
addFilter 'no-platform-filter', {
61-
it.platform(com.diffplug.common.swt.os.SwtPlatform.parseWsOsArch(platformCode))
62-
}
63-
}
64-
}
6564
dependencies {
6665
api project(':durian-swt')
6766
implementation "com.diffplug.durian:durian-core:$VER_DURIAN"
6867
}
69-
configurations.all {
70-
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
71-
if (details.requested.name.contains('${osgi.platform}')) {
72-
details.useTarget('org.eclipse.platform:org.eclipse.swt:' + details.requested.version)
73-
}
74-
}
75-
}
7668
// the manifest should be a fragment
69+
String platformCode = project.name.substring('durian-swt.'.length())
7770
def swtPlatform = com.diffplug.common.swt.os.SwtPlatform.parseWsOsArch(platformCode)
7871
jar.manifest.attributes (
7972
'Fragment-Host': 'durian-swt',
8073
'Eclipse-PlatformFilter': swtPlatform.platformFilter(),
8174
)
75+
76+
if (VER_SWT_EVOLVE.isEmpty()) {
77+
String SWT_TO_USE = platformCode.endsWith("x86") ? VER_ECLIPSE_PLATFORM_X86 : VER_ECLIPSE_PLATFORM
78+
apply plugin: 'dev.equo.p2deps'
79+
p2deps {
80+
into 'api', {
81+
p2repo "https://download.eclipse.org/eclipse/updates/$SWT_TO_USE/"
82+
install "org.eclipse.swt.$platformCode"
83+
addFilter 'no-platform-filter', {
84+
it.platform(com.diffplug.common.swt.os.SwtPlatform.parseWsOsArch(platformCode))
85+
}
86+
}
87+
}
88+
configurations.all {
89+
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
90+
if (details.requested.name.contains('${osgi.platform}')) {
91+
details.useTarget('org.eclipse.platform:org.eclipse.swt:' + details.requested.version)
92+
}
93+
}
94+
}
95+
} else {
96+
// VER_SWT_EVOLVE version
97+
String equoOs;
98+
if ('win32' == swtPlatform.os) {
99+
equoOs = 'windows'
100+
} else if ('macosx' == swtPlatform.os) {
101+
equoOs = 'macos'
102+
} else if ('linux' == swtPlatform.os) {
103+
equoOs = 'linux'
104+
} else {
105+
throw UnsupportedOperationException("Unknown os in " + swtPlatform)
106+
}
107+
dependencies {
108+
api "dev.equo:swt-evolve:${VER_SWT_EVOLVE}:${equoOs}-${swtPlatform.arch}"
109+
}
110+
}
82111
}
83112
}

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ VER_DURIAN_DEBUG=1.1.0
1818
# SWT Dependencies from P2
1919
VER_ECLIPSE_PLATFORM=4.37
2020

21+
# set to empty for no SWT evolve
22+
VER_SWT_EVOLVE=0.10.0
23+
#VER_SWT_EVOLVE=
24+
2125
# Testing
2226
VER_JUNIT=4.13.2
2327
VER_ASSERTJ=3.27.3

0 commit comments

Comments
 (0)