Skip to content

Commit

Permalink
gradle intellij platform 2.* build migration CI issues.
Browse files Browse the repository at this point in the history
- re-configure jacocoTestReport coverage
  • Loading branch information
yaronyam committed Sep 14, 2024
1 parent eef79f1 commit f8304a4
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
# uses: gradle/gradle-build-action@v2
# with:
run: |
./gradlew check jacocoTestReport jacocoIntTestReport -PideaVersion=${{ inputs.IDEA_VERSION }} -PscalaPluginVersion=${{ inputs.SCALA_PLUGIN_VERSION }} -PenableIdeaGroovyPlugin=${{ inputs.WITH_IDEA_PLUGINS }} -PenableIdeaScalaPlugin=${{ inputs.WITH_IDEA_PLUGINS }}
# ./gradlew check jacocoTestReport jacocoIntTestReport -PideaVersion=${{ inputs.IDEA_VERSION }} -PscalaPluginVersion=${{ inputs.SCALA_PLUGIN_VERSION }} -PenableIdeaGroovyPlugin=${{ inputs.WITH_IDEA_PLUGINS }} -PenableIdeaScalaPlugin=${{ inputs.WITH_IDEA_PLUGINS }}
./gradlew check jacocoTestReport -PideaVersion=${{ inputs.IDEA_VERSION }} -PscalaPluginVersion=${{ inputs.SCALA_PLUGIN_VERSION }} -PenableIdeaGroovyPlugin=${{ inputs.WITH_IDEA_PLUGINS }} -PenableIdeaScalaPlugin=${{ inputs.WITH_IDEA_PLUGINS }}

- name: Test Report
uses: dorny/test-reporter@v1
Expand Down
35 changes: 30 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ plugins {
id("org.jetbrains.intellij.platform") version "2.0.1"
}

//apply plugin: 'jacoco'
//apply plugin: "org.jetbrains.intellij.platform"
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'java'

def enableIdeaGroovyPlugin=Boolean.valueOf(enableIdeaGroovyPlugin)
def groovyOn = enableIdeaGroovyPlugin ? 'enabled':'disabled'
Expand Down Expand Up @@ -88,7 +86,18 @@ allprojects {
useJUnitPlatform()
}
}

jacocoTestReport {
dependsOn test
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
html.required = !isRunInCI
}
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: 'com/weirddev/testme/intellij/ui/**')
})
outputs.upToDateWhen { false } // Always generate report
}
def shouldInstrumentCode = !Boolean.valueOf(System.getProperty('skipCodeInstrumentation', 'false'))
intellijPlatform {
projectName = 'TestMe'
Expand Down Expand Up @@ -168,7 +177,23 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

//tasks.register('jacocoRootReport', JacocoReport) {
// description = 'Generates an aggregate report from all subprojects'
// dependsOn check, jacocoMerge
// additionalSourceDirs.from = files(testedProjects.sourceSets.main.allSource.srcDirs)
// sourceDirectories.from = files(testedProjects.sourceSets.main.allSource.srcDirs)
//// classDirectories.from = files(testedProjects.sourceSets.main.output)
//// classDirectories.setFrom(instrumentCode)
// classDirectories.setFrom(testedProjects.collect { it.instrumentCode })
// //https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin-faq.html#jacoco-reports-0-coverage
//// executionData files(testedProjects*.tasks.withType(Test).executionData)
// executionData jacocoMerge.destinationFile
// reports {
// xml.enabled true //isRunInCI
// html.enabled !isRunInCI
// html.destination file("${buildDir}/jacocoHtml")
// }
//}
def javadocHeader = ""
task templateContextJavadocs(type: Javadoc, description: 'Generate javadocs for template context', group: 'Documentation') {
dependsOn delombok
Expand Down
15 changes: 15 additions & 0 deletions testme-intellij-common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'org.jetbrains.intellij.platform.module'
id 'jacoco'
}
apply plugin: "io.freefair.lombok"
apply plugin: 'groovy'
Expand All @@ -26,4 +27,18 @@ dependencies {
testImplementation 'org.mockito:mockito-core:4.3.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
testImplementation("org.spockframework:spock-core:2.3-groovy-3.0")
}
test {
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
}
outputs.upToDateWhen { false } // Always generate report
}
15 changes: 15 additions & 0 deletions testme-intellij-groovy/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'org.jetbrains.intellij.platform.module'
id 'jacoco'
}

repositories {
Expand Down Expand Up @@ -28,4 +29,18 @@ dependencies {
exclude group:'org.jetbrains.plugins', module: 'properties'
exclude group:'org.jetbrains.plugins', module: 'Groovy'
}
}
test {
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
}
outputs.upToDateWhen { false } // Always generate report
}
16 changes: 16 additions & 0 deletions testme-intellij-scala/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'org.jetbrains.intellij.platform.module'
id 'jacoco'
}
apply plugin: 'groovy'
repositories {
Expand Down Expand Up @@ -30,4 +31,19 @@ dependencies {
}
compileOnly group: 'org.scala-lang', name: 'scala-library', version: '2.11.12'
testImplementation("org.spockframework:spock-core:2.3-groovy-3.0")
}

test {
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
classDirectories.setFrom(instrumentCode)
reports {
xml.required = true
}
outputs.upToDateWhen { false } // Always generate report
}

0 comments on commit f8304a4

Please sign in to comment.