import org.gradle.internal.jvm.Jvm plugins { id 'com.github.johnrengelman.shadow' version '5.1.0' id 'java' id 'maven-publish' id 'idea' id 'cpp' } repositories { mavenLocal() mavenCentral() maven { url = 'http://repo.maven.apache.org/maven2' } } dependencies { compile 'darcula:darcula.laf:1.0.0' compile 'com.metsci.ext.com.kitfox.svg:svg-salamander:[0.1.19,)' compile 'org.jetbrains:annotations:16.0.1' compile 'net.java.dev.jna:jna:4.1.0' compileOnly 'org.swinglabs:swingx:1.6.1' testCompile 'org.swinglabs:swingx:1.6.1' testCompile 'junit:junit:4.12' } group = 'com.weis' version = '1.0-SNAPSHOT' println "Building on OS: " + System.properties['os.name'] println "Using JDK: " + System.properties['java.home'] model { platforms { x86 { architecture 'x86' } x64 { architecture 'x86_64' } } } compileJava { sourceCompatibility = 11 targetCompatibility = 11 } model { components { jniplatform(NativeLibrarySpec) { targetPlatform "x86" targetPlatform "x64" binaries.all { cppCompiler.args "-I${Jvm.current().javaHome}/include" cppCompiler.args "-I${Jvm.current().javaHome}/include/win32" cppCompiler.args "-std=c++11" linker.args "-ldwmapi" linker.args "-lGdi32" } } } } publishing { publications { maven(MavenPublication) { from(components.java) } } } tasks.withType(JavaCompile) { dependsOn 'copyLibraries' configure(options) { options.encoding = 'UTF-8' options.compilerArgs += [ '-h', file("${projectDir}/src/jniplatform/cpp"), ] options.compilerArgs += [ '--add-exports=java.desktop/sun.awt=ALL-UNNAMED', '--add-exports=java.desktop/com.sun.java.swing=ALL-UNNAMED', '--add-exports=java.desktop/sun.swing=ALL-UNNAMED' ] } } task copyLibraries(type: Copy) { dependsOn('jniplatformX64SharedLibrary', 'jniplatformX86SharedLibrary') from "${buildDir}/libs/jniplatform/shared" into "${projectDir}/src/main/resources/library" } shadowJar { exclude 'help/' exclude 'icons/' minimize() }