You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
provs/build.gradle

186 lines
5.6 KiB
Groovy

3 years ago
buildscript {
ext.kotlin_version = '1.4.31'
ext.CI_PROJECT_ID = System.env.CI_PROJECT_ID
repositories { mavenCentral() }
3 years ago
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
3 years ago
}
}
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'java-library'
apply plugin: 'java-test-fixtures'
apply plugin: 'maven-publish'
apply plugin: 'kotlinx-serialization'
3 years ago
group = 'org.domaindrivenarchitecture.provs'
version = '0.8.15'
3 years ago
repositories {
mavenCentral()
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
}
}
3 years ago
test {
// set properties for the tests
def propertiesForTests = ["testdockerwithoutsudo"]
for (def prop : propertiesForTests) {
def value = System.getProperty(prop)
if (value != null) {
systemProperty prop, value
}
}
3 years ago
useJUnitPlatform {
if (System.getenv("CI_JOB_TOKEN") != null) {
excludeTags('containernonci')
}
3 years ago
}
}
compileJava.options.debugOptions.debugLevel = "source,lines,vars"
compileTestFixturesJava.options.debugOptions.debugLevel = "source,lines,vars"
3 years ago
compileTestJava.options.debugOptions.debugLevel = "source,lines,vars"
sourceCompatibility = 1.11
targetCompatibility = 1.11
3 years ago
// https://stackoverflow.com/questions/21904269/configure-gradle-to-publish-sources-and-javadoc
java {
withSourcesJar()
withJavadocJar()
}
3 years ago
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0"
implementation group: 'com.hierynomus', name: 'sshj', version: '0.31.0'
3 years ago
api "org.slf4j:slf4j-api:1.7.30"
api "ch.qos.logback:logback-classic:1.2.3"
api "ch.qos.logback:logback-core:1.2.3"
testFixturesApi group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2'
3 years ago
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
}
//create a single Jar with all dependencies excl. Kotlin libs
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.core.entry.EntryKt'
3 years ago
}
archivesBaseName = project.name + '-all'
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
3 years ago
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
//create a single Jar with all dependencies excl. Kotlin libs without version-number but with suffix "latest"
3 years ago
task fatJarLatest(type: Jar) {
doFirst {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
3 years ago
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.core.entry.EntryKt'
3 years ago
}
with jar
archiveFileName = 'provs-fat-latest.jar'
}
//create a single Jar with all dependencies incl. Kotlin libs
task uberJar(type: Jar) {
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
} {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
3 years ago
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.core.entry.EntryKt'
3 years ago
}
archiveClassifier = 'uber'
}
//create a single Jar with all dependencies incl. Kotlin libs - as ...-latest
task uberJarLatest(type: Jar) {
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
} {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
3 years ago
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.core.entry.EntryKt'
3 years ago
}
archiveFileName = 'provs-latest.jar'
}
task sourceJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
archiveClassifier.set("sources")
}
publishing {
publications {
library(MavenPublication) {
3 years ago
from components.java
}
}
repositories {
if (System.getenv("CI_JOB_TOKEN") != null) {
// see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html
maven {
url "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/packages/maven"
3 years ago
name "GitLab"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
} else {
mavenLocal()
3 years ago
}
}
}