Commit 6730a27c authored by David's avatar David
Browse files

Migrated to latest gradle and build.gradle.kts

parent e5230b30
Pipeline #709 failed with stage
in 10 seconds
openjdk64-11.0.9.1
11.0.9
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.21'
id "io.spring.dependency-management" version "1.0.7.RELEASE" //Bet I don't need this...
id 'com.github.johnrengelman.shadow' version '5.0.0'
id "org.hidetake.ssh" version "2.9.0"
id "application"
id 'org.openjfx.javafxplugin' version '0.0.9'
}
apply plugin: 'org.junit.platform.gradle.plugin'
mainClassName = "is.kow.deskscreen.DeskScreenKt"
javafx {
version = "15.0.1"
modules = [ 'javafx.controls', 'javafx.swing' ]
configuration = "compileOnly"
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
repositories {
mavenCentral()
jcenter()
maven { url "https://dl.bintray.com/jerady/maven" }
maven { url "http://dl.bintray.com/jetbrains/spek" }
maven { url 'https://jitpack.io' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
dependencyManagement {
imports {
mavenBom 'org.apache.logging.log4j:log4j-bom:2.11.0'
}
}
junitPlatform {
filters {
engines {
include 'spek'
}
}
}
shadowJar {
//Needed to make sure ikonli works!
// https://github.com/aalmiray/ikonli/issues/34#issuecomment-410438646
mergeServiceFiles()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8",
"org.jetbrains.kotlin:kotlin-reflect",
"no.tornado:tornadofx:1.7.20",
'io.reactivex.rxjava2:rxkotlin:2.4.0',
"com.github.thomasnield:rxkotlinfx:2.2.2",
'io.github.microutils:kotlin-logging:1.5.4',
"io.reactivex.rxjava2:rxjava:2.2.20", //have to include it explicitly
"org.apache.logging.log4j:log4j-api",
"org.apache.logging.log4j:log4j-core",
"org.apache.logging.log4j:log4j-slf4j-impl",
"io.github.microutils:kotlin-logging:2.0.4",
'io.github.config4k:config4k:0.4.0'
//V4l4j for the raspberry pi, to get video directly from v4l
//Seems to be reasonably effective. OpenCV would be cool, but it's icky.
// The other option is fork out to rpi commands directly
//This requires the bcm2835_v4l2 module to be loaded
// Need to figure out how to get this to build, it's a huge PITA
//implementation 'com.github.sarxos:v4l4j:0.9.1-r507'
implementation 'com.github.Hopding:JRPiCam:1.1.1'
//Going to do much simpler oauth2
//compile 'org.pac4j:pac4j-oauth:3.6.1'
//Some extra java time classes that are potentially useful
implementation 'org.threeten:threeten-extra:1.5.0'
// Fuckin apple stoleDark sky, so that's dead.
// //Gonna use the DarkSky forecast info
// implementation 'tk.plogitech:darksky-forecast-api-jackson:1.3.1',
// 'org.slf4j:jul-to-slf4j:1.7.25'
implementation group: "org.http4k", name: "http4k-client-apache", version: "3.38.1"
implementation group: "org.http4k", name: "http4k-format-jackson", version: "3.38.1"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7"
implementation 'com.jayway.jsonpath:json-path:2.4.0'
//Caching!
implementation 'com.github.ben-manes.caffeine:caffeine:2.6.2'
// //The METARs are XML, so lets get some XML parsing
// implementation 'javax.xml.bind:jaxb-api:2.3.0',
// "com.migesok:jaxb-java-time-adapters:1.1.3", //To handle java 8 time in jaxb
// 'org.glassfish.jaxb:jaxb-runtime:2.3.0.1'
//Using the snapshot version of pi4j, because it's the best
//Maybe I can get away without using the snapshot....
implementation("io.dvlopt:linux-i2c:1.0.0")
//implementation 'com.pi4j:pi4j-core:1.4-SNAPSHOT'
//Pi4j 2 is hella immature, might have to figure out how to write some kind of rust wrapper to export local json or something
//implementation('com.pi4j:pi4j-plugin-raspberrypi:2.0-SNAPSHOT')
//Javafx dependencies
// implementation "org.openjfx:javafx-base:${javaFxVersion}:${platformClassifier}"
// implementation "org.openjfx:javafx-swing:${javaFxVersion}:${platformClassifier}"
// implementation "org.openjfx:javafx-controls:${javaFxVersion}:${platformClassifier}"
//Trying ikonili, because FontawesomeFX is being a pain
//TODO: update this to use a version variable
implementation 'org.kordamp.ikonli:ikonli-javafx:12.2.0'
implementation 'org.kordamp.ikonli:ikonli-fontawesome5-pack:12.2.0'
implementation 'org.kordamp.ikonli:ikonli-weathericons-pack:12.2.0'
// implementation 'com.hierynomus:sshj:0.26.0',
// 'com.jcraft:jzlib:1.1.3'
testImplementation "org.jetbrains.spek:spek-api:1.1.5",
"com.natpryce:hamkrest:1.4.2.2"
testRuntime "org.jetbrains.spek:spek-junit-platform-engine:1.1.5"
}
test {
testLogging {
events "passed", "skipped", "failed"
}
reports {
html.enabled = true
}
}
//Deploy it to the rpi!
remotes {
rpi {
host = deviceIp
user = 'pi'
agent = true
}
}
task deploy {
description "Deploys to the local rPI instance, and restarts it"
dependsOn 'shadowJar'
doLast {
ssh.run {
session(remotes.rpi) {
put from: configurations.shadow.artifacts.files, into: '/opt/deskscreen'
execute 'sudo systemctl restart deskscreen'
}
}
}
}
task runDesktop(type: JavaExec) {
group = "Application"
description = "Run it on the desktop lol"
classpath = sourceSets.main.runtimeClasspath
environment += [
"JIRA_BASEURL": jiraBaseUrl,
"USERNAME": username,
"PASSWORD": password,
"REDDIT_USERNAME": redditUsername,
"REDDIT_PASSWORD": redditPassword,
"REDDIT_CLIENT_ID": redditClientId,
"REDDIT_SECRET": redditSecret
]
//jvmArgs = [""]
main = "is.kow.deskscreen.DesktopScreen"
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("org.jetbrains.kotlin.jvm") version "1.4.21"
id("application")
id("org.openjfx.javafxplugin") version "0.0.9"
id("com.github.johnrengelman.shadow") version "6.1.0"
id("org.hidetake.ssh") version "2.10.1"
}
//Properties
val jiraBaseUrl: String by project
val username: String by project
val password: String by project
val redditUsername: String by project
val redditPassword: String by project
val redditClientId: String by project
val redditSecret: String by project
java {
modularity.inferModulePath.set(true)
}
application {
mainClass.set("is.kow.deskscreen.DeskScreenKt")
//Has to be used for the ShadowJar to work
mainClassName = "is.kow.deskscreen.DeskScreenKt"
}
val javafxModules = listOf("javafx.controls", "javafx.swing")
javafx {
version = "15.0.1"
modules = javafxModules
configuration = "compileOnly"
}
fun org.hidetake.groovy.ssh.core.Service.runSessions(action: org.hidetake.groovy.ssh.core.RunHandler.() -> Unit) =
run(delegateClosureOf(action))
fun org.hidetake.groovy.ssh.core.RunHandler.session(
vararg remotes: org.hidetake.groovy.ssh.core.Remote,
action: org.hidetake.groovy.ssh.session.SessionHandler.() -> Unit
) =
session(*remotes, delegateClosureOf(action))
fun org.hidetake.groovy.ssh.session.SessionHandler.put(from: Any, into: Any) =
put(hashMapOf("from" to from, "into" to into))
repositories {
mavenCentral()
//TODO: need to drop jcenter...
jcenter()
maven { url = uri("https://dl.bintray.com/jerady/maven") }
maven { url = uri("http://dl.bintray.com/jetbrains/spek") }
maven { url = uri("https://jitpack.io") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
// maven { url = uri("") }
}
//TODO: convert to kotest
tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
named<Wrapper>("wrapper") {
distributionType = Wrapper.DistributionType.ALL
}
named<Test>("test") {
}
named<ShadowJar>("shadowJar") {
mergeServiceFiles()
}
}
dependencies {
implementation(platform("org.apache.logging.log4j:log4j-bom:2.11.0"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("no.tornado:tornadofx:1.7.20")
implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
implementation("com.github.thomasnield:rxkotlinfx:2.2.2")
implementation("io.github.microutils:kotlin-logging:1.5.4")
implementation("io.reactivex.rxjava2:rxjava:2.2.20") //have to include it explicitly
implementation("org.apache.logging.log4j:log4j-api")
implementation("org.apache.logging.log4j:log4j-core")
implementation("org.apache.logging.log4j:log4j-slf4j-impl")
implementation("io.github.microutils:kotlin-logging:2.0.4")
implementation("io.github.config4k:config4k:0.4.0")
//V4l4j for the raspberry pi, to get video directly from v4l
//Seems to be reasonably effective. OpenCV would be cool, but it"s icky.
// The other option is fork out to rpi commands directly
//This requires the bcm2835_v4l2 module to be loaded
// Need to figure out how to get this to build, it"s a huge PITA
//implementation "com.github.sarxos:v4l4j:0.9.1-r507"
implementation("com.github.Hopding:JRPiCam:1.1.1")
//Going to do much simpler oauth2
//compile "org.pac4j:pac4j-oauth:3.6.1"
//Some extra java time classes that are potentially useful
implementation("org.threeten:threeten-extra:1.5.0")
// Fuckin apple stoleDark sky, so that's dead.
implementation("org.http4k:http4k-client-apache:3.38.1")
implementation(group = "org.http4k", name = "http4k-format-jackson", version = "3.38.1")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7")
implementation("com.jayway.jsonpath:json-path:2.4.0")
//Caching!
implementation("com.github.ben-manes.caffeine:caffeine:2.6.2")
implementation("io.dvlopt:linux-i2c:1.0.0")
//Trying ikonili, because FontawesomeFX is being a pain
//TODO: update this to use a version variable
implementation("org.kordamp.ikonli:ikonli-javafx:12.2.0")
implementation("org.kordamp.ikonli:ikonli-fontawesome5-pack:12.2.0")
implementation("org.kordamp.ikonli:ikonli-weathericons-pack:12.2.0")
// implementation "com.hierynomus:sshj:0.26.0",
// "com.jcraft:jzlib:1.1.3"
testImplementation("org.jetbrains.spek:spek-api:1.1.5")
testImplementation("com.natpryce:hamkrest:1.4.2.2")
}
val rpi = remotes.create("deskscreen") {
val deviceIp: String by project
host = deviceIp
user = "pi"
agent = true
}
tasks.register("deploy") {
description = "Deploys to the local rPI instance, and restarts it"
dependsOn("shadowJar")
doLast {
ssh.runSessions {
session(rpi) {
put(configurations["shadow"].artifacts.files, "/opt/deskscreen")
execute("sudo systemctl restart deskscreen")
}
}
}
}
tasks.register<JavaExec>("runDesktop") {
group = "Application"
description = "Run it on the desktop lol"
classpath = sourceSets["main"].compileClasspath + sourceSets["main"].runtimeClasspath
// jvmArgs = listOf("--module-path", sourceSets["main"].compileClasspath.asPath, "--add-modules") + javafxModules
environment.putAll(
mapOf(
"JIRA_BASEURL" to jiraBaseUrl,
"USERNAME" to username,
"PASSWORD" to password,
"REDDIT_USERNAME" to redditUsername,
"REDDIT_PASSWORD" to redditPassword,
"REDDIT_CLIENT_ID" to redditClientId,
"REDDIT_SECRET" to redditSecret
)
)
//jvmArgs = [""]
main = "is.kow.deskscreen.LameDesktopApp"
}
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
......@@ -7,7 +7,7 @@
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
......@@ -125,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
......@@ -154,19 +154,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
......@@ -175,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
......@@ -5,7 +5,7 @@
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -9,11 +9,17 @@ import tornadofx.stackpane
* the primary entry point when I'm on my desktop, run this guy from the IDE
*/
fun main(args: Array<String>) {
launch<DesktopScreen>(args)
}
//fun main(args: Array<String>) {
// launch<DesktopScreen>(args)
//}
class DesktopScreen : App(DesktopView::class, Styles::class) {
companion object {
@JvmStatic
fun main(args: Array<String>) {
launch<DesktopScreen>(args)
}
}
}
class DesktopView : View(title = "DeskTopScreen") {
......
package `is`.kow.deskscreen
class LameDesktopApp {
companion object {
@JvmStatic
fun main(args: Array<String>) {
DesktopScreen.main(args)
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment