[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:
committed by
Space Team
parent
243707c956
commit
f06a1c89ef
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user