Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEG-4936 migrate to pleo gradle plugin #232

Merged
merged 21 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/templates.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
version: v23.1.2
version: v32.0.1

files:
- .github/.kodiak.toml
- .github/workflows/format-kotlin.yaml
- .github/workflows/release.yaml
- .github/workflows/verify-release.yaml
- .autorc.json
- .github/workflows/pr-help.yaml
- .github/.kodiak.toml
- .github/workflows/assign-random-codeowner.yaml
- .github/workflows/build-and-test.yaml
- .github/workflows/codeql-analysis.yaml
- .github/workflows/pr-help.yaml
- .github/workflows/release.yaml
- .github/workflows/verify-release.yaml

values:
autoRelease: true
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/format-kotlin.yaml

This file was deleted.

108 changes: 5 additions & 103 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,17 @@ buildscript {

dependencies {
classpath(libs.kotlin.gradle.plugin)
classpath(libs.kotlinter.gradle)
}
}

plugins {
alias(libs.plugins.kotlin.jvm) apply false
id 'jacoco'
alias(libs.plugins.coveralls.jacoco) apply false
alias(libs.plugins.jacocolog) apply false
alias(libs.plugins.pleo.gradle.plugin)
}

allprojects {
group = 'io.pleo'

apply plugin: libs.plugins.coveralls.jacoco.get().pluginId
apply plugin: libs.plugins.jacocolog.get().pluginId

jacoco {
toolVersion = "0.8.7"
}

tasks.named("jacocoLogAggregatedCoverage") {
enabled = false
}

repositories {
mavenCentral()
}
Expand All @@ -47,7 +33,6 @@ subprojects {
apply plugin: libs.plugins.java.library.get().pluginId
apply plugin: libs.plugins.kotlin.library.get().pluginId
apply plugin: libs.plugins.maven.publish.get().pluginId
apply plugin: libs.plugins.jmailen.kotlinter.get().pluginId

sourceCompatibility = 17
targetCompatibility = 17
Expand Down Expand Up @@ -77,16 +62,6 @@ subprojects {
testRuntimeOnly(libs.junit.jupiter.engine)
}

task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
}

task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}

javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
Expand All @@ -102,85 +77,12 @@ subprojects {
useJUnitPlatform()
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar

pom {
name = project.name
description = "Dynamic properties for your Java/Kotlin app"
url = 'http://github.com/pleo-io/prop'
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
name = 'Pleo'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:[email protected]:pleo-io/prop.git'
developerConnection = 'scm:git:[email protected]:pleo-io/prop.git'
url = 'https://github.com/pleo-io/prop'
}
}
}
}

repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/pleo-io/prop")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}

ext.generateVersion = { ->
def updateMode = properties.get("mode") ?: "internal"
def splitVersionStrings = version.toString().split("[.]")
def (major, minor, patch) = splitVersionStrings.collect{Integer.parseInt(it)}
switch (updateMode) {
case "major": major++; minor = 0; patch = 0; break
case "minor": minor++; patch = 0; break
case "patch": patch++; break
}
"$major.$minor.$patch"
}

tasks.register("incrementVersion") {
group = "release"
description = "Increments the version in this build file everywhere it is used."

doLast {
def propertiesReference = new Properties()
def propertiesFile = file("gradle.properties")

def newVersion = properties.get("overrideVersion") ?: generateVersion()
propertiesReference.load(propertiesFile.newDataInputStream())
propertiesReference.setProperty("version", newVersion)
propertiesReference.store(propertiesFile.newWriter(), null)
}
}

// Executed only at root level so code coverage is only reported once to Coveralls
coverallsJacoco {
reportPath = "build/reports/jacoco/jacocoAggregatedReport/jacocoAggregatedReport.xml"
reportSourceSets += subprojects.sourceSets.main.allSource.srcDirs.flatten()
tasks.check {
finalizedBy("formatKotlin")
}

tasks.named('coverallsJacoco') {
dependsOn jacocoAggregatedReport
pleoRepositoryExtension {
publish.set(subprojects.toSet())
}
19 changes: 19 additions & 0 deletions detekt-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>FunctionParameterNaming:InlineProviderModule.kt$InlineProviderModule$@Named("io.pleo.test.prop3") u_u: Prop&lt;String&gt;</ID>
<ID>FunctionParameterNaming:InlineProviderModule.kt$InlineProviderModule$@Named("io.pleo.test.prop3") w_w: Prop&lt;String&gt;</ID>
<ID>FunctionParameterNaming:InlineProviderModule.kt$InlineProviderModule$@Named("io.pleo.test.prop4") w_w: Prop&lt;String&gt;</ID>
<ID>SwallowedException:PropTest.kt$PropTest$ex: CreationException</ID>
<ID>ThrowsCount:ParsingProperty.kt$ParsingProperty$private fun parseProperty(): T</ID>
<ID>TooGenericExceptionCaught:JacksonParserFactory.kt$JacksonParserFactory$ex: RuntimeException</ID>
<ID>TooGenericExceptionCaught:ParsingProperty.kt$ParsingProperty$ex: Exception</ID>
<ID>TooGenericExceptionCaught:ParsingProperty.kt$ParsingProperty$ex: RuntimeException</ID>
<ID>TooGenericExceptionCaught:PropMappingVisitor.kt$PropMappingVisitor$ex: RuntimeException</ID>
<ID>TooManyFunctions:CompositeConfigurationBuilder.kt$CompositeConfigurationBuilder : ConfigurationBuilder</ID>
<ID>TooManyFunctions:PropMappingVisitor.kt$PropMappingVisitor : DefaultElementVisitor</ID>
<ID>UnusedPrivateProperty:NullValue.kt$NullValue$@Named("io.pleo.undefined.property") thisThrows: Prop&lt;String&gt;</ID>
<ID>UnusedPrivateProperty:UnnamedProp.kt$UnnamedProp$unnamedProp: Prop&lt;String&gt;</ID>
</CurrentIssues>
</SmellBaseline>
18 changes: 18 additions & 0 deletions detekt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# File: detekt.yaml

style:
ForbiddenComment:
active: true
values:
- "STOPSHIP:"
- "TODO:"
allowedPatterns: ""
customMessage: ""
MaxLineLength:
maxLineLength: 160

naming:
FunctionNaming:
excludes: &TestClasses
- '**/*Tests.kt'
- '**/*Test.kt'
6 changes: 5 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#Thu Feb 02 09:01:06 UTC 2023
#Some properties were automatically set by the Pleo Gradle plugin.
#Thu Dec 21 10:26:54 EET 2023
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
org.gradle.jvmargs=-Xmx4096m "-XX\:MaxMetaspaceSize\=1024m"
version=6.0.28
8 changes: 2 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jacksonVersion = "2.14.2"
junitVersion = "5.9.3"
kotlinGuiceVersion = "1.6.0"
kotlinVersion = "1.8.0"
kotlinterGradleVersion = "3.13.0"
logbackClassicVersion = "1.4.5"
mockkVersion = "1.13.4"
monetaVersion = "1.4.2"
pleoGradlePluginVersion = "5.14.0"
slf4jVersion = "2.0.6"

[libraries]
Expand All @@ -28,18 +28,14 @@ junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", vers
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
kotlin-guice = { module = "dev.misfitlabs.kotlinguice4:kotlin-guice", version.ref = "kotlinGuiceVersion" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlinVersion" }
kotlinter-gradle = { module = "org.jmailen.gradle:kotlinter-gradle", version.ref = "kotlinterGradleVersion" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logbackClassicVersion" }
mockk = { module = "io.mockk:mockk", version.ref = "mockkVersion" }
moneta = { module = "org.javamoney:moneta", version.ref = "monetaVersion" }
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4jVersion" }

[plugins]
java-library = { id = "java-library" }
jmailen-kotlinter = { id = "org.jmailen.kotlinter" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinVersion" }
kotlin-library = { id = "kotlin" }
maven-publish = { id = "maven-publish" }
coveralls-jacoco = { id = "com.github.nbaztec.coveralls-jacoco", version = "1.2.15" }
jacocolog = { id = "org.barfuin.gradle.jacocolog", version = "3.0.0" }

pleo-gradle-plugin = { id = "io.pleo.gradle.plugin", version.ref = "pleoGradlePluginVersion" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading