anvilauth-injector/build.gradle
2023-11-01 18:52:13 +08:00

65 lines
1.5 KiB
Groovy

plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.palantir.git-version' version '3.0.0'
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.ow2.asm:asm:9.6'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'
}
tasks.withType(JavaCompile) {
options.release = 8
options.deprecation = true
}
def buildNumber = System.getenv('AI_BUILD_NUMBER')
def gitInfo = versionDetails()
version = System.getenv('AI_VERSION_NUMBER') ?: 'snapshot';
if (!gitInfo.isCleanTag) version += '.dirty'
jar {
manifest {
attributes (
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'yushijinhun',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Automatic-Module-Name': 'moe.yushi.authlibinjector',
'Premain-Class': 'moe.yushi.authlibinjector.Premain',
'Agent-Class': 'moe.yushi.authlibinjector.Premain',
'Can-Retransform-Classes': true,
'Can-Redefine-Classes': true,
'Git-Commit': gitInfo.gitHashFull,
'Git-IsClean': gitInfo.isCleanTag,
'Build-Number': buildNumber?:'-1'
)
}
}
processResources {
from('LICENSE') {
rename('LICENSE', 'authlib-injector.txt')
into 'META-INF/licenses'
}
}
test {
useJUnitPlatform()
}
shadowJar {
archiveClassifier.set(null)
exclude 'META-INF/maven/**'
exclude 'module-info.class'
relocate 'org.objectweb.asm', 'moe.yushi.authlibinjector.internal.org.objectweb.asm'
}
defaultTasks 'clean', 'shadowJar'