[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 changeApiVersion(version: String, forTests: Boolean): PsiElement?
|
||||||
|
|
||||||
fun addKotlinLibraryToModuleBuildScript(
|
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,
|
scope: DependencyScope,
|
||||||
libraryDescriptor: ExternalLibraryDescriptor
|
libraryDescriptor: ExternalLibraryDescriptor
|
||||||
)
|
)
|
||||||
|
|||||||
+8
-2
@@ -184,8 +184,14 @@ class GroovyBuildScriptManipulator(
|
|||||||
override fun changeApiVersion(version: String, forTests: Boolean): PsiElement? =
|
override fun changeApiVersion(version: String, forTests: Boolean): PsiElement? =
|
||||||
changeKotlinTaskParameter(scriptFile, "apiVersion", version, forTests)
|
changeKotlinTaskParameter(scriptFile, "apiVersion", version, forTests)
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun addKotlinLibraryToModuleBuildScript(
|
override fun addKotlinLibraryToModuleBuildScript(
|
||||||
targetModule: Module,
|
scope: DependencyScope,
|
||||||
|
libraryDescriptor: ExternalLibraryDescriptor
|
||||||
|
) = addKotlinLibraryToModuleBuildScript(null, scope, libraryDescriptor)
|
||||||
|
|
||||||
|
override fun addKotlinLibraryToModuleBuildScript(
|
||||||
|
targetModule: Module?,
|
||||||
scope: DependencyScope,
|
scope: DependencyScope,
|
||||||
libraryDescriptor: ExternalLibraryDescriptor
|
libraryDescriptor: ExternalLibraryDescriptor
|
||||||
) {
|
) {
|
||||||
@@ -197,7 +203,7 @@ class GroovyBuildScriptManipulator(
|
|||||||
libraryDescriptor.maxVersion
|
libraryDescriptor.maxVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
if (usesNewMultiplatform()) {
|
if (targetModule != null && usesNewMultiplatform()) {
|
||||||
scriptFile
|
scriptFile
|
||||||
.getKotlinBlock()
|
.getKotlinBlock()
|
||||||
.getSourceSetsBlock()
|
.getSourceSetsBlock()
|
||||||
|
|||||||
+8
-2
@@ -116,8 +116,14 @@ class KotlinBuildScriptManipulator(
|
|||||||
override fun changeApiVersion(version: String, forTests: Boolean): PsiElement? =
|
override fun changeApiVersion(version: String, forTests: Boolean): PsiElement? =
|
||||||
scriptFile.changeKotlinTaskParameter("apiVersion", version, forTests)
|
scriptFile.changeKotlinTaskParameter("apiVersion", version, forTests)
|
||||||
|
|
||||||
|
@Suppress("OverridingDeprecatedMember")
|
||||||
override fun addKotlinLibraryToModuleBuildScript(
|
override fun addKotlinLibraryToModuleBuildScript(
|
||||||
targetModule: Module,
|
scope: DependencyScope,
|
||||||
|
libraryDescriptor: ExternalLibraryDescriptor
|
||||||
|
) = addKotlinLibraryToModuleBuildScript(null, scope, libraryDescriptor)
|
||||||
|
|
||||||
|
override fun addKotlinLibraryToModuleBuildScript(
|
||||||
|
targetModule: Module?,
|
||||||
scope: DependencyScope,
|
scope: DependencyScope,
|
||||||
libraryDescriptor: ExternalLibraryDescriptor
|
libraryDescriptor: ExternalLibraryDescriptor
|
||||||
) {
|
) {
|
||||||
@@ -128,7 +134,7 @@ class KotlinBuildScriptManipulator(
|
|||||||
scope.toGradleCompileScope(scriptFile.module?.getBuildSystemType() == AndroidGradle)
|
scope.toGradleCompileScope(scriptFile.module?.getBuildSystemType() == AndroidGradle)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (usesNewMultiplatform()) {
|
if (targetModule != null && usesNewMultiplatform()) {
|
||||||
val findOrCreateTargetSourceSet = scriptFile
|
val findOrCreateTargetSourceSet = scriptFile
|
||||||
.getKotlinBlock()
|
.getKotlinBlock()
|
||||||
?.getSourceSetsBlock()
|
?.getSourceSetsBlock()
|
||||||
|
|||||||
Reference in New Issue
Block a user