Browse Source

Plugin path resolution customization (#1549)

pull/1511/head
Shagen Ogandzhanian 3 years ago committed by GitHub
parent
commit
a1f923399f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      web/build.gradle.kts
  2. 34
      web/settings.gradle.kts

1
web/build.gradle.kts

@ -1,7 +1,6 @@
import org.gradle.api.tasks.testing.AbstractTestTask
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
val COMPOSE_CORE_VERSION: String by project
val COMPOSE_WEB_VERSION: String by project
val COMPOSE_REPO_USERNAME: String? by project
val COMPOSE_REPO_KEY: String? by project

34
web/settings.gradle.kts

@ -1,22 +1,50 @@
pluginManagement {
val COMPOSE_CORE_VERSION: String by settings
println("[build] compose core version: $COMPOSE_CORE_VERSION")
// pluginManagement section won't see outer scope, hence the FQ names
fun properties(path: String): java.util.Properties? {
val localPropertiesFile = File(path)
if (!localPropertiesFile.exists()) {
return null
}
return java.io.FileInputStream(localPropertiesFile).use() { inputStream ->
val props = java.util.Properties()
props.load(inputStream)
props
}
}
val localProperties: java.util.Properties? = properties("local.properties")
val repos = (localProperties?.getProperty("compose.web.repos"))?.split(File.pathSeparator)
repositories {
gradlePluginPortal()
mavenCentral()
mavenLocal()
repos?.forEach { urlPath ->
maven {
url = uri(urlPath)
}
}
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
maven {
url = uri("https://packages.jetbrains.team/maven/p/ui/dev")
}
google()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == "org.jetbrains.compose") {
println("[build] compose core version: ${extra["COMPOSE_CORE_VERSION"]}")
useModule("org.jetbrains.compose:org.jetbrains.compose.gradle.plugin:${extra["COMPOSE_CORE_VERSION"]}")
useModule("org.jetbrains.compose:org.jetbrains.compose.gradle.plugin:$COMPOSE_CORE_VERSION")
} else if (requested.id.id == "org.jetbrains.kotlin.multiplatform") {
useModule("org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:1.5.31")
}

Loading…
Cancel
Save