Revert "[Gradle] Propagate offline mode to Native platform libs generator"
This reverts commit fa951f8f9c.
This commit is contained in:
committed by
Space
parent
b3848811e6
commit
146564718e
+5
-63
@@ -20,9 +20,9 @@ import org.jetbrains.kotlin.konan.target.HostManager
|
|||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
import org.jetbrains.kotlin.konan.target.presetName
|
import org.jetbrains.kotlin.konan.target.presetName
|
||||||
import org.jetbrains.kotlin.konan.util.DependencyDirectories
|
import org.jetbrains.kotlin.konan.util.DependencyDirectories
|
||||||
import org.junit.*
|
import org.junit.Assume
|
||||||
import org.junit.rules.TemporaryFolder
|
import org.junit.BeforeClass
|
||||||
import kotlin.test.assertFalse
|
import org.junit.Test
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
class NativePlatformLibsIT : BaseGradleIT() {
|
class NativePlatformLibsIT : BaseGradleIT() {
|
||||||
@@ -35,16 +35,6 @@ class NativePlatformLibsIT : BaseGradleIT() {
|
|||||||
// We temporary disable it for windows until a proper fix is found.
|
// We temporary disable it for windows until a proper fix is found.
|
||||||
Assume.assumeFalse(HostManager.hostIsMingw)
|
Assume.assumeFalse(HostManager.hostIsMingw)
|
||||||
}
|
}
|
||||||
|
|
||||||
@field:ClassRule
|
|
||||||
@JvmField
|
|
||||||
val tempDir = TemporaryFolder()
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
@AfterClass
|
|
||||||
fun deleteTempDir() {
|
|
||||||
tempDir.delete()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override val defaultGradleVersion: GradleVersionRequired
|
override val defaultGradleVersion: GradleVersionRequired
|
||||||
@@ -85,11 +75,8 @@ class NativePlatformLibsIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Project.buildWithLightDist(
|
private fun Project.buildWithLightDist(vararg tasks: String, check: CompiledProject.() -> Unit) =
|
||||||
vararg tasks: String,
|
build(*tasks, "-Pkotlin.native.distribution.type=light", check = check)
|
||||||
options: BuildOptions = defaultBuildOptions(),
|
|
||||||
check: CompiledProject.() -> Unit
|
|
||||||
) = build(*tasks, "-Pkotlin.native.distribution.type=light", options = options, check = check)
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testNoGenerationForOldCompiler() = with(platformLibrariesProject("linuxX64")) {
|
fun testNoGenerationForOldCompiler() = with(platformLibrariesProject("linuxX64")) {
|
||||||
@@ -319,49 +306,4 @@ class NativePlatformLibsIT : BaseGradleIT() {
|
|||||||
assertContains("Generate platform libraries for linux_x64")
|
assertContains("Generate platform libraries for linux_x64")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `check offline mode is propagated to the platform libs generator`() = with(platformLibrariesProject("linuxX64")) {
|
|
||||||
deleteInstalledCompilers()
|
|
||||||
|
|
||||||
// Install the compiler at the first time. Don't build to reduce execution time.
|
|
||||||
buildWithLightDist("tasks") {
|
|
||||||
assertSuccessful()
|
|
||||||
assertContains("Generate platform libraries for linux_x64")
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteInstalledCompilers()
|
|
||||||
|
|
||||||
// Check that --offline works when all the dependencies are already downloaded:
|
|
||||||
val buildOptionsOffline = defaultBuildOptions()
|
|
||||||
.let { it.copy(freeCommandLineArgs = it.freeCommandLineArgs + "--offline") }
|
|
||||||
|
|
||||||
buildWithLightDist("tasks", options = buildOptionsOffline) {
|
|
||||||
assertSuccessful()
|
|
||||||
assertContains("Generate platform libraries for linux_x64")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that --offline fails when there are no downloaded dependencies:
|
|
||||||
val customKonanDataDir = tempDir.newFolder("konanOffline")
|
|
||||||
val buildOptionsOfflineWithCustomKonanDataDir = buildOptionsOffline.copy(
|
|
||||||
customEnvironmentVariables = buildOptionsOffline.customEnvironmentVariables +
|
|
||||||
("KONAN_DATA_DIR" to customKonanDataDir.absolutePath)
|
|
||||||
)
|
|
||||||
|
|
||||||
buildWithLightDist("tasks", options = buildOptionsOfflineWithCustomKonanDataDir) {
|
|
||||||
assertFailed()
|
|
||||||
assertContains("Generate platform libraries for linux_x64")
|
|
||||||
}
|
|
||||||
|
|
||||||
// The build above have extracted the cached compiler to the custom KONAN_DATA_DIR; remove it:
|
|
||||||
assertTrue(customKonanDataDir.deleteRecursively())
|
|
||||||
|
|
||||||
// Check that the compiler is not extracted if it is not cached:
|
|
||||||
buildWithLightDist("tasks", "-Pkotlin.native.version=1.6.20-M1-9999", options = buildOptionsOfflineWithCustomKonanDataDir) {
|
|
||||||
assertFailed()
|
|
||||||
assertNotContains("Generate platform libraries for linux_x64")
|
|
||||||
}
|
|
||||||
|
|
||||||
assertFalse(customKonanDataDir.exists())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-7
@@ -196,11 +196,4 @@ internal class KotlinNativeLibraryGenerationRunner(project: Project) :
|
|||||||
AbstractKotlinNativeCInteropRunner("generatePlatformLibraries", project) {
|
AbstractKotlinNativeCInteropRunner("generatePlatformLibraries", project) {
|
||||||
// The library generator works for a long time so enabling C2 can improve performance.
|
// The library generator works for a long time so enabling C2 can improve performance.
|
||||||
override val disableC2: Boolean = false
|
override val disableC2: Boolean = false
|
||||||
|
|
||||||
override val defaultArguments: List<String>
|
|
||||||
get() = mutableListOf<String>().apply {
|
|
||||||
if (project.gradle.startParameter.isOffline) {
|
|
||||||
addAll(listOf("-Xoverride-konan-properties", "airplaneMode=true"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user