-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Wasm] Get back D8RootExtension as deprecated one, and per-project va…
…riant is only envSpec
- Loading branch information
Showing
10 changed files
with
118 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
...-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/d8/D8Extension.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 56 additions & 5 deletions
61
...dle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/d8/D8RootExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,65 @@ | ||
/* | ||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.kotlin.gradle.targets.js.d8 | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.tasks.TaskProvider | ||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl | ||
import org.jetbrains.kotlin.gradle.logging.kotlinInfo | ||
import org.jetbrains.kotlin.gradle.targets.js.AbstractSettings | ||
import org.jetbrains.kotlin.gradle.utils.property | ||
|
||
// To be compatible with previous KGP version, we need to keep D8RootExtension as deprecated. | ||
// To prevent Kotlin build from failing (due to `-Werror`), only deprecate after upgrade of bootstrap version | ||
//@Deprecated("This extension is deprecated. Use D8Extension instead.", ReplaceWith("D8Extension")) | ||
@OptIn(ExperimentalWasmDsl::class) | ||
typealias D8RootExtension = D8Extension | ||
open class D8RootExtension( | ||
@Transient val project: Project, | ||
private val d8EnvSpec: D8EnvSpec, | ||
) : AbstractSettings<D8Env>() { | ||
|
||
private val gradleHome = project.gradle.gradleUserHomeDir.also { | ||
project.logger.kotlinInfo("Storing cached files in $it") | ||
} | ||
|
||
override val downloadProperty: org.gradle.api.provider.Property<Boolean> = project.objects.property<Boolean>() | ||
.convention(true) | ||
|
||
// value not convention because this property can be nullable to not add repository | ||
override val downloadBaseUrlProperty: org.gradle.api.provider.Property<String> = project.objects.property<String>() | ||
.value("https://storage.googleapis.com/chromium-v8/official/canary") | ||
|
||
override val installationDirectory: DirectoryProperty = project.objects.directoryProperty() | ||
.fileValue(gradleHome.resolve("d8")) | ||
|
||
/** | ||
* The same as in [D8EnvSpec.version] | ||
*/ | ||
override val versionProperty: org.gradle.api.provider.Property<String> = project.objects.property<String>() | ||
.convention("11.9.85") | ||
|
||
/** | ||
* Specify the edition of the D8. | ||
* | ||
* Valid options for bundled version are `rel` (release variant) and `dbg` (debug variant). | ||
*/ | ||
val edition: org.gradle.api.provider.Property<String> = project.objects.property<String>() | ||
.convention("rel") | ||
|
||
override val commandProperty: org.gradle.api.provider.Property<String> = project.objects.property<String>() | ||
.convention("d8") | ||
|
||
override fun finalizeConfiguration(): D8Env { | ||
return d8EnvSpec.produceEnv(project.providers).get() | ||
} | ||
|
||
val setupTaskProvider: TaskProvider<out D8SetupTask> | ||
get() = with(d8EnvSpec) { | ||
project.d8SetupTaskProvider | ||
} | ||
|
||
companion object { | ||
const val EXTENSION_NAME: String = "kotlinD8" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters