[K/N] Merge :kotlin-native-shared with :native:kotlin-native-utils
* Code was moved to utils, but sources are included to the shared until bootstrap advance. * Fixed dependencies and set API & LV to 1.4 for the modules used with Gradle. Merge-request: KT-MR-9122 Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
633d840c88
commit
aed6272107
@@ -1,3 +1,5 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
@@ -16,6 +18,14 @@ sourceSets {
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions {
|
||||
languageVersion = "1.4"
|
||||
apiVersion = "1.4"
|
||||
freeCompilerArgs += listOf("-Xsuppress-version-warnings")
|
||||
}
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
standardPublicJars()
|
||||
@@ -29,11 +29,11 @@ object WobblyTF8 {
|
||||
if (char1 < '\u0080') {
|
||||
// U+0000..U+007F -> 0xxxxxxx
|
||||
// 7 meaningful bits -> 1 byte
|
||||
buffer[writtenBytes++] = char1.code
|
||||
buffer[writtenBytes++] = char1.toInt()
|
||||
} else if (char1 < '\u0800') {
|
||||
// U+0080..U+07FF -> 110xxxxx 10xxxxxx
|
||||
// 11 meaningful bits -> 2 bytes
|
||||
val codePoint = char1.code
|
||||
val codePoint = char1.toInt()
|
||||
buffer[writtenBytes++] = (codePoint ushr 6) or 0b1100_0000
|
||||
buffer[writtenBytes++] = (codePoint and 0b0011_1111) or 0b1000_0000
|
||||
} else {
|
||||
@@ -55,7 +55,7 @@ object WobblyTF8 {
|
||||
|
||||
// U+0800..U+FFFF -> 1110xxxx 10xxxxxx 10xxxxxx
|
||||
// 16 meaningful bits -> 3 bytes
|
||||
val codePoint = char1.code
|
||||
val codePoint = char1.toInt()
|
||||
buffer[writtenBytes++] = (codePoint ushr 12) or 0b1110_0000
|
||||
buffer[writtenBytes++] = ((codePoint ushr 6) and 0b0011_1111) or 0b1000_0000
|
||||
buffer[writtenBytes++] = (codePoint and 0b0011_1111) or 0b1000_0000
|
||||
|
||||
@@ -152,9 +152,9 @@ class WobblyTF8Test {
|
||||
fun ByteArray.decodeWithWobbly(): String = WobblyTF8.decode(this)
|
||||
fun ByteArray.decodeWithUTF8(): String = toString(Charsets.UTF_8)
|
||||
|
||||
val CODE_POINTS_BEFORE_SURROGATES = MIN_CODE_POINT until MIN_SURROGATE.code
|
||||
val CODE_POINTS_SURROGATES = MIN_SURROGATE.code..MAX_SURROGATE.code
|
||||
val CODE_POINTS_AFTER_SURROGATES = (MAX_SURROGATE.code + 1) until MIN_SUPPLEMENTARY_CODE_POINT
|
||||
val CODE_POINTS_BEFORE_SURROGATES = MIN_CODE_POINT until MIN_SURROGATE.toInt()
|
||||
val CODE_POINTS_SURROGATES = MIN_SURROGATE.toInt()..MAX_SURROGATE.toInt()
|
||||
val CODE_POINTS_AFTER_SURROGATES = (MAX_SURROGATE.toInt() + 1) until MIN_SUPPLEMENTARY_CODE_POINT
|
||||
val CODE_POINTS_SUPPLEMENTARY = MIN_SUPPLEMENTARY_CODE_POINT..MAX_CODE_POINT
|
||||
|
||||
fun generateWellFormedString(
|
||||
|
||||
@@ -210,7 +210,7 @@ task sanity {
|
||||
})
|
||||
dependsOn(":kotlin-native:Interop:Indexer:check")
|
||||
dependsOn(":kotlin-native:Interop:StubGenerator:check")
|
||||
dependsOn(":kotlin-native-shared:check")
|
||||
dependsOn(":native:kotlin-native-utils:check")
|
||||
}
|
||||
|
||||
boolean isExcluded(String dir) {
|
||||
|
||||
@@ -58,8 +58,6 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-metadata-klib:$metadataVersion")
|
||||
|
||||
implementation("org.jetbrains.kotlin:kotlin-util-klib:${project.bootstrapKotlinVersion}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-native-utils:${project.bootstrapKotlinVersion}")
|
||||
|
||||
api(project(":kotlin-native-shared"))
|
||||
}
|
||||
|
||||
|
||||
@@ -42,15 +42,22 @@ java {
|
||||
kotlin {
|
||||
sourceSets {
|
||||
main {
|
||||
kotlin.srcDir("src/main/kotlin")
|
||||
kotlin.srcDir("src/library/kotlin")
|
||||
// TODO: All code was moved to utils. Bootstrap should be advanced to make these classes appear
|
||||
// in the bootstrap version of kotlin-native-utils. Only then this project should be removed, all usages
|
||||
// of `:kotlin-native-shared` should be replaced with `:native:kotlin-native-utils`
|
||||
kotlin.srcDir("../../native/utils/src")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlinOptions.freeCompilerArgs += listOf("-Xskip-prerelease-check")
|
||||
kotlinOptions {
|
||||
languageVersion = "1.4"
|
||||
apiVersion = "1.4"
|
||||
allWarningsAsErrors = false
|
||||
jvmTarget = "1.8"
|
||||
freeCompilerArgs += "-Xskip-prerelease-check"
|
||||
}
|
||||
}
|
||||
|
||||
val isCompositeBootstrap = project.extraProperties.has("kotlin.native.build.composite-bootstrap")
|
||||
@@ -60,7 +67,7 @@ val isCompositeBootstrap = project.extraProperties.has("kotlin.native.build.comp
|
||||
*
|
||||
* It to use this project in composite build (build-tools) and as a project itself.
|
||||
* Project should depend on a current snapshot builds while build-tools use bootstrap dependencies.
|
||||
* TODO: merge this project with kotlin-native-utils to get rid of this hack
|
||||
* TODO: finalize merge of this project with kotlin-native-utils to get rid of this hack
|
||||
*/
|
||||
fun compositeDependency(coordinates: String, subproject: String = ""): Any {
|
||||
val parts = coordinates.split(':')
|
||||
@@ -78,7 +85,6 @@ fun compositeDependency(coordinates: String, subproject: String = ""): Any {
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:${project.bootstrapKotlinVersion}")
|
||||
api(compositeDependency("org.jetbrains.kotlin:kotlin-native-utils:${project.bootstrapKotlinVersion}", ":native"))
|
||||
api(compositeDependency("org.jetbrains.kotlin:kotlin-util-klib:${project.bootstrapKotlinVersion}"))
|
||||
api(compositeDependency("org.jetbrains.kotlin:kotlin-util-io:${project.bootstrapKotlinVersion}"))
|
||||
|
||||
@@ -92,9 +98,3 @@ dependencies {
|
||||
testApi("org.junit.jupiter:junit-jupiter")
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCompositeBootstrap) {
|
||||
tasks.withType<Test>().configureEach() {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,13 @@ description = "Kotlin/Native utils"
|
||||
dependencies {
|
||||
compileOnly(kotlinStdlib())
|
||||
api(project(":kotlin-util-io"))
|
||||
api(project(":kotlin-util-klib"))
|
||||
api(platform(project(":kotlin-gradle-plugins-bom")))
|
||||
|
||||
testImplementation(commonDependency("junit:junit"))
|
||||
testImplementation(kotlinStdlib())
|
||||
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||
testApiJUnit5()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -28,10 +30,12 @@ tasks {
|
||||
freeCompilerArgs += "-Xsuppress-version-warnings"
|
||||
}
|
||||
}
|
||||
|
||||
withType<Test>().configureEach {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: this single known external consumer of this artifact is Kotlin/Native backend,
|
||||
// so publishing could be stopped after migration to monorepo
|
||||
publish()
|
||||
|
||||
standardPublicJars()
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,7 @@ internal class CurrentXcodeTest {
|
||||
assumeTrue(HostManager.hostIsMac)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should be able to access Xcode bundle version`() {
|
||||
val version = CurrentXcode().bundleVersion
|
||||
@@ -18,9 +18,9 @@ idePluginDependency {
|
||||
val embedded by configurations
|
||||
|
||||
dependencies {
|
||||
embedded(project(":kotlin-native-shared")) { isTransitive = false }
|
||||
embedded(project(":kotlin-native:backend.native")) { isTransitive = false }
|
||||
|
||||
proguardLibraryJars(project(":kotlin-native-shared")) { isTransitive = false }
|
||||
proguardLibraryJars(project(":kotlin-native:backend.native", "kotlin_stdlib_jar"))
|
||||
proguardLibraryJars(project(":kotlin-native:backend.native", "kotlin_reflect_jar"))
|
||||
proguardLibraryJars(project(":kotlin-native:backend.native", "cli_bcApiElements"))
|
||||
|
||||
Reference in New Issue
Block a user