-
Notifications
You must be signed in to change notification settings - Fork 451
Converts the build to Gradle Kotlin DSL #14155
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,9 +7,9 @@ version = System.getenv("JAR_VERSION") | |
|
|
||
| publishing { | ||
| publications { | ||
| maven(MavenPublication) { | ||
| artifact(tasks.named(sourceSets.main.jarTaskName)) { | ||
| extension 'jar' | ||
| create<MavenPublication>("maven") { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we work with constants here for which their names can help to understand better what this is? |
||
| artifact(tasks.named(sourceSets.main.get().jarTaskName)) { | ||
| extension = "jar" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't we have a constant for that already? |
||
| } | ||
| } | ||
| } | ||
|
|
||
This file was deleted.
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is just a copy of the previous build.gradle, right? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| import com.install4j.gradle.Install4jTask | ||
| import de.undercouch.gradle.tasks.download.Download | ||
|
|
||
| plugins { | ||
| id("triplea-java-library") | ||
| id("application") | ||
| alias(libs.plugins.shadow) | ||
| alias(libs.plugins.install4j) | ||
| alias(libs.plugins.download) | ||
| } | ||
|
|
||
| application { | ||
| mainClass.set("org.triplea.game.client.HeadedGameRunner") | ||
| applicationDefaultJvmArgs = listOf( | ||
| //This flag fixes touch gestures in Java-21;Technical Reference: https://stackoverflow.com/questions/48535595/what-replaces-gestureutilities-in-java-9 | ||
| "--add-opens=java.desktop/com.apple.eawt.event=ALL-UNNAMED" | ||
| ) | ||
| } | ||
|
|
||
| val releasesDir = project.layout.buildDirectory.file("releases").get().asFile | ||
|
|
||
| fun getProductVersion(): String { | ||
| return project(":game-app").file("../game-app/run/.build/product-version.txt").readText().trim() | ||
| } | ||
|
|
||
| fun getCommitNumber(): String { | ||
| return providers.exec { | ||
| commandLine("git", "rev-list", "--count", "HEAD") | ||
| }.standardOutput.asText.get().trim() | ||
| } | ||
|
|
||
| val releaseVersion = getProductVersion() + "+" + getCommitNumber() | ||
|
|
||
| dependencies { | ||
| implementation(project(":game-app:ai")) | ||
| implementation(project(":game-app:domain-data")) | ||
| implementation(project(":game-app:game-core")) | ||
| implementation(project(":game-app:map-data")) | ||
| implementation(project(":http-clients:lobby-client")) | ||
| implementation(project(":lib:feign-common")) | ||
| implementation(project(":lib:java-extras")) | ||
| implementation(project(":lib:swing-lib")) | ||
| implementation(project(":lib:websocket-client")) | ||
| testImplementation(project(":lib:test-common")) | ||
| } | ||
|
|
||
| tasks.named<Jar>("jar") { | ||
| archiveBaseName.set("$group-$name") | ||
| manifest { | ||
| attributes("Main-Class" to application.mainClass.get()) | ||
| } | ||
| } | ||
|
|
||
| val assetsZipFileName = "game_headed_assets.zip" | ||
| val downloadAssets = tasks.register<Download>("downloadAssets") { | ||
| src("https://github.com/triplea-game/assets/releases/download/47/$assetsZipFileName") | ||
| dest(project.layout.buildDirectory.dir("downloads/assets-zip")) | ||
| overwrite(false) | ||
| onlyIfModified(true) | ||
| quiet(true) | ||
| } | ||
|
|
||
| val unzipAssets = tasks.register<Copy>("unzipAssets") { | ||
| from(zipTree(downloadAssets.map { it.outputs.files.singleFile })) | ||
| into(project.layout.buildDirectory.dir("assets")) | ||
| } | ||
|
|
||
| tasks.named<ProcessResources>("processResources") { | ||
| from(unzipAssets) { | ||
| into("assets") | ||
| } | ||
| } | ||
|
|
||
| val platformInstallers = tasks.register<Install4jTask>("platformInstallers") { | ||
| group = "release" | ||
| description = "creates installer files using install4j (eg: install.exe)" | ||
| dependsOn(tasks.named("shadowJar")) | ||
|
|
||
| projectFile = file("build.install4j") | ||
| release = releaseVersion | ||
| license = System.getenv("INSTALL4J_LICENSE_KEY") | ||
| doLast { | ||
| ant.withGroovyBuilder { | ||
| "chmod"("dir" to releasesDir, "perm" to "+x", "includes" to "*.sh") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| val portableInstaller = tasks.register<Zip>("portableInstaller") { | ||
| group = "release" | ||
|
|
||
| from(file(".triplea-root")) | ||
| from(unzipAssets) { | ||
| into("assets") | ||
| } | ||
| from(file("dice_servers")) { | ||
| into("dice_servers") | ||
| } | ||
| from(tasks.named("shadowJar")) { | ||
| into("bin") | ||
| } | ||
| } | ||
|
|
||
| tasks.register<Copy>("release") { | ||
| group = "release" | ||
| dependsOn(platformInstallers) | ||
|
|
||
| from(portableInstaller) | ||
| from(file("$releasesDir/TripleA_${releaseVersion}_macos.dmg")) | ||
| from(file("$releasesDir/TripleA_${releaseVersion}_unix.sh")) | ||
| from(file("$releasesDir/TripleA_${releaseVersion}_windows-64bit.exe")) | ||
| into(file(project.layout.buildDirectory.dir("artifacts"))) | ||
|
|
||
| doFirst { | ||
| inputs.files.forEach { | ||
| if (!it.exists()) { | ||
| throw GradleException("artifact '$it' does not exist") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") { | ||
| dependsOn(unzipAssets) | ||
|
|
||
| // "archiveVersion" sets the version number on packaged jar files | ||
| // eg: "2.6+105234" in "lobby-server-2.6+50370c.jar" | ||
| archiveVersion.set(releaseVersion) | ||
| archiveClassifier.set("") | ||
| } |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"makes"