[stdlib-mpp] Publish patched/custom kpsm to list 'commonMain' included into 'nativeApiElements'

Native/Shared Source Sets still requires stdlib:commonMain.klib as
dependency for IDE analysis.

See: KT-56278
^KT-60901 Verification Pending
This commit is contained in:
Sebastian Sellmair
2023-08-09 11:37:05 +02:00
committed by Space Team
parent 243707c956
commit f06a1c89ef
3 changed files with 141 additions and 0 deletions
+31
View File
@@ -743,6 +743,37 @@ tasks {
if (project.hasProperty("kotlin.stdlib.test.long.running")) {
check.configure { dependsOn(jvmLongRunningTest) }
}
/*
We are using a custom 'kotlin-project-structure-metadata' to ensure 'nativeApiElements' lists 'commonMain' as source set
*/
val generateProjectStructureMetadata by existing {
val outputFile = file("build/kotlinProjectStructureMetadata/kotlin-project-structure-metadata.json")
val outputTestFile = file("kotlin-project-structure-metadata.beforePatch.json")
val patchedFile = file("kotlin-project-structure-metadata.json")
inputs.file(patchedFile)
inputs.file(outputTestFile)
doLast {
/*
Check that the generated 'outputFile' by default matches our expectations stored in the .beforePatch file
This will fail if the kotlin-project-structure-metadata.json file would change unnoticed (w/o updating our patched file)
*/
run {
val outputFileText = outputFile.readText().trim()
val expectedFileContent = outputTestFile.readText().trim()
if (outputFileText != expectedFileContent)
error(
"${outputFile.path} file content does not match expected content\n\n" +
"expected:\n\n$expectedFileContent\n\nactual:\n\n$outputFileText"
)
}
patchedFile.copyTo(outputFile, overwrite = true)
}
}
}
@@ -0,0 +1,52 @@
{
"projectStructure": {
"formatVersion": "0.3.3",
"isPublishedAsRoot": "true",
"variants": [
{
"name": "jsApiElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jsRuntimeElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jsV1ApiElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jsV1RuntimeElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jvmApiElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jvmRuntimeElements",
"sourceSet": [
"commonMain"
]
}
],
"sourceSets": [
{
"name": "commonMain",
"dependsOn": [],
"moduleDependency": [],
"binaryLayout": "klib"
}
]
}
}
@@ -0,0 +1,58 @@
{
"projectStructure": {
"formatVersion": "0.3.3",
"isPublishedAsRoot": "true",
"variants": [
{
"name": "jsApiElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jsRuntimeElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jsV1ApiElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jsV1RuntimeElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jvmApiElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "jvmRuntimeElements",
"sourceSet": [
"commonMain"
]
},
{
"name": "nativeApiElements",
"sourceSet": [
"commonMain"
]
}
],
"sourceSets": [
{
"name": "commonMain",
"dependsOn": [],
"moduleDependency": [],
"binaryLayout": "klib"
}
]
}
}