84 lines
2.1 KiB
Groovy
84 lines
2.1 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'application'
|
|
id "de.undercouch.download" version "4.1.1"
|
|
id 'com.github.johnrengelman.shadow'
|
|
id "maven-publish"
|
|
}
|
|
|
|
application {
|
|
mainClass = 'io.gitlab.jfronny.inceptum.Wrapper'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'com.google.code.gson:gson:2.8.8'
|
|
}
|
|
|
|
processResources {
|
|
inputs.property "version", project.version
|
|
|
|
filesMatching("version.json") {
|
|
expand "version": project.version
|
|
filter { line -> line.replace("@flavor@", rootProject.ext.flavorProp) }
|
|
filter { line -> line.replace("@public@", "$rootProject.ext.isPublic") }
|
|
}
|
|
}
|
|
|
|
class FileOutput extends DefaultTask {
|
|
@OutputFile
|
|
File output
|
|
}
|
|
def bootstrapVersion = "0.1.6"
|
|
def bootstrapArch = "i686"
|
|
|
|
task downloadBootstrap(type: Download) {
|
|
src "https://maven.fabricmc.net/net/fabricmc/fabric-installer-native-bootstrap/windows-${bootstrapArch}/${bootstrapVersion}/windows-${bootstrapArch}-${bootstrapVersion}.exe"
|
|
dest project.buildDir
|
|
}
|
|
|
|
task nativeExe(dependsOn: [downloadBootstrap, shadowJar], type: FileOutput) {
|
|
output = file("${projectDir}/build/libs/${archivesBaseName}-${project.version}.exe")
|
|
outputs.upToDateWhen { false }
|
|
|
|
doFirst {
|
|
output.delete()
|
|
}
|
|
|
|
doLast {
|
|
output.createNewFile()
|
|
output.setBytes downloadBootstrap.outputFiles.first().readBytes()
|
|
|
|
output.append shadowJar.archiveFile.get().getAsFile().readBytes()
|
|
}
|
|
}
|
|
if (flavor == 'windows') build.dependsOn nativeExe
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
artifact(shadowJar) {
|
|
builtBy shadowJar
|
|
}
|
|
}
|
|
}
|
|
|
|
if (rootProject.ext.isPublic) {
|
|
repositories.maven {
|
|
url = "https://gitlab.com/api/v4/projects/30862253/packages/maven"
|
|
name = "gitlab"
|
|
|
|
credentials(HttpHeaderCredentials) {
|
|
name = "Job-Token"
|
|
value = System.getenv().CI_JOB_TOKEN
|
|
}
|
|
authentication {
|
|
header(HttpHeaderAuthentication)
|
|
}
|
|
}
|
|
}
|
|
repositories.mavenLocal()
|
|
} |