KLIB reader: comments added (#1937)

This commit is contained in:
Dmitriy Dolovov
2018-08-25 18:33:04 +03:00
committed by GitHub
parent dcb423a3ce
commit 6d8ae1650f
12 changed files with 40 additions and 0 deletions
+2
View File
@@ -1,3 +1,5 @@
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: drop this module completely!
buildscript { buildscript {
ext.rootBuildDirectory = file('../..') ext.rootBuildDirectory = file('../..')
+2
View File
@@ -1,3 +1,5 @@
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: drop this module completely!
buildscript { buildscript {
ext.rootBuildDirectory = file('../..') ext.rootBuildDirectory = file('../..')
@@ -11,6 +11,18 @@ interface KonanResolvedModuleDescriptorsFactory {
val moduleDescriptorFactory: KonanDeserializedModuleDescriptorFactory val moduleDescriptorFactory: KonanDeserializedModuleDescriptorFactory
/**
* Given the [resolvedLibraries] creates the list of [ModuleDescriptorImpl]s with properly installed
* inter-dependencies. The result of this method is returned in a form of [KonanResolvedModuleDescriptors] instance.
*
* Please use this method with care: Unless this method accepts `null` for [builtIns], it is not recommended to
* invoke it this way. If you are compiling a source module, please supply the non-null [builtIns] from the
* source module, so that all modules created in your compilation session will share the same built-ins instance.
*
* Otherwise (if `null` was supplied), a new instance of [KotlinBuiltIns] will be created. The created built-ins
* instance will be shared by all modules created in this method. But this instance will have no connection
* with probably existing built-ins instance of your source module(s).
*/
fun createResolved( fun createResolved(
resolvedLibraries: KonanLibraryResolveResult, resolvedLibraries: KonanLibraryResolveResult,
storageManager: StorageManager, storageManager: StorageManager,
@@ -22,6 +34,11 @@ interface KonanResolvedModuleDescriptorsFactory {
class KonanResolvedModuleDescriptors( class KonanResolvedModuleDescriptors(
/**
* The list of modules each representing an individual Kotlin/Native library. All modules
* in this list have properly installed dependencies, i.e. module has all necessary dependencies
* on other modules plus a dependency on the [forwardDeclarationsModule].
*/
val resolvedDescriptors: List<ModuleDescriptorImpl>, val resolvedDescriptors: List<ModuleDescriptorImpl>,
/** /**
+1
View File
@@ -34,6 +34,7 @@ repositories {
} }
} }
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: drop generation of KonanVersion!
task generateCompilerVersion(type: VersionGenerator){} task generateCompilerVersion(type: VersionGenerator){}
sourceSets { sourceSets {
@@ -16,6 +16,8 @@
package org.jetbrains.kotlin.konan package org.jetbrains.kotlin.konan
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
/** /**
* https://en.wikipedia.org/wiki/Software_versioning * https://en.wikipedia.org/wiki/Software_versioning
* scheme major.minor[.build[.revision]]. * scheme major.minor[.build[.revision]].
@@ -16,6 +16,8 @@
package org.jetbrains.kotlin.konan.util package org.jetbrains.kotlin.konan.util
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
val <T : Enum<T>> T.visibleName get() = name.toLowerCase() val <T : Enum<T>> T.visibleName get() = name.toLowerCase()
interface Named { interface Named {
val name: String val name: String
@@ -16,6 +16,8 @@
package org.jetbrains.kotlin.konan.file package org.jetbrains.kotlin.konan.file
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
import java.io.BufferedReader import java.io.BufferedReader
import java.io.InputStream import java.io.InputStream
import java.io.InputStreamReader import java.io.InputStreamReader
@@ -6,17 +6,20 @@ import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.util.removeSuffixIfPresent import org.jetbrains.kotlin.konan.util.removeSuffixIfPresent
import org.jetbrains.kotlin.konan.util.suffixIfNot import org.jetbrains.kotlin.konan.util.suffixIfNot
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the constants below:
const val KLIB_FILE_EXTENSION = "klib" const val KLIB_FILE_EXTENSION = "klib"
const val KLIB_FILE_EXTENSION_WITH_DOT = ".$KLIB_FILE_EXTENSION" const val KLIB_FILE_EXTENSION_WITH_DOT = ".$KLIB_FILE_EXTENSION"
const val KONAN_STDLIB_NAME = "stdlib" const val KONAN_STDLIB_NAME = "stdlib"
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove this interface!
interface SearchPathResolver { interface SearchPathResolver {
val searchRoots: List<File> val searchRoots: List<File>
fun resolve(givenPath: String): File fun resolve(givenPath: String): File
fun defaultLinks(noStdLib: Boolean, noDefaultLibs: Boolean): List<File> fun defaultLinks(noStdLib: Boolean, noDefaultLibs: Boolean): List<File>
} }
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove this interface!
interface SearchPathResolverWithTarget: SearchPathResolver { interface SearchPathResolverWithTarget: SearchPathResolver {
val target: KonanTarget val target: KonanTarget
} }
@@ -16,6 +16,8 @@
package org.jetbrains.kotlin.konan.target package org.jetbrains.kotlin.konan.target
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
import org.jetbrains.kotlin.konan.target.KonanTarget.* import org.jetbrains.kotlin.konan.target.KonanTarget.*
import org.jetbrains.kotlin.konan.util.Named import org.jetbrains.kotlin.konan.util.Named
import java.io.Serializable import java.io.Serializable
@@ -16,6 +16,8 @@
package org.jetbrains.kotlin.konan.properties package org.jetbrains.kotlin.konan.properties
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
import org.jetbrains.kotlin.konan.file.* import org.jetbrains.kotlin.konan.file.*
typealias Properties = java.util.Properties typealias Properties = java.util.Properties
@@ -3,6 +3,8 @@ package org.jetbrains.kotlin.konan.util
import org.jetbrains.kotlin.konan.target.KonanTarget import org.jetbrains.kotlin.konan.target.KonanTarget
import java.util.* import java.util.*
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove the whole file!
fun defaultTargetSubstitutions(target: KonanTarget) = fun defaultTargetSubstitutions(target: KonanTarget) =
mapOf<String, String>( mapOf<String, String>(
"target" to target.visibleName, "target" to target.visibleName,
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.konan.util
import kotlin.system.measureTimeMillis import kotlin.system.measureTimeMillis
import org.jetbrains.kotlin.konan.file.* import org.jetbrains.kotlin.konan.file.*
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove this function:
fun printMillisec(message: String, body: () -> Unit) { fun printMillisec(message: String, body: () -> Unit) {
val msec = measureTimeMillis{ val msec = measureTimeMillis{
body() body()
@@ -26,10 +27,12 @@ fun printMillisec(message: String, body: () -> Unit) {
println("$message: $msec msec") println("$message: $msec msec")
} }
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove this function:
fun profile(message: String, body: () -> Unit) = profileIf( fun profile(message: String, body: () -> Unit) = profileIf(
System.getProperty("konan.profile")?.equals("true") ?: false, System.getProperty("konan.profile")?.equals("true") ?: false,
message, body) message, body)
// FIXME(ddol): KLIB-REFACTORING-CLEANUP: remove this function:
fun profileIf(condition: Boolean, message: String, body: () -> Unit) = fun profileIf(condition: Boolean, message: String, body: () -> Unit) =
if (condition) printMillisec(message, body) else body() if (condition) printMillisec(message, body) else body()