提交 7c09fc19 编写于 作者: S Sam Judd

Avoid including default source sets in repackaged compiler jar.

Unless you override the jar task completely, any files you specified are
added to the original files, not replaced. To make matters worse, gradle
does not fail jar tasks when duplicate classes are added by default.

We’ve fixed the immediate issue with compiler’s jar file by excluding classes that do not originate from our repackaged/proguarded jar to 
avoid duplicate class files.We’ve hopefully also prevented future occurrences by forcing all jar tasks in the project to fail by default 
if duplicate classes are added.

Fixes #2452.
上级 7614e100
......@@ -74,10 +74,17 @@ task proguard(type: ProGuardTask, dependsOn: tasks.jarjar) {
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
}
// Create the standard jar artifact based on our compiled, repackaged and proguarded jar.
// Replace the contents of the standard jar task with those from our our compiled, repackaged and
// proguarded jar. Replacing the task itself is possible and looks simpler, but requires
// reconstructing the task dependency chain and is more complex in practice.
jar {
dependsOn proguard
from zipTree(proguardedJar)
exclude { entry ->
sourceSets.main.output.files*.absolutePath.any {
entry.file.absolutePath.startsWith it
}
}
}
apply from: "${rootProject.projectDir}/scripts/upload.gradle"
......@@ -26,6 +26,11 @@ subprojects {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
// Avoid issues like #2452.
tasks.withType(Jar) {
duplicatesStrategy = DuplicatesStrategy.FAIL
}
}
subprojects { project ->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册