KT-45777: Ignore faulty groovy-2.5.11 jar
Test: The following should pass
- Step 1: ./gradlew publish
- Step 2: ./gradlew publish compileTestKotlin -Pbootstrap.local=true
-Pbootstrap.local.path=/path/to/kotlin/build/repo
-Pkotlin.incremental.useClasspathSnapshot=true
This commit is contained in:
committed by
nataliya.valtman
parent
a6d0fcc676
commit
aea693e309
+12
-12
@@ -31,14 +31,14 @@ object ClasspathEntrySnapshotter {
|
|||||||
ClassFileWithContents(ClassFile(classpathEntry, unixStyleRelativePath), contents)
|
ClassFileWithContents(ClassFile(classpathEntry, unixStyleRelativePath), contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isKnownProblematicClasspathEntry(classpathEntry)) {
|
val snapshots = try {
|
||||||
return ClasspathEntrySnapshot(classes.associateTo(LinkedHashMap()) {
|
ClassSnapshotter.snapshot(classes)
|
||||||
it.classFile.unixStyleRelativePath to ContentHashJavaClassSnapshot(it.contents.md5())
|
} catch (e: Throwable) {
|
||||||
})
|
if (isKnownProblematicClasspathEntry(classpathEntry)) {
|
||||||
|
classes.map { ContentHashJavaClassSnapshot(it.contents.md5()) }
|
||||||
|
} else throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
val snapshots = ClassSnapshotter.snapshot(classes)
|
|
||||||
|
|
||||||
val relativePathsToSnapshotsMap = classes.map { it.classFile.unixStyleRelativePath }.zipToMap(snapshots)
|
val relativePathsToSnapshotsMap = classes.map { it.classFile.unixStyleRelativePath }.zipToMap(snapshots)
|
||||||
return ClasspathEntrySnapshot(relativePathsToSnapshotsMap)
|
return ClasspathEntrySnapshot(relativePathsToSnapshotsMap)
|
||||||
}
|
}
|
||||||
@@ -201,14 +201,14 @@ object ClassSnapshotter {
|
|||||||
|
|
||||||
/** Returns `true` if it is known that the snapshot of the given class can't be created for some reason. */
|
/** Returns `true` if it is known that the snapshot of the given class can't be created for some reason. */
|
||||||
private fun isKnownProblematicClass(classFile: ClassFile): Boolean {
|
private fun isKnownProblematicClass(classFile: ClassFile): Boolean {
|
||||||
if (classFile.classRoot.name.startsWith("groovy-all")
|
if (classFile.classRoot.name.startsWith("groovy")
|
||||||
&& classFile.unixStyleRelativePath.endsWith("\$CollectorHelper.class")
|
&& classFile.unixStyleRelativePath.endsWith("\$CollectorHelper.class")
|
||||||
) {
|
) {
|
||||||
// [FAULTY JAR] In gradle-6.9/lib/groovy-all-1.3-2.5.12.jar, the bytecode of groovy/cli/OptionField\$CollectorHelper.class
|
// [FAULTY JAR] In groovy-all-1.3-2.5.12.jar and groovy-2.5.11.jar, the bytecode of
|
||||||
// indicates that its outer class is groovy/cli/OptionField, but the bytecode of groovy/cli/OptionField.class does not list any
|
// groovy/cli/OptionField\$CollectorHelper.class indicates that its outer class is groovy/cli/OptionField, but the bytecode of
|
||||||
// nested classes.
|
// groovy/cli/OptionField.class does not list any nested classes.
|
||||||
// This happens with a few other CollectorHelper classes in this jar.
|
// This happens with a few other CollectorHelper classes in these jars.
|
||||||
// Therefore, this is a faulty jar, and our snapshotting logic cannot process it.
|
// Therefore, these are faulty jars, and our snapshotting logic cannot process it.
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (classFile.classRoot.name.startsWith("gradle-api")
|
if (classFile.classRoot.name.startsWith("gradle-api")
|
||||||
|
|||||||
Reference in New Issue
Block a user