Workarounds to build parts of stdlib as kotlin-runtime and mock runtime

Fix source paths of kotlin-stdlib-minimal-for-tests
This commit is contained in:
Ilya Gorbunov
2018-01-25 22:47:38 +03:00
parent 7c74083f09
commit 23d0e5f2e1
8 changed files with 26 additions and 11 deletions
@@ -23,16 +23,19 @@ sourceSets {
} }
val copySources by task<Copy> { val copySources by task<Copy> {
from(project(":kotlin-stdlib").projectDir.resolve("jvm/runtime")) val stdlibProjectDir = project(":kotlin-stdlib").projectDir
.include("kotlin/TypeAliases.kt",
"kotlin/text/TypeAliases.kt") from(stdlibProjectDir.resolve("runtime"))
from(project(":kotlin-stdlib").projectDir.resolve("src")) .include("kotlin/TypeAliases.kt",
.include("kotlin/collections/TypeAliases.kt", "kotlin/text/TypeAliases.kt")
"kotlin/jvm/JvmVersion.kt", from(stdlibProjectDir.resolve("src"))
"kotlin/util/Standard.kt", .include("kotlin/collections/TypeAliases.kt",
"kotlin/internal/Annotations.kt", "kotlin/jvm/JvmVersion.kt")
"kotlin/internal/contracts/ContractBuilder.kt", from(stdlibProjectDir.resolve("../src"))
"kotlin/internal/contracts/Effect.kt") .include("kotlin/util/Standard.kt",
"kotlin/internal/Annotations.kt",
"kotlin/internal/contracts/ContractBuilder.kt",
"kotlin/internal/contracts/Effect.kt")
into(File(buildDir, "src")) into(File(buildDir, "src"))
} }
@@ -44,7 +47,7 @@ tasks.withType<JavaCompile> {
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
dependsOn(copySources) dependsOn(copySources)
kotlinOptions { kotlinOptions {
freeCompilerArgs += listOf("-module-name", "kotlin-stdlib") freeCompilerArgs += listOf("-module-name", "kotlin-stdlib", "-Xmulti-platform")
} }
} }
@@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
@file:Suppress("ACTUAL_WITHOUT_EXPECT") // for building kotlin-runtime
package kotlin package kotlin
@@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
@file:Suppress("ACTUAL_WITHOUT_EXPECT") // for building kotlin-runtime
package kotlin package kotlin
public actual class UninitializedPropertyAccessException : RuntimeException { public actual class UninitializedPropertyAccessException : RuntimeException {
@@ -22,6 +22,7 @@ import kotlin.annotation.AnnotationTarget.*
* Marks the JVM backing field of the annotated property as `volatile`, meaning that writes to this field * Marks the JVM backing field of the annotated property as `volatile`, meaning that writes to this field
* are immediately made visible to other threads. * are immediately made visible to other threads.
*/ */
@Suppress("ACTUAL_WITHOUT_EXPECT") // for building kotlin-runtime
@Target(FIELD) @Target(FIELD)
@Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE)
@MustBeDocumented @MustBeDocumented
@@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
@file:Suppress("ACTUAL_WITHOUT_EXPECT") // for building kotlin-runtime
package kotlin.jvm package kotlin.jvm
import kotlin.reflect.KClass import kotlin.reflect.KClass
@@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
@file:Suppress("ACTUAL_WITHOUT_EXPECT") // for building kotlin-runtime
package kotlin.text package kotlin.text
@SinceKotlin("1.1") public actual typealias Appendable = java.lang.Appendable @SinceKotlin("1.1") public actual typealias Appendable = java.lang.Appendable
@@ -1,5 +1,7 @@
@file:kotlin.jvm.JvmVersion @file:kotlin.jvm.JvmVersion
@file:Suppress("ACTUAL_WITHOUT_EXPECT") // for building kotlin-stdlib-minimal-for-test
package kotlin.collections package kotlin.collections
@SinceKotlin("1.1") public actual typealias RandomAccess = java.util.RandomAccess @SinceKotlin("1.1") public actual typealias RandomAccess = java.util.RandomAccess
+1
View File
@@ -44,6 +44,7 @@ compileKotlin {
"-Xallow-kotlin-package", "-Xallow-kotlin-package",
"-Xnormalize-constructor-calls=enable", "-Xnormalize-constructor-calls=enable",
"-Xdump-declarations-to=${buildDir}/runtime-declarations.json", "-Xdump-declarations-to=${buildDir}/runtime-declarations.json",
"-Xmulti-platform",
"-cp", "${rootDir}/dist/builtins", "-cp", "${rootDir}/dist/builtins",
"-module-name", project.name "-module-name", project.name
] ]