From 0542b62430f7d6e9ad83e35bc2ec5ce9c8a83dcb Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Sat, 2 Mar 2024 01:51:44 +0100 Subject: [PATCH] [K/N] Extract :native:cli-native from kotlin-native/backend.native/cli.bc --- kotlin-native/backend.native/build.gradle | 24 ++++--------------- .../backend.native/cli.bc/cli.bc.iml | 18 -------------- .../backend.native/tests/build.gradle | 3 +-- kotlin-native/build.gradle | 2 +- .../build.gradle.kts | 4 +++- .../utilities/cli-runner/build.gradle.kts | 1 + native/cli-native/build.gradle.kts | 15 ++++++++++++ .../org/jetbrains/kotlin/cli/bc/K2Native.kt | 0 .../cli/bc/K2NativeCompilerArguments.kt | 0 .../build.gradle.kts | 3 ++- settings.gradle | 1 + 11 files changed, 29 insertions(+), 42 deletions(-) delete mode 100644 kotlin-native/backend.native/cli.bc/cli.bc.iml create mode 100644 native/cli-native/build.gradle.kts rename {kotlin-native/backend.native/cli.bc => native/cli-native}/src/org/jetbrains/kotlin/cli/bc/K2Native.kt (100%) rename {kotlin-native/backend.native/cli.bc => native/cli-native}/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt (100%) diff --git a/kotlin-native/backend.native/build.gradle b/kotlin-native/backend.native/build.gradle index 9031ff1b14c..b93210d116d 100644 --- a/kotlin-native/backend.native/build.gradle +++ b/kotlin-native/backend.native/build.gradle @@ -22,9 +22,6 @@ sourceSets { } resources.srcDir 'compiler/ir/backend.native/resources/' } - cli_bc { - kotlin.srcDir 'cli.bc/src' - } } compileCompilerKotlin { @@ -42,10 +39,6 @@ tasks.withType(KotlinCompilationTask.class).configureEach { compilerOptions.optIn.add("org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI") } -compileCli_bcKotlin { - compilerOptions.freeCompilerArgs.add('-Xskip-prerelease-check') -} - configurations { kotlin_compiler_jar kotlin_stdlib_jar @@ -53,11 +46,10 @@ configurations { kotlin_script_runtime_jar trove4j_jar - cli_bcApiElements { - extendsFrom cli_bcApi + compilerApiElements { + extendsFrom apiElements + extendsFrom compilerApi } - - cli_bcApi.extendsFrom compilerApi } dependencies { @@ -102,17 +94,12 @@ dependencies { compilerApi(intellijCore()) compileOnly(jpsModel()) } - - cli_bcApi sourceSets.compiler.output - - cli_bcApiElements sourceSets.cli_bc.output } -classes.dependsOn 'compilerClasses', 'cli_bcClasses' +classes.dependsOn 'compilerClasses' tasks.named("jar") { - from sourceSets.cli_bc.output, - sourceSets.compiler.output + from sourceSets.compiler.output dependsOn 'external_jars' } @@ -158,7 +145,6 @@ tasks.register("debugCompiler", JavaExec) { } RepoArtifacts.sourcesJar(project) { - it.from(sourceSets["cli_bc"].allSource) it.from(sourceSets["compiler"].allSource) } diff --git a/kotlin-native/backend.native/cli.bc/cli.bc.iml b/kotlin-native/backend.native/cli.bc/cli.bc.iml deleted file mode 100644 index 507103972c1..00000000000 --- a/kotlin-native/backend.native/cli.bc/cli.bc.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 6cd2dacca93..da75ead2c76 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -26,7 +26,6 @@ apply plugin: 'kotlin.native.build-tools-conventions' apply plugin: 'native-dependencies' configurations { - cli_bc update_tests nopPluginApi @@ -1443,7 +1442,7 @@ dependencies { nopPluginApi project(":kotlin-util-klib-metadata") nopPluginApi project(":compiler:ir.serialization.common") - api project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements') + api project(':native:cli-native') api libs.junit4 } diff --git a/kotlin-native/build.gradle b/kotlin-native/build.gradle index 8f9739c7434..a47bda96a6a 100644 --- a/kotlin-native/build.gradle +++ b/kotlin-native/build.gradle @@ -184,7 +184,7 @@ dependencies { distPack project(':native:base') distPack project(':kotlin-native:utilities:cli-runner') distPack project(':kotlin-native:klib') - distPack project(path: ':kotlin-native:backend.native', configuration: 'cli_bcApiElements') + distPack project(':native:cli-native') distPack project(path: ':kotlin-native:endorsedLibraries:kotlinx.cli', configuration: "jvmRuntimeElements") commonSources project(path: ':kotlin-stdlib', configuration: 'metadataSourcesElements') commonSources project(path: ':kotlin-test', configuration: 'metadataSourcesElements') diff --git a/kotlin-native/prepare/kotlin-native-compiler-embeddable/build.gradle.kts b/kotlin-native/prepare/kotlin-native-compiler-embeddable/build.gradle.kts index 0c066335709..25abbbb1102 100644 --- a/kotlin-native/prepare/kotlin-native-compiler-embeddable/build.gradle.kts +++ b/kotlin-native/prepare/kotlin-native-compiler-embeddable/build.gradle.kts @@ -48,12 +48,14 @@ dependencies { kotlinNativeEmbedded(project(":kotlin-native:backend.native")) kotlinNativeEmbedded(project(":kotlin-native:utilities:cli-runner")) kotlinNativeEmbedded(project(":kotlin-native:klib")) - kotlinNativeEmbedded(project(":kotlin-native:backend.native", "cli_bcApiElements")) + kotlinNativeEmbedded(project(":native:cli-native")) kotlinNativeEmbedded(project(":kotlin-native:endorsedLibraries:kotlinx.cli", "jvmRuntimeElements")) kotlinNativeEmbedded(project(":kotlin-compiler")) { isTransitive = false } kotlinNativeSources(project(":kotlin-native:backend.native")) + kotlinNativeSources(project(":native:cli-native")) kotlinNativeJavadoc(project(":kotlin-native:backend.native")) + kotlinNativeJavadoc(project(":native:cli-native")) testImplementation(libs.junit4) testImplementation(kotlinTest("junit")) diff --git a/kotlin-native/utilities/cli-runner/build.gradle.kts b/kotlin-native/utilities/cli-runner/build.gradle.kts index 2ab8c982e19..e02b1e0ce5c 100644 --- a/kotlin-native/utilities/cli-runner/build.gradle.kts +++ b/kotlin-native/utilities/cli-runner/build.gradle.kts @@ -7,6 +7,7 @@ plugins { dependencies { implementation(kotlinStdlib()) implementation(project(":kotlin-native:backend.native")) + implementation(project(":native:cli-native")) implementation(project(":compiler:cli-common")) implementation(project(":kotlin-native:Interop:StubGenerator")) implementation(project(":kotlin-native:klib")) diff --git a/native/cli-native/build.gradle.kts b/native/cli-native/build.gradle.kts new file mode 100644 index 00000000000..5c30a95abf5 --- /dev/null +++ b/native/cli-native/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + kotlin("jvm") +} + +dependencies { + api(project(":kotlin-native:backend.native", "compilerApiElements")) +} + +sourceSets { + "main" { projectDefault() } + "test" { none() } +} + +sourcesJar() +javadocJar() \ No newline at end of file diff --git a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt b/native/cli-native/src/org/jetbrains/kotlin/cli/bc/K2Native.kt similarity index 100% rename from kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt rename to native/cli-native/src/org/jetbrains/kotlin/cli/bc/K2Native.kt diff --git a/kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt b/native/cli-native/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt similarity index 100% rename from kotlin-native/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt rename to native/cli-native/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt diff --git a/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts b/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts index b8116edfdd4..ed863cdaa1d 100644 --- a/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts +++ b/prepare/ide-plugin-dependencies/kotlin-backend-native-for-ide/build.gradle.kts @@ -35,8 +35,9 @@ idePluginDependency { proguardLibraryJars(project(":native:kotlin-native-utils")) { 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")) + proguardLibraryJars(project(":native:cli-native")) backendNativeSourcesConfiguration(project(":kotlin-native:backend.native")) + backendNativeSourcesConfiguration(project(":native:cli-native")) } noDefaultJar() diff --git a/settings.gradle b/settings.gradle index 289929ea105..e78a56bb456 100644 --- a/settings.gradle +++ b/settings.gradle @@ -899,4 +899,5 @@ if (buildProperties.isKotlinNativeEnabled) { include ':kotlin-native:backend.native:tests' include ':kotlin-native:prepare:kotlin-native-compiler-embeddable' include ':native:kotlin-test-native-xctest' + include ':native:cli-native' }