Minor klib cleanups

Review: https://jetbrains.team/p/kt/reviews/8401

- Code style
- Drop unused properties in kotlin-native/build.gradle
- kotlin-native/build.gradle: drop unused import
- use final instead of open when possible

This is just a cleanup commit. It neither fixes any issue/bug, nor
introduces new behaviour.

Feel free to revert this commit if you find out that it breaks something
This commit is contained in:
Nikita Bobko
2023-01-09 10:33:43 +01:00
parent 73149fdf0b
commit dff13ec584
6 changed files with 12 additions and 16 deletions
@@ -11,11 +11,11 @@ data class KotlinLibraryVersioning(
) )
fun Properties.writeKonanLibraryVersioning(versions: KotlinLibraryVersioning) { fun Properties.writeKonanLibraryVersioning(versions: KotlinLibraryVersioning) {
versions.abiVersion ?. let { this.setProperty(KLIB_PROPERTY_ABI_VERSION, it.toString()) } versions.abiVersion?.let { this.setProperty(KLIB_PROPERTY_ABI_VERSION, it.toString()) }
versions.libraryVersion ?. let { this.setProperty(KLIB_PROPERTY_LIBRARY_VERSION, it) } versions.libraryVersion?.let { this.setProperty(KLIB_PROPERTY_LIBRARY_VERSION, it) }
versions.compilerVersion ?. let { this.setProperty(KLIB_PROPERTY_COMPILER_VERSION, it) } versions.compilerVersion?.let { this.setProperty(KLIB_PROPERTY_COMPILER_VERSION, it) }
versions.metadataVersion ?. let { this.setProperty(KLIB_PROPERTY_METADATA_VERSION, it) } versions.metadataVersion?.let { this.setProperty(KLIB_PROPERTY_METADATA_VERSION, it) }
versions.irVersion ?. let { this.setProperty(KLIB_PROPERTY_IR_VERSION, it) } versions.irVersion?.let { this.setProperty(KLIB_PROPERTY_IR_VERSION, it) }
} }
fun Properties.readKonanLibraryVersioning(): KotlinLibraryVersioning { fun Properties.readKonanLibraryVersioning(): KotlinLibraryVersioning {
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.konan.properties.Properties
import org.jetbrains.kotlin.konan.properties.loadProperties import org.jetbrains.kotlin.konan.properties.loadProperties
import org.jetbrains.kotlin.library.* import org.jetbrains.kotlin.library.*
open class BaseKotlinLibraryImpl( class BaseKotlinLibraryImpl(
val access: BaseLibraryAccess<KotlinLibraryLayout>, val access: BaseLibraryAccess<KotlinLibraryLayout>,
override val isDefault: Boolean override val isDefault: Boolean
) : BaseKotlinLibrary { ) : BaseKotlinLibrary {
@@ -53,7 +53,7 @@ open class BaseKotlinLibraryImpl(
} }
} }
open class MetadataLibraryImpl( class MetadataLibraryImpl(
val access: MetadataLibraryAccess<MetadataKotlinLibraryLayout> val access: MetadataLibraryAccess<MetadataKotlinLibraryLayout>
) : MetadataLibrary { ) : MetadataLibrary {
@@ -292,7 +292,7 @@ class IrPerFileLibraryImpl(_access: IrLibraryAccess<IrKotlinLibraryLayout>) : Ir
} }
} }
open class KotlinLibraryImpl( class KotlinLibraryImpl(
val base: BaseKotlinLibraryImpl, val base: BaseKotlinLibraryImpl,
val metadata: MetadataLibraryImpl, val metadata: MetadataLibraryImpl,
val ir: IrLibraryImpl val ir: IrLibraryImpl
@@ -73,11 +73,11 @@ open class BaseLibraryAccess<L : KotlinLibraryLayout>(val klib: File, component:
} }
open class MetadataLibraryAccess<L : KotlinLibraryLayout>(klib: File, component: String) : BaseLibraryAccess<L>(klib, component) { class MetadataLibraryAccess<L : KotlinLibraryLayout>(klib: File, component: String) : BaseLibraryAccess<L>(klib, component) {
override val layout = MetadataLibraryLayoutImpl(klib, component) override val layout = MetadataLibraryLayoutImpl(klib, component)
} }
open class IrLibraryAccess<L : KotlinLibraryLayout>(klib: File, component: String) : BaseLibraryAccess<L>(klib, component) { class IrLibraryAccess<L : KotlinLibraryLayout>(klib: File, component: String) : BaseLibraryAccess<L>(klib, component) {
override val layout = IrLibraryLayoutImpl(klib, component) override val layout = IrLibraryLayoutImpl(klib, component)
} }
@@ -123,7 +123,7 @@ open class ExtractingKotlinLibraryLayout(zipped: KotlinLibraryLayoutImpl) : Kotl
override val component = zipped.component override val component = zipped.component
} }
open class ExtractingBaseLibraryImpl(zipped: KotlinLibraryLayoutImpl) : class ExtractingBaseLibraryImpl(zipped: KotlinLibraryLayoutImpl) :
ExtractingKotlinLibraryLayout(zipped) { ExtractingKotlinLibraryLayout(zipped) {
override val manifestFile: File by lazy { zipped.extract(zipped.manifestFile) } override val manifestFile: File by lazy { zipped.extract(zipped.manifestFile) }
override val resourcesDir: File by lazy { zipped.extractDir(zipped.resourcesDir) } override val resourcesDir: File by lazy { zipped.extractDir(zipped.resourcesDir) }
@@ -24,7 +24,7 @@ open class KotlinLibraryLayoutForWriter(
get() = File(unzippedDir, KLIB_MANIFEST_FILE_NAME) get() = File(unzippedDir, KLIB_MANIFEST_FILE_NAME)
} }
open class BaseWriterImpl( class BaseWriterImpl(
val libraryLayout: KotlinLibraryLayoutForWriter, val libraryLayout: KotlinLibraryLayoutForWriter,
moduleName: String, moduleName: String,
_versions: KotlinLibraryVersioning, _versions: KotlinLibraryVersioning,
-2
View File
@@ -80,8 +80,6 @@ ext {
kotlinCompilerModule = project(":kotlin-compiler") kotlinCompilerModule = project(":kotlin-compiler")
kotlinStdLibModule= project(":kotlin-stdlib") kotlinStdLibModule= project(":kotlin-stdlib")
kotlinScriptRuntimeModule= project(":kotlin-script-runtime")
kotlinUtilKliMetadatabModule= project(":kotlin-util-klib-metadata")
// A separate map for each build for automatic cleaning the daemon after the build have finished. // A separate map for each build for automatic cleaning the daemon after the build have finished.
toolClassLoadersMap = new ConcurrentHashMap<Object, URLClassLoader>() toolClassLoadersMap = new ConcurrentHashMap<Object, URLClassLoader>()
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.UtilsKt
def kotlinRoot = ext.properties.containsKey("rootBuildDirectory") ? file("${ext.rootBuildDirectory}/..") : rootProject.projectDir def kotlinRoot = ext.properties.containsKey("rootBuildDirectory") ? file("${ext.rootBuildDirectory}/..") : rootProject.projectDir
File versionPropertiesFile = new File(kotlinRoot, "gradle/versions.properties") File versionPropertiesFile = new File(kotlinRoot, "gradle/versions.properties")
def versionProperties = new Properties() def versionProperties = new Properties()