"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt" between
kotlin-1.3.20.tar.gz and kotlin-1.3.21.tar.gz

About: Kotlin is a Java like statically typed programming language for the JVM, Android and the browser. Source code.

NewMultiplatformIT.kt  (kotlin-1.3.20):NewMultiplatformIT.kt  (kotlin-1.3.21)
skipping to change at line 332 skipping to change at line 332
val expectedClasses = val expectedClasses =
classesWithoutJava + classesWithoutJava +
"kotlin/jvm6/main/com/example/lib/KotlinClassInJava.clas s" + "kotlin/jvm6/main/com/example/lib/KotlinClassInJava.clas s" +
"java/main/com/example/lib/JavaClassInJava.class" "java/main/com/example/lib/JavaClassInJava.class"
val actualClasses = getFilePathsSet("build/classes") val actualClasses = getFilePathsSet("build/classes")
Assert.assertEquals(expectedClasses, actualClasses) Assert.assertEquals(expectedClasses, actualClasses)
} }
} }
@Test @Test
fun testParallelTasks() {
parallelTasksImpl(isParallel = true)
}
@Test
fun testNoParallelTasks() {
parallelTasksImpl(isParallel = false)
}
private fun parallelTasksImpl(isParallel: Boolean) = with(Project("new-mpp-p
arallel", gradleVersion)) {
val options = defaultBuildOptions().copy(parallelTasksInProject = isPara
llel)
build("assemble", options = options) {
assertSuccessful()
val tasks = arrayOf(":compileKotlinMetadata", ":compileKotlinJvm", "
:compileKotlinJs")
if (isParallel) {
assertTasksSubmittedWork(*tasks)
} else {
assertTasksDidNotSubmitWork(*tasks)
}
val expectedKotlinOutputFiles = listOf(
kotlinClassesDir(sourceSet = "metadata/main") + "common/A.kotlin
_metadata",
kotlinClassesDir(sourceSet = "jvm/main") + "common/A.class",
kotlinClassesDir(sourceSet = "js/main") + "new-mpp-parallel.js"
)
expectedKotlinOutputFiles.forEach { assertFileExists(it) }
}
}
@Test
fun testLibWithTests() = doTestLibWithTests(Project("new-mpp-lib-with-tests" , gradleVersion)) fun testLibWithTests() = doTestLibWithTests(Project("new-mpp-lib-with-tests" , gradleVersion))
@Test @Test
fun testLibWithTestsKotlinDsl() = with(Project("new-mpp-lib-with-tests", gra dleVersion)) { fun testLibWithTestsKotlinDsl() = with(Project("new-mpp-lib-with-tests", gra dleVersion)) {
setupWorkingDir() setupWorkingDir()
gradleBuildScript().delete() gradleBuildScript().delete()
projectDir.resolve("build.gradle.kts.alternative").renameTo(projectDir.r esolve("build.gradle.kts")) projectDir.resolve("build.gradle.kts.alternative").renameTo(projectDir.r esolve("build.gradle.kts"))
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl) gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
doTestLibWithTests(this) doTestLibWithTests(this)
} }
skipping to change at line 980 skipping to change at line 951
fun CompiledProject.checkFrameworkCompilationCommandLine(check: (String) -> Unit) { fun CompiledProject.checkFrameworkCompilationCommandLine(check: (String) -> Unit) {
output.lineSequence().filter { output.lineSequence().filter {
it.contains("Run tool: konanc") && it.contains("-p framework") it.contains("Run tool: konanc") && it.contains("-p framework")
}.toList().also { }.toList().also {
assertTrue(it.isNotEmpty()) assertTrue(it.isNotEmpty())
}.forEach(check) }.forEach(check)
} }
if (HostManager.hostIsMac) { if (HostManager.hostIsMac) {
// Check dependency exporting and bitcode embedding in frameworks. // Check dependency exporting and bitcode embedding in frameworks.
// For release builds // For release builds.
build("linkReleaseFrameworkIos") { build("linkReleaseFrameworkIos") {
assertSuccessful() assertSuccessful()
assertFileExists("build/bin/ios/releaseFramework/native_binary.f ramework") assertFileExists("build/bin/ios/releaseFramework/native_binary.f ramework")
fileInWorkingDir("build/bin/ios/releaseFramework/native_binary.f ramework/Headers/native_binary.h") fileInWorkingDir("build/bin/ios/releaseFramework/native_binary.f ramework/Headers/native_binary.h")
.readText().contains("+ (int32_t)exported") .readText().contains("+ (int32_t)exported")
// Check that by default release frameworks have bitcode embedde d. // Check that by default release frameworks have bitcode embedde d.
checkFrameworkCompilationCommandLine { checkFrameworkCompilationCommandLine {
assertTrue(it.contains("-Xembed-bitcode")) assertTrue(it.contains("-Xembed-bitcode"))
assertTrue(it.contains("-opt")) assertTrue(it.contains("-opt"))
} }
} }
// For debug builds // For debug builds.
build("linkDebugFrameworkIos") { build("linkDebugFrameworkIos") {
assertSuccessful() assertSuccessful()
assertFileExists("build/bin/ios/debugFramework/native_binary.fra mework") assertFileExists("build/bin/ios/debugFramework/native_binary.fra mework")
fileInWorkingDir("build/bin/ios/debugFramework/native_binary.fra mework/Headers/native_binary.h") fileInWorkingDir("build/bin/ios/debugFramework/native_binary.fra mework/Headers/native_binary.h")
.readText().contains("+ (int32_t)exported") .readText().contains("+ (int32_t)exported")
// Check that by default debug frameworks have bitcode marker em bedded. // Check that by default debug frameworks have bitcode marker em bedded.
checkFrameworkCompilationCommandLine { checkFrameworkCompilationCommandLine {
assertTrue(it.contains("-Xembed-bitcode-marker")) assertTrue(it.contains("-Xembed-bitcode-marker"))
assertTrue(it.contains("-g")) assertTrue(it.contains("-g"))
} }
skipping to change at line 1017 skipping to change at line 988
build("linkCustomReleaseFrameworkIos") { build("linkCustomReleaseFrameworkIos") {
assertSuccessful() assertSuccessful()
checkFrameworkCompilationCommandLine { checkFrameworkCompilationCommandLine {
assertTrue(it.contains("-linker-options -L.")) assertTrue(it.contains("-linker-options -L."))
assertTrue(it.contains("-Xtime")) assertTrue(it.contains("-Xtime"))
assertFalse(it.contains("-Xembed-bitcode-marker")) assertFalse(it.contains("-Xembed-bitcode-marker"))
assertFalse(it.contains("-Xembed-bitcode")) assertFalse(it.contains("-Xembed-bitcode"))
} }
} }
// Check that bitcode is disabled for iOS simulator.
build("linkReleaseFrameworkIosSim", "linkDebugFrameworkIosSim") {
assertSuccessful()
assertFileExists("build/bin/iosSim/releaseFramework/native-binar
y.framework")
assertFileExists("build/bin/iosSim/debugFramework/native-binary.
framework")
checkFrameworkCompilationCommandLine {
assertFalse(it.contains("-Xembed-bitcode"))
assertFalse(it.contains("-Xembed-bitcode-marker"))
}
}
// Check that plugin doesn't allow exporting dependencies not added in the API configuration. // Check that plugin doesn't allow exporting dependencies not added in the API configuration.
val buildFile = listOf("build.gradle", "build.gradle.kts").map { pro jectDir.resolve(it) }.single { it.exists() } val buildFile = listOf("build.gradle", "build.gradle.kts").map { pro jectDir.resolve(it) }.single { it.exists() }
buildFile.modify { buildFile.modify {
it.replace("api(project(\":exported\"))", "") it.replace("api(project(\":exported\"))", "")
} }
build("linkReleaseFrameworkIos") { build("linkReleaseFrameworkIos") {
assertFailed() assertFailed()
val failureMsg = "Following dependencies exported in the release Framework binary " + val failureMsg = "Following dependencies exported in the release Framework binary " +
"are not specified as API-dependencies of a correspondin g source set" "are not specified as API-dependencies of a correspondin g source set"
assertTrue(output.contains(failureMsg)) assertTrue(output.contains(failureMsg))
skipping to change at line 1233 skipping to change at line 1215
repositories { repositories {
maven { url "file://${'$'}{rootProject.projectDir.absolu tePath.replace('\\', '/')}/repo" } maven { url "file://${'$'}{rootProject.projectDir.absolu tePath.replace('\\', '/')}/repo" }
} }
dependencies { dependencies {
commonMainApi 'com.external.dependency:external:1.2.3' commonMainApi 'com.external.dependency:external:1.2.3'
} }
""".trimIndent() """.trimIndent()
) )
} }
gradleBuildScript().appendText("\n" + """ gradleBuildScript().appendText(
"\n" + """
publishing { publishing {
publications { publications {
jvm6 { jvm6 {
groupId = "foo" groupId = "foo"
artifactId = "bar" artifactId = "bar"
version = "42" version = "42"
} }
} }
} }
""".trimIndent()) """.trimIndent()
)
if (withMetadata) {
gradleBuildScript().appendText(
"\n" + """
publishing {
publications {
kotlinMultiplatform {
// KT-29485
artifactId = 'sample-lib-multiplatform'
}
}
}
""".trimIndent()
)
}
build("clean", "publish") { build("clean", "publish") {
assertSuccessful() assertSuccessful()
assertFileContains( assertFileContains(
"repo/com/exampleapp/sample-app-nodejs/1.0/sample-app-nodejs -1.0.pom", "repo/com/exampleapp/sample-app-nodejs/1.0/sample-app-nodejs -1.0.pom",
"<groupId>com.example</groupId>", "<groupId>com.example</groupId>",
"<artifactId>sample-lib-nodejs</artifactId>", "<artifactId>sample-lib-nodejs</artifactId>",
"<version>1.0</version>" "<version>1.0</version>"
) )
assertFileContains( assertFileContains(
skipping to change at line 1272 skipping to change at line 1271
assertFileContains( assertFileContains(
"repo/com/exampleapp/sample-app-jvm8/1.0/sample-app-jvm8 -1.0.pom", "repo/com/exampleapp/sample-app-jvm8/1.0/sample-app-jvm8 -1.0.pom",
"<groupId>com.external.dependency</groupId>", "<groupId>com.external.dependency</groupId>",
"<artifactId>external-jvm6</artifactId>", "<artifactId>external-jvm6</artifactId>",
"<version>1.2.3</version>" "<version>1.2.3</version>"
) )
// Check that, despite the rewritten POM, the module metadat a contains the original dependency: // Check that, despite the rewritten POM, the module metadat a contains the original dependency:
val moduleMetadata = projectDir.resolve("repo/com/exampleapp /sample-app-jvm8/1.0/sample-app-jvm8-1.0.module").readText() val moduleMetadata = projectDir.resolve("repo/com/exampleapp /sample-app-jvm8/1.0/sample-app-jvm8-1.0.module").readText()
.replace("\\s+".toRegex(), "").replace("\n", "") .replace("\\s+".toRegex(), "").replace("\n", "")
assertTrue { "\"group\":\"com.example\",\"module\":\"sample- lib\"" in moduleMetadata } assertTrue { "\"group\":\"com.example\",\"module\":\"sample- lib-multiplatform\"" in moduleMetadata }
assertTrue { "\"group\":\"com.external.dependency\",\"module \":\"external\"" in moduleMetadata } assertTrue { "\"group\":\"com.external.dependency\",\"module \":\"external\"" in moduleMetadata }
} }
assertFileExists("repo/foo/bar/42/bar-42.jar") assertFileExists("repo/foo/bar/42/bar-42.jar")
} }
} }
} }
@Test @Test
fun testMppBuildWithCompilerPlugins() = with(Project("sample-lib", gradleVer sion, "new-mpp-lib-and-app")) { fun testMppBuildWithCompilerPlugins() = with(Project("sample-lib", gradleVer sion, "new-mpp-lib-and-app")) {
setupWorkingDir() setupWorkingDir()
skipping to change at line 1526 skipping to change at line 1525
build { build {
assertSuccessful() assertSuccessful()
assertNotContains( assertNotContains(
UnusedSourceSetsChecker.WARNING_PREFIX_ONE, UnusedSourceSetsChecker.WARNING_PREFIX_ONE,
UnusedSourceSetsChecker.WARNING_PREFIX_MANY, UnusedSourceSetsChecker.WARNING_PREFIX_MANY,
UnusedSourceSetsChecker.WARNING_INTRO UnusedSourceSetsChecker.WARNING_INTRO
) )
} }
} }
@Test
fun testKt29725() {
with(Project("new-mpp-native-libraries", GradleVersionRequired.Exact("5.
2"))) {
// Assert that a project with a native target can be configured with
Gradle 5.2
build("tasks") {
assertSuccessful()
}
}
}
} }
 End of changes. 8 change blocks. 
38 lines changed or deleted 47 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)