Darklaf - A themeable swing Look and Feel based on Darcula-Laf
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

229 lines
6.4 KiB

import org.gradle.internal.jvm.Jvm
plugins {
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'java'
id 'maven-publish'
id 'signing'
id 'idea'
id 'cpp'
}
repositories {
mavenLocal()
mavenCentral()
maven {
url = 'http://repo.maven.apache.org/maven2'
}
}
dependencies {
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'
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
}
artifacts {
archives jar
archives sourceJar
}
signing {
// def signingKeyId = findProperty("signingKeyId")
// def signingKey = findProperty("signingKey")
// def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign configurations.archives
}
publishing {
publications {
mavenJava(MavenPublication) {
customizePom(pom)
groupId = 'com.github.weisj'
artifactId 'darklaf'
version = '1.3.1.1'
from components.java
// create the sign pom artifact
pom.withXml {
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
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
}
}
println "Building on OS: " + System.properties['os.name']
println "Using JDK: " + System.properties['java.home']
println signingKey
compileJava {
sourceCompatibility = 8
targetCompatibility = 8
}
model {
platforms {
x86 {
architecture 'x86'
}
x64 {
architecture 'x86_64'
}
}
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"
}
}
}
}
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',
// '--add-exports=java.desktop/sun.awt.shell=ALL-UNNAMED'
// ]
}
}
task copyLibraries(type: Copy) {
dependsOn('jniplatformX64SharedLibrary', 'jniplatformX86SharedLibrary')
from "${buildDir}/libs/jniplatform/shared"
into "${projectDir}/src/main/resources/com/github/weisj/darklaf/platform/windows"
}
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/'
minimize()
}