[Compatibility] Restore GradleBuildScriptManipulator.addKotlinLibraryToModuleBuildScript(scope, libraryDescriptor)
#KT-33336 Fixed
This commit is contained in:
+10
-1
@@ -54,7 +54,16 @@ interface GradleBuildScriptManipulator<out Psi : PsiFile> {
|
||||
fun changeApiVersion(version: String, forTests: Boolean): PsiElement?
|
||||
|
||||
fun addKotlinLibraryToModuleBuildScript(
|
||||
targetModule: Module,
|
||||
targetModule: Module?,
|
||||
scope: DependencyScope,
|
||||
libraryDescriptor: ExternalLibraryDescriptor
|
||||
)
|
||||
|
||||
@Deprecated(
|
||||
"Can't work with multiplatform projects",
|
||||
ReplaceWith("addKotlinLibraryToModuleBuildScript(null, scope, libraryDescriptor)")
|
||||
)
|
||||
fun addKotlinLibraryToModuleBuildScript(
|
||||
scope: DependencyScope,
|
||||
libraryDescriptor: ExternalLibraryDescriptor
|
||||
)
|
||||
|
||||
+8
-2
@@ -184,8 +184,14 @@ class GroovyBuildScriptManipulator(
|
||||
override fun changeApiVersion(version: String, forTests: Boolean): PsiElement? =
|
||||
changeKotlinTaskParameter(scriptFile, "apiVersion", version, forTests)
|
||||
|
||||
@Suppress("OverridingDeprecatedMember")
|
||||
override fun addKotlinLibraryToModuleBuildScript(
|
||||
targetModule: Module,
|
||||
scope: DependencyScope,
|
||||
libraryDescriptor: ExternalLibraryDescriptor
|
||||
) = addKotlinLibraryToModuleBuildScript(null, scope, libraryDescriptor)
|
||||
|
||||
override fun addKotlinLibraryToModuleBuildScript(
|
||||
targetModule: Module?,
|
||||
scope: DependencyScope,
|
||||
libraryDescriptor: ExternalLibraryDescriptor
|
||||
) {
|
||||
@@ -197,7 +203,7 @@ class GroovyBuildScriptManipulator(
|
||||
libraryDescriptor.maxVersion
|
||||
)
|
||||
|
||||
if (usesNewMultiplatform()) {
|
||||
if (targetModule != null && usesNewMultiplatform()) {
|
||||
scriptFile
|
||||
.getKotlinBlock()
|
||||
.getSourceSetsBlock()
|
||||
|
||||
+8
-2
@@ -116,8 +116,14 @@ class KotlinBuildScriptManipulator(
|
||||
override fun changeApiVersion(version: String, forTests: Boolean): PsiElement? =
|
||||
scriptFile.changeKotlinTaskParameter("apiVersion", version, forTests)
|
||||
|
||||
@Suppress("OverridingDeprecatedMember")
|
||||
override fun addKotlinLibraryToModuleBuildScript(
|
||||
targetModule: Module,
|
||||
scope: DependencyScope,
|
||||
libraryDescriptor: ExternalLibraryDescriptor
|
||||
) = addKotlinLibraryToModuleBuildScript(null, scope, libraryDescriptor)
|
||||
|
||||
override fun addKotlinLibraryToModuleBuildScript(
|
||||
targetModule: Module?,
|
||||
scope: DependencyScope,
|
||||
libraryDescriptor: ExternalLibraryDescriptor
|
||||
) {
|
||||
@@ -128,7 +134,7 @@ class KotlinBuildScriptManipulator(
|
||||
scope.toGradleCompileScope(scriptFile.module?.getBuildSystemType() == AndroidGradle)
|
||||
)
|
||||
|
||||
if (usesNewMultiplatform()) {
|
||||
if (targetModule != null && usesNewMultiplatform()) {
|
||||
val findOrCreateTargetSourceSet = scriptFile
|
||||
.getKotlinBlock()
|
||||
?.getSourceSetsBlock()
|
||||
|
||||
Reference in New Issue
Block a user