resolve jna from maven repo

This commit is contained in:
Anton Keks 2021-01-25 22:03:43 +02:00
parent b32ea12857
commit e87d409424
3 changed files with 22 additions and 18 deletions

View File

@ -38,16 +38,15 @@ repositories {
}
configurations {
linux64
win32
win64
mac
any
jna
any
linux64
win32.extendsFrom(jna)
win64.extendsFrom(jna)
mac
// compile and test with current platform's SWT and JNA
compileOnly.extendsFrom(getAt(platform))
compileOnly.extendsFrom(jna)
compileOnly.extendsFrom(getAt(platform), jna)
testImplementation.extendsFrom(compileOnly)
runtimeClasspath.extendsFrom(compileOnly)
all*.exclude module: 'org.eclipse.swt' // transitive dependency in Maven that fails
@ -59,8 +58,7 @@ dependencies {
win64 "org.eclipse.platform:org.eclipse.swt.win32.win32.x86_64:${swtVersion}"
win32 "org.eclipse.platform:org.eclipse.swt.win32.win32.x86:3.108.0"
mac "org.eclipse.platform:org.eclipse.swt.cocoa.macosx.x86_64:${swtVersion}"
jna files('lib/jna.jar')
jna "net.java.dev.jna:jna:5.6.0"
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.23.0'
}
@ -75,7 +73,7 @@ test {
}
}
def packageTask(String platform, def moreJars = [], def moreLibs = [], Closure doMore) {
def packageTask(String platform, def moreLibs = [], Closure doMore) {
return tasks.create(platform, Jar) {
dependsOn = ['classes']
manifest {
@ -90,8 +88,9 @@ def packageTask(String platform, def moreJars = [], def moreLibs = [], Closure d
}
baseName = project.name + '-' + platform
from {
(configurations.compile + configurations[platform] + files(moreJars))
.collect { it.isDirectory() ? it : zipTree(it) } + moreLibs
(configurations.compile + configurations[platform]).collect {
it.isDirectory() ? it : zipTree(it)
} + moreLibs
}
exclude(
'images/**/*.svg',
@ -102,18 +101,23 @@ def packageTask(String platform, def moreJars = [], def moreLibs = [], Closure d
'about.html',
'fragment.properties',
'chrome.manifest',
// GTK stuff
// Linux/GTK
'libswt-awt-gtk-*.so',
'libswt-glx-gtk-*.so',
'libswt-webkit-gtk-*.so',
'webkitextensions*/*',
// Win32 stuff
// Win32
'swt-awt-*.dll',
'swt-wgl-*.dll',
'swt-gdip-*.dll',
'swt-webkit-*.dll',
// Mac stuff
// Mac
'libswt-awt-*.jnilib',
// JNA
'com/sun/jna/*/*.a',
'com/sun/jna/*/*.so',
'com/sun/jna/*/*.jnilib',
"com/sun/jna/win32-${platform == 'win32' ? 'x86-64' : platform == 'win64' ? 'x86' : '*'}/*.dll"
)
with jar
@ -210,7 +214,7 @@ def rpm(def platform, def arch) {
ant.delete(dir: dist)
}
packageTask('linux64', [], 'ext/rocksaw/lib/linux64/librocksaw.so') {
packageTask('linux64', 'ext/rocksaw/lib/linux64/librocksaw.so') {
deb('linux64', 'amd64')
rpm('linux64', 'x86_64')
}
@ -219,11 +223,11 @@ packageTask('any') {
deb('any', 'all', 'libswt-gtk-4-java, libswt-cairo-gtk-4-jni,')
}
packageTask('win32', 'lib/jna-win32.jar', 'ext/rocksaw/lib/rocksaw.dll') {
packageTask('win32', 'ext/rocksaw/lib/rocksaw.dll') {
winLauncher('win32')
}
packageTask('win64', 'lib/jna-win64.jar') {
packageTask('win64') {
winLauncher('win64')
}

Binary file not shown.

Binary file not shown.