[KPM] Implement KotlinExternalModelContainer
KT-51262 KT-51220
This commit is contained in:
committed by
Space
parent
55448943af
commit
f1655e5f4e
@@ -7,6 +7,7 @@ plugins {
|
||||
dependencies {
|
||||
implementation(gradleKotlinDsl())
|
||||
compileOnly(project(":kotlin-gradle-plugin"))
|
||||
compileOnly(project(":kotlin-gradle-plugin-idea"))
|
||||
compileOnly("com.android.tools.build:gradle:7.0.0")
|
||||
}
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.
|
||||
*/
|
||||
|
||||
@file:OptIn(InternalKotlinGradlePluginApi::class)
|
||||
|
||||
package org.jetbrains.kotlin.gradle.android
|
||||
|
||||
import org.jetbrains.kotlin.gradle.kpm.KotlinExternalModelKey
|
||||
import org.jetbrains.kotlin.gradle.kpm.idea.InternalKotlinGradlePluginApi
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
internal val androidDslKey = KotlinExternalModelKey<AndroidDsl>()
|
||||
|
||||
class AndroidDsl : Serializable {
|
||||
var compileSdk = 0
|
||||
var isMinifyEnabled: Boolean = false
|
||||
var androidManifest: File? = null
|
||||
}
|
||||
+5
@@ -78,4 +78,9 @@ fun KotlinGradleModule.createKotlinAndroidVariant(androidVariant: BaseVariant) {
|
||||
androidVariant.getCompileClasspath(mainBytecodeKey),
|
||||
project.getAndroidRuntimeJars()
|
||||
)
|
||||
|
||||
val androidDsl = AndroidDsl()
|
||||
androidDsl.androidManifest = project.file("AndroidManifest.xml")
|
||||
androidDsl.compileSdk = 23
|
||||
androidCommon.external[androidDslKey] = androidDsl
|
||||
}
|
||||
|
||||
+4
-3
@@ -6,9 +6,10 @@
|
||||
package org.jetbrains.kotlin.gradle.android
|
||||
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleFragment
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleFragmentInternal
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.KotlinGradleModule
|
||||
|
||||
val KotlinGradleModule.androidCommon: KotlinGradleFragment
|
||||
get() = fragments.findByName("android") ?: fragments.create("android") { fragment ->
|
||||
val KotlinGradleModule.androidCommon: KotlinGradleFragmentInternal
|
||||
get() = (fragments.findByName("android") ?: fragments.create("android") { fragment ->
|
||||
fragment.refines(common)
|
||||
}
|
||||
}) as KotlinGradleFragmentInternal
|
||||
|
||||
Reference in New Issue
Block a user