Skip to content

Conversation

@timmattison
Copy link

NOTE: This template will not work until Gradle Kotlin DSL support and Gradle wrapper support are added into GDK

Description of changes:
This adds a template that uses Gradle, the Gradle Kotlin DSL, and the Gradle wrapper

Why is this change necessary:
I have a lot of code that uses the Gradle Kotlin DSL and the Gradle wrapper and I'd like to use it with GDK

How was this change tested:
I published my own simple Hello World component with it

Any additional information or context required to review the change:
This build script adds a little extra intelligence when building and publishing to let the user know where to go to find information about the values they need to set. I do think it's useful but I could see it being removed if we want a more minimal script.

When executing ./gradlew build this code will correctly set the component version number by reading it from the gdk-config.json so it doesn't need to be in the gdk configuration and the build script. If the version is set to NEXT_PATCH the JAR will use 1.0.0 as the version number so gdk can find it.

When executing ./gradlew publish this code will also run the build task so the user doesn't need to do ./gradlew build or gdk component build and then gdk component publish. They still have the option of publishing without building by using gdk component publish directly. But generally in my development process I want to do both at the same time.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@timmattison
Copy link
Author

timmattison commented Mar 18, 2022

If all of the fancy stuff is unwanted then everything below line 37 can be deleted and then this can be used in its place:

tasks.shadowJar {
    archiveFileName.set("${project.description}-1.0.0.jar")
}

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

Successfully merging this pull request may close these issues.

1 participant