2021-02-10 19:24:43 +00:00
|
|
|
buildscript {
|
2021-08-17 18:36:45 +00:00
|
|
|
ext.kotlin_version = '1.5.21'
|
2021-03-31 10:09:03 +00:00
|
|
|
ext.CI_PROJECT_ID = System.env.CI_PROJECT_ID
|
|
|
|
|
2021-08-07 13:50:55 +00:00
|
|
|
repositories { mavenCentral() }
|
2021-02-10 19:24:43 +00:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
2021-08-07 13:50:55 +00:00
|
|
|
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apply plugin: 'org.jetbrains.kotlin.jvm'
|
2021-05-15 17:33:56 +00:00
|
|
|
apply plugin: 'java-library'
|
2021-02-26 19:32:49 +00:00
|
|
|
apply plugin: 'java-test-fixtures'
|
2021-04-16 11:45:05 +00:00
|
|
|
apply plugin: 'maven-publish'
|
2021-08-07 13:50:55 +00:00
|
|
|
apply plugin: 'kotlinx-serialization'
|
|
|
|
|
2021-02-10 19:24:43 +00:00
|
|
|
|
2021-08-07 17:12:22 +00:00
|
|
|
group = 'org.domaindrivenarchitecture.provs'
|
2021-09-02 18:38:26 +00:00
|
|
|
version = '0.8.17-SNAPSHOT'
|
2021-02-10 19:24:43 +00:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
2021-08-08 14:27:21 +00:00
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-10 19:24:43 +00:00
|
|
|
test {
|
2021-02-25 18:57:06 +00:00
|
|
|
// set properties for the tests
|
|
|
|
def propertiesForTests = ["testdockerwithoutsudo"]
|
|
|
|
for (def prop : propertiesForTests) {
|
|
|
|
def value = System.getProperty(prop)
|
|
|
|
if (value != null) {
|
|
|
|
systemProperty prop, value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-10 19:24:43 +00:00
|
|
|
useJUnitPlatform {
|
2021-02-25 18:57:06 +00:00
|
|
|
if (System.getenv("CI_JOB_TOKEN") != null) {
|
|
|
|
excludeTags('containernonci')
|
|
|
|
}
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
compileJava.options.debugOptions.debugLevel = "source,lines,vars"
|
2021-05-15 17:33:56 +00:00
|
|
|
compileTestFixturesJava.options.debugOptions.debugLevel = "source,lines,vars"
|
2021-02-10 19:24:43 +00:00
|
|
|
compileTestJava.options.debugOptions.debugLevel = "source,lines,vars"
|
|
|
|
|
2021-04-19 19:02:21 +00:00
|
|
|
sourceCompatibility = 1.11
|
|
|
|
targetCompatibility = 1.11
|
|
|
|
|
2021-02-10 19:24:43 +00:00
|
|
|
// https://stackoverflow.com/questions/21904269/configure-gradle-to-publish-sources-and-javadoc
|
|
|
|
java {
|
|
|
|
withSourcesJar()
|
|
|
|
withJavadocJar()
|
|
|
|
}
|
|
|
|
|
2021-04-19 19:02:21 +00:00
|
|
|
|
2021-02-10 19:24:43 +00:00
|
|
|
dependencies {
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
|
|
|
2021-08-17 18:36:45 +00:00
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2"
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.2.2"
|
2021-08-07 13:50:55 +00:00
|
|
|
|
2021-09-07 15:59:03 +00:00
|
|
|
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-cli:0.3.2"
|
|
|
|
implementation 'com.charleskorn.kaml:kaml:0.35.2'
|
|
|
|
|
2021-04-16 11:45:05 +00:00
|
|
|
implementation group: 'com.hierynomus', name: 'sshj', version: '0.31.0'
|
2021-02-10 19:24:43 +00:00
|
|
|
|
2021-08-17 18:36:45 +00:00
|
|
|
api "org.slf4j:slf4j-api:1.7.32"
|
|
|
|
api "ch.qos.logback:logback-classic:1.2.5"
|
|
|
|
api "ch.qos.logback:logback-core:1.2.5"
|
2021-02-10 19:24:43 +00:00
|
|
|
|
2021-03-31 10:09:03 +00:00
|
|
|
testFixturesApi group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.2'
|
2021-08-17 18:36:45 +00:00
|
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//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,
|
2021-09-09 16:37:41 +00:00
|
|
|
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
|
|
|
archivesBaseName = project.name + '-all'
|
2021-07-28 14:31:41 +00:00
|
|
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
|
|
|
|
2021-02-10 19:24:43 +00:00
|
|
|
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
|
|
with jar
|
|
|
|
}
|
|
|
|
|
2021-04-16 11:45:05 +00:00
|
|
|
//create a single Jar with all dependencies excl. Kotlin libs without version-number but with suffix "latest"
|
2021-02-10 19:24:43 +00:00
|
|
|
task fatJarLatest(type: Jar) {
|
|
|
|
doFirst {
|
|
|
|
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
|
|
|
}
|
2021-07-28 14:31:41 +00:00
|
|
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
2021-02-10 19:24:43 +00:00
|
|
|
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
|
|
|
|
|
|
|
|
manifest {
|
|
|
|
attributes 'Implementation-Title': 'Gradle Jar File Example',
|
|
|
|
'Implementation-Version': project.version,
|
2021-09-09 16:37:41 +00:00
|
|
|
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
|
|
|
with jar
|
|
|
|
archiveFileName = 'provs-fat-latest.jar'
|
|
|
|
}
|
|
|
|
|
2021-09-09 16:37:41 +00:00
|
|
|
task uberjarWorkplace(type: Jar) {
|
2021-02-10 19:24:43 +00:00
|
|
|
|
|
|
|
from sourceSets.main.output
|
|
|
|
|
|
|
|
dependsOn configurations.runtimeClasspath
|
|
|
|
from {
|
|
|
|
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
|
|
|
|
} {
|
2021-07-28 14:31:41 +00:00
|
|
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
2021-02-10 19:24:43 +00:00
|
|
|
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
|
|
|
|
}
|
|
|
|
|
|
|
|
manifest {
|
|
|
|
attributes 'Implementation-Title': 'Gradle Jar File Example',
|
|
|
|
'Implementation-Version': project.version,
|
2021-09-09 16:37:41 +00:00
|
|
|
'Main-Class': 'org.domaindrivenarchitecture.provs.workplace.application.CliKt'
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
2021-09-09 16:37:41 +00:00
|
|
|
archiveFileName = 'provs-workplace.jar'
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
|
|
|
|
2021-10-09 13:13:51 +00:00
|
|
|
task uberjarEntry(type: Jar) {
|
|
|
|
|
|
|
|
from sourceSets.main.output
|
|
|
|
|
|
|
|
dependsOn configurations.runtimeClasspath
|
|
|
|
from {
|
|
|
|
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
|
|
|
|
} {
|
|
|
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
archiveFileName = 'provs-entry.jar'
|
|
|
|
}
|
|
|
|
|
2021-02-10 19:24:43 +00:00
|
|
|
|
|
|
|
task sourceJar(type: Jar, dependsOn: classes) {
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
archiveClassifier.set("sources")
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
2021-02-11 18:24:16 +00:00
|
|
|
library(MavenPublication) {
|
2021-02-10 19:24:43 +00:00
|
|
|
from components.java
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
if (System.getenv("CI_JOB_TOKEN") != null) {
|
|
|
|
// see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html
|
|
|
|
maven {
|
2021-03-31 10:09:03 +00:00
|
|
|
url "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/packages/maven"
|
2021-02-10 19:24:43 +00:00
|
|
|
name "GitLab"
|
|
|
|
credentials(HttpHeaderCredentials) {
|
|
|
|
name = 'Job-Token'
|
|
|
|
value = System.getenv("CI_JOB_TOKEN")
|
|
|
|
}
|
|
|
|
authentication {
|
|
|
|
header(HttpHeaderAuthentication)
|
|
|
|
}
|
|
|
|
}
|
2021-04-16 11:45:05 +00:00
|
|
|
} else {
|
|
|
|
mavenLocal()
|
2021-02-10 19:24:43 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-07 15:59:03 +00:00
|
|
|
}
|