Move model interfaces code from Java to Kotlin

This commit is contained in:
Lucas Smaira
2018-07-30 12:18:04 +01:00
committed by Sergey Igushkin
parent 52990c9eb1
commit 49292cd26c
21 changed files with 130 additions and 359 deletions
@@ -13,23 +13,11 @@ import java.io.Serializable
* Implementation of the [CompilerArguments] interface.
*/
data class CompilerArgumentsImpl(
private val myCurrentArguments: List<String>,
private val myDefaultArguments: List<String>,
private val myCompilerClasspath: List<File>
override val currentArguments: List<String>,
override val defaultArguments: List<String>,
override val compileClasspath: List<File>
) : CompilerArguments, Serializable {
override fun getCurrentArguments(): List<String> {
return myCurrentArguments
}
override fun getDefaultArguments(): List<String> {
return myDefaultArguments
}
override fun getCompileClasspath(): List<File> {
return myCompilerClasspath
}
companion object {
private const val serialVersionUID = 1L
}
@@ -12,13 +12,9 @@ import java.io.Serializable
* Implementation of the [ExperimentalFeatures] interface.
*/
data class ExperimentalFeaturesImpl(
private val myCoroutines: String?
override val coroutines: String?
) : ExperimentalFeatures, Serializable {
override fun getCoroutines(): String? {
return myCoroutines
}
companion object {
private const val serialVersionUID = 1L
}
@@ -13,21 +13,11 @@ import java.io.Serializable
* Implementation of the [Kapt] interface.
*/
data class KaptImpl(
private val myName: String,
private val kaptSourceSets: Collection<KaptSourceSet>
override val name: String,
override val kaptSourceSets: Collection<KaptSourceSet>
) : Kapt, Serializable {
override fun getModelVersion(): Long {
return serialVersionUID
}
override fun getName(): String {
return myName
}
override fun getKaptSourceSets(): Collection<KaptSourceSet> {
return kaptSourceSets
}
override val modelVersion = serialVersionUID
companion object {
private const val serialVersionUID = 1L
@@ -13,30 +13,14 @@ import java.io.Serializable
* Implementation of the [KaptSourceSet] interface.
*/
data class KaptSourceSetImpl(
private val myName: String,
private val myType: KaptSourceSet.KaptSourceSetType,
private val myGeneratedSourcesDirectory: File,
private val myGeneratedKotlinSourcesDirectory: File,
private val myGeneratedClassesDirectory: File
override val name: String,
override val type: KaptSourceSet.KaptSourceSetType,
override val generatedSourcesDirectory: File,
override val generatedKotlinSourcesDirectory: File,
override val generatedClassesDirectory: File
) : KaptSourceSet, Serializable {
override fun getName(): String {
return myName
}
override fun getType(): KaptSourceSet.KaptSourceSetType {
return myType
}
override fun getGeneratedSourcesDirectory(): File {
return myGeneratedSourcesDirectory
}
override fun getGeneratedKotlinSourcesDirectory(): File {
return myGeneratedKotlinSourcesDirectory
}
override fun getGeneratedClassesDirectory(): File {
return myGeneratedClassesDirectory
companion object {
private const val serialVersionUID = 1L
}
}
@@ -12,26 +12,12 @@ import java.io.Serializable
* Implementation of the [KotlinAndroidExtension] interface.
*/
data class KotlinAndroidExtensionImpl(
private val myName: String,
private val myIsExperimental: Boolean,
private val myDefaultCacheImplementation: String?
override val name: String,
override val isExperimental: Boolean,
override val defaultCacheImplementation: String?
) : KotlinAndroidExtension, Serializable {
override fun getModelVersion(): Long {
return serialVersionUID
}
override fun getName(): String {
return myName
}
override fun isExperimental(): Boolean {
return myIsExperimental
}
override fun getDefaultCacheImplementation(): String? {
return myDefaultCacheImplementation
}
override val modelVersion = serialVersionUID
companion object {
private const val serialVersionUID = 1L
@@ -14,41 +14,15 @@ import java.io.Serializable
* Implementation of the [KotlinProject] interface.
*/
data class KotlinProjectImpl(
private val myName: String,
private val myKotlinVersion: String,
private val myProjectType: KotlinProject.ProjectType,
private val mySourceSets: Collection<SourceSet>,
private val myExpectedByDependencies: Collection<String>,
private val myExperimentalFeatures: ExperimentalFeatures
override val name: String,
override val kotlinVersion: String,
override val projectType: KotlinProject.ProjectType,
override val sourceSets: Collection<SourceSet>,
override val expectedByDependencies: Collection<String>,
override val experimentalFeatures: ExperimentalFeatures
) : KotlinProject, Serializable {
override fun getModelVersion(): Long {
return serialVersionUID
}
override fun getName(): String {
return myName
}
override fun getKotlinVersion(): String {
return myKotlinVersion
}
override fun getProjectType(): KotlinProject.ProjectType {
return myProjectType
}
override fun getSourceSets(): Collection<SourceSet> {
return mySourceSets
}
override fun getExpectedByDependencies(): Collection<String> {
return myExpectedByDependencies
}
override fun getExperimentalFeatures(): ExperimentalFeatures {
return myExperimentalFeatures
}
override val modelVersion = serialVersionUID
companion object {
private const val serialVersionUID = 1L
@@ -14,48 +14,16 @@ import java.io.Serializable
* Implementation of the [SourceSet] interface.
*/
data class SourceSetImpl(
private val myName: String,
private val myType: SourceSet.SourceSetType,
private val myFriendSourceSets: Collection<String>,
private val mySourceDirectories: Collection<File>,
private val myResourcesDirectories: Collection<File>,
private val myClassesOutputDirectory: File,
private val myResourcesOutputDirectory: File,
private val myCompilerArguments: CompilerArguments
override val name: String,
override val type: SourceSet.SourceSetType,
override val friendSourceSets: Collection<String>,
override val sourceDirectories: Collection<File>,
override val resourcesDirectories: Collection<File>,
override val classesOutputDirectory: File,
override val resourcesOutputDirectory: File,
override val compilerArguments: CompilerArguments
) : SourceSet, Serializable {
override fun getName(): String {
return myName
}
override fun getType(): SourceSet.SourceSetType {
return myType
}
override fun getFriendSourceSets(): Collection<String> {
return myFriendSourceSets
}
override fun getSourceDirectories(): Collection<File> {
return mySourceDirectories
}
override fun getResourcesDirectories(): Collection<File> {
return myResourcesDirectories
}
override fun getClassesOutputDirectory(): File {
return myClassesOutputDirectory
}
override fun getResourcesOutputDirectory(): File {
return myResourcesOutputDirectory
}
override fun getCompilerArguments(): CompilerArguments {
return myCompilerArguments
}
companion object {
private const val serialVersionUID = 1L
}