Update BCV to 0.12.0; use JAR dump mode for kotlinx-metadata-jvm and

therefore remove BCV from kotlinx-metadata project.

Introduce @IgnoreInApiDump to workaround issue#104 in BCV.
This commit is contained in:
Leonid Startsev
2022-10-24 18:22:18 +02:00
committed by Space Team
parent 2b2e749d1f
commit 2aede50306
11 changed files with 1258 additions and 1222 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ plugins {
id("jps-compatible")
id("org.jetbrains.gradle.plugin.idea-ext")
id("org.gradle.crypto.checksum") version "1.2.0"
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.11.0" apply false
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.12.0" apply false
signing
}
+6
View File
@@ -8555,6 +8555,12 @@
<sha256 value="3419b5b189537ad322080b18c9bf023f9b47219076945abd35c4a4a1cf55bf89" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlinx" name="binary-compatibility-validator" version="0.12.0">
<artifact name="binary-compatibility-validator-0.12.0.jar">
<md5 value="f7faa3421e7f75ef97c4bf4780bcfdf2" origin="Generated by Gradle"/>
<sha256 value="1d7d5b66cf783af164f321c43a9923e8eb48129c8c670230c1d2fd084f76aa64" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlinx" name="binary-compatibility-validator" version="0.7.1">
<artifact name="binary-compatibility-validator-0.7.1.jar">
<md5 value="f188e849f683da58684012bbdc732abc" origin="Generated by Gradle"/>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,6 @@ description = "Kotlin metadata manipulation library"
plugins {
kotlin("jvm")
id("jps-compatible")
id("org.jetbrains.kotlinx.binary-compatibility-validator")
}
sourceSets {
File diff suppressed because it is too large Load Diff
@@ -54,7 +54,7 @@ if (deployVersion != null) {
publish()
}
runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
val shadowJarTask = runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
callGroovy("manifestAttributes", manifest, project)
manifest.attributes["Implementation-Version"] = archiveVersion
@@ -67,7 +67,17 @@ runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
val test by tasks
test.dependsOn("shadowJar")
tasks["check"].dependsOn(":kotlinx-metadata:check")
tasks.apiBuild {
inputJar.value(shadowJarTask.flatMap { it.archiveFile })
}
apiValidation {
ignoredPackages.add("kotlinx.metadata.internal")
nonPublicMarkers.addAll(listOf(
"kotlinx.metadata.internal.IgnoreInApiDump",
"kotlinx.metadata.jvm.internal.IgnoreInApiDump"
))
}
sourcesJar {
for (dependency in shadows.dependencies) {
@@ -9,6 +9,7 @@ package kotlinx.metadata.jvm
import kotlinx.metadata.*
import kotlinx.metadata.impl.accept
import kotlinx.metadata.jvm.internal.IgnoreInApiDump
import kotlinx.metadata.jvm.KotlinClassMetadata.Companion.COMPATIBLE_METADATA_VERSION
import org.jetbrains.kotlin.metadata.jvm.JvmModuleProtoBuf
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
@@ -25,7 +26,7 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.serializeToByteArray
* @property bytes the byte array representing the contents of a `.kotlin_module` file
*/
class KotlinModuleMetadata(@Suppress("CanBeParameter", "MemberVisibilityCanBePrivate") val bytes: ByteArray) {
internal val data: ModuleMapping = ModuleMapping.loadModuleMapping(
@get:IgnoreInApiDump internal val data: ModuleMapping = ModuleMapping.loadModuleMapping(
bytes, javaClass.name, skipMetadataVersionCheck = false, isJvmPackageNameSupported = true
) {
// TODO: report incorrect versions of modules
@@ -0,0 +1,16 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlinx.metadata.jvm.internal
/**
* Workaround for https://github.com/Kotlin/binary-compatibility-validator/issues/104:
*
* When internal declaration has some classes that were relocated by shadowJar plugin,
* binary-compatibility-validator can't filter them out.
* Therefore, we explicitly exclude declarations marked with this annotation.
*/
@Retention(AnnotationRetention.BINARY)
internal annotation class IgnoreInApiDump
@@ -5,6 +5,7 @@
package kotlinx.metadata
import kotlinx.metadata.internal.IgnoreInApiDump
import org.jetbrains.kotlin.metadata.ProtoBuf.*
import org.jetbrains.kotlin.metadata.ProtoBuf.Class.Kind as ClassKind
import org.jetbrains.kotlin.metadata.deserialization.Flags as F
@@ -38,8 +39,10 @@ import org.jetbrains.kotlin.metadata.deserialization.Flags as F
* @see flagsOf
*/
class Flag(private val offset: Int, private val bitWidth: Int, private val value: Int) {
@IgnoreInApiDump
internal constructor(field: F.FlagField<*>, value: Int) : this(field.offset, field.bitWidth, value)
@IgnoreInApiDump
internal constructor(field: F.BooleanFlagField) : this(field, 1)
internal operator fun plus(flags: Flags): Flags =
@@ -9,6 +9,7 @@ package kotlinx.metadata.impl
import kotlinx.metadata.*
import kotlinx.metadata.Flags // Don't remove this import. See KT-45553
import kotlinx.metadata.impl.extensions.MetadataExtensions
import kotlinx.metadata.internal.IgnoreInApiDump
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.*
import kotlin.contracts.ExperimentalContracts
@@ -23,7 +24,7 @@ interface ReadContextExtension
class ReadContext(
val strings: NameResolver,
val types: TypeTable,
internal val versionRequirements: VersionRequirementTable,
@get:IgnoreInApiDump internal val versionRequirements: VersionRequirementTable,
private val parent: ReadContext? = null,
val contextExtensions: List<ReadContextExtension> = emptyList()
) {
@@ -0,0 +1,16 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlinx.metadata.internal
/**
* Workaround for https://github.com/Kotlin/binary-compatibility-validator/issues/104:
*
* When internal declaration has some classes that were relocated by shadowJar plugin,
* binary-compatibility-validator can't filter them out.
* Therefore, we explicitly exclude declarations marked with this annotation.
*/
@Retention(AnnotationRetention.BINARY)
internal annotation class IgnoreInApiDump