Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 49 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,19 @@ group = 'com.diffplug.durian'
spotlessChangelog {
changelogFile 'CHANGES.md'
}
repositories { mavenCentral() }

allprojects {
repositories {
mavenCentral()
if (!VER_SWT_EVOLVE.isEmpty()) {
maven {
url = 'https://gitlab.com/api/v4/projects/72079350/packages/maven'
content {
includeGroup 'dev.equo'
}
}
}
}
apply from: 干.file('base/changelog.gradle')
}
apply from: 干.file('spotless/freshmark.gradle')
Expand Down Expand Up @@ -50,34 +61,52 @@ subprojects { subProject ->
main = 'com.diffplug.common.swt.os.OS'
}
} else {
String platformCode = project.name.substring('durian-swt.'.length())
String SWT_TO_USE = platformCode.endsWith("x86") ? VER_ECLIPSE_PLATFORM_X86 : VER_ECLIPSE_PLATFORM
apply plugin: 'dev.equo.p2deps'
p2deps {
into 'api', {
p2repo "https://download.eclipse.org/eclipse/updates/$SWT_TO_USE/"
install "org.eclipse.swt.$platformCode"
addFilter 'no-platform-filter', {
it.platform(com.diffplug.common.swt.os.SwtPlatform.parseWsOsArch(platformCode))
}
}
}
dependencies {
api project(':durian-swt')
implementation "com.diffplug.durian:durian-core:$VER_DURIAN"
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name.contains('${osgi.platform}')) {
details.useTarget('org.eclipse.platform:org.eclipse.swt:' + details.requested.version)
}
}
}
// the manifest should be a fragment
String platformCode = project.name.substring('durian-swt.'.length())
def swtPlatform = com.diffplug.common.swt.os.SwtPlatform.parseWsOsArch(platformCode)
jar.manifest.attributes (
'Fragment-Host': 'durian-swt',
'Eclipse-PlatformFilter': swtPlatform.platformFilter(),
)

if (VER_SWT_EVOLVE.isEmpty()) {
String SWT_TO_USE = platformCode.endsWith("x86") ? VER_ECLIPSE_PLATFORM_X86 : VER_ECLIPSE_PLATFORM
apply plugin: 'dev.equo.p2deps'
p2deps {
into 'api', {
p2repo "https://download.eclipse.org/eclipse/updates/$SWT_TO_USE/"
install "org.eclipse.swt.$platformCode"
addFilter 'no-platform-filter', {
it.platform(com.diffplug.common.swt.os.SwtPlatform.parseWsOsArch(platformCode))
}
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.name.contains('${osgi.platform}')) {
details.useTarget('org.eclipse.platform:org.eclipse.swt:' + details.requested.version)
}
}
}
} else {
// VER_SWT_EVOLVE version
String equoOs;
if ('win32' == swtPlatform.os) {
equoOs = 'windows'
} else if ('macosx' == swtPlatform.os) {
equoOs = 'macos'
} else if ('linux' == swtPlatform.os) {
equoOs = 'linux'
} else {
throw UnsupportedOperationException("Unknown os in " + swtPlatform)
}
dependencies {
api "dev.equo:swt-evolve:${VER_SWT_EVOLVE}:${equoOs}-${swtPlatform.arch}"
}
}
}
}
34 changes: 27 additions & 7 deletions durian-swt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,34 @@ p2deps {
it.platformNone()
}
}
into 'compileOnly', {
p2repo "https://download.eclipse.org/eclipse/updates/$VER_ECLIPSE_PLATFORM/"
install 'org.eclipse.swt'
if (VER_SWT_EVOLVE.isEmpty()) {
into 'compileOnly', {
p2repo "https://download.eclipse.org/eclipse/updates/$VER_ECLIPSE_PLATFORM/"
install 'org.eclipse.swt'
}
into 'testImplementation', {
p2repo "https://download.eclipse.org/eclipse/updates/$VER_ECLIPSE_PLATFORM/"
install 'org.eclipse.swt'
install 'org.eclipse.swt.svg'
}
}
into 'testImplementation', {
p2repo "https://download.eclipse.org/eclipse/updates/$VER_ECLIPSE_PLATFORM/"
install 'org.eclipse.swt'
install 'org.eclipse.swt.svg'
}
if (!VER_SWT_EVOLVE.isEmpty()) {
def swtPlatform = com.diffplug.common.swt.os.SwtPlatform.getRunning()
String equoOs;
if ('win32' == swtPlatform.os) {
equoOs = 'windows'
} else if ('macosx' == swtPlatform.os) {
equoOs = 'macos'
} else if ('linux' == swtPlatform.os) {
equoOs = 'linux'
} else {
throw UnsupportedOperationException("Unknown os in " + swtPlatform)
}
String swtEvolve = "dev.equo:swt-evolve:${VER_SWT_EVOLVE}:${equoOs}-${swtPlatform.arch}"
dependencies {
compileOnly swtEvolve
testImplementation swtEvolve
}
}
dependencies {
Expand Down
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ VER_DURIAN_DEBUG=1.1.0
# SWT Dependencies from P2
VER_ECLIPSE_PLATFORM=4.37

# set to empty for no SWT evolve
VER_SWT_EVOLVE=0.10.0
#VER_SWT_EVOLVE=

# Testing
VER_JUNIT=4.13.2
VER_ASSERTJ=3.27.3
Loading