Migrate collections to arrays for memory optimisation
during import process
This commit is contained in:
+5
-5
@@ -714,7 +714,7 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
|||||||
ManualLanguageFeatureSetting(feature, LanguageFeature.State.ENABLED, arg)
|
ManualLanguageFeatureSetting(feature, LanguageFeature.State.ENABLED, arg)
|
||||||
}
|
}
|
||||||
it.useExperimental = languageSettings.experimentalAnnotationsInUse.toTypedArray()
|
it.useExperimental = languageSettings.experimentalAnnotationsInUse.toTypedArray()
|
||||||
it.pluginOptions = languageSettings.compilerPluginArguments.toTypedArray()
|
it.pluginOptions = languageSettings.compilerPluginArguments
|
||||||
it.pluginClasspaths = languageSettings.compilerPluginClasspath.map(File::getPath).toTypedArray()
|
it.pluginClasspaths = languageSettings.compilerPluginClasspath.map(File::getPath).toTypedArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -733,12 +733,12 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
|||||||
sourceSetInfo.actualPlatforms.addSimplePlatforms(listOf(compilation.platform))
|
sourceSetInfo.actualPlatforms.addSimplePlatforms(listOf(compilation.platform))
|
||||||
sourceSetInfo.isTestModule = compilation.isTestModule
|
sourceSetInfo.isTestModule = compilation.isTestModule
|
||||||
sourceSetInfo.compilerArguments =
|
sourceSetInfo.compilerArguments =
|
||||||
createCompilerArguments(compilation.arguments.currentArguments, compilation.platform).also {
|
createCompilerArguments(compilation.arguments.currentArguments.toList(), compilation.platform).also {
|
||||||
it.multiPlatform = true
|
it.multiPlatform = true
|
||||||
}
|
}
|
||||||
sourceSetInfo.dependencyClasspath = compilation.dependencyClasspath
|
sourceSetInfo.dependencyClasspath = compilation.dependencyClasspath.toList()
|
||||||
sourceSetInfo.defaultCompilerArguments =
|
sourceSetInfo.defaultCompilerArguments =
|
||||||
createCompilerArguments(compilation.arguments.defaultArguments, compilation.platform)
|
createCompilerArguments(compilation.arguments.defaultArguments.toList(), compilation.platform)
|
||||||
sourceSetInfo.addSourceSets(compilation.sourceSets, compilation.fullName(), gradleModule, resolverCtx)
|
sourceSetInfo.addSourceSets(compilation.sourceSets, compilation.fullName(), gradleModule, resolverCtx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -760,7 +760,7 @@ open class KotlinMPPGradleProjectResolver : AbstractProjectResolverExtension() {
|
|||||||
|
|
||||||
private fun createCompilerArguments(args: List<String>, platform: KotlinPlatform): CommonCompilerArguments {
|
private fun createCompilerArguments(args: List<String>, platform: KotlinPlatform): CommonCompilerArguments {
|
||||||
val compilerArguments = IdePlatformKindTooling.getTooling(platform).kind.argumentsClass.newInstance()
|
val compilerArguments = IdePlatformKindTooling.getTooling(platform).kind.argumentsClass.newInstance()
|
||||||
parseCommandLineArguments(args, compilerArguments)
|
parseCommandLineArguments(args.toList(), compilerArguments)
|
||||||
return compilerArguments
|
return compilerArguments
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ interface KotlinLanguageSettings : Serializable {
|
|||||||
val isProgressiveMode: Boolean
|
val isProgressiveMode: Boolean
|
||||||
val enabledLanguageFeatures: Set<String>
|
val enabledLanguageFeatures: Set<String>
|
||||||
val experimentalAnnotationsInUse: Set<String>
|
val experimentalAnnotationsInUse: Set<String>
|
||||||
val compilerPluginArguments: List<String>
|
val compilerPluginArguments: Array<String>
|
||||||
val compilerPluginClasspath: Set<File>
|
val compilerPluginClasspath: Set<File>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,15 +67,15 @@ interface KotlinCompilationOutput : Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface KotlinCompilationArguments : Serializable {
|
interface KotlinCompilationArguments : Serializable {
|
||||||
val defaultArguments: List<String>
|
val defaultArguments: Array<String>
|
||||||
val currentArguments: List<String>
|
val currentArguments: Array<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface KotlinCompilation : KotlinModule {
|
interface KotlinCompilation : KotlinModule {
|
||||||
val sourceSets: Collection<KotlinSourceSet>
|
val sourceSets: Collection<KotlinSourceSet>
|
||||||
val output: KotlinCompilationOutput
|
val output: KotlinCompilationOutput
|
||||||
val arguments: KotlinCompilationArguments
|
val arguments: KotlinCompilationArguments
|
||||||
val dependencyClasspath: List<String>
|
val dependencyClasspath: Array<String>
|
||||||
val disambiguationClassifier: String?
|
val disambiguationClassifier: String?
|
||||||
val platform: KotlinPlatform
|
val platform: KotlinPlatform
|
||||||
val kotlinTaskProperties: KotlinTaskProperties
|
val kotlinTaskProperties: KotlinTaskProperties
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
getProgressiveMode(gradleLanguageSettings) as? Boolean ?: false,
|
getProgressiveMode(gradleLanguageSettings) as? Boolean ?: false,
|
||||||
getEnabledLanguageFeatures(gradleLanguageSettings) as? Set<String> ?: emptySet(),
|
getEnabledLanguageFeatures(gradleLanguageSettings) as? Set<String> ?: emptySet(),
|
||||||
getExperimentalAnnotationsInUse?.invoke(gradleLanguageSettings) as? Set<String> ?: emptySet(),
|
getExperimentalAnnotationsInUse?.invoke(gradleLanguageSettings) as? Set<String> ?: emptySet(),
|
||||||
getCompilerPluginArguments?.invoke(gradleLanguageSettings) as? List<String> ?: emptyList(),
|
(getCompilerPluginArguments?.invoke(gradleLanguageSettings) as? List<String> ?: emptyList()).toTypedArray(),
|
||||||
(getCompilerPluginClasspath?.invoke(gradleLanguageSettings) as? FileCollection)?.files ?: emptySet()
|
(getCompilerPluginClasspath?.invoke(gradleLanguageSettings) as? FileCollection)?.files ?: emptySet()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
dependencies,
|
dependencies,
|
||||||
output,
|
output,
|
||||||
arguments,
|
arguments,
|
||||||
dependencyClasspath,
|
dependencyClasspath.toTypedArray(),
|
||||||
kotlinTaskProperties
|
kotlinTaskProperties
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
val getDefaultArguments = compileTaskClass.getMethodOrNull("getDefaultSerializedCompilerArguments")
|
val getDefaultArguments = compileTaskClass.getMethodOrNull("getDefaultSerializedCompilerArguments")
|
||||||
val currentArguments = safelyGetArguments(compileKotlinTask, getCurrentArguments)
|
val currentArguments = safelyGetArguments(compileKotlinTask, getCurrentArguments)
|
||||||
val defaultArguments = safelyGetArguments(compileKotlinTask, getDefaultArguments)
|
val defaultArguments = safelyGetArguments(compileKotlinTask, getDefaultArguments)
|
||||||
return KotlinCompilationArgumentsImpl(defaultArguments, currentArguments)
|
return KotlinCompilationArgumentsImpl(defaultArguments.toTypedArray(), currentArguments.toTypedArray())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildDependencyClasspath(compileKotlinTask: Task): List<String> {
|
private fun buildDependencyClasspath(compileKotlinTask: Task): List<String> {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ data class KotlinLanguageSettingsImpl(
|
|||||||
override val isProgressiveMode: Boolean,
|
override val isProgressiveMode: Boolean,
|
||||||
override val enabledLanguageFeatures: Set<String>,
|
override val enabledLanguageFeatures: Set<String>,
|
||||||
override val experimentalAnnotationsInUse: Set<String>,
|
override val experimentalAnnotationsInUse: Set<String>,
|
||||||
override val compilerPluginArguments: List<String>,
|
override val compilerPluginArguments: Array<String>,
|
||||||
override val compilerPluginClasspath: Set<File>
|
override val compilerPluginClasspath: Set<File>
|
||||||
) : KotlinLanguageSettings {
|
) : KotlinLanguageSettings {
|
||||||
constructor(settings: KotlinLanguageSettings) : this(
|
constructor(settings: KotlinLanguageSettings) : this(
|
||||||
@@ -73,10 +73,13 @@ data class KotlinCompilationOutputImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class KotlinCompilationArgumentsImpl(
|
data class KotlinCompilationArgumentsImpl(
|
||||||
override val defaultArguments: List<String>,
|
override val defaultArguments: Array<String>,
|
||||||
override val currentArguments: List<String>
|
override val currentArguments: Array<String>
|
||||||
) : KotlinCompilationArguments {
|
) : KotlinCompilationArguments {
|
||||||
constructor(arguments: KotlinCompilationArguments) : this(ArrayList(arguments.defaultArguments), ArrayList(arguments.currentArguments))
|
constructor(arguments: KotlinCompilationArguments) : this(
|
||||||
|
arguments.defaultArguments,
|
||||||
|
arguments.currentArguments
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class KotlinCompilationImpl(
|
data class KotlinCompilationImpl(
|
||||||
@@ -85,7 +88,7 @@ data class KotlinCompilationImpl(
|
|||||||
override val dependencies: Set<KotlinDependency>,
|
override val dependencies: Set<KotlinDependency>,
|
||||||
override val output: KotlinCompilationOutput,
|
override val output: KotlinCompilationOutput,
|
||||||
override val arguments: KotlinCompilationArguments,
|
override val arguments: KotlinCompilationArguments,
|
||||||
override val dependencyClasspath: List<String>,
|
override val dependencyClasspath: Array<String>,
|
||||||
override val kotlinTaskProperties: KotlinTaskProperties
|
override val kotlinTaskProperties: KotlinTaskProperties
|
||||||
) : KotlinCompilation {
|
) : KotlinCompilation {
|
||||||
|
|
||||||
@@ -100,7 +103,7 @@ data class KotlinCompilationImpl(
|
|||||||
kotlinCompilation.dependencies.map { it.deepCopy(cloningCache) }.toSet(),
|
kotlinCompilation.dependencies.map { it.deepCopy(cloningCache) }.toSet(),
|
||||||
KotlinCompilationOutputImpl(kotlinCompilation.output),
|
KotlinCompilationOutputImpl(kotlinCompilation.output),
|
||||||
KotlinCompilationArgumentsImpl(kotlinCompilation.arguments),
|
KotlinCompilationArgumentsImpl(kotlinCompilation.arguments),
|
||||||
ArrayList(kotlinCompilation.dependencyClasspath),
|
kotlinCompilation.dependencyClasspath,
|
||||||
KotlinTaskPropertiesImpl(kotlinCompilation.kotlinTaskProperties)
|
KotlinTaskPropertiesImpl(kotlinCompilation.kotlinTaskProperties)
|
||||||
) {
|
) {
|
||||||
disambiguationClassifier = kotlinCompilation.disambiguationClassifier
|
disambiguationClassifier = kotlinCompilation.disambiguationClassifier
|
||||||
|
|||||||
Reference in New Issue
Block a user