Skip to content
Snippets Groups Projects
Verified Commit dfab40da authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

build: restructure build tools

parent 25d070b8
No related branches found
No related tags found
No related merge requests found
Showing
with 250 additions and 275 deletions
......@@ -27,15 +27,13 @@ test:
SSL_KEY_DATA: "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JSUpRUUlCQURBTkJna3Foa2lHOXcwQkFRRUZBQVNDQ1Nzd2dna25BZ0VBQW9JQ0FRRE5qbVUybnVBU3M2YVEKZHB4QmRudHFCaTVkV0JtZ242bWxYa0l5alV0dzJQSDR5QnZaVytvUTh4TlRKM3FCcmFMdTAybjFyNm9kcnRVUApLV2tUYVhGdm43VTZuRkhuQmo3akUwQngwbG8yU1E2SEx4OXJ4dWNUT1BMdVE2aXpWRTRiTzNoS0Q0ck93QnFiCnJPOFp2TUpveHFKQ21HVytsblZ4aTNEaER5MjltVWtCK0RFUjVBRExUTmN4ZC95OUcyTTBTNHBmZm1rT3N0RDkKLytJVVgxSXN1V1pDSWowdC9ueVR6by8yV2dBYnBDN1gzMW9uRzNnTHpRNU95YWRoYjZGWDF6MTFOZUFsMEdsZAplZ1lYd20xaDJwbERPSGRHVnJ2T1NmQ1c2Si9pVVg1aUw0UHRNK0o1V1dpZW10dDU1RHVKWXkraUNuY0pSRkdHCnpMbWVHNHBnc1pwTm9ON2R1dzhRd1dBSHJuUWtHRUk3NVFPMzJIL1c5clFZM2IxY2V3VWNoWk5QV2ZzMGxpbDEKY2V1NGkrWjFFV1BJam1QckJ4ZTdmdy83Mnc4ZGY1dzVGMlQ4UkpkWTJaUTU3dHNRcERQTEdJS0hGN0g0eUdsdAozOVhYQmllcGErZElPdlM0RXdRYms5ZzI5eTR2ZFp3Szk3UGxlVkszOVFuRXpCWXFUUUhYbU42amU5ZXk4eXJDClVoYVl3TGIxQ1VJVDRwL1NMTkFHWkdBcXc4U0dHU1dJRUdXbmd3cTEwVU1LRXZLaUlWMW00QjEwVDFF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2Zxb2V3ZW01cnowQ21UcmFYcXJlSHV6UlgrYy9uV1FxbUpEeU44bwpOZUhoRzVzSXRJaGVQcE5RK1FjUGV6VnlsKyt2TUhGd09POTJvK2kvejd6SDZ1Y1IrZzhPUjQxdlhqSVFFUDVuCjV3OU9HeU94VmZnRmhPNlErQ1VmSXMzSk1sd28vWGt3RnAyTkpvaE5XQVB6UEl5SjVWOVhwSmt1YVdKMTdjL1UKandmWU56Tmx2MXBEeVZHQWFJOG9NRFhSTWFaMwotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg=="
SSL_REQUIRED: "true"
script:
- "./gradlew check ktlintCheck coberturaTestReport --stacktrace"
- "./gradlew check ktlintCheck --stacktrace"
artifacts:
paths:
- "*/build/test-results/**/TEST-*.xml"
- "*/build/reports/*.xml"
- "*/build/reports/cobertura/*.xml"
- "*/build/reports/jacoco/*.xml"
reports:
cobertura:
- "*/build/reports/cobertura/*.xml"
junit:
- "*/build/test-results/**/TEST-*.xml"
- "*/build/reports/*.xml"
......
......@@ -7,77 +7,12 @@
* obtain one at https://mozilla.org/MPL/2.0/.
*/
import de.justjanne.coverageconverter.CoverageConverterExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jlleitschuh.gradle.ktlint") version "10.1.0" apply false
id("com.vanniktech.maven.publish") version "0.13.0" apply false
id("de.justjanne.jacoco-cobertura-converter") apply false
id("org.jetbrains.dokka") version "1.4.32"
}
allprojects {
apply(plugin = "org.jetbrains.dokka")
repositories {
mavenCentral()
google()
}
}
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
apply(plugin = "jacoco")
apply(plugin = "de.justjanne.jacoco-cobertura-converter")
dependencies {
val implementation by configurations
val testImplementation by configurations
val testRuntimeOnly by configurations
implementation(kotlin("stdlib"))
testImplementation(kotlin("test-junit5"))
val kotlinxCoroutinesVersion: String by project
implementation("org.jetbrains.kotlinx", "kotlinx-coroutines-core", kotlinxCoroutinesVersion)
testImplementation("org.jetbrains.kotlinx", "kotlinx-coroutines-test", kotlinxCoroutinesVersion)
val junit5Version: String by project
testImplementation("org.junit.jupiter", "junit-jupiter-api", junit5Version)
testImplementation("org.junit.jupiter", "junit-jupiter-params", junit5Version)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junit5Version)
val hamcrestVersion: String by project
testImplementation("org.hamcrest", "hamcrest-library", hamcrestVersion)
id("justjanne.dokka")
id("justjanne.publish-maven-central")
idea
eclipse
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf(
"-Xinline-classes",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes"
)
}
}
configure<JacocoPluginExtension> {
toolVersion = "0.8.7"
}
configure<CoverageConverterExtension> {
autoConfigureCoverage = true
}
configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
}
group = "de.justjanne.libquassel"
version = "0.7.0"
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
plugins {
`kotlin-dsl`
}
kotlinDslPluginOptions {
experimentalWarning.set(false)
}
repositories {
google()
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin", "kotlin-gradle-plugin", "1.5.10")
implementation("de.justjanne", "jacoco-cobertura-converter", "1.0.0")
implementation(gradleApi())
implementation(localGroovy())
}
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.coverageconverter
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule
import com.fasterxml.jackson.dataformat.xml.XmlMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
import de.justjanne.coverageconverter.jacoco.CounterTypeDto
import de.justjanne.coverageconverter.jacoco.ReportDto
import org.gradle.api.Action
import org.gradle.api.Task
import org.gradle.testing.jacoco.tasks.JacocoReport
import java.io.File
internal class CoverageConverterAction(
private val jacocoReportTask: JacocoReport
) : Action<Task> {
private fun findOutputFile(jacocoFile: File): File? {
val actualFile = jacocoFile.absoluteFile
if (actualFile.exists() && actualFile.parentFile.name == "jacoco") {
val folder = File(actualFile.parentFile.parentFile, "cobertura")
folder.mkdirs()
return File(folder, actualFile.name)
}
return null
}
override fun execute(task: Task) {
fun printTotal(data: ReportDto) {
val instructionRate = convertCounter(data.counters, CounterTypeDto.INSTRUCTION).rate * 100
val instructionMissed = convertCounter(data.counters, CounterTypeDto.INSTRUCTION).missed
val branchRate = convertCounter(data.counters, CounterTypeDto.BRANCH).rate * 100
val branchMissed = convertCounter(data.counters, CounterTypeDto.BRANCH).missed
println("[JacocoPrinter] Instructions $instructionRate% (Missed $instructionMissed)")
println("[JacocoPrinter] Branches $branchRate% (Missed $branchMissed)")
}
fun convertFile(input: File, output: File) {
val mapper = XmlMapper(
JacksonXmlModule().apply {
setDefaultUseWrapper(false)
}
).apply {
enable(SerializationFeature.INDENT_OUTPUT)
enable(SerializationFeature.WRAP_ROOT_VALUE)
registerModule(KotlinModule(strictNullChecks = true))
}
val data = mapper.readValue(input, ReportDto::class.java)
val result = convertReport(data)
printTotal(data)
mapper.writeValue(output, result)
}
jacocoReportTask.reports.forEach {
if (it.isEnabled && it.destination.extension == "xml") {
val outputFile = findOutputFile(it.destination)
if (outputFile != null) {
convertFile(it.destination, outputFile)
}
}
}
}
}
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.coverageconverter
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
import org.gradle.testing.jacoco.tasks.JacocoReport
import java.io.File
class CoverageConverterPlugin : Plugin<Project> {
override fun apply(project: Project) {
val extension = project.extensions.create("coverage", CoverageConverterExtension::class.java)
project.afterEvaluate {
val testTask = tasks.getByName("test")
val jacocoReportTask = tasks.getByName("jacocoTestReport") as? JacocoReport
if (jacocoReportTask != null) {
jacocoReportTask.dependsOn(testTask)
if (extension.autoConfigureCoverage) {
jacocoReportTask.sourceDirectories.from(fileTree("src/main/kotlin"))
jacocoReportTask.classDirectories.from(fileTree("build/classes/kotlin/main"))
jacocoReportTask.reports {
xml.destination = File("${buildDir}/reports/jacoco/report.xml")
html.isEnabled = true
xml.isEnabled = true
csv.isEnabled = false
}
}
tasks.register("coberturaTestReport") {
dependsOn(jacocoReportTask)
mustRunAfter(jacocoReportTask)
group = "verification"
doLast(CoverageConverterAction(jacocoReportTask))
}
}
}
}
}
#
# libquassel
# Copyright (c) 2021 Janne Mareike Koschinski
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
#
implementation-class=de.justjanne.coverageconverter.CoverageConverterPlugin
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
kotlin.code.style=official
bouncyCastleVersion=1.68
hamcrestVersion=2.2
junit5Version=5.7.2
kotlinVersion=1.5.10
kotlinBitflagsVersion=1.3.0
kotlinxCoroutinesVersion=1.5.0
sl4jVersion=1.7.30
testcontainersCiVersion=1.3.0
threetenBpVersion=1.5.1
kotlinPoetVersion=1.8.0
kspVersion=1.5.10-1.0.0-beta01
GROUP=de.justjanne.libquassel
VERSION_NAME=0.6.2
POM_URL=https://git.kuschku.de/justJanne/libquassel
POM_SCM_URL=https://git.kuschku.de/justJanne/libquassel
POM_SCM_CONNECTION=scm:git:https://git.kuschku.de/justJanne/libquassel.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git.kuschku.de:2222/justJanne/libquassel.git
POM_LICENSE_NAME=Mozilla Public License Version 2.0
POM_LICENSE_URL=https://www.mozilla.org/en-US/MPL/2.0/
POM_LICENSE_DIST=repo
POM_DEVELOPER_ID=justJanne
POM_DEVELOPER_NAME=Janne Mareike Koschinski
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
dependencies {
implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.6.10")
implementation("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.6.10-1.0.4")
implementation("org.jlleitschuh.gradle:ktlint-gradle:10.2.1")
}
configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
File added
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionSha256Szm=8cc27038d5dbd815759851ba53e70cf62e481b87494cc97cfd97982ada5ba634
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
rootProject.name = "convention"
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2022 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.coverageconverter
open class CoverageConverterExtension {
var autoConfigureCoverage: Boolean = false
plugins {
id("org.jetbrains.dokka")
}
plugins {
java
jacoco
}
version = rootProject.version
group = rootProject.group
tasks.getByName("jacocoTestReport") {
enabled = false
}
tasks.withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
tasks.withType<Test> {
useJUnitPlatform()
}
configure<JavaPluginExtension> {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("justjanne.java")
id("justjanne.dokka")
id("justjanne.ktlint")
id("com.google.devtools.ksp")
kotlin("jvm")
kotlin("kapt")
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.10")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0")
testImplementation("org.junit.jupiter", "junit-jupiter-api", "5.8.2")
testImplementation("org.junit.jupiter", "junit-jupiter-params", "5.8.2")
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5:1.6.10")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf(
"-Xinline-classes",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes"
)
jvmTarget = "1.8"
}
}
/*
* libquassel
* Copyright (c) 2021 Janne Mareike Koschinski
* Copyright (c) 2022 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
package de.justjanne.libquassel.annotations
@Retention(AnnotationRetention.SOURCE)
annotation class SyncedData(
val name: String
)
plugins {
id("org.jlleitschuh.gradle.ktlint")
}
/*
* libquassel
* Copyright (c) 2022 Janne Mareike Koschinski
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*/
plugins {
id("maven-publish")
id("signing")
}
version = rootProject.version
group = rootProject.group
val canSign = project.properties.keys
.any { it.startsWith("signing.") }
publishing {
publications {
create<MavenPublication>("maven") {
publication()
pom()
}
}
}
configure<SigningExtension> {
if (canSign) {
useGpgCmd()
sign(publishing.publications["maven"])
}
}
fun MavenPublication.pom() {
pom {
name.set(buildHumanReadableName(artifactId))
description.set("Pure-Kotlin implementation of the Quassel Protocol")
url.set("https://git.kuschku.de/justJanne/libquassel")
licenses {
license {
name.set("Mozilla Public License Version 2.0")
url.set("https://www.mozilla.org/en-US/MPL/2.0/")
}
}
developers {
developer {
id.set("justJanne")
name.set("Janne Mareike Koschinski")
}
}
scm {
connection.set("scm:git:https://git.kuschku.de/justJanne/libquassel.git")
developerConnection.set("scm:git:ssh://git.kuschku.de:2222/justJanne/libquassel.git")
url.set("https://git.kuschku.de/justJanne/libquassel")
}
}
}
fun MavenPublication.publication() {
val projectName = project.name
.removePrefix("core")
.removePrefix("-")
artifactId = buildArtifactName(
extractArtifactGroup(project.group as String),
rootProject.name,
projectName.ifEmpty { null }
)
from(components["java"])
}
fun buildArtifactName(group: String? = null, project: String? = null, module: String? = null): String {
return removeConsecutive(listOfNotNull(group, project, module).flatMap { it.split('-') })
.joinToString("-")
}
fun buildHumanReadableName(name: String) = name
.splitToSequence('-')
.joinToString(" ", transform = String::capitalize)
fun extractArtifactGroup(group: String): String? {
// split into parts by domain separator
val elements = group.split('.')
// drop the tld/domain part, e.g. io.datalbry
val withoutDomain = elements.drop(2)
// if anything remains, that’s our artifact group
return withoutDomain.lastOrNull()
}
fun <T> removeConsecutive(list: List<T>): List<T> {
val result = mutableListOf<T>()
for (el in list) {
if (el != result.lastOrNull()) {
result.add(el)
}
}
return result
}
plugins {
id("io.github.gradle-nexus.publish-plugin")
}
val canSign = project.properties.keys
.any { it.startsWith("signing.") }
if (canSign) {
nexusPublishing {
repositories {
sonatype()
}
}
}
[versions]
bouncycastle = "1.70"
hamcrest = "2.2"
junit = "5.7.2"
kotlin-stdlib = "1.6.10"
kotlin-bitflags = "1.3.0"
kotlin-coroutines = "1.5.0"
slf4j = "1.7.30"
testcontainers = "1.3.0"
threetenbp = "1.5.2"
kotlinpoet = "1.10.2"
ksp = "1.6.10-1.0.4"
[libraries]
testcontainers = { module = "de.justjanne:testcontainers-ci", version.ref = "testcontainers" }
slf4j = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
hamcrest = { module = "org.hamcrest:hamcrest-library", version.ref = "hamcrest" }
ksp = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }
threetenbp = { module = "org.threeten:threetenbp", version.ref = "threetenbp" }
kotlin-bitflags = { module = "de.justjanne:kotlin-bitflags", version.ref = "kotlin-bitflags" }
bouncycastle = { module = "org.bouncycastle:bcpkix-jdk15on", version.ref = "bouncycastle" }
No preview for this file type
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionSha256Szm=0e46229820205440b48a5501122002842b82886e76af35f0f3a069243dca4b3c
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionSha256Szm=8cc27038d5dbd815759851ba53e70cf62e481b87494cc97cfd97982ada5ba634
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment