Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Kotlin DSL #14

Open
jmfayard opened this issue Feb 7, 2019 · 2 comments
Open

Gradle Kotlin DSL #14

jmfayard opened this issue Feb 7, 2019 · 2 comments

Comments

@jmfayard
Copy link

jmfayard commented Feb 7, 2019

Hello Edvin,

it would be good to have a documentation sample for Gradle/Kotlin.

It should be something like this:

plugins {
    id("no.tornado.fxlauncher") version "1.0.20"
}
fxlauncher {
    applicationVendor = "My Company"
    // Base URL where you will host the application artifacts
    applicationUrl = "http://fxldemo.tornado.no/"
    applicationMainClass = "no.tornado.FxlDemo"
    acceptDowngrade = false
    // Optional scp target for application artifacts hosted at the above url
    deployTarget = "[email protected]:fxldemo"
}

and here is a (not-tested) deployS3 configuration

tasks.register<Exec>("deployS3") {
    // You need to have installed AWS command line interface: https://aws.amazon.com/cli/
    group = "fxlauncher"
    dependsOn("embedApplicationManifest")
    val environmentVariables = listOf("aws_access_key_id", "aws_secret_access_key", "aws_access_deploy_target", "aws_region")
    val aws = environmentVariables.map { System.getenv(it) } 
    // todo: check if variables exist
    val (aws_access_key_id, aws_secret_access_key, aws_access_deploy_target, aws_region) = aws
    commandLine = "aws configure set aws_access_key_id ${System.getenv("aws_access_key_id")}".split(" ")
    commandLine = "aws configure set aws_secret_access_key ${System.getenv("aws_secret_access_key")}".split(" ")
    commandLine = "aws s3 cp build/libs $aws_access_deploy_target --acl public-read --recursive --region us-west-1".split(" ")
}

@edvin
Copy link
Owner

edvin commented Feb 11, 2019

Thanks. This should probably even be the default now, would you be able to submit a PR for the switchover? We should keep the old one for reference, but use the Kotlin DSL as default.

@oemergenc
Copy link

oemergenc commented Oct 24, 2020

Hi, i am also very interested in this and tried the described approach.
Unfortunately i run into some problems. While generating the native installer works, it seems to not copy the application dependencies, therefore my application cannot start. Maybe i am doing something wrong.

I forked the project and created a branch with my changes.
Basically just updated gradle files and switched to build.gradle.kts.
Maybe you could have a look here:

master...oemergenc:feature/gradle-kotlin-dsl

This is what i am doing:

git clone https://github.com/oemergenc/fxldemo-gradle.git
cd fxldemo-gradle
git checkout feature/gradle-kotlin-dsl
./gradlew generateNativeInstaller

After that running ls in the build directory results in this:

I ❯ ll build/fxlauncher
total 96
-rw-r--r--  1 omer.genc  staff   623B Oct 24 05:36 app.xml
-rw-r--r--  1 omer.genc  staff    36K Oct 24 05:36 fxlauncher.jar
-rw-r--r--  1 omer.genc  staff   1.9K Oct 24 05:36 fxldemo-gradle.jar

Where all dependencies declared in build.gradle.kts are missing.
Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants