|
|
|
import org.gradle.internal.jvm.Jvm
|
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id 'com.github.johnrengelman.shadow' version '5.1.0'
|
|
|
|
id 'java'
|
|
|
|
id 'maven-publish'
|
|
|
|
id 'signing'
|
|
|
|
id 'idea'
|
|
|
|
id 'cpp'
|
|
|
|
}
|
|
|
|
|
|
|
|
def signingKey = project.findProperty('signingKeyProp') ?: System.getenv('signingKeyProp') ?: ""
|
|
|
|
def signingPassword = project.findProperty('signingPasswordProp') ?: System.getenv('signingPasswordProp') ?: ""
|
|
|
|
def deployRepoUrl = project.findProperty('deployRepoUrlProp') ?: System.getenv('deployRepoUrlProp') ?: ""
|
|
|
|
def deployRepoUsername = project.findProperty('deployRepoUsernameProp') ?: System.getenv('deployRepoUsernameProp') ?: ""
|
|
|
|
def deployRepoPassword = project.findProperty('deployRepoPasswordProp') ?: System.getenv('deployRepoPasswordProp') ?: ""
|
|
|
|
if (signingKey.isEmpty()) {
|
|
|
|
project.gradle.startParameter.excludedTaskNames.add('signArchives')
|
|
|
|
}
|
|
|
|
|
|
|
|
project.gradle.startParameter.excludedTaskNames.add('jniplatformX86StaticLibrary')
|
|
|
|
project.gradle.startParameter.excludedTaskNames.add('jniplatformX64StaticLibrary')
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
|
|
|
maven {
|
|
|
|
url = 'https://repo.maven.apache.org/maven2'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile 'com.formdev:svgSalamander:1.1.2.1'
|
|
|
|
compile 'net.java.dev.jna:jna:4.1.0'
|
|
|
|
compile 'org.swinglabs:jxlayer:3.0.4'
|
|
|
|
compileOnly 'org.swinglabs:swingx:1.6.1'
|
|
|
|
testCompile 'org.swinglabs:swingx:1.6.1'
|
|
|
|
}
|
|
|
|
|
|
|
|
task sourceJar(type: Jar, dependsOn: classes) {
|
|
|
|
classifier 'sources'
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
|
|
|
|
|
|
|
task packageJavadoc(type: Jar) {
|
|
|
|
classifier 'javadoc'
|
|
|
|
from javadoc
|
|
|
|
}
|
|
|
|
|
|
|
|
javadoc {
|
|
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
|
|
options.addStringOption('-add-exports java.desktop/sun.swing=ALL-UNNAMED ' +
|
|
|
|
'--add-exports java.desktop/sun.awt=ALL-UNNAMED ' +
|
|
|
|
'--add-exports java.desktop/com.sun.java.swing=ALL-UNNAMED ' +
|
|
|
|
'--add-exports java.desktop/sun.awt.shell=ALL-UNNAMED', '-quiet')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
archives jar
|
|
|
|
archives sourceJar
|
|
|
|
archives packageJavadoc
|
|
|
|
}
|
|
|
|
|
|
|
|
signing {
|
|
|
|
def key = signingKey.replaceAll("#", "\n")
|
|
|
|
useInMemoryPgpKeys(key, signingPassword)
|
|
|
|
sign configurations.archives
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenJava(MavenPublication) {
|
|
|
|
customizePom(pom)
|
|
|
|
groupId = 'com.github.weisj'
|
|
|
|
artifactId 'darklaf'
|
|
|
|
version = '1.3.3.4'
|
|
|
|
|
|
|
|
from components.java
|
|
|
|
|
|
|
|
// create the sign pom artifact
|
|
|
|
pom.withXml {
|
|
|
|
def pomFile = file("${project.buildDir}/generated-pom.xml")
|
|
|
|
def projectPom = file("pom.xml")
|
|
|
|
writeTo(pomFile)
|
|
|
|
writeTo(projectPom)
|
|
|
|
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
|
|
|
|
artifact(pomAscFile) {
|
|
|
|
classifier = null
|
|
|
|
extension = 'pom.asc'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
artifact(sourceJar) {
|
|
|
|
classifier = 'sources'
|
|
|
|
}
|
|
|
|
|
|
|
|
// create the signed artifacts
|
|
|
|
project.tasks.signArchives.signatureFiles.each {
|
|
|
|
artifact(it) {
|
|
|
|
def matcher = it.file =~ /-(sources|javadoc)\.jar\.asc$/
|
|
|
|
if (matcher.find()) {
|
|
|
|
classifier = matcher.group(1)
|
|
|
|
} else {
|
|
|
|
classifier = null
|
|
|
|
}
|
|
|
|
extension = 'jar.asc'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url = deployRepoUrl
|
|
|
|
credentials {
|
|
|
|
username = deployRepoUsername
|
|
|
|
password = deployRepoPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def customizePom(pom) {
|
|
|
|
pom.withXml {
|
|
|
|
def root = asNode()
|
|
|
|
|
|
|
|
// eliminate test-scoped dependencies (no need in maven central POMs)
|
|
|
|
root.dependencies.removeAll { dep ->
|
|
|
|
dep.scope == "test"
|
|
|
|
}
|
|
|
|
|
|
|
|
// add all items necessary for maven central publication
|
|
|
|
root.children().last() + {
|
|
|
|
resolveStrategy = DELEGATE_FIRST
|
|
|
|
|
|
|
|
description 'A themeable Look and Feel for java swing.'
|
|
|
|
name 'Darklaf'
|
|
|
|
url 'https://github.com/mautini/schemaorg-java'
|
|
|
|
organization {
|
|
|
|
name 'com.github.weisj'
|
|
|
|
url 'https://github.com/weisj'
|
|
|
|
}
|
|
|
|
issueManagement {
|
|
|
|
system 'GitHub'
|
|
|
|
url 'https://github.com/weisJ/darklaf/issues'
|
|
|
|
}
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name 'MIT'
|
|
|
|
url 'https://github.com/weisJ/darklaf/blob/master/licence/LICENSE'
|
|
|
|
distribution 'repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scm {
|
|
|
|
url 'https://github.com/weisJ/darklaf'
|
|
|
|
connection 'scm:git:git://github.com/weisJ/darklaf.git'
|
|
|
|
developerConnection 'scm:git:ssh://git@github.com:weisj/darklaf.git'
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
name 'Jannis Weis'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
model {
|
|
|
|
tasks.generatePomFileForMavenJavaPublication {
|
|
|
|
destination = file("$buildDir/generated-pom.xml")
|
|
|
|
}
|
|
|
|
tasks.publishMavenJavaPublicationToMavenLocal {
|
|
|
|
dependsOn project.tasks.signArchives
|
|
|
|
}
|
|
|
|
tasks.publishMavenJavaPublicationToMavenRepository {
|
|
|
|
dependsOn project.tasks.signArchives
|
|
|
|
}
|
|
|
|
platforms {
|
|
|
|
x86 {
|
|
|
|
architecture 'x86'
|
|
|
|
}
|
|
|
|
x64 {
|
|
|
|
architecture 'x64'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 "dwmapi.lib"
|
|
|
|
linker.args "user32.lib"
|
|
|
|
linker.args "Gdi32.lib"
|
|
|
|
linker.args "-ldwmapi"
|
|
|
|
linker.args "-lGdi32"
|
|
|
|
linker.args "-luser32"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
println "Building on OS: " + System.properties['os.name']
|
|
|
|
println "Using JDK: " + System.properties['java.home']
|
|
|
|
|
|
|
|
compileJava {
|
|
|
|
sourceCompatibility = 8
|
|
|
|
targetCompatibility = 8
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
|
|
dependsOn 'buildLibraries'
|
|
|
|
}
|
|
|
|
configure(options) {
|
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
options.compilerArgs += [
|
|
|
|
'-h', file("${projectDir}/src/jniplatform/cpp"),
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task copyLibraries(type: Copy) {
|
|
|
|
from "${buildDir}/libs/jniplatform/shared"
|
|
|
|
into "${projectDir}/src/main/resources/com/github/weisj/darklaf/platform/windows"
|
|
|
|
include "*/*.dll"
|
|
|
|
}
|
|
|
|
|
|
|
|
task buildLibraries {
|
|
|
|
dependsOn('jniplatformX64SharedLibrary', 'jniplatformX86SharedLibrary')
|
|
|
|
finalizedBy(copyLibraries)
|
|
|
|
}
|
|
|
|
|
|
|
|
task put_files_in_META_INF {
|
|
|
|
def resDir = new File(buildDir, 'generated/files_for_META_INF/')
|
|
|
|
def destDir = new File(resDir, 'META-INF/')
|
|
|
|
java {
|
|
|
|
sourceSets {
|
|
|
|
main.resources {
|
|
|
|
srcDir resDir
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
doLast {
|
|
|
|
destDir.mkdirs()
|
|
|
|
copy {
|
|
|
|
from 'licenses'
|
|
|
|
into destDir
|
|
|
|
}
|
|
|
|
copy {
|
|
|
|
from 'LICENSE'
|
|
|
|
into destDir
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
dependsOn('put_files_in_META_INF')
|
|
|
|
}
|
|
|
|
|
|
|
|
shadowJar {
|
|
|
|
exclude 'help/'
|
|
|
|
exclude 'icons/'
|
|
|
|
exclude 'org/jdesktop/jxlayer/plaf/ext/images/'
|
|
|
|
exclude 'com/sun/jna/darwin/'
|
|
|
|
exclude 'com/sun/jna/freebsd-x86/'
|
|
|
|
exclude 'com/sun/jna/freebsd-x86-64/'
|
|
|
|
exclude 'com/sun/jna/linux-arm/'
|
|
|
|
exclude 'com/sun/jna/linux-x86/'
|
|
|
|
exclude 'com/sun/jna/linux-x86-64/'
|
|
|
|
exclude 'com/sun/jna/openbsd-x86/'
|
|
|
|
exclude 'com/sun/jna/openbsd-x86-64/'
|
|
|
|
exclude 'com/sun/jna/sunos-sparc/'
|
|
|
|
exclude 'com/sun/jna/sunos-sparcv9/'
|
|
|
|
exclude 'com/sun/jna/sunos-x86/'
|
|
|
|
exclude 'com/sun/jna/sunos-x86-64/'
|
|
|
|
}
|