migrate onto new templates-oriented in gradle model

This commit is contained in:
InsanusMokrassar 2024-11-11 16:49:11 +06:00
parent 6dced2d86e
commit 896028d0bb
11 changed files with 35 additions and 28 deletions

View File

@ -4,5 +4,5 @@ plugins {
id "com.android.library" id "com.android.library"
} }
apply from: "$mppAndroidProjectPresetPath" apply from: "$mppAndroidProject"

View File

@ -3,5 +3,5 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
apply from: "$mppJavaProjectPresetPath" apply from: "$mppJavaProject"

View File

@ -3,5 +3,5 @@ plugins {
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
apply from: "$mppJsProjectPresetPath" apply from: "$mppJsProject"

View File

@ -4,5 +4,5 @@ plugins {
id "com.android.library" id "com.android.library"
} }
apply from: "$mppProjectWithSerializationPresetPath" apply from: "$mppProjectWithSerialization"

View File

@ -1,6 +1,14 @@
allprojects { File templatesFolder = new File("$rootProject.projectDir.absolutePath${File.separatorChar}gradle${File.separatorChar}templates")
ext {
projectByName = { String name -> Map properties = new HashMap<String, String>()
if (templatesFolder.exists() && templatesFolder.isDirectory()) {
templatesFolder.listFiles().each {
properties[it.name - ".gradle"] = it.absolutePath
}
}
properties["projectByName"] = { name ->
for (subproject in rootProject.subprojects) { for (subproject in rootProject.subprojects) {
if (subproject.name == name) { if (subproject.name == name) {
return subproject return subproject
@ -9,17 +17,16 @@ allprojects {
return null return null
} }
internalProject = { String name -> properties["internalProject"] = { name ->
projectByName(name) projectByName("$name")
} }
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle" allprojects {
mppJavaProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJavaProject.gradle" ext {
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle" releaseMode = (project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true"
mppAndroidProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppAndroidProject.gradle"
defaultAndroidSettingsPresetPath = "${rootProject.projectDir.absolutePath}/defaultAndroidSettings.gradle" properties.forEach { k, v ->
it[k] = v
// publishGradlePath = "${rootProject.projectDir.absolutePath}/publish.gradle" }
} }
} }

View File

@ -36,4 +36,4 @@ kotlin {
} }
} }
apply from: "$defaultAndroidSettingsPresetPath" apply from: "$defaultAndroidSettings"

View File

@ -62,4 +62,4 @@ java {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
apply from: "$defaultAndroidSettingsPresetPath" apply from: "$defaultAndroidSettings"

View File

@ -4,5 +4,5 @@ plugins {
id "com.android.library" id "com.android.library"
} }
apply from: "$mppProjectWithSerializationPresetPath" apply from: "$mppProjectWithSerialization"