provs/build.gradle

186 lines
5.3 KiB
Groovy
Raw Permalink Normal View History

2021-02-10 19:24:43 +00:00
buildscript {
ext.kotlin_version = '1.6.10'
ext.CI_PROJECT_ID = System.env.CI_PROJECT_ID
repositories { mavenCentral() }
2021-02-10 19:24:43 +00:00
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
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'
apply plugin: 'maven-publish'
apply plugin: 'kotlinx-serialization'
2021-02-10 19:24:43 +00:00
group = 'org.domaindrivenarchitecture.provs'
2022-03-05 08:47:20 +00:00
version = 'release-0.9.11'
2021-02-10 19:24:43 +00:00
repositories {
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
2021-08-08 14:27:21 +00:00
}
}
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 {
def excludedTags = System.getProperty("excludeTags")
if (System.getProperty("excludeTags") != null) {
excludeTags(excludedTags)
}
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"
// https://stackoverflow.com/questions/21904269/configure-gradle-to-publish-sources-and-javadoc
java {
withSourcesJar()
withJavadocJar()
}
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"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.2'
implementation "org.jetbrains.kotlinx:kotlinx-cli:0.3.4"
implementation 'com.charleskorn.kaml:kaml:0.40.0'
implementation group: 'com.hierynomus', name: 'sshj', version: '0.32.0'
2021-02-10 19:24:43 +00:00
api 'org.slf4j:slf4j-api:1.7.36'
api 'ch.qos.logback:logback-classic:1.2.10'
api 'ch.qos.logback:logback-core:1.2.10'
2021-02-10 19:24:43 +00:00
testFixturesApi 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation('io.mockk:mockk:1.12.2')
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
2021-02-10 19:24:43 +00:00
}
2021-12-01 20:19:08 +00:00
task uberjarDesktop(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) }
} {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
2021-02-10 19:24:43 +00:00
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
manifest {
2021-11-24 21:04:53 +00:00
attributes 'Implementation-Title': 'Uberjar of provs',
2021-02-10 19:24:43 +00:00
'Implementation-Version': project.version,
2022-02-03 08:06:03 +00:00
'Main-Class': 'org.domaindrivenarchitecture.provs.desktop.application.ApplicationKt'
2021-02-10 19:24:43 +00:00
}
archiveFileName = 'provs-desktop.jar'
}
task uberjarServer(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': 'Uberjar of provs',
'Implementation-Version': project.version,
'Main-Class': 'org.domaindrivenarchitecture.provs.server.application.ApplicationKt'
}
archiveFileName = 'provs-server.jar'
2021-02-10 19:24:43 +00:00
}
2022-03-04 14:53:42 +00:00
// copy jar to /usr/local/bin and make it executable
// Remark: to be able to use it you must have jarwrapper installed (sudo apt install jarwrapper)
task installlocally {
dependsOn(uberjarServer, uberjarDesktop)
doLast {
exec {
executable "sh"
args '-c', 'sudo cp ~/repo/dda/provs/build/libs/provs-server.jar /usr/local/bin/'
}
exec {
executable "sh"
args '-c', 'sudo cp ~/repo/dda/provs/build/libs/provs-desktop.jar /usr/local/bin/'
}
exec {
executable "sh"
args '-c', 'sudo chmod 755 /usr/local/bin/provs-server.jar'
}
exec {
executable "sh"
args '-c', 'sudo chmod 755 /usr/local/bin/provs-desktop.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 {
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)
}
}
} else {
mavenLocal()
2021-02-10 19:24:43 +00:00
}
}
}