Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Commit

Permalink
chore: improve install4j gradle task
Browse files Browse the repository at this point in the history
  • Loading branch information
Xerus committed Jul 27, 2019
1 parent 69e3add commit 2bbdd6c
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.install4j.gradle.Install4jTask
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.IOException
import java.util.*
import com.install4j.gradle.Install4jTask

val isUnstable = properties["release"] == null
var commitNumber: String = ""
Expand All @@ -27,14 +27,6 @@ plugins {
id("com.install4j.gradle") version "8.0"
}

install4j {
if (hasProperty("install4jDir")) {
(property("install4jDir") as String?)?.let {
installDir = file(it)
}
}
}

// source directories
sourceSets {
main {
Expand Down Expand Up @@ -90,6 +82,11 @@ githubRelease {
token(project.properties["github.token"]?.toString())
}

install4j {
(properties["install4j.installDir"] as String?)?.let { installDir = file(it) }
(properties["install4j.license"] as String?)?.let { license = it }
}

val MAIN = "_main"
tasks {

Expand Down Expand Up @@ -145,23 +142,18 @@ tasks {
dependsOn(shadowJar)
group = MAIN

var path : File? = null
projectFile = file("MonsterUtilities.install4j")
destination = "build/install4j/"
this.release = version.toString()

lateinit var jarTemp: File
doFirst {
path = file(jarFile).copyTo(file("build/install4j/$jarFile"), true)
if (path?.exists() == false) {
println("Couldn't create temporary install4j file '${path?.path}'")
}
jarTemp = file(jarFile).copyTo(file("build/install4j/$jarFile"), true)
}

doLast {
if (path?.delete() == false) {
println("Cannot delete temporary install4j file '${path?.path}'")
}
if(!jarTemp.delete())
println("Couldn't delete temporary install4j file '${jarTemp.path}'")
}

projectFile = file("MonsterUtilities.install4j")
this.release = version.toString()
destination = "build/install4j/"
}

withType<KotlinCompile> {
Expand Down

0 comments on commit 2bbdd6c

Please sign in to comment.