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

Multi Groovy Build #336

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
44 changes: 0 additions & 44 deletions .github/workflows/ci-groovy-3.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/ci-groovy-4.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI Groovy 2.4
name: CI

on:
push:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
if: success() || failure()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
check_name: 'JUnit Test Report G2'
check_name: 'JUnit Test Report'
- name: Archive test classes
uses: actions/upload-artifact@v4
if: failure()
Expand Down
9 changes: 0 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ plugins {
id "io.github.gradle-nexus.publish-plugin"
}

ext {
groovyVersion = project.findProperty("groovyVersion") ?: 'v2'
if (!(groovyVersion in ['v2', 'v3', 'v4']))
throw new GradleException("Unsupported Groovy version $groovyVersion")
}

group 'com.blackbuild.klum.ast'
description 'A transformation for creating convenient configuration model DSLs.'

Expand Down Expand Up @@ -55,9 +49,6 @@ gitPublish {
releaseCheck.doLast {
if (!gradle.includedBuilds.isEmpty())
throw new GradleException("Releasing is not allowed with composite builds. Please release $gradle.includedBuilds separately")

if (rootProject.ext.groovyVersion != "v2")
throw new GradleException("Releasing must be done with Groovy 2.4")
}

evaluationDependsOnChildren()
Expand Down
106 changes: 106 additions & 0 deletions buildSrc/src/main/groovy/klum-ast.base-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
plugins {
id "java-library"
id 'groovy'
id 'jacoco'
id 'signing'
id 'maven-publish'
id 'com.github.hierynomus.license'
}

group rootProject.group

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
withJavadocJar()
withSourcesJar()
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-parameters'
}

jacoco {
toolVersion = "0.8.11"
}

jacocoTestReport {
executionData(tasks.withType(Test))
reports {
xml.required = true
}
}

dependencies {
compileOnly libs.jb.anno
compileOnly libs.groovy.v2

testImplementation libs.jb.anno

testRuntimeOnly libs.bundles.spockRuntime
testRuntimeOnly libs.jpl
}

publishing.publications.configureEach {
suppressPomMetadataWarningsFor('testFixturesApiElements')
suppressPomMetadataWarningsFor('testFixturesRuntimeElements')
pom { pom ->
project.getName()
pom.name = project.name
pom.description = project.description

pom.url = 'https://github.com/klum-dsl/klum-ast.git'

pom.scm {
url = 'https://github.com/klum-dsl/klum-ast.git'
connection = 'scm:git:https://github.com/klum-dsl/klum-ast.git'
developerConnection = 'scm:git:https://github.com/klum-dsl/klum-ast.git'
}

pom.licenses {
license {
name = 'MIT License (MIT)'
url = 'https://opensource.org/licenses/MIT'
distribution = 'repo'
}
}

pom.developers {
developer {
id = 'pauxus'
name = 'Stephan Pauxberger'
email = '[email protected]'
url = 'https://github.com/pauxus'
}
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
}
}
}

afterEvaluate {
signing {
required { gradle.taskGraph.hasTask("publish") || gradle.taskGraph.hasTask("publishToMavenLocal") }
publishing.publications.configureEach {
sign it
}
}
}


license {
header = rootProject.file("LICENSE")
mapping("java", "SLASHSTAR_STYLE")
mapping("groovy", "SLASHSTAR_STYLE")
mapping("gdsl", "SLASHSTAR_STYLE")
exclude("mockup/**")
strictCheck(true)
}

101 changes: 0 additions & 101 deletions buildSrc/src/main/groovy/klum-ast.conventions.gradle

This file was deleted.

61 changes: 61 additions & 0 deletions buildSrc/src/main/groovy/klum-ast.multigroovy-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
plugins {
id "klum-ast.base-conventions"
id 'jvm-test-suite'
}

dependencies {
testImplementation libs.bundles.spock.groovy.v2
}

configurations {
sharedTests
}

configurations.matching { it.name in ["testImplementation", "groovy3TestsImplementation", "groovy4TestsImplementation"]}.configureEach {
extendsFrom(configurations.sharedTests)
}

testing {
suites {
test {
useJUnit()
}

withType(JvmTestSuite).matching { it.name.startsWith("groovy") }.configureEach {
def groovyVersion = it.name.charAt(6)
useSpock(libs.versions.spock."g$groovyVersion")

sources {
groovy {
srcDirs = ['src/test/groovy']
destinationDirectory = file("build/classes/groovy/test-g$groovyVersion")
}
}

dependencies {
implementation project()
implementation libs.jb.anno
implementation libs.spock.junit4."g$groovyVersion"
implementation libs.groovy."v$groovyVersion"
implementation sourceSets.test.output
runtimeOnly libs.bytebuddy
runtimeOnly libs.objenesis
runtimeOnly libs.jpl

}
}
groovy3Tests(JvmTestSuite)
groovy4Tests(JvmTestSuite)
}
}

// Need to add test fixtures as source, since we compile with different spock versions
tasks.withType(GroovyCompile).configureEach {
if (!name.contains("Test") || name.contains("Fixtures")) return
it.source(project(':klum-ast').sourceSets.testFixtures.groovy.srcDirs)
}

tasks.named('check') {
dependsOn(testing.suites.groovy3Tests)
dependsOn(testing.suites.groovy4Tests)
}
Loading