Skip to content

Commit

Permalink
Plugin path resolution customization (JetBrains#1549)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schahen authored and mareklangiewicz committed Feb 14, 2022
1 parent 488ddd3 commit 1cd1a69
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
1 change: 0 additions & 1 deletion web/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
34 changes: 31 additions & 3 deletions web/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
Expand Down

0 comments on commit 1cd1a69

Please sign in to comment.