generators: extract OperationsMap generator to a separate source set
Refactor generators so that OperationsMapGenerator is in its own source set with minimal dependencies.
This commit is contained in:
+49
-29
@@ -4,45 +4,64 @@ plugins {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { }
|
||||
"main" { java.srcDirs("main") }
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
val builtinsSourceSet = sourceSets.create("builtins") {
|
||||
java.srcDir("builtins")
|
||||
fun extraSourceSet(name: String, extendMain: Boolean = true): Pair<SourceSet, Configuration> {
|
||||
val sourceSet = sourceSets.create(name) {
|
||||
java.srcDir(name)
|
||||
}
|
||||
val api = configurations[sourceSet.apiConfigurationName]
|
||||
if (extendMain) {
|
||||
dependencies { api(mainSourceSet.output) }
|
||||
configurations[sourceSet.runtimeOnlyConfigurationName]
|
||||
.extendsFrom(configurations.runtimeClasspath.get())
|
||||
}
|
||||
return sourceSet to api
|
||||
}
|
||||
val builtinsCompile by configurations
|
||||
|
||||
val (builtinsSourceSet, builtinsApi) = extraSourceSet("builtins", extendMain = false)
|
||||
val (evaluateSourceSet, evaluateApi) = extraSourceSet("evaluate")
|
||||
|
||||
dependencies {
|
||||
compile(projectTests(":compiler:cli"))
|
||||
compile(projectTests(":idea:idea-maven"))
|
||||
compile(projectTests(":j2k"))
|
||||
compile(projectTests(":nj2k"))
|
||||
compile(projectTests(":libraries:tools:new-project-wizard:new-project-wizard-cli"))
|
||||
compile(projectTests(":idea:idea-android"))
|
||||
compile(projectTests(":idea:scripting-support"))
|
||||
compile(projectTests(":jps-plugin"))
|
||||
compile(projectTests(":plugins:jvm-abi-gen"))
|
||||
compile(projectTests(":plugins:android-extensions-compiler"))
|
||||
compile(projectTests(":plugins:android-extensions-ide"))
|
||||
compile(projectTests(":kotlin-annotation-processing"))
|
||||
compile(projectTests(":kotlin-annotation-processing-cli"))
|
||||
compile(projectTests(":kotlin-allopen-compiler-plugin"))
|
||||
compile(projectTests(":kotlin-noarg-compiler-plugin"))
|
||||
compile(projectTests(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
compile(projectTests(":kotlinx-serialization-compiler-plugin"))
|
||||
compile(projectTests(":idea:jvm-debugger:jvm-debugger-test"))
|
||||
compile(projectTests(":generators:test-generator"))
|
||||
compile(projectTests(":idea"))
|
||||
builtinsCompile("org.jetbrains.kotlin:kotlin-stdlib:$bootstrapKotlinVersion")
|
||||
// for GeneratorsFileUtil
|
||||
api(kotlinStdlib())
|
||||
api(intellijDep()) { includeJars("util") }
|
||||
|
||||
builtinsApi("org.jetbrains.kotlin:kotlin-stdlib:$bootstrapKotlinVersion") { isTransitive = false }
|
||||
evaluateApi(project(":core:deserialization"))
|
||||
|
||||
testImplementation(builtinsSourceSet.output)
|
||||
testImplementation(evaluateSourceSet.output)
|
||||
|
||||
testImplementation(projectTests(":compiler:cli"))
|
||||
testImplementation(projectTests(":idea:idea-maven"))
|
||||
testImplementation(projectTests(":j2k"))
|
||||
testImplementation(projectTests(":nj2k"))
|
||||
testImplementation(projectTests(":libraries:tools:new-project-wizard:new-project-wizard-cli"))
|
||||
testImplementation(projectTests(":idea:idea-android"))
|
||||
testImplementation(projectTests(":idea:scripting-support"))
|
||||
testImplementation(projectTests(":jps-plugin"))
|
||||
testImplementation(projectTests(":plugins:jvm-abi-gen"))
|
||||
testImplementation(projectTests(":plugins:android-extensions-compiler"))
|
||||
testImplementation(projectTests(":plugins:android-extensions-ide"))
|
||||
testImplementation(projectTests(":kotlin-annotation-processing"))
|
||||
testImplementation(projectTests(":kotlin-annotation-processing-cli"))
|
||||
testImplementation(projectTests(":kotlin-allopen-compiler-plugin"))
|
||||
testImplementation(projectTests(":kotlin-noarg-compiler-plugin"))
|
||||
testImplementation(projectTests(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
testImplementation(projectTests(":kotlinx-serialization-compiler-plugin"))
|
||||
testImplementation(projectTests(":idea:jvm-debugger:jvm-debugger-test"))
|
||||
testImplementation(projectTests(":generators:test-generator"))
|
||||
testImplementation(projectTests(":idea"))
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testCompile(builtinsSourceSet.output)
|
||||
testRuntime(intellijDep()) { includeJars("idea_rt") }
|
||||
testRuntime(project(":kotlin-reflect"))
|
||||
testRuntimeOnly(intellijDep()) { includeJars("idea_rt") }
|
||||
testRuntimeOnly(project(":kotlin-reflect"))
|
||||
|
||||
if (Ide.IJ()) {
|
||||
testCompileOnly(jpsBuildTest())
|
||||
testCompile(jpsBuildTest())
|
||||
testImplementation(jpsBuildTest())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,5 +78,6 @@ val generateProtoBufCompare by generator("org.jetbrains.kotlin.generators.protob
|
||||
val generateGradleOptions by generator("org.jetbrains.kotlin.generators.arguments.GenerateGradleOptionsKt")
|
||||
|
||||
val generateBuiltins by generator("org.jetbrains.kotlin.generators.builtins.generateBuiltIns.GenerateBuiltInsKt", builtinsSourceSet)
|
||||
val generateOperationsMap by generator("org.jetbrains.kotlin.generators.evaluate.GenerateOperationsMapKt", evaluateSourceSet)
|
||||
|
||||
testsJar()
|
||||
|
||||
+2
-13
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.generators.evaluate
|
||||
+1
-2
@@ -6,7 +6,6 @@ package org.jetbrains.kotlin.generators.util
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
@@ -33,7 +32,7 @@ object GeneratorsFileUtil {
|
||||
}
|
||||
val useTempFile = !SystemInfo.isWindows
|
||||
val tempFile =
|
||||
if (useTempFile) File(KotlinTestUtils.tmpDir(file.name), file.name + ".tmp") else file
|
||||
if (useTempFile) File(createTempDir(file.name), file.name + ".tmp") else file
|
||||
tempFile.writeText(newText, Charsets.UTF_8)
|
||||
println("File written: " + tempFile.absolutePath)
|
||||
if (useTempFile) {
|
||||
@@ -10,6 +10,7 @@ dependencies {
|
||||
testCompile(projectTests(":compiler:tests-common"))
|
||||
testCompile(kotlinStdlib())
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":generators"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
Reference in New Issue
Block a user