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

Fix java classes being skipped in AGP >= 3.4 #166

Merged
merged 1 commit into from
Jan 13, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ class GenerationPlugin implements Plugin<Project> {

def classPaths = [
"**/intermediates/classes/${sourcePath}/**",
"**/intermediates/javac/${sourceName}/*/classes/**" // Android Gradle Plugin 3.2.x support.
"**/intermediates/javac/${sourceName}/*/classes/**", // Android Gradle Plugin 3.2.x support.
"**/intermediates/javac/${sourceName}/classes/**" // Android Gradle Plugin 3.4 and 3.5 support.
]

if (isKotlinAndroid(subProject) || isKotlinMultiplatform(subProject)) {
Expand Down Expand Up @@ -373,7 +374,7 @@ class GenerationPlugin implements Plugin<Project> {
protected static boolean isAndroidFeature(final Project project) {
return project.plugins.hasPlugin('com.android.feature')
}

protected static boolean isAndroidDynamicFeature(final Project project) {
return project.plugins.hasPlugin('com.android.dynamic-feature')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,26 @@ class GenerationTest {
assert reports.html.destination.toPath() == Paths.get(project.buildDir.absolutePath, "/reports/jacoco/${flavor}${buildType.capitalize()}")

assert classDirectories.getFrom().first().dir == project.file("build/")
assert contentEquals(classDirectories.getFrom().first().includes, ["**/intermediates/classes/${flavor}/${buildType}/**".toString(), "**/intermediates/javac/${flavor}${buildType.capitalize()}/*/classes/**".toString()])

assert contentEquals(classDirectories.getFrom().first().includes, [
"**/intermediates/classes/${flavor}/${buildType}/**".toString(),
"**/intermediates/javac/${flavor}${buildType.capitalize()}/*/classes/**".toString(),
"**/intermediates/javac/${flavor}${buildType.capitalize()}/classes/**".toString()
])

if (hasKotlin(project)) {
assert contentEquals(classDirectories.getFrom().first().includes, ["**/intermediates/classes/${flavor}/${buildType}/**".toString(), "**/intermediates/javac/${flavor}${buildType.capitalize()}/*/classes/**".toString(),
"**/tmp/kotlin-classes/${buildType}/**".toString(), "**/tmp/kotlin-classes/${flavor}${buildType.capitalize()}/**".toString()])
assert contentEquals(classDirectories.getFrom().first().includes, [
"**/intermediates/classes/${flavor}/${buildType}/**",
"**/intermediates/javac/${flavor}${buildType.capitalize()}/*/classes/**",
"**/intermediates/javac/${flavor}${buildType.capitalize()}/classes/**",
"**/tmp/kotlin-classes/${buildType}/**",
"**/tmp/kotlin-classes/${flavor}${buildType.capitalize()}/**"])
} else {
assert contentEquals(classDirectories.getFrom().first().includes, ["**/intermediates/classes/${flavor}/${buildType}/**".toString(), "**/intermediates/javac/${flavor}${buildType.capitalize()}/*/classes/**".toString()])
assert contentEquals(classDirectories.getFrom().first().includes, [
"**/intermediates/classes/${flavor}/${buildType}/**".toString(),
"**/intermediates/javac/${flavor}${buildType.capitalize()}/*/classes/**".toString(),
"**/intermediates/javac/${flavor}${buildType.capitalize()}/classes/**".toString()
])
}

assert taskDependsOn(task, "test${flavor.capitalize()}${buildType.capitalize()}UnitTest")
Expand Down Expand Up @@ -345,9 +358,18 @@ class GenerationTest {

assert classDirectories.getFrom().first().dir == project.file("build/")
if (hasKotlin(project)) {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/debug/**', '**/intermediates/javac/debug/*/classes/**', '**/tmp/kotlin-classes/debug/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/debug/**',
'**/intermediates/javac/debug/*/classes/**',
"**/intermediates/javac/debug/classes/**",
'**/tmp/kotlin-classes/debug/**'
])
} else {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/debug/**', '**/intermediates/javac/debug/*/classes/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/debug/**',
'**/intermediates/javac/debug/*/classes/**',
"**/intermediates/javac/debug/classes/**"
])
}

assert taskDependsOn(debugTask, 'testDebugUnitTest')
Expand Down Expand Up @@ -385,9 +407,18 @@ class GenerationTest {

assert classDirectories.getFrom().first().dir == project.file("build/")
if (hasKotlin(project)) {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/debug/**', '**/intermediates/javac/debug/*/classes/**', '**/tmp/kotlin-classes/debug/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/debug/**',
'**/intermediates/javac/debug/*/classes/**',
"**/intermediates/javac/debug/classes/**",
'**/tmp/kotlin-classes/debug/**'
])
} else {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/debug/**', '**/intermediates/javac/debug/*/classes/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/debug/**',
'**/intermediates/javac/debug/*/classes/**',
"**/intermediates/javac/debug/classes/**",
])
}

assert taskDependsOn(debugTaskCombined, 'testDebugUnitTest')
Expand Down Expand Up @@ -429,9 +460,18 @@ class GenerationTest {

assert classDirectories.getFrom().first().dir == project.file("build/")
if (hasKotlin(project)) {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/release/**', '**/intermediates/javac/release/*/classes/**', '**/tmp/kotlin-classes/release/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/release/**',
'**/intermediates/javac/release/*/classes/**',
"**/intermediates/javac/release/classes/**",
'**/tmp/kotlin-classes/release/**'
])
} else {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/release/**', '**/intermediates/javac/release/*/classes/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/release/**',
'**/intermediates/javac/release/*/classes/**',
"**/intermediates/javac/release/classes/**"
])
}

assert taskDependsOn(releaseTask, 'testReleaseUnitTest')
Expand Down Expand Up @@ -470,9 +510,18 @@ class GenerationTest {

assert classDirectories.getFrom().first().dir == project.file("build/")
if (hasKotlin(project)) {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/release/**', '**/intermediates/javac/release/*/classes/**', '**/tmp/kotlin-classes/release/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/release/**',
'**/intermediates/javac/release/*/classes/**',
"**/intermediates/javac/release/classes/**",
'**/tmp/kotlin-classes/release/**'
])
} else {
assert contentEquals(classDirectories.getFrom().first().includes, ['**/intermediates/classes/release/**', '**/intermediates/javac/release/*/classes/**'])
assert contentEquals(classDirectories.getFrom().first().includes, [
'**/intermediates/classes/release/**',
'**/intermediates/javac/release/*/classes/**',
"**/intermediates/javac/release/classes/**",
])
}

assert taskDependsOn(releaseTaskCombined, 'testReleaseUnitTest')
Expand Down