added SWT example to gradle
This commit is contained in:
parent
b975de46cc
commit
f2aaf153d3
205
build.gradle.kts
205
build.gradle.kts
@ -10,7 +10,7 @@ plugins {
|
|||||||
java
|
java
|
||||||
maven
|
maven
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
kotlin("jvm") version "1.2.40"
|
kotlin("jvm").version("1.2.40")
|
||||||
}
|
}
|
||||||
|
|
||||||
apply {
|
apply {
|
||||||
@ -20,7 +20,6 @@ apply {
|
|||||||
|
|
||||||
kotlin.experimental.coroutines = Coroutines.ENABLE
|
kotlin.experimental.coroutines = Coroutines.ENABLE
|
||||||
|
|
||||||
|
|
||||||
// version = getWPILibVersion() ?: getVersionFromGitTag(fallback = "0.0.0") // fall back to git describe if no WPILib version is set
|
// version = getWPILibVersion() ?: getVersionFromGitTag(fallback = "0.0.0") // fall back to git describe if no WPILib version is set
|
||||||
group = "com.dorkbox"
|
group = "com.dorkbox"
|
||||||
version = "3.13-SNAPSHOT"
|
version = "3.13-SNAPSHOT"
|
||||||
@ -42,6 +41,10 @@ java {
|
|||||||
//// }
|
//// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
// This creates the swtExampleJar configuration usable inside dependencies and allowing us custom libs when building the SWT example jar
|
||||||
|
val swtExampleJar = configurations.create("swtExampleJar")
|
||||||
|
|
||||||
// make working with sourceSets easier
|
// make working with sourceSets easier
|
||||||
val sourceSets = java.sourceSets
|
val sourceSets = java.sourceSets
|
||||||
fun sourceSets(block: SourceSetContainer.() -> Unit) = sourceSets.apply(block)
|
fun sourceSets(block: SourceSetContainer.() -> Unit) = sourceSets.apply(block)
|
||||||
@ -60,8 +63,8 @@ val SourceSetContainer.swingExample: SourceSet get() = maybeCreate("swingExample
|
|||||||
fun SourceSetContainer.swingExample(block: SourceSet.() -> Unit) = swingExample.apply(block)
|
fun SourceSetContainer.swingExample(block: SourceSet.() -> Unit) = swingExample.apply(block)
|
||||||
val org.gradle.api.tasks.SourceSetContainer.javaFxExample: SourceSet get() = maybeCreate("javaFxExample")
|
val org.gradle.api.tasks.SourceSetContainer.javaFxExample: SourceSet get() = maybeCreate("javaFxExample")
|
||||||
fun SourceSetContainer.javaFxExample(block: SourceSet.() -> Unit) = javaFxExample.apply(block)
|
fun SourceSetContainer.javaFxExample(block: SourceSet.() -> Unit) = javaFxExample.apply(block)
|
||||||
//val org.gradle.api.tasks.SourceSetContainer.testSwt: SourceSet get() = maybeCreate("testSwt")
|
val org.gradle.api.tasks.SourceSetContainer.swtExample: SourceSet get() = maybeCreate("swtExample")
|
||||||
//fun SourceSetContainer.testSwt(block: SourceSet.() -> Unit) = testSwt.apply(block)
|
fun SourceSetContainer.swtExample(block: SourceSet.() -> Unit) = swtExample.apply(block)
|
||||||
|
|
||||||
//val SourceSet.kotlin: SourceDirectorySet
|
//val SourceSet.kotlin: SourceDirectorySet
|
||||||
// get() = (this as HasConvention).convention.getPlugin<KotlinSourceSet>().kotlin
|
// get() = (this as HasConvention).convention.getPlugin<KotlinSourceSet>().kotlin
|
||||||
@ -162,6 +165,21 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swtExample {
|
||||||
|
java {
|
||||||
|
sourceDirs = files("test")
|
||||||
|
include(javaFile("dorkbox.TestTray", "dorkbox.TestTraySwt", "dorkbox.CustomSwingUI"))
|
||||||
|
|
||||||
|
srcDir(sourceSets.main.allJava)
|
||||||
|
compileClasspath = sourceSets.main.compileClasspath + files(swtExampleJar)
|
||||||
|
|
||||||
|
resources {
|
||||||
|
sourceDirs = files("test")
|
||||||
|
include("dorkbox/*.png")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -200,6 +218,7 @@ dependencies {
|
|||||||
compile(group = "org.slf4j", name = "slf4j-api", version = "1.7.25")
|
compile(group = "org.slf4j", name = "slf4j-api", version = "1.7.25")
|
||||||
|
|
||||||
testCompileOnly(group = "org.eclipse.swt", name = "org.eclipse.swt.gtk.linux.x86_64", version = "4.3")
|
testCompileOnly(group = "org.eclipse.swt", name = "org.eclipse.swt.gtk.linux.x86_64", version = "4.3")
|
||||||
|
swtExampleJar(group = "org.eclipse.swt", name = "org.eclipse.swt.gtk.linux.x86_64", version = "4.3")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
tasks.withType<JavaCompile> {
|
||||||
@ -260,6 +279,31 @@ task<Jar>("_javaFxExampleJar") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task<Jar>("_swtExampleJar") {
|
||||||
|
dependsOn("compileSwtExampleJava")
|
||||||
|
|
||||||
|
baseName = "SwtExample"
|
||||||
|
|
||||||
|
from(sourceSets.swtExample.output.classesDirs)
|
||||||
|
from(sourceSets.swtExample.output.resourcesDir)
|
||||||
|
|
||||||
|
// makes it a fat-jar, we filter out the "Utilities" project (because we manually
|
||||||
|
// This line of code recursively collects and copies all of a project's files and adds them to the JAR itself.
|
||||||
|
// One can extend this task, to skip certain files or particular types at will
|
||||||
|
from(configurations.runtime
|
||||||
|
.filter({ it.nameWithoutExtension != "Utilities" })
|
||||||
|
.map({ if (it.isDirectory) it else zipTree(it) }))
|
||||||
|
with(tasks["jar"] as CopySpec)
|
||||||
|
|
||||||
|
from(swtExampleJar.map({ if (it.isDirectory) it else zipTree(it) }))
|
||||||
|
with(tasks["jar"] as CopySpec)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes["Main-Class"] = "dorkbox.TestTraySwt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -274,35 +318,6 @@ task<Jar>("_javaFxExampleJar") {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//task<JavaCompile>("Java") {
|
|
||||||
// source = sourceSets.main.allSource
|
|
||||||
// classpath = sourceSets.main.compileClasspath
|
|
||||||
// destinationDir = sourceSets.main.java.outputDir
|
|
||||||
//}
|
|
||||||
|
|
||||||
//
|
|
||||||
//project(":Swing") {
|
|
||||||
// sourceSets {
|
|
||||||
// main {
|
|
||||||
// java {
|
|
||||||
// sourceDirs = files("test")
|
|
||||||
// include(javaFile("dorkbox.TestTray", "dorkbox.CustomSwingUI"))
|
|
||||||
//
|
|
||||||
//// java.srcDir(sourceSets.main.java)
|
|
||||||
//// java.srcDir(sourceSets.utilities.java)
|
|
||||||
//
|
|
||||||
// resources {
|
|
||||||
// sourceDirs = files("test")
|
|
||||||
// include("dorkbox/*.png")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// dependencies {
|
|
||||||
//// compile(project (":"))
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
// val compileKotlin: KotlinCompile by tasks
|
// val compileKotlin: KotlinCompile by tasks
|
||||||
// compileKotlin.kotlinOptions.jvmTarget = "1.8"
|
// compileKotlin.kotlinOptions.jvmTarget = "1.8"
|
||||||
@ -334,119 +349,37 @@ Tasks and publishing
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//task<JavaCompile>("compileTestJavafx") {
|
|
||||||
// dependsOn("compileJava")
|
|
||||||
//
|
//
|
||||||
// source = sourceSets.testJavafx.allSource
|
//tasks {
|
||||||
// classpath = sourceSets.main.compileClasspath
|
// // Disable publication on root project
|
||||||
// destinationDir = sourceSets.testJavafx.java.outputDir
|
// "artifactoryPublish"(ArtifactoryTask::class) {
|
||||||
|
// skip = true
|
||||||
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//
|
//artifactory {
|
||||||
//task<Jar>("_testSwingJar") {
|
// setContextUrl("https://repo.gradle.org/gradle")
|
||||||
// dependsOn(task<JavaCompile>("compileTestSwing") {
|
// publish(delegateClosureOf<PublisherConfig> {
|
||||||
//// dependsOn("compileJava")
|
// repository(delegateClosureOf<GroovyObject> {
|
||||||
//
|
// val targetRepoKey = "libs-${buildTagFor(project.version as String)}s-local"
|
||||||
// sourceCompatibility = "1.7"
|
// setProperty("repoKey", targetRepoKey)
|
||||||
// targetCompatibility = "1.7"
|
// setProperty("username", project.findProperty("artifactory_user") ?: "nouser")
|
||||||
//
|
// setProperty("password", project.findProperty("artifactory_password") ?: "nopass")
|
||||||
// source = sourceSets.testSwing.allJava
|
// setProperty("maven", true)
|
||||||
// classpath = sourceSets.main.compileClasspath
|
// })
|
||||||
// destinationDir = sourceSets.testSwing.java.outputDir
|
// defaults(delegateClosureOf<GroovyObject> {
|
||||||
|
// invokeMethod("publications", "mavenJava")
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// resolve(delegateClosureOf<ResolverConfig> {
|
||||||
|
// setProperty("repoKey", "repo")
|
||||||
// })
|
// })
|
||||||
//
|
|
||||||
// baseName = "testSwing"
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// println("source")
|
|
||||||
// sourceSets.main.compileClasspath.forEach({ it: File? -> println(" " + it) })
|
|
||||||
// from(sourceSets.testSwing.output.classesDirs)
|
|
||||||
//
|
|
||||||
// // makes it a fat-jar
|
|
||||||
// // This line of code recursively collects and copies all of a project's files and adds them to the JAR itself.
|
|
||||||
// // One can extend this task, to skip certain files or particular types at will
|
|
||||||
// // specifically, we filter out the "Utilities" project
|
|
||||||
//// from(configurations.runtime
|
|
||||||
//// .filter({ it.nameWithoutExtension != "Utilities" })
|
|
||||||
//// .map({ if (it.isDirectory) it else zipTree(it) }))
|
|
||||||
// with(tasks["jar"] as CopySpec)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// manifest {
|
|
||||||
// attributes["Main-Class"] = "dorkbox.TestTray"
|
|
||||||
//}
|
//}
|
||||||
//}
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|
||||||
project(":SwingTest") {
|
|
||||||
sourceSets {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// task<JavaCompile>("compileTestSwt") {
|
|
||||||
// dependsOn("compileJava")
|
|
||||||
//
|
|
||||||
// source = sourceSets.testSwt.allSource
|
|
||||||
// classpath = sourceSets.main.compileClasspath
|
|
||||||
// destinationDir = sourceSets.testSwt.java.outputDir
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
|
||||||
// task<Jar>("testJavaFXJar") {
|
|
||||||
// dependsOn("compileTestJavaFX")
|
|
||||||
//
|
|
||||||
// baseName = "testJavaFx"
|
|
||||||
//
|
|
||||||
// from(sourceSets.testJavaFX.resources)
|
|
||||||
//
|
|
||||||
// // makes it a fat-jar
|
|
||||||
// // This line of code recursively collects and copies all of a project's files and adds them to the JAR itself.
|
|
||||||
// // One can extend this task, to skip certain files or particular types at will
|
|
||||||
// // specifically, we filter out the "Utilities" project
|
|
||||||
// from(configurations.runtime.filter({ it.nameWithoutExtension != "Utilities" }).map({ if (it.isDirectory) it else zipTree(it) }))
|
|
||||||
// with(tasks["jar"] as CopySpec)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// manifest {
|
|
||||||
// attributes["Main-Class"] = "dorkbox.TestTrayJavaFX"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// task<Jar>("testSwtJar") {
|
|
||||||
// dependsOn("compileTestSwt")
|
|
||||||
//
|
|
||||||
// baseName = "testSwt"
|
|
||||||
//
|
|
||||||
// from(sourceSets.testSwt.resources)
|
|
||||||
//
|
|
||||||
// // makes it a fat-jar
|
|
||||||
// // This line of code recursively collects and copies all of a project's files and adds them to the JAR itself.
|
|
||||||
// // One can extend this task, to skip certain files or particular types at will
|
|
||||||
// // specifically, we filter out the "Utilities" project
|
|
||||||
// from(configurations.runtime.filter({ it.nameWithoutExtension != "Utilities" }).map({ if (it.isDirectory) it else zipTree(it) }))
|
|
||||||
// with(tasks["jar"] as CopySpec)
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// manifest {
|
|
||||||
// attributes["Main-Class"] = "dorkbox.TestTraySwt"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user