mirror of https://github.com/weisJ/darklaf.git
Vladimir Sitnikov
5 years ago
35 changed files with 636 additions and 986 deletions
@ -0,0 +1,29 @@ |
|||||||
|
root = true |
||||||
|
|
||||||
|
[*] |
||||||
|
trim_trailing_whitespace = true |
||||||
|
insert_final_newline = true |
||||||
|
charset = utf-8 |
||||||
|
indent_style = space |
||||||
|
|
||||||
|
[*.md] |
||||||
|
indent_size = 4 |
||||||
|
trim_trailing_whitespace = false |
||||||
|
|
||||||
|
[{*.sh,gradlew}] |
||||||
|
end_of_line = lf |
||||||
|
|
||||||
|
[{*.bat,*.cmd}] |
||||||
|
end_of_line = crlf |
||||||
|
|
||||||
|
[{*.kts,*.kt}] |
||||||
|
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL |
||||||
|
ij_kotlin_name_count_to_use_star_import = 999 |
||||||
|
ij_kotlin_name_count_to_use_star_import_for_members = 999 |
||||||
|
|
||||||
|
[*.java] |
||||||
|
# Doc: https://youtrack.jetbrains.com/issue/IDEA-170643#focus=streamItem-27-3708697.0-0 |
||||||
|
#"static ", "java.", "org.javacc.", "" |
||||||
|
#ij_java_imports_layout = $*,|,java.**,|,org.javacc.**,|,* |
||||||
|
#ij_java_use_single_class_imports = true |
||||||
|
indent_size = 4 |
@ -1,273 +0,0 @@ |
|||||||
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') ?: "") as String |
|
||||||
def signingPassword = (project.findProperty('signingPasswordProp') |
|
||||||
?: System.getenv('signingPasswordProp') ?: "") as String |
|
||||||
def deployRepoUrl = (project.findProperty('deployRepoUrlProp') |
|
||||||
?: System.getenv('deployRepoUrlProp') ?: "") as String |
|
||||||
def deployRepoUsername =( project.findProperty('deployRepoUsernameProp') |
|
||||||
?: System.getenv('deployRepoUsernameProp') ?: "") as String |
|
||||||
def deployRepoPassword = (project.findProperty('deployRepoPasswordProp') |
|
||||||
?: System.getenv('deployRepoPasswordProp') ?: "") as String |
|
||||||
if (signingKey.isEmpty()) { |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('signArchives') |
|
||||||
} |
|
||||||
|
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformX86StaticLibrary') |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformX64StaticLibrary') |
|
||||||
if (!Os.is(Os.FAMILY_WINDOWS)) { |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformX86SharedLibrary') |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformX64SharedLibrary') |
|
||||||
} |
|
||||||
|
|
||||||
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) |
|
||||||
} |
|
||||||
|
|
||||||
tasks.withType(Jar) { |
|
||||||
from(project.projectDir) { |
|
||||||
include("LICENSE") |
|
||||||
into("META-INF/license") |
|
||||||
} |
|
||||||
from("${project.projectDir}/licenses") { |
|
||||||
include("*") |
|
||||||
into("META-INF/license") |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
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/' |
|
||||||
} |
|
@ -0,0 +1,294 @@ |
|||||||
|
import com.github.vlsi.gradle.crlf.CrLfSpec |
||||||
|
import com.github.vlsi.gradle.crlf.LineEndings |
||||||
|
import com.github.vlsi.gradle.properties.dsl.props |
||||||
|
|
||||||
|
plugins { |
||||||
|
`java-library` |
||||||
|
id("com.github.johnrengelman.shadow") |
||||||
|
id("com.github.vlsi.crlf") |
||||||
|
id("com.github.vlsi.gradle-extensions") |
||||||
|
id("com.github.vlsi.stage-vote-release") |
||||||
|
} |
||||||
|
|
||||||
|
val skipJavadoc by props() |
||||||
|
val enableMavenLocal by props() |
||||||
|
val enableGradleMetadata by props() |
||||||
|
|
||||||
|
val String.v: String get() = rootProject.extra["$this.version"] as String |
||||||
|
|
||||||
|
val buildVersion = "darklaf".v + releaseParams.snapshotSuffix |
||||||
|
println("Building Darklaf $buildVersion") |
||||||
|
println(" JDK: " + System.getProperty("java.home")) |
||||||
|
|
||||||
|
releaseParams { |
||||||
|
tlp.set("darklaf") |
||||||
|
organizationName.set("weisJ") |
||||||
|
componentName.set("darklaf") |
||||||
|
prefixForProperties.set("gh") |
||||||
|
svnDistEnabled.set(false) |
||||||
|
sitePreviewEnabled.set(false) |
||||||
|
nexus { |
||||||
|
mavenCentral() |
||||||
|
} |
||||||
|
voteText.set { |
||||||
|
""" |
||||||
|
${it.componentName} v${it.version}-rc${it.rc} is ready for preview. |
||||||
|
|
||||||
|
Git SHA: ${it.gitSha} |
||||||
|
Staging repository: ${it.nexusRepositoryUri} |
||||||
|
""".trimIndent() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
allprojects { |
||||||
|
group = "com.github.weisj" |
||||||
|
version = buildVersion |
||||||
|
|
||||||
|
repositories { |
||||||
|
if (enableMavenLocal) { |
||||||
|
mavenLocal() |
||||||
|
} |
||||||
|
mavenCentral() |
||||||
|
} |
||||||
|
|
||||||
|
tasks.withType<AbstractArchiveTask>().configureEach { |
||||||
|
// Ensure builds are reproducible |
||||||
|
isPreserveFileTimestamps = false |
||||||
|
isReproducibleFileOrder = true |
||||||
|
dirMode = "775".toInt(8) |
||||||
|
fileMode = "664".toInt(8) |
||||||
|
} |
||||||
|
|
||||||
|
plugins.withType<JavaLibraryPlugin> { |
||||||
|
dependencies { |
||||||
|
// cpp-library is not compatible with java-library |
||||||
|
// they both use api and implementation configurations |
||||||
|
val bom = platform(project(":darklaf-dependencies-bom")) |
||||||
|
if (!plugins.hasPlugin("cpp-library")) { |
||||||
|
api(bom) |
||||||
|
} else { |
||||||
|
// cpp-library does not know these configurations, so they are for Java |
||||||
|
compileOnly(bom) |
||||||
|
runtimeOnly(bom) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
plugins.withId("cpp-library") { |
||||||
|
tasks.withType<PublishToMavenRepository>() |
||||||
|
.matching { |
||||||
|
it.name.startsWith("publishMain") || |
||||||
|
it.name.startsWith("signMain") || |
||||||
|
it.name.startsWith("generatePomFileForMain") || |
||||||
|
it.name.startsWith("generateMetadataFileForMain") |
||||||
|
} |
||||||
|
.configureEach { |
||||||
|
// We don't need to publish CPP artifacts (e.g. header files) |
||||||
|
enabled = false |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!enableGradleMetadata) { |
||||||
|
tasks.withType<GenerateModuleMetadata> { |
||||||
|
enabled = false |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
plugins.withType<JavaPlugin> { |
||||||
|
configure<JavaPluginExtension> { |
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8 |
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8 |
||||||
|
withSourcesJar() |
||||||
|
if (!skipJavadoc) { |
||||||
|
withJavadocJar() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
apply(plugin = "maven-publish") |
||||||
|
|
||||||
|
tasks { |
||||||
|
withType<JavaCompile>().configureEach { |
||||||
|
options.encoding = "UTF-8" |
||||||
|
} |
||||||
|
|
||||||
|
withType<Jar>().configureEach { |
||||||
|
manifest { |
||||||
|
attributes["Bundle-License"] = "MIT" |
||||||
|
attributes["Implementation-Title"] = project.name |
||||||
|
attributes["Implementation-Version"] = project.version |
||||||
|
attributes["Specification-Vendor"] = "Darklaf" |
||||||
|
attributes["Specification-Version"] = project.version |
||||||
|
attributes["Specification-Title"] = "Darklaf" |
||||||
|
attributes["Implementation-Vendor"] = "Darklaf" |
||||||
|
attributes["Implementation-Vendor-Id"] = "com.github.weisj" |
||||||
|
} |
||||||
|
|
||||||
|
CrLfSpec(LineEndings.LF).run { |
||||||
|
into("META-INF") { |
||||||
|
filteringCharset = "UTF-8" |
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
||||||
|
// This includes either project-specific license or a default one |
||||||
|
if (file("$projectDir/LICENSE").exists()) { |
||||||
|
textFrom("$projectDir/LICENSE") |
||||||
|
} else { |
||||||
|
textFrom("$rootDir/LICENSE") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
withType<Javadoc>().configureEach { |
||||||
|
(options as StandardJavadocDocletOptions).apply { |
||||||
|
// -add-exports requires target 9 |
||||||
|
// The library is built with target=1.8, so add-exports |
||||||
|
if (project.the<JavaPluginExtension>().targetCompatibility.isJava9Compatible) { |
||||||
|
addStringOption("-add-exports", "java.desktop/sun.swing=ALL-UNNAMED") |
||||||
|
addStringOption("-add-exports", "java.desktop/sun.awt=ALL-UNNAMED") |
||||||
|
addStringOption("-add-exports", "java.desktop/com.sun.java.swing=ALL-UNNAMED") |
||||||
|
addStringOption("-add-exports", "java.desktop/sun.awt.shell=ALL-UNNAMED") |
||||||
|
} |
||||||
|
quiet() |
||||||
|
locale = "en" |
||||||
|
docEncoding = "UTF-8" |
||||||
|
charSet = "UTF-8" |
||||||
|
encoding = "UTF-8" |
||||||
|
docTitle = "Darklaf ${project.name} API" |
||||||
|
windowTitle = "Darklaf ${project.name} API" |
||||||
|
header = "<b>Darklaf</b>" |
||||||
|
addBooleanOption("Xdoclint:none", true) |
||||||
|
addStringOption("source", "8") |
||||||
|
if (JavaVersion.current().isJava9Compatible) { |
||||||
|
addBooleanOption("html5", true) |
||||||
|
links("https://docs.oracle.com/javase/9/docs/api/") |
||||||
|
} else { |
||||||
|
links("https://docs.oracle.com/javase/8/docs/api/") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
configure<PublishingExtension> { |
||||||
|
if (project.path.startsWith(":darklaf-dependencies-bom")) { |
||||||
|
// We don't it to Central for now |
||||||
|
return@configure |
||||||
|
} |
||||||
|
|
||||||
|
publications { |
||||||
|
create<MavenPublication>(project.name) { |
||||||
|
artifactId = project.name |
||||||
|
version = rootProject.version.toString() |
||||||
|
description = project.description |
||||||
|
from(project.components.get("java")) |
||||||
|
} |
||||||
|
withType<MavenPublication> { |
||||||
|
// Use the resolved versions in pom.xml |
||||||
|
// Gradle might have different resolution rules, so we set the versions |
||||||
|
// that were used in Gradle build/test. |
||||||
|
versionMapping { |
||||||
|
usage(Usage.JAVA_RUNTIME) { |
||||||
|
fromResolutionResult() |
||||||
|
} |
||||||
|
usage(Usage.JAVA_API) { |
||||||
|
fromResolutionOf("runtimeClasspath") |
||||||
|
} |
||||||
|
} |
||||||
|
pom { |
||||||
|
withXml { |
||||||
|
val sb = asString() |
||||||
|
var s = sb.toString() |
||||||
|
// <scope>compile</scope> is Maven default, so delete it |
||||||
|
s = s.replace("<scope>compile</scope>", "") |
||||||
|
// Cut <dependencyManagement> because all dependencies have the resolved versions |
||||||
|
s = s.replace( |
||||||
|
Regex( |
||||||
|
"<dependencyManagement>.*?</dependencyManagement>", |
||||||
|
RegexOption.DOT_MATCHES_ALL |
||||||
|
), |
||||||
|
"" |
||||||
|
) |
||||||
|
sb.setLength(0) |
||||||
|
sb.append(s) |
||||||
|
// Re-format the XML |
||||||
|
asNode() |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
description.set( |
||||||
|
project.description |
||||||
|
?: "A themeable Look and Feel for java swing" |
||||||
|
) |
||||||
|
name.set( |
||||||
|
(project.findProperty("artifact.name") as? String) |
||||||
|
?: project.name.capitalize().replace("-", " ") |
||||||
|
) |
||||||
|
url.set("https://github.com/weisJ/darklaf") |
||||||
|
organization { |
||||||
|
name.set("com.github.weisj") |
||||||
|
url.set("https://github.com/weisj") |
||||||
|
} |
||||||
|
issueManagement { |
||||||
|
system.set("GitHub") |
||||||
|
url.set("https://github.com/weisJ/darklaf/issues") |
||||||
|
} |
||||||
|
licenses { |
||||||
|
license { |
||||||
|
name.set("MIT") |
||||||
|
url.set("https://github.com/weisJ/darklaf/blob/master/LICENSE") |
||||||
|
distribution.set("repo") |
||||||
|
} |
||||||
|
} |
||||||
|
scm { |
||||||
|
url.set("https://github.com/weisJ/darklaf") |
||||||
|
connection.set("scm:git:git://github.com/weisJ/darklaf.git") |
||||||
|
developerConnection.set("scm:git:ssh://git@github.com:weisj/darklaf.git") |
||||||
|
} |
||||||
|
developers { |
||||||
|
developer { |
||||||
|
name.set("Jannis Weis") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
implementation(project(":darklaf-native-utils")) |
||||||
|
implementation(project(":darklaf-windows")) |
||||||
|
implementation("com.formdev:svgSalamander") |
||||||
|
implementation("net.java.dev.jna:jna") |
||||||
|
implementation("org.swinglabs:jxlayer") |
||||||
|
compileOnly("org.swinglabs:swingx") |
||||||
|
testImplementation("org.swinglabs:swingx") |
||||||
|
} |
||||||
|
|
||||||
|
tasks.jar { |
||||||
|
CrLfSpec(LineEndings.LF).run { |
||||||
|
into("META-INF") { |
||||||
|
filteringCharset = "UTF-8" |
||||||
|
textFrom("licenses/NOTICE.txt") |
||||||
|
textFrom("licenses/PBJAR_LICENSE.txt") |
||||||
|
textFrom("licenses/INTELLIJ_LICENSE.txt") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
tasks.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/") |
||||||
|
} |
@ -0,0 +1,3 @@ |
|||||||
|
# For some reason Gradle requires LF eol for precompiled script plugins |
||||||
|
# Otherwise buildSrc compilation fails on Windows |
||||||
|
/src/main/kotlin/**/*.gradle.kts text eol=lf |
@ -0,0 +1,16 @@ |
|||||||
|
plugins { |
||||||
|
`kotlin-dsl` |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
implementation(kotlin("gradle-plugin")) |
||||||
|
} |
||||||
|
|
||||||
|
repositories { |
||||||
|
mavenCentral() |
||||||
|
gradlePluginPortal() |
||||||
|
} |
||||||
|
|
||||||
|
configure<KotlinDslPluginOptions> { |
||||||
|
experimentalWarning.set(false) |
||||||
|
} |
@ -0,0 +1,86 @@ |
|||||||
|
import org.gradle.internal.jvm.Jvm |
||||||
|
|
||||||
|
plugins { |
||||||
|
`cpp-library` |
||||||
|
`java-library` |
||||||
|
} |
||||||
|
|
||||||
|
// This configuration might be used for adding cpp-only dependencies |
||||||
|
val jniImplementation by configurations.creating |
||||||
|
|
||||||
|
configurations.matching { |
||||||
|
it.name.startsWith("cppCompile") || |
||||||
|
it.name.startsWith("nativeLink") || |
||||||
|
it.name.startsWith("nativeRuntime") |
||||||
|
}.all { |
||||||
|
extendsFrom(jniImplementation) |
||||||
|
} |
||||||
|
|
||||||
|
tasks.compileJava { |
||||||
|
options.headerOutputDirectory.convention( |
||||||
|
project.layout.buildDirectory.dir("generated/jni-headers") |
||||||
|
) |
||||||
|
// The nested output is not marked automatically as an output of the task regarding task dependencies. |
||||||
|
// So we mark it manually here. |
||||||
|
// See https://github.com/gradle/gradle/issues/6619. |
||||||
|
outputs.dir(options.headerOutputDirectory); |
||||||
|
// Cannot do incremental header generation, since the pattern for cleaning them up is currently wrong. |
||||||
|
// See https://github.com/gradle/gradle/issues/12084. |
||||||
|
options.isIncremental = false; |
||||||
|
} |
||||||
|
|
||||||
|
tasks.withType<CppCompile>().configureEach { |
||||||
|
includes(tasks.compileJava.flatMap { it.options.headerOutputDirectory }) |
||||||
|
} |
||||||
|
|
||||||
|
library { |
||||||
|
binaries.configureEach { |
||||||
|
val targetOs = targetMachine.operatingSystemFamily |
||||||
|
compileTask.get().apply { |
||||||
|
val javaHome = Jvm.current().javaHome.canonicalPath |
||||||
|
includes("$javaHome/include") |
||||||
|
includes(when { |
||||||
|
targetOs.isMacOs -> listOf("$javaHome/include/darwin") |
||||||
|
targetOs.isLinux -> listOf("$javaHome/include/linux") |
||||||
|
targetOs.isWindows -> listOf("$javaHome/include/win32") |
||||||
|
else -> emptyList() |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Gradle does not support [Provider] for [JavaForkOptions.systemProperty], so |
||||||
|
* we pass an object that overrides [Any.toString]. |
||||||
|
*/ |
||||||
|
fun Provider<String>.overrideToString() = object { |
||||||
|
override fun toString() = orNull ?: "" |
||||||
|
} |
||||||
|
|
||||||
|
// Gradle populates library.binaries in afterEvaluate, so we can't access it earlier |
||||||
|
afterEvaluate { |
||||||
|
// C++ library is built for Windows only, so we skip it otherwise |
||||||
|
library.developmentBinary.orNull?.let { it as CppSharedLibrary }?.let { developmentBinary -> |
||||||
|
tasks.test { |
||||||
|
dependsOn(developmentBinary.linkTask) |
||||||
|
val libraryDir = developmentBinary.runtimeFile |
||||||
|
.map { it.asFile.parentFile.absolutePath } |
||||||
|
systemProperty("java.library.path", libraryDir.overrideToString()) |
||||||
|
} |
||||||
|
} |
||||||
|
tasks.jar { |
||||||
|
// Publish non-optimized, debuggable binary to simplify analysis in case of crashes |
||||||
|
library.binaries.get() |
||||||
|
.filter { it.isDebuggable && !it.isOptimized } |
||||||
|
.filterIsInstance<CppSharedLibrary>() |
||||||
|
.forEach { binary -> |
||||||
|
dependsOn(binary.linkTask) |
||||||
|
val variantName = binary.targetMachine.let { |
||||||
|
"${it.operatingSystemFamily}-${it.architecture}" |
||||||
|
} |
||||||
|
into("com/github/weisj/darklaf/platform/${project.name}/$variantName") { |
||||||
|
from(binary.runtimeFile) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,267 +0,0 @@ |
|||||||
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') ?: "") as String |
|
||||||
def signingPassword = (project.findProperty('signingPasswordProp') |
|
||||||
?: System.getenv('signingPasswordProp') ?: "") as String |
|
||||||
def deployRepoUrl = (project.findProperty('deployRepoUrlProp') |
|
||||||
?: System.getenv('deployRepoUrlProp') ?: "") as String |
|
||||||
def deployRepoUsername =( project.findProperty('deployRepoUsernameProp') |
|
||||||
?: System.getenv('deployRepoUsernameProp') ?: "") as String |
|
||||||
def deployRepoPassword = (project.findProperty('deployRepoPasswordProp') |
|
||||||
?: System.getenv('deployRepoPasswordProp') ?: "") as String |
|
||||||
if (signingKey.isEmpty()) { |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('signArchives') |
|
||||||
} |
|
||||||
|
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformStaticLibrary') |
|
||||||
if (!Os.is(Os.FAMILY_WINDOWS)) { |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformSharedLibrary') |
|
||||||
} |
|
||||||
|
|
||||||
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 { |
|
||||||
x64 { |
|
||||||
architecture 'x64' |
|
||||||
} |
|
||||||
} |
|
||||||
components { |
|
||||||
jniplatform(NativeLibrarySpec) { |
|
||||||
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/x64" |
|
||||||
include "*.dll" |
|
||||||
} |
|
||||||
|
|
||||||
task buildLibraries { |
|
||||||
dependsOn('jniplatformSharedLibrary') |
|
||||||
finalizedBy(copyLibraries) |
|
||||||
} |
|
||||||
|
|
||||||
tasks.withType(Jar) { |
|
||||||
from(project.projectDir) { |
|
||||||
include("LICENSE") |
|
||||||
into("META-INF/license") |
|
||||||
} |
|
||||||
from("${project.projectDir}/licenses") { |
|
||||||
include("*") |
|
||||||
into("META-INF/license") |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
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/' |
|
||||||
} |
|
@ -1,267 +0,0 @@ |
|||||||
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') ?: "") as String |
|
||||||
def signingPassword = (project.findProperty('signingPasswordProp') |
|
||||||
?: System.getenv('signingPasswordProp') ?: "") as String |
|
||||||
def deployRepoUrl = (project.findProperty('deployRepoUrlProp') |
|
||||||
?: System.getenv('deployRepoUrlProp') ?: "") as String |
|
||||||
def deployRepoUsername =( project.findProperty('deployRepoUsernameProp') |
|
||||||
?: System.getenv('deployRepoUsernameProp') ?: "") as String |
|
||||||
def deployRepoPassword = (project.findProperty('deployRepoPasswordProp') |
|
||||||
?: System.getenv('deployRepoPasswordProp') ?: "") as String |
|
||||||
if (signingKey.isEmpty()) { |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('signArchives') |
|
||||||
} |
|
||||||
|
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformStaticLibrary') |
|
||||||
if (!Os.is(Os.FAMILY_WINDOWS)) { |
|
||||||
project.gradle.startParameter.excludedTaskNames.add('jniplatformSharedLibrary') |
|
||||||
} |
|
||||||
|
|
||||||
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' |
|
||||||
} |
|
||||||
} |
|
||||||
components { |
|
||||||
jniplatform(NativeLibrarySpec) { |
|
||||||
targetPlatform "x86" |
|
||||||
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/x86" |
|
||||||
include "*.dll" |
|
||||||
} |
|
||||||
|
|
||||||
task buildLibraries { |
|
||||||
dependsOn('jniplatformSharedLibrary') |
|
||||||
finalizedBy(copyLibraries) |
|
||||||
} |
|
||||||
|
|
||||||
tasks.withType(Jar) { |
|
||||||
from(project.projectDir) { |
|
||||||
include("LICENSE") |
|
||||||
into("META-INF/license") |
|
||||||
} |
|
||||||
from("${project.projectDir}/licenses") { |
|
||||||
include("*") |
|
||||||
into("META-INF/license") |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
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/' |
|
||||||
} |
|
@ -0,0 +1,37 @@ |
|||||||
|
plugins { |
||||||
|
`java-platform` |
||||||
|
} |
||||||
|
|
||||||
|
val String.v: String get() = rootProject.extra["$this.version"] as String |
||||||
|
|
||||||
|
// Note: Gradle allows to declare dependency on "bom" as "api", |
||||||
|
// and it makes the contraints to be transitively visible |
||||||
|
// However Maven can't express that, so the approach is to use Gradle resolution |
||||||
|
// and generate pom files with resolved versions |
||||||
|
// See https://github.com/gradle/gradle/issues/9866 |
||||||
|
|
||||||
|
fun DependencyConstraintHandlerScope.apiv( |
||||||
|
notation: String, |
||||||
|
versionProp: String = notation.substringAfterLast(':') |
||||||
|
) = |
||||||
|
"api"(notation + ":" + versionProp.v) |
||||||
|
|
||||||
|
fun DependencyConstraintHandlerScope.runtimev( |
||||||
|
notation: String, |
||||||
|
versionProp: String = notation.substringAfterLast(':') |
||||||
|
) = |
||||||
|
"runtime"(notation + ":" + versionProp.v) |
||||||
|
|
||||||
|
dependencies { |
||||||
|
// Parenthesis are needed here: https://github.com/gradle/gradle/issues/9248 |
||||||
|
(constraints) { |
||||||
|
// api means "the dependency is for both compilation and runtime" |
||||||
|
// runtime means "the dependency is only for runtime, not for compilation" |
||||||
|
// In other words, marking dependency as "runtime" would avoid accidental |
||||||
|
// dependency on it during compilation |
||||||
|
apiv("net.java.dev.jna:jna") |
||||||
|
apiv("org.swinglabs:jxlayer") |
||||||
|
apiv("org.swinglabs:swingx") |
||||||
|
apiv("com.formdev:svgSalamander") |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
# Gradle |
||||||
|
org.gradle.parallel=true |
||||||
|
kotlin.code.style=official |
||||||
|
|
||||||
|
# See https://github.com/gradle/gradle/pull/11358 , https://issues.apache.org/jira/browse/INFRA-14923 |
||||||
|
# repository.apache.org does not yet support .sha256 and .sha512 checksums |
||||||
|
systemProp.org.gradle.internal.publish.checksums.insecure=true |
||||||
|
|
||||||
|
# Darklaf version |
||||||
|
darklaf.version=1.3.3.4 |
||||||
|
|
||||||
|
# Plugins |
||||||
|
shadow.version=5.1.0 |
||||||
|
com.github.vlsi.vlsi-release-plugins.version=1.54 |
||||||
|
com.github.johnrengelman.shadow.version=5.1.0 |
||||||
|
|
||||||
|
# Dependencies |
||||||
|
jna.version=4.1.0 |
||||||
|
jxlayer.version=3.0.4 |
||||||
|
swingx.version=1.6.1 |
||||||
|
svgSalamander.version=1.1.2.1 |
Binary file not shown.
@ -1,6 +1,5 @@ |
|||||||
#Tue Oct 01 16:12:24 CEST 2019 |
distributionSha256Sum=10065868c78f1207afb3a92176f99a37d753a513dff453abb6b5cceda4058cda |
||||||
distributionUrl = https\://services.gradle.org/distributions/gradle-5.6.2-all.zip |
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip |
||||||
distributionBase = GRADLE_USER_HOME |
distributionBase=GRADLE_USER_HOME |
||||||
distributionPath = wrapper/dists |
distributionPath=wrapper/dists |
||||||
zipStorePath = wrapper/dists |
zipStorePath=wrapper/dists |
||||||
zipStoreBase = GRADLE_USER_HOME |
|
||||||
|
@ -0,0 +1,21 @@ |
|||||||
|
The MIT License (MIT) |
||||||
|
|
||||||
|
Copyright (c) 2012 Adam Heinrich <adam@adamh.cz> |
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
of this software and associated documentation files (the "Software"), to deal |
||||||
|
in the Software without restriction, including without limitation the rights |
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
copies of the Software, and to permit persons to whom the Software is |
||||||
|
furnished to do so, subject to the following conditions: |
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all |
||||||
|
copies or substantial portions of the Software. |
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
SOFTWARE. |
@ -0,0 +1,12 @@ |
|||||||
|
plugins { |
||||||
|
`java-library` |
||||||
|
} |
||||||
|
|
||||||
|
tasks.jar { |
||||||
|
com.github.vlsi.gradle.crlf.CrLfSpec(com.github.vlsi.gradle.crlf.LineEndings.LF).run { |
||||||
|
into("META-INF") { |
||||||
|
filteringCharset = "UTF-8" |
||||||
|
textFrom("$rootDir/licenses/NATIVEUTIL_LICENSE.txt") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,7 +1,7 @@ |
|||||||
/* |
/* |
||||||
* MIT License |
* MIT License |
||||||
* |
* |
||||||
* Copyright (c) 2020 Jannis Weis |
* Copyright (c) 2012 Adam Heinrich <adam@adamh.cz> |
||||||
* |
* |
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
* of this software and associated documentation files (the "Software"), to deal |
* of this software and associated documentation files (the "Software"), to deal |
@ -0,0 +1,29 @@ |
|||||||
|
pluginManagement { |
||||||
|
plugins { |
||||||
|
fun String.v() = extra["$this.version"].toString() |
||||||
|
fun PluginDependenciesSpec.idv(id: String, key: String = id) = id(id) version key.v() |
||||||
|
|
||||||
|
idv("com.github.johnrengelman.shadow") |
||||||
|
idv("com.github.vlsi.crlf", "com.github.vlsi.vlsi-release-plugins") |
||||||
|
idv("com.github.vlsi.gradle-extensions", "com.github.vlsi.vlsi-release-plugins") |
||||||
|
idv("com.github.vlsi.ide", "com.github.vlsi.vlsi-release-plugins") |
||||||
|
idv("com.github.vlsi.license-gather", "com.github.vlsi.vlsi-release-plugins") |
||||||
|
idv("com.github.vlsi.stage-vote-release", "com.github.vlsi.vlsi-release-plugins") |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
rootProject.name = "darklaf" |
||||||
|
|
||||||
|
include( |
||||||
|
"dependencies-bom", |
||||||
|
"native-utils", |
||||||
|
"windows" |
||||||
|
) |
||||||
|
|
||||||
|
for (p in rootProject.children) { |
||||||
|
if (p.children.isEmpty()) { |
||||||
|
// Rename leaf projects only |
||||||
|
// E.g. we don't expect to publish examples as a Maven module |
||||||
|
p.name = "darklaf-" + p.name |
||||||
|
} |
||||||
|
} |
@ -1,77 +0,0 @@ |
|||||||
/* DO NOT EDIT THIS FILE - it is machine generated */ |
|
||||||
#include <jni.h> |
|
||||||
/* Header for class com_github_weisj_darklaf_platform_windows_JNIDecorations */ |
|
||||||
|
|
||||||
#ifndef _Included_com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
#define _Included_com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: updateValues |
|
||||||
* Signature: (JIII)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_updateValues |
|
||||||
(JNIEnv *, jclass, jlong, jint, jint, jint); |
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: setResizable |
|
||||||
* Signature: (JZ)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_setResizable |
|
||||||
(JNIEnv *, jclass, jlong, jboolean); |
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: setBackground |
|
||||||
* Signature: (JIII)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_setBackground |
|
||||||
(JNIEnv *, jclass, jlong, jint, jint, jint); |
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: minimize |
|
||||||
* Signature: (J)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_minimize |
|
||||||
(JNIEnv *, jclass, jlong); |
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: maximize |
|
||||||
* Signature: (J)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_maximize |
|
||||||
(JNIEnv *, jclass, jlong); |
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: restore |
|
||||||
* Signature: (J)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_restore |
|
||||||
(JNIEnv *, jclass, jlong); |
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: installDecorations |
|
||||||
* Signature: (J)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_installDecorations |
|
||||||
(JNIEnv *, jclass, jlong); |
|
||||||
|
|
||||||
/*
|
|
||||||
* Class: com_github_weisj_darklaf_platform_windows_JNIDecorations |
|
||||||
* Method: uninstallDecorations |
|
||||||
* Signature: (J)V |
|
||||||
*/ |
|
||||||
JNIEXPORT void JNICALL Java_com_github_weisj_darklaf_platform_windows_JNIDecorations_uninstallDecorations |
|
||||||
(JNIEnv *, jclass, jlong); |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} |
|
||||||
#endif |
|
||||||
#endif |
|
@ -0,0 +1,33 @@ |
|||||||
|
plugins { |
||||||
|
`jni-library` |
||||||
|
} |
||||||
|
|
||||||
|
fun DependencyHandlerScope.javaImplementation(dep: Any) { |
||||||
|
compileOnly(dep) |
||||||
|
runtimeOnly(dep) |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
javaImplementation(project(":darklaf-native-utils")) |
||||||
|
javaImplementation("net.java.dev.jna:jna") |
||||||
|
} |
||||||
|
|
||||||
|
library { |
||||||
|
targetMachines.addAll(machines.windows.x86, machines.windows.x86_64) |
||||||
|
binaries.configureEach { |
||||||
|
compileTask.get().compilerArgs.addAll(toolChain.let { |
||||||
|
if (it is Gcc || it is Clang) listOf("--std=c++11") |
||||||
|
else emptyList() |
||||||
|
}) |
||||||
|
} |
||||||
|
binaries.whenElementFinalized(CppSharedLibrary::class) { |
||||||
|
linkTask.get().linkerArgs.addAll( |
||||||
|
"dwmapi.lib", |
||||||
|
"user32.lib", |
||||||
|
"Gdi32.lib", |
||||||
|
"-ldwmapi", |
||||||
|
"-lGdi32", |
||||||
|
"-luser32" |
||||||
|
) |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue