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

Add more vertical spacing to KLib dumps #225

Merged
merged 7 commits into from
Jun 11, 2024
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.dump text eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private fun KlibVerificationTests.checkKlibDump(

val expected = readFileList(expectedDumpFileName)

Assertions.assertThat(generatedDump.readText()).isEqualToIgnoringNewLines(expected)
Assertions.assertThat(generatedDump.readText()).isEqualTo(expected)
}

internal class KlibVerificationTests : BaseKotlinGradleTest() {
Expand Down Expand Up @@ -155,7 +155,7 @@ internal class KlibVerificationTests : BaseKotlinGradleTest() {
assertTrue(jvmApiDump.exists(), "No API dump for JVM")

val jvmExpected = readFileList("/examples/classes/AnotherBuildConfig.dump")
Assertions.assertThat(jvmApiDump.readText()).isEqualToIgnoringNewLines(jvmExpected)
Assertions.assertThat(jvmApiDump.readText()).isEqualTo(jvmExpected)
}
}

Expand Down Expand Up @@ -357,6 +357,28 @@ internal class KlibVerificationTests : BaseKotlinGradleTest() {
)
}

@Test
fun `check sorting for target-specific declarations`() {
val runner = test {
baseProjectSetting()
addToSrcSet("/examples/classes/TopLevelDeclarations.kt")
addToSrcSet("/examples/classes/TopLevelDeclarationsExp.kt")
addToSrcSet("/examples/classes/TopLevelDeclarationsLinuxOnly.kt", "linuxMain")
addToSrcSet("/examples/classes/TopLevelDeclarationsMingwOnly.kt", "mingwMain")
addToSrcSet("/examples/classes/TopLevelDeclarationsAndroidOnly.kt", "androidNativeMain")


runner {
arguments.add(":klibApiDump")
}
}

checkKlibDump(
runner.build(), "/examples/classes/TopLevelDeclarations.klib.diverging.dump",
dumpTask = ":klibApiDump"
)
}

@Test
fun `infer a dump for a target with custom name`() {
val runner = test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}

// Targets: [linux]
final fun (org.different.pack/BuildConfig).org.different.pack/linuxArm64Specific(): kotlin/Int // org.different.pack/linuxArm64Specific|[email protected](){}[0]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]
final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}

// Targets: [linux]
final fun (org.different.pack/BuildConfig).org.different.pack/linuxArm64Specific(): kotlin/Int // org.different.pack/linuxArm64Specific|[email protected](){}[0]
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
}

// Targets: [linuxArm64]
final fun (org.different.pack/BuildConfig).org.different.pack/linuxArm64Specific(): kotlin/Int // org.different.pack/linuxArm64Specific|[email protected](){}[0]
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
// Library unique name: <testproject>
final class org.different.pack/BuildConfig { // org.different.pack/BuildConfig|null[0]
constructor <init>() // org.different.pack/BuildConfig.<init>|<init>(){}[0]

final val p1 // org.different.pack/BuildConfig.p1|{}p1[0]
final fun <get-p1>(): kotlin/Int // org.different.pack/BuildConfig.p1.<get-p1>|<get-p1>(){}[0]

final fun f1(): kotlin/Int // org.different.pack/BuildConfig.f1|f1(){}[0]
final fun f2(): kotlin/Int // org.different.pack/BuildConfig.f2|f2(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,26 @@
// Library unique name: <testproject>
final class foo.api/ClassInPublicPackage { // foo.api/ClassInPublicPackage|null[0]
constructor <init>() // foo.api/ClassInPublicPackage.<init>|<init>(){}[0]

final class Inner { // foo.api/ClassInPublicPackage.Inner|null[0]
constructor <init>() // foo.api/ClassInPublicPackage.Inner.<init>|<init>(){}[0]
}
}

final class foo/ClassWithPublicMarkers { // foo/ClassWithPublicMarkers|null[0]
constructor <init>() // foo/ClassWithPublicMarkers.<init>|<init>(){}[0]

final class MarkedClass { // foo/ClassWithPublicMarkers.MarkedClass|null[0]
constructor <init>() // foo/ClassWithPublicMarkers.MarkedClass.<init>|<init>(){}[0]

final val bar1 // foo/ClassWithPublicMarkers.MarkedClass.bar1|{}bar1[0]
final fun <get-bar1>(): kotlin/Int // foo/ClassWithPublicMarkers.MarkedClass.bar1.<get-bar1>|<get-bar1>(){}[0]
}

final class NotMarkedClass { // foo/ClassWithPublicMarkers.NotMarkedClass|null[0]
constructor <init>() // foo/ClassWithPublicMarkers.NotMarkedClass.<init>|<init>(){}[0]
}

final var bar1 // foo/ClassWithPublicMarkers.bar1|{}bar1[0]
final fun <get-bar1>(): kotlin/Int // foo/ClassWithPublicMarkers.bar1.<get-bar1>|<get-bar1>(){}[0]
final fun <set-bar1>(kotlin/Int) // foo/ClassWithPublicMarkers.bar1.<set-bar1>|<set-bar1>(kotlin.Int){}[0]
Expand All @@ -34,12 +40,15 @@ final class foo/ClassWithPublicMarkers { // foo/ClassWithPublicMarkers|null[0]
final fun <get-notMarkedPublic>(): kotlin/Int // foo/ClassWithPublicMarkers.notMarkedPublic.<get-notMarkedPublic>|<get-notMarkedPublic>(){}[0]
final fun <set-notMarkedPublic>(kotlin/Int) // foo/ClassWithPublicMarkers.notMarkedPublic.<set-notMarkedPublic>|<set-notMarkedPublic>(kotlin.Int){}[0]
}

open annotation class foo/PublicClass : kotlin/Annotation { // foo/PublicClass|null[0]
constructor <init>() // foo/PublicClass.<init>|<init>(){}[0]
}

open annotation class foo/PublicField : kotlin/Annotation { // foo/PublicField|null[0]
constructor <init>() // foo/PublicField.<init>|<init>(){}[0]
}

open annotation class foo/PublicProperty : kotlin/Annotation { // foo/PublicProperty|null[0]
constructor <init>() // foo/PublicProperty.<init>|<init>(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
// Library unique name: <testproject>
final class /Generated { // /Generated|null[0]
constructor <init>() // /Generated.<init>|<init>(){}[0]

final fun helloCreator(): kotlin/Int // /Generated.helloCreator|helloCreator(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
final class foo/ClassWithProperties { // foo/ClassWithProperties|null[0]
constructor <init>() // foo/ClassWithProperties.<init>|<init>(){}[0]
}

open annotation class foo/HiddenField : kotlin/Annotation { // foo/HiddenField|null[0]
constructor <init>() // foo/HiddenField.<init>|<init>(){}[0]
}

open annotation class foo/HiddenProperty : kotlin/Annotation { // foo/HiddenProperty|null[0]
constructor <init>() // foo/HiddenProperty.<init>|<init>(){}[0]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// Library unique name: <testproject>
final class subclasses/A { // subclasses/A|null[0]
constructor <init>() // subclasses/A.<init>|<init>(){}[0]

final class D { // subclasses/A.D|null[0]
constructor <init>() // subclasses/A.D.<init>|<init>(){}[0]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,90 +9,120 @@
open annotation class examples.classes/A : kotlin/Annotation { // examples.classes/A|null[0]
constructor <init>() // examples.classes/A.<init>|<init>(){}[0]
}

open annotation class examples.classes/AA : kotlin/Annotation { // examples.classes/AA|null[0]
constructor <init>() // examples.classes/AA.<init>|<init>(){}[0]
}

open annotation class examples.classes/AAA : kotlin/Annotation { // examples.classes/AAA|null[0]
constructor <init>() // examples.classes/AAA.<init>|<init>(){}[0]
}

final enum class examples.classes/E : kotlin/Enum<examples.classes/E> { // examples.classes/E|null[0]
enum entry A // examples.classes/E.A|null[0]
enum entry B // examples.classes/E.B|null[0]
enum entry C // examples.classes/E.C|null[0]

final val entries // examples.classes/E.entries|#static{}entries[0]
final fun <get-entries>(): kotlin.enums/EnumEntries<examples.classes/E> // examples.classes/E.entries.<get-entries>|<get-entries>#static(){}[0]

final fun valueOf(kotlin/String): examples.classes/E // examples.classes/E.valueOf|valueOf#static(kotlin.String){}[0]
final fun values(): kotlin/Array<examples.classes/E> // examples.classes/E.values|values#static(){}[0]
}

final enum class examples.classes/EE : kotlin/Enum<examples.classes/EE> { // examples.classes/EE|null[0]
enum entry AA // examples.classes/EE.AA|null[0]
enum entry BB // examples.classes/EE.BB|null[0]
enum entry CC // examples.classes/EE.CC|null[0]

final val entries // examples.classes/EE.entries|#static{}entries[0]
final fun <get-entries>(): kotlin.enums/EnumEntries<examples.classes/EE> // examples.classes/EE.entries.<get-entries>|<get-entries>#static(){}[0]

final fun valueOf(kotlin/String): examples.classes/EE // examples.classes/EE.valueOf|valueOf#static(kotlin.String){}[0]
final fun values(): kotlin/Array<examples.classes/EE> // examples.classes/EE.values|values#static(){}[0]
}

abstract fun interface examples.classes/FI { // examples.classes/FI|null[0]
abstract fun a() // examples.classes/FI.a|a(){}[0]
}

abstract interface examples.classes/I // examples.classes/I|null[0]

abstract interface examples.classes/II // examples.classes/II|null[0]

abstract class examples.classes/AC { // examples.classes/AC|null[0]
constructor <init>() // examples.classes/AC.<init>|<init>(){}[0]

abstract fun a() // examples.classes/AC.a|a(){}[0]
final fun b() // examples.classes/AC.b|b(){}[0]
}

final class examples.classes/C { // examples.classes/C|null[0]
constructor <init>(kotlin/Any) // examples.classes/C.<init>|<init>(kotlin.Any){}[0]

final val v // examples.classes/C.v|{}v[0]
final fun <get-v>(): kotlin/Any // examples.classes/C.v.<get-v>|<get-v>(){}[0]

final fun m() // examples.classes/C.m|m(){}[0]
}

final class examples.classes/D { // examples.classes/D|null[0]
constructor <init>(kotlin/Int) // examples.classes/D.<init>|<init>(kotlin.Int){}[0]

final val x // examples.classes/D.x|{}x[0]
final fun <get-x>(): kotlin/Int // examples.classes/D.x.<get-x>|<get-x>(){}[0]

final fun component1(): kotlin/Int // examples.classes/D.component1|component1(){}[0]
final fun copy(kotlin/Int =...): examples.classes/D // examples.classes/D.copy|copy(kotlin.Int){}[0]
final fun equals(kotlin/Any?): kotlin/Boolean // examples.classes/D.equals|equals(kotlin.Any?){}[0]
final fun hashCode(): kotlin/Int // examples.classes/D.hashCode|hashCode(){}[0]
final fun toString(): kotlin/String // examples.classes/D.toString|toString(){}[0]
}

final class examples.classes/IC : examples.classes/II { // examples.classes/IC|null[0]
constructor <init>() // examples.classes/IC.<init>|<init>(){}[0]
}

final class examples.classes/Outer { // examples.classes/Outer|null[0]
constructor <init>() // examples.classes/Outer.<init>|<init>(){}[0]

final class Nested { // examples.classes/Outer.Nested|null[0]
constructor <init>() // examples.classes/Outer.Nested.<init>|<init>(){}[0]

final enum class NE : kotlin/Enum<examples.classes/Outer.Nested.NE> { // examples.classes/Outer.Nested.NE|null[0]
enum entry A // examples.classes/Outer.Nested.NE.A|null[0]
enum entry B // examples.classes/Outer.Nested.NE.B|null[0]
enum entry C // examples.classes/Outer.Nested.NE.C|null[0]

final val entries // examples.classes/Outer.Nested.NE.entries|#static{}entries[0]
final fun <get-entries>(): kotlin.enums/EnumEntries<examples.classes/Outer.Nested.NE> // examples.classes/Outer.Nested.NE.entries.<get-entries>|<get-entries>#static(){}[0]

final fun valueOf(kotlin/String): examples.classes/Outer.Nested.NE // examples.classes/Outer.Nested.NE.valueOf|valueOf#static(kotlin.String){}[0]
final fun values(): kotlin/Array<examples.classes/Outer.Nested.NE> // examples.classes/Outer.Nested.NE.values|values#static(){}[0]
}

final inner class Inner { // examples.classes/Outer.Nested.Inner|null[0]
constructor <init>() // examples.classes/Outer.Nested.Inner.<init>|<init>(){}[0]
}

final inner class YetAnotherInner { // examples.classes/Outer.Nested.YetAnotherInner|null[0]
constructor <init>() // examples.classes/Outer.Nested.YetAnotherInner.<init>|<init>(){}[0]
}
}
}

open class examples.classes/OC { // examples.classes/OC|null[0]
constructor <init>(kotlin/Int) // examples.classes/OC.<init>|<init>(kotlin.Int){}[0]
constructor <init>(kotlin/Long) // examples.classes/OC.<init>|<init>(kotlin.Long){}[0]
constructor <init>(kotlin/String) // examples.classes/OC.<init>|<init>(kotlin.String){}[0]

final val ix // examples.classes/OC.ix|{}ix[0]
final fun <get-ix>(): kotlin/Int // examples.classes/OC.ix.<get-ix>|<get-ix>(){}[0]
final val iy // examples.classes/OC.iy|{}iy[0]
final fun <get-iy>(): kotlin/Long // examples.classes/OC.iy.<get-iy>|<get-iy>(){}[0]
final val iz // examples.classes/OC.iz|{}iz[0]
final fun <get-iz>(): kotlin/String // examples.classes/OC.iz.<get-iz>|<get-iz>(){}[0]

final var x // examples.classes/OC.x|{}x[0]
final fun <get-x>(): kotlin/Int // examples.classes/OC.x.<get-x>|<get-x>(){}[0]
final fun <set-x>(kotlin/Int) // examples.classes/OC.x.<set-x>|<set-x>(kotlin.Int){}[0]
Expand All @@ -102,27 +132,34 @@ open class examples.classes/OC { // examples.classes/OC|null[0]
final var z // examples.classes/OC.z|{}z[0]
final fun <get-z>(): kotlin/Int // examples.classes/OC.z.<get-z>|<get-z>(){}[0]
final fun <set-z>(kotlin/Int) // examples.classes/OC.z.<set-z>|<set-z>(kotlin.Int){}[0]

final fun c() // examples.classes/OC.c|c(){}[0]
open fun o(): kotlin/Int // examples.classes/OC.o|o(){}[0]
}

final object examples.classes/O // examples.classes/O|null[0]

final object examples.classes/OO // examples.classes/OO|null[0]

final const val examples.classes/con // examples.classes/con|{}con[0]
final fun <get-con>(): kotlin/String // examples.classes/con.<get-con>|<get-con>(){}[0]
final const val examples.classes/intCon // examples.classes/intCon|{}intCon[0]
final fun <get-intCon>(): kotlin/Int // examples.classes/intCon.<get-intCon>|<get-intCon>(){}[0]

fzhinkin marked this conversation as resolved.
Show resolved Hide resolved
final val examples.classes/a // examples.classes/a|{}a[0]
final fun <get-a>(): kotlin/Any // examples.classes/a.<get-a>|<get-a>(){}[0]
final val examples.classes/i // examples.classes/i|{}i[0]
final fun <get-i>(): kotlin/Int // examples.classes/i.<get-i>|<get-i>(){}[0]
final val examples.classes/l // examples.classes/l|{}l[0]
final fun <get-l>(): kotlin/Long // examples.classes/l.<get-l>|<get-l>(){}[0]

final var examples.classes/d // examples.classes/d|{}d[0]
final fun <get-d>(): kotlin/Double // examples.classes/d.<get-d>|<get-d>(){}[0]
final fun <set-d>(kotlin/Double) // examples.classes/d.<set-d>|<set-d>(kotlin.Double){}[0]
final var examples.classes/r // examples.classes/r|{}r[0]
final fun <get-r>(): kotlin/Float // examples.classes/r.<get-r>|<get-r>(){}[0]
final fun <set-r>(kotlin/Float) // examples.classes/r.<set-r>|<set-r>(kotlin.Float){}[0]

final fun <#A: kotlin/Any?> examples.classes/consume(#A) // examples.classes/consume|consume(0:0){0§<kotlin.Any?>}[0]
final fun examples.classes/testFun(): kotlin/Int // examples.classes/testFun|testFun(){}[0]
final inline fun examples.classes/testInlineFun() // examples.classes/testInlineFun|testInlineFun(){}[0]
Loading