I am using Jacoco for code coverage in Android applciations. My jacoco gradle script looks as follows:
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.7.5.201505241946"
}
project.afterEvaluate {
// Grab all build types and product flavors
def buildTypes = android.buildTypes.collect { type -> type.name }
def productFlavors = android.productFlavors.collect { flavor -> flavor.name }
// When no product flavors defined, use empty
if (!productFlavors) productFlavors.add('')
productFlavors.each { productFlavorName ->
buildTypes.each { buildTypeName ->
def sourceName, sourcePath
if (!productFlavorName) {
sourceName = sourcePath = "${buildTypeName}"
} else {
sourceName = "${productFlavorName}${buildTypeName.capitalize()}"
sourcePath = "${productFlavorName}/${buildTypeName}"
}
def testTaskName = "test${sourceName.capitalize()}UnitTest"
// Create coverage task of form 'testFlavorTypeCoverage' depending on 'testFlavorTypeUnitTest'
task "${testTaskName}Coverage" (type:JacocoReport, dependsOn: "$testTaskName") {
group = "Reporting"
description = "Generate Jacoco coverage reports on the ${sourceName.capitalize()} build."
classDirectories = fileTree(
dir: "${project.buildDir}/intermediates/classes/${sourcePath}",
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/*$ViewBinder*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)
def coverageSourceDirs = [
"src/main/java",
"src/$productFlavorName/java",
"src/$buildTypeName/java"
]
additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files("${project.buildDir}/jacoco/${testTaskName}.exec")
reports {
xml.enabled = true
html.enabled = true
html.destination = "${System.getenv('View_Root')}/_Build/Jacoco"
}
}
}
}
}
However when I build the application and run jacoco tasks, it creates the following tmp folder
TestCodeCoverageGradle\app\build\tmp\expandedArchives\org.jacoco.agent-0.7.5.201505241946.jar_4kl8n0og88tqsbq2l6n2wtmaa
The name is too long for workspace to be deleted on a build server.
Is there a way that I can configure to delete these tmp folder or create tmp folder which has smaller names?
I greatly appreciate any inputs.
Thanks,
ST
Hello Sahana,
it looks like your build server is running on Windows. Back in the day I always set my basic workspace directory to sth. like C:\\ws to make sure I do not run into the 255 character path limit.
Regards
Mirko
--
Sent from my mobile
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/6b80ccb5-a668-423b-a0ee-5fe97e6d231a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.