Skip to content

Commit

Permalink
feat: update build to be compatible with gradle 9.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfaller committed Nov 13, 2024
1 parent 82a1879 commit a2aff2f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 77 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/build-test-gumtree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ jobs:
with:
name: benchmark-report
path: benchmark/build/reports/analysis.html
- name: generate jacoco report
run: ./gradlew jacocoRootReport
- name: upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: build/reports/jacoco/jacocoRootReport/html/
- name: generate test report
run: ./gradlew testReport
- name: upload test report
uses: actions/upload-artifact@v4
with:
name: test-report
path: build/reports/tests
- name: upload snapshot package
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
Expand Down
43 changes: 6 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'jacoco'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

nexusPublishing {
Expand All @@ -25,8 +25,11 @@ allprojects {

subprojects {
apply plugin: 'java'
sourceCompatibility = '17'
targetCompatibility = '17'

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

compileJava {
options.compilerArgs << '-Xlint:deprecation'
Expand Down Expand Up @@ -112,40 +115,6 @@ configure(subprojects.findAll { it.name.startsWith('gen.antlr4') }) {
}
}

def jacocoProjectsNames = ['core', 'gen.jdt', 'gen.c', 'gen.ruby', 'gen.js', 'gen.srcml', 'gen.css']
def jacocoProjects = subprojects.findAll { it.name in jacocoProjectsNames }
configure(jacocoProjects) {
apply plugin: 'jacoco'

jacocoTestReport {
reports {
html.required = true
xml.required = true
csv.required = false
}
}
}

task testReport(type: TestReport) {
destinationDirectory.set(file("$layout.buildDirectory/reports/tests"))
reportOn subprojects*.test
}

task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn(jacocoProjects.test)

getAdditionalSourceDirs().from = files(jacocoProjects.sourceSets.main.allSource.srcDirs)
getSourceDirectories().from = files(jacocoProjects.sourceSets.main.allSource.srcDirs)
getClassDirectories().from = files(jacocoProjects.sourceSets.main.output)
getExecutionData().from = files(jacocoProjects.jacocoTestReport.executionData)

reports {
html.required = true
xml.required = true
}
}

def projectDescriptions = [
'client': 'GumTree abstract client module.',
'client.diff': 'GumTree diff client.',
Expand Down
28 changes: 10 additions & 18 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'info.solidsoft.pitest' version '1.7.0'
id 'jacoco'
}

description = 'GumTree core module.'
Expand All @@ -11,23 +11,15 @@ dependencies {
implementation 'org.jgrapht:jgrapht-core:1.5.1'
}

pitest {
targetClasses = ['com.github.gumtreediff.*']
targetTests = ['com.github.gumtreediff.test.TestTree',
'com.github.gumtreediff.test.TestMetadata',
'com.github.gumtreediff.test.TestTreeUtils',
'com.github.gumtreediff.test.TestMappingStore',
'com.github.gumtreediff.test.TestTreeClassifier']
threads = 4
outputFormats = ['XML', 'HTML']
timestampedReports = false
junit5PluginVersion = '0.15'
test {
finalizedBy jacocoTestReport
}

allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
jacocoTestReport {
dependsOn test
reports {
html.required = true
xml.required = false
csv.required = false
}
}
}
14 changes: 10 additions & 4 deletions dist-native/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version "8.1.1"
id 'com.gradleup.shadow' version '8.3.5'
id 'application'
}

Expand Down Expand Up @@ -31,9 +31,15 @@ distributions {
}
}

mainClassName = 'com.github.gumtreediff.client.Run'
applicationName = 'gumtree'
archivesBaseName = 'gumtree'
application {
mainClass = 'com.github.gumtreediff.client.Run'
applicationName = 'gumtree'
}

tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
archiveBaseName.set('gumtree')
}

shadowDistZip.enabled = true
distTar.enabled = false
distZip.enabled = false
Expand Down
14 changes: 10 additions & 4 deletions dist/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version "8.1.1"
id 'com.gradleup.shadow' version '8.3.5'
id 'application'
}

Expand Down Expand Up @@ -45,9 +45,15 @@ distributions {
}
}

mainClassName = 'com.github.gumtreediff.client.Run'
applicationName = 'gumtree'
archivesBaseName = 'gumtree'
application {
mainClass = 'com.github.gumtreediff.client.Run'
applicationName = 'gumtree'
}

tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
archiveBaseName.set('gumtree')
}

shadowDistZip.enabled = true
distTar.enabled = false
distZip.enabled = false
Expand Down

0 comments on commit a2aff2f

Please sign in to comment.