Select Git revision
build.gradle
-
René Schöne authoredRené Schöne authored
build.gradle 2.20 KiB
plugins {
id 'maven-publish'
id 'application'
id 'java-gradle-plugin'
}
group 'org.jastadd.preprocessor'
mainClassName = 'org.jastadd.preprocessor.testing.doc.DocumentationCreator'
gradlePlugin {
plugins {
RelastPlugin {
id = 'testing'
implementationClass = 'org.jastadd.preprocessor.testing.plugin.PreprocessorPlugin'
}
}
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
def versionFile = 'src/main/resources/PreprocessorTesting.properties'
def oldProps = new Properties()
try {
file(versionFile).withInputStream { stream -> oldProps.load(stream) }
version = oldProps['version']
} catch (ignored) {
// this happens, if either the properties file is not present, or cannot be read from
throw new GradleException("File ${versionFile} not found or unreadable. Aborting.")
}
task newVersion() {
doFirst {
def props = new Properties()
props['version'] = value
props.store(file(versionFile).newWriter(), null)
}
}
task printVersion() {
doLast {
println(version)
}
}
task setDevVersionForCI() {
doFirst {
def props = new Properties()
props['version'] = version + "-$System.env.CI_PIPELINE_IID"
props.store(file(versionFile).newWriter(), null)
}
}
//830
publishing {
publications {
maven(MavenPublication) {
groupId = "org.jastadd.preprocessor"
artifactId = "testing"
from components.java // jar
}
}
repositories {
maven {
url "https://git-st.inf.tu-dresden.de/api/v4/projects/$System.env.CI_PROJECT_ID/packages/maven"
// Uncomment the following lines to publish manually (and comment out the other credentials section)
// credentials(HttpHeaderCredentials) {
// name = "Private-Token"
// value = gitLabPrivateToken // the variable resides in ~/.gradle/gradle.properties
// }
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}