Skip to content

Commit

Permalink
Revert "[Gradle] Propagate offline mode to Native cinterop"
Browse files Browse the repository at this point in the history
This reverts commit a28884b
  • Loading branch information
SvyatoslavScherbina authored and Space committed Jun 24, 2022
1 parent ed8868a commit 91863f2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1168,51 +1168,6 @@ class GeneralNativeIT : BaseGradleIT() {
}
}

@Test
fun `check offline mode is propagated to the cinterop`() = with(transformNativeTestProjectWithPluginDsl("native-cinterop")) {
val buildOptions = defaultBuildOptions()
val cinteropTask = ":projectLibrary:cinteropAnotherNumberHost"

build(cinteropTask, options = buildOptions) {
assertSuccessful()
}

// Check that --offline works when all the dependencies are already downloaded:
val buildOptionsOffline = buildOptions.copy(freeCommandLineArgs = buildOptions.freeCommandLineArgs + "--offline")

build("clean", cinteropTask, options = buildOptionsOffline) {
assertSuccessful()
withNativeCommandLineArguments(cinteropTask, toolName = "cinterop") {
assertTrue(it.containsSequentially("-Xoverride-konan-properties", "airplaneMode=true"))
}
}

// 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)
)

build("clean", cinteropTask, options = buildOptionsOfflineWithCustomKonanDataDir) {
assertFailed()
}

checkNoDependenciesDownloaded(customKonanDataDir)

// Check that the compiler is not extracted if it is not cached:
assertTrue(customKonanDataDir.deleteRecursively())
build(
"clean", cinteropTask, "-Pkotlin.native.version=1.6.20-M1-9999",
options = buildOptionsOfflineWithCustomKonanDataDir
) {
assertFailed()
assertTasksNotExecuted(listOf(cinteropTask))
}

assertFalse(customKonanDataDir.exists())
}

@Test
fun allowToOverrideDownloadUrl() {
with(transformNativeTestProjectWithPluginDsl("native-parallel")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@ internal class KotlinNativeCInteropRunner private constructor(project: Project)
fun runWithContext(action: () -> Unit)
}

override val defaultArguments: List<String>
get() = mutableListOf<String>().apply {
if (project.gradle.startParameter.isOffline) {
addAll(listOf("-Xoverride-konan-properties", "airplaneMode=true"))
}
}

companion object {
fun ExecutionContext.run(args: List<String>) {
val runner = KotlinNativeCInteropRunner(project)
Expand Down

0 comments on commit 91863f2

Please sign in to comment.