Merge pull request #34 from bazelbuild/reorganize_packages
reorganize builder packages
diff --git a/.bazelproject b/.bazelproject
index ec0f427..1574656 100644
--- a/.bazelproject
+++ b/.bazelproject
@@ -17,7 +17,7 @@
.
targets:
- //kotlin/workers:for_ide
+ //kotlin/builder:for_ide
//:all_tests
//examples/...
diff --git a/BUILD b/BUILD
index b5351ab..b8b3116 100644
--- a/BUILD
+++ b/BUILD
@@ -14,7 +14,7 @@
test_suite(
name = "all_tests",
tests = [
- "//kotlin/workers:unittests",
+ "//kotlin/builder:unittests",
"//tests/integrationtests"
]
)
\ No newline at end of file
diff --git a/kotlin/workers/BUILD b/kotlin/builder/BUILD
similarity index 82%
rename from kotlin/workers/BUILD
rename to kotlin/builder/BUILD
index 6cfd49f..7ca7573 100644
--- a/kotlin/workers/BUILD
+++ b/kotlin/builder/BUILD
@@ -11,13 +11,13 @@
# 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.
-load("//kotlin/workers:bootstrap.bzl", "kotlin_worker_lib")
+load("//kotlin/builder:bootstrap.bzl", "kotlin_worker_lib")
kotlin_worker_lib(
srcs = glob(["src/**/*.kt"]),
args = ["-jvm-target", "1.8"],
deps = [
- "//kotlin/workers/proto",
+ "//kotlin/builder/proto",
"@com_github_jetbrains_kotlin//:preloader",
"@io_bazel_rules_kotlin_protobuf_protobuf_java//jar",
"//third_party:okio",
@@ -25,7 +25,7 @@
"//third_party:moshi-kotlin"
],
exports = [
- "//kotlin/workers/proto",
+ "//kotlin/builder/proto",
],
runtime_deps = [
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
@@ -36,15 +36,15 @@
)
java_binary(
- name = "compiler_jvm",
- main_class = "io.bazel.ruleskotlin.workers.KotlinJvmBuilder",
+ name = "builder",
+ main_class = "io.bazel.kotlin.builder.KotlinBuilder",
visibility = ["//visibility:public"],
runtime_deps = [":worker_lib"]
)
java_test(
name = "unittests",
- test_class = "io.bazel.ruleskotlin.workers.compilers.jvm.utils.JdepsParserTest",
+ test_class = "io.bazel.kotlin.builder.mode.jvm.utils.JdepsParserTest",
srcs = glob(["unittests/**/*.java"]),
deps = [":worker_lib"],
size = "small"
diff --git a/kotlin/workers/bootstrap.bzl b/kotlin/builder/bootstrap.bzl
similarity index 100%
rename from kotlin/workers/bootstrap.bzl
rename to kotlin/builder/bootstrap.bzl
diff --git a/kotlin/workers/proto/BUILD b/kotlin/builder/proto/BUILD
similarity index 89%
rename from kotlin/workers/proto/BUILD
rename to kotlin/builder/proto/BUILD
index e5770b9..367160c 100644
--- a/kotlin/workers/proto/BUILD
+++ b/kotlin/builder/proto/BUILD
@@ -18,7 +18,7 @@
"jars/libworker_protocol_proto-speed.jar"
],
exports = ["@io_bazel_rules_kotlin_protobuf_protobuf_java//jar"],
- visibility = ["//kotlin/workers:__subpackages__"]
+ visibility = ["//kotlin/builder:__subpackages__"]
)
filegroup(
@@ -27,5 +27,5 @@
"jars/libdeps_proto-speed.jar",
"jars/libworker_protocol_proto-speed.jar"
],
- visibility = ["//kotlin/workers:__subpackages__"]
+ visibility = ["//kotlin/builder:__subpackages__"]
)
\ No newline at end of file
diff --git a/kotlin/workers/proto/deps.proto b/kotlin/builder/proto/deps.proto
similarity index 100%
rename from kotlin/workers/proto/deps.proto
rename to kotlin/builder/proto/deps.proto
diff --git a/kotlin/workers/proto/jars/libdeps_proto-speed.jar b/kotlin/builder/proto/jars/libdeps_proto-speed.jar
similarity index 100%
rename from kotlin/workers/proto/jars/libdeps_proto-speed.jar
rename to kotlin/builder/proto/jars/libdeps_proto-speed.jar
Binary files differ
diff --git a/kotlin/workers/proto/jars/libworker_protocol_proto-speed.jar b/kotlin/builder/proto/jars/libworker_protocol_proto-speed.jar
similarity index 100%
rename from kotlin/workers/proto/jars/libworker_protocol_proto-speed.jar
rename to kotlin/builder/proto/jars/libworker_protocol_proto-speed.jar
Binary files differ
diff --git a/kotlin/workers/proto/worker_protocol.proto b/kotlin/builder/proto/worker_protocol.proto
similarity index 100%
rename from kotlin/workers/proto/worker_protocol.proto
rename to kotlin/builder/proto/worker_protocol.proto
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/BazelWorker.kt b/kotlin/builder/src/io/bazel/kotlin/builder/BazelWorker.kt
similarity index 97%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/BazelWorker.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/BazelWorker.kt
index 0aa3f75..7834b4b 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/BazelWorker.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/BazelWorker.kt
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
import com.google.devtools.build.lib.worker.WorkerProtocol
-import io.bazel.ruleskotlin.workers.utils.rootCause
+import io.bazel.kotlin.builder.utils.rootCause
import java.io.*
import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file.Files
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/BuildAction.kt b/kotlin/builder/src/io/bazel/kotlin/builder/BuildAction.kt
similarity index 95%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/BuildAction.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/BuildAction.kt
index 7805229..87e6b09 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/BuildAction.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/BuildAction.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
abstract class BuildAction(@Suppress("unused") val id : String, protected val toolchain: KotlinToolchain) {
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/CommandLineProgram.kt b/kotlin/builder/src/io/bazel/kotlin/builder/CommandLineProgram.kt
similarity index 98%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/CommandLineProgram.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/CommandLineProgram.kt
index 3479d50..082d0fe 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/CommandLineProgram.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/CommandLineProgram.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
/**
* Interface for command line programs.
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/CompileResult.kt b/kotlin/builder/src/io/bazel/kotlin/builder/CompileResult.kt
similarity index 95%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/CompileResult.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/CompileResult.kt
index 52c30b4..5cf91cf 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/CompileResult.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/CompileResult.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
import java.util.*
@@ -34,7 +34,7 @@
error().ifPresent { e -> throw RuntimeException(message, e) }
}
- class Meta(id: String) : io.bazel.ruleskotlin.workers.Meta<CompileResult> {
+ class Meta(id: String) : io.bazel.kotlin.builder.Meta<CompileResult> {
override val id: String = id
fun run(ctx: Context, op: (Context) -> Int): CompileResult {
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/Context.kt b/kotlin/builder/src/io/bazel/kotlin/builder/Context.kt
similarity index 96%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/Context.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/Context.kt
index eba0f6c..9dbc1c7 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/Context.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/Context.kt
@@ -15,7 +15,7 @@
*/
@file:Suppress("UNCHECKED_CAST")
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
import java.util.stream.Stream
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/Flag.kt b/kotlin/builder/src/io/bazel/kotlin/builder/Flag.kt
similarity index 98%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/Flag.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/Flag.kt
index 633f17b..416ffcc 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/Flag.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/Flag.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.KotlinJsonAdapterFactory
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/KotlinJvmBuilder.kt b/kotlin/builder/src/io/bazel/kotlin/builder/KotlinBuilder.kt
similarity index 88%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/KotlinJvmBuilder.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/KotlinBuilder.kt
index 1244a96..244686b 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/KotlinJvmBuilder.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/KotlinBuilder.kt
@@ -13,17 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
-import io.bazel.ruleskotlin.workers.compilers.jvm.actions.*
-import io.bazel.ruleskotlin.workers.model.Flags
+import io.bazel.kotlin.builder.mode.jvm.actions.*
+import io.bazel.kotlin.builder.model.Flags
import java.io.IOException
/**
* Bazel Kotlin Compiler worker.
*/
-object KotlinJvmBuilder : CommandLineProgram.Base(
+object KotlinBuilder : CommandLineProgram.Base(
flags = Flags::class.flagsByName()
) {
override val toolchain: KotlinToolchain = try {
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/KotlinToolchain.kt b/kotlin/builder/src/io/bazel/kotlin/builder/KotlinToolchain.kt
similarity index 95%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/KotlinToolchain.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/KotlinToolchain.kt
index 0e948e0..cf68e6f 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/KotlinToolchain.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/KotlinToolchain.kt
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
-import io.bazel.ruleskotlin.workers.utils.resolveVerified
-import io.bazel.ruleskotlin.workers.utils.verifiedRelativeFiles
+import io.bazel.kotlin.builder.utils.resolveVerified
+import io.bazel.kotlin.builder.utils.verifiedRelativeFiles
import org.jetbrains.kotlin.preloading.ClassPreloadingUtils
import org.jetbrains.kotlin.preloading.Preloader
import java.io.File
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/Meta.kt b/kotlin/builder/src/io/bazel/kotlin/builder/Meta.kt
similarity index 97%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/Meta.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/Meta.kt
index fd76c8f..dd089bb 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/Meta.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/Meta.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers
+package io.bazel.kotlin.builder
interface Meta<T : Any> {
val id: String
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/CreateOutputJar.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/CreateOutputJar.kt
similarity index 80%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/CreateOutputJar.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/CreateOutputJar.kt
index 17d1157..7075633 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/CreateOutputJar.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/CreateOutputJar.kt
@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.actions
+package io.bazel.kotlin.builder.mode.jvm.actions
-import io.bazel.ruleskotlin.workers.BuildAction
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.KotlinToolchain
-import io.bazel.ruleskotlin.workers.model.CompileDirectories
-import io.bazel.ruleskotlin.workers.model.Flags
-import io.bazel.ruleskotlin.workers.model.PluginDescriptors
-import io.bazel.ruleskotlin.workers.utils.executeAndAwaitSuccess
+import io.bazel.kotlin.builder.BuildAction
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.KotlinToolchain
+import io.bazel.kotlin.builder.model.CompileDirectories
+import io.bazel.kotlin.builder.model.Flags
+import io.bazel.kotlin.builder.model.PluginDescriptors
+import io.bazel.kotlin.builder.utils.executeAndAwaitSuccess
import java.nio.file.Path
/**
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/GenerateJdepsFile.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/GenerateJdepsFile.kt
similarity index 75%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/GenerateJdepsFile.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/GenerateJdepsFile.kt
index ca13558..6229d20 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/GenerateJdepsFile.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/GenerateJdepsFile.kt
@@ -13,19 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.actions
+package io.bazel.kotlin.builder.mode.jvm.actions
import com.google.devtools.build.lib.view.proto.Deps
-import io.bazel.ruleskotlin.workers.BuildAction
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.KotlinToolchain
-import io.bazel.ruleskotlin.workers.compilers.jvm.utils.JdepsParser
-import io.bazel.ruleskotlin.workers.model.Flags.CLASSPATH
-import io.bazel.ruleskotlin.workers.model.Flags.LABEL
-import io.bazel.ruleskotlin.workers.model.Flags.OUTPUT_CLASSJAR
-import io.bazel.ruleskotlin.workers.model.Flags.OUTPUT_JDEPS
-import io.bazel.ruleskotlin.workers.utils.executeAndWaitOutput
-import io.bazel.ruleskotlin.workers.utils.rootCause
+import io.bazel.kotlin.builder.BuildAction
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.KotlinToolchain
+import io.bazel.kotlin.builder.mode.jvm.utils.JdepsParser
+import io.bazel.kotlin.builder.model.Flags.CLASSPATH
+import io.bazel.kotlin.builder.model.Flags.LABEL
+import io.bazel.kotlin.builder.model.Flags.OUTPUT_CLASSJAR
+import io.bazel.kotlin.builder.model.Flags.OUTPUT_JDEPS
+import io.bazel.kotlin.builder.utils.executeAndWaitOutput
+import io.bazel.kotlin.builder.utils.rootCause
import java.io.FileOutputStream
import java.nio.file.Files
import java.nio.file.Paths
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/Initialize.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/Initialize.kt
similarity index 89%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/Initialize.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/Initialize.kt
index 20d2ee1..8811fa2 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/Initialize.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/Initialize.kt
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.actions
+package io.bazel.kotlin.builder.mode.jvm.actions
-import io.bazel.ruleskotlin.workers.BuildAction
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.KotlinToolchain
-import io.bazel.ruleskotlin.workers.utils.PluginArgs
-import io.bazel.ruleskotlin.workers.model.*
+import io.bazel.kotlin.builder.BuildAction
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.KotlinToolchain
+import io.bazel.kotlin.builder.utils.PluginArgs
+import io.bazel.kotlin.builder.model.*
import java.nio.file.Files
import java.nio.file.Paths
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/JavaMainCompile.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/JavaMainCompile.kt
similarity index 76%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/JavaMainCompile.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/JavaMainCompile.kt
index eb016a6..f5483b6 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/JavaMainCompile.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/JavaMainCompile.kt
@@ -13,17 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.actions
+package io.bazel.kotlin.builder.mode.jvm.actions
-import io.bazel.ruleskotlin.workers.BuildAction
-import io.bazel.ruleskotlin.workers.CompileResult
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.KotlinToolchain
-import io.bazel.ruleskotlin.workers.utils.annotationProcessingGeneratedJavaSources
-import io.bazel.ruleskotlin.workers.model.CompileDirectories
-import io.bazel.ruleskotlin.workers.model.Flags
-import io.bazel.ruleskotlin.workers.model.Metas
-import io.bazel.ruleskotlin.workers.utils.executeAndAwait
+import io.bazel.kotlin.builder.BuildAction
+import io.bazel.kotlin.builder.CompileResult
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.KotlinToolchain
+import io.bazel.kotlin.builder.utils.annotationProcessingGeneratedJavaSources
+import io.bazel.kotlin.builder.model.CompileDirectories
+import io.bazel.kotlin.builder.model.Flags
+import io.bazel.kotlin.builder.model.Metas
+import io.bazel.kotlin.builder.utils.executeAndAwait
/**
* Simple java compile action that invokes javac directly and simply.
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/KotlinMainCompile.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/KotlinMainCompile.kt
similarity index 85%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/KotlinMainCompile.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/KotlinMainCompile.kt
index de78269..76e2b22 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/KotlinMainCompile.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/KotlinMainCompile.kt
@@ -13,21 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.actions
+package io.bazel.kotlin.builder.mode.jvm.actions
-import io.bazel.ruleskotlin.workers.BuildAction
-import io.bazel.ruleskotlin.workers.CompileResult
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.KotlinToolchain
-import io.bazel.ruleskotlin.workers.compilers.jvm.utils.KotlinCompilerOutputProcessor
-import io.bazel.ruleskotlin.workers.model.CompileDirectories
-import io.bazel.ruleskotlin.workers.model.CompilePluginConfig
-import io.bazel.ruleskotlin.workers.model.Flags
-import io.bazel.ruleskotlin.workers.model.Metas
-import io.bazel.ruleskotlin.workers.utils.addAll
-import io.bazel.ruleskotlin.workers.utils.annotationProcessingGeneratedJavaSources
-import io.bazel.ruleskotlin.workers.utils.moduleName
+import io.bazel.kotlin.builder.BuildAction
+import io.bazel.kotlin.builder.CompileResult
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.KotlinToolchain
+import io.bazel.kotlin.builder.mode.jvm.utils.KotlinCompilerOutputProcessor
+import io.bazel.kotlin.builder.model.CompileDirectories
+import io.bazel.kotlin.builder.model.CompilePluginConfig
+import io.bazel.kotlin.builder.model.Flags
+import io.bazel.kotlin.builder.model.Metas
+import io.bazel.kotlin.builder.utils.addAll
+import io.bazel.kotlin.builder.utils.annotationProcessingGeneratedJavaSources
+import io.bazel.kotlin.builder.utils.moduleName
// The Kotlin compiler is not suited for javac compilation as of 1.2.21. The errors are not conveyed directly and would need to be preprocessed, also javac
// invocations Configured via Kotlin use eager analysis in some corner cases this can result in classpath exceptions from the Java Compiler..
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/ProcessCompileResult.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/ProcessCompileResult.kt
similarity index 90%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/ProcessCompileResult.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/ProcessCompileResult.kt
index 5165880..ae183ac 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/actions/ProcessCompileResult.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/ProcessCompileResult.kt
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.actions
+package io.bazel.kotlin.builder.mode.jvm.actions
-import io.bazel.ruleskotlin.workers.BuildAction
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.KotlinToolchain
+import io.bazel.kotlin.builder.BuildAction
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.KotlinToolchain
/**
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/utils/JdepsParser.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/utils/JdepsParser.kt
similarity index 94%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/utils/JdepsParser.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/utils/JdepsParser.kt
index dc835dd..8854fc3 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/utils/JdepsParser.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/utils/JdepsParser.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.utils
+package io.bazel.kotlin.builder.mode.jvm.utils
import com.google.devtools.build.lib.view.proto.Deps
import java.nio.file.Path
@@ -65,7 +65,7 @@
private fun processLine(line: String) {
val trimmedLine = line.trim { it <= ' ' }
when (mode) {
- JdepsParser.Mode.COLLECT_DEPS -> if (!line.startsWith(" ")) {
+ Mode.COLLECT_DEPS -> if (!line.startsWith(" ")) {
val parts = line.split(" -> ".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
if (parts.size == 2) {
if (parts[0] != filename) {
@@ -77,21 +77,21 @@
mode = Mode.DETERMINE_JDK
processLine(line)
}
- JdepsParser.Mode.DETERMINE_JDK -> {
+ Mode.DETERMINE_JDK -> {
mode = Mode.COLLECT_PACKAGES_JDK8
if (!line.endsWith(packageSuffix)) {
mode = Mode.COLLECT_PACKAGES_JDK9
}
processLine(line)
}
- JdepsParser.Mode.COLLECT_PACKAGES_JDK8 -> when {
+ Mode.COLLECT_PACKAGES_JDK8 -> when {
trimmedLine.endsWith(packageSuffix) -> packages.add(trimmedLine.substring(0, trimmedLine.length - packageSuffix.length))
trimmedLine.startsWith("-> ") -> {
// ignore package detail lines, in the jdk8 format these start with arrows.
}
else -> throw RuntimeException("unexpected line while collecting packages: " + line)
}
- JdepsParser.Mode.COLLECT_PACKAGES_JDK9 -> {
+ Mode.COLLECT_PACKAGES_JDK9 -> {
val pkg = trimmedLine.split("\\s+".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
packages.add(pkg[0])
}
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/utils/KotlinCompilerOutputProcessor.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/utils/KotlinCompilerOutputProcessor.kt
similarity index 97%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/utils/KotlinCompilerOutputProcessor.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/utils/KotlinCompilerOutputProcessor.kt
index 899fbc8..6f0cc25 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/compilers/jvm/utils/KotlinCompilerOutputProcessor.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/utils/KotlinCompilerOutputProcessor.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.utils
+package io.bazel.kotlin.builder.mode.jvm.utils
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/CompileState.kt b/kotlin/builder/src/io/bazel/kotlin/builder/model/CompileState.kt
similarity index 95%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/model/CompileState.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/model/CompileState.kt
index 05078ae..932fb32 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/CompileState.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/model/CompileState.kt
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.model
+package io.bazel.kotlin.builder.model
-import io.bazel.ruleskotlin.workers.MandatoryMeta
+import io.bazel.kotlin.builder.MandatoryMeta
import java.nio.file.Files
import java.nio.file.Path
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/Flags.kt b/kotlin/builder/src/io/bazel/kotlin/builder/model/Flags.kt
similarity index 95%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/model/Flags.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/model/Flags.kt
index 5b2461e..209be6c 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/Flags.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/model/Flags.kt
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.model
+package io.bazel.kotlin.builder.model
-import io.bazel.ruleskotlin.workers.Flag
+import io.bazel.kotlin.builder.Flag
/**
* The flags supported by the worker.
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/JavaBuilderFlags.kt b/kotlin/builder/src/io/bazel/kotlin/builder/model/JavaBuilderFlags.kt
similarity index 97%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/model/JavaBuilderFlags.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/model/JavaBuilderFlags.kt
index 54cfebf..c44a85e 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/JavaBuilderFlags.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/model/JavaBuilderFlags.kt
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.model
+package io.bazel.kotlin.builder.model
/**
* Declares the flags used by the java builder.
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/Metas.kt b/kotlin/builder/src/io/bazel/kotlin/builder/model/Metas.kt
similarity index 92%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/model/Metas.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/model/Metas.kt
index 5c59ecd..e5c5f4c 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/Metas.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/model/Metas.kt
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.model
+package io.bazel.kotlin.builder.model
-import io.bazel.ruleskotlin.workers.MandatoryMeta
+import io.bazel.kotlin.builder.MandatoryMeta
/**
* Listin of Meta keys that don't make sense as companion objects.
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/PluginDescriptors.kt b/kotlin/builder/src/io/bazel/kotlin/builder/model/PluginDescriptors.kt
similarity index 93%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/model/PluginDescriptors.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/model/PluginDescriptors.kt
index 03f765a..9b2b66c 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/model/PluginDescriptors.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/model/PluginDescriptors.kt
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.model
+package io.bazel.kotlin.builder.model
import com.squareup.moshi.Json
-import io.bazel.ruleskotlin.workers.Meta
+import io.bazel.kotlin.builder.Meta
data class AnnotationProcessor(
@Json(name = "processor_class") val processorClass: String,
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/IOUtils.kt b/kotlin/builder/src/io/bazel/kotlin/builder/utils/IOUtils.kt
similarity index 98%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/IOUtils.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/utils/IOUtils.kt
index f743403..fd52c42 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/IOUtils.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/utils/IOUtils.kt
@@ -15,7 +15,7 @@
*/
@file:JvmName("IOUtils")
-package io.bazel.ruleskotlin.workers.utils
+package io.bazel.kotlin.builder.utils
import java.io.*
import java.nio.file.Path
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/MiscUtils.kt b/kotlin/builder/src/io/bazel/kotlin/builder/utils/MiscUtils.kt
similarity index 84%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/MiscUtils.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/utils/MiscUtils.kt
index 3e76387..9ed9b85 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/MiscUtils.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/utils/MiscUtils.kt
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.utils
+package io.bazel.kotlin.builder.utils
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.model.Flags
-import io.bazel.ruleskotlin.workers.model.Metas
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.model.Flags
+import io.bazel.kotlin.builder.model.Metas
fun <T, C: MutableCollection<T>> C.addAll(vararg entries: T): C = this.also { addAll(entries) }
diff --git a/kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/PluginUtils.kt b/kotlin/builder/src/io/bazel/kotlin/builder/utils/PluginUtils.kt
similarity index 91%
rename from kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/PluginUtils.kt
rename to kotlin/builder/src/io/bazel/kotlin/builder/utils/PluginUtils.kt
index a3a43b5..27f4094 100644
--- a/kotlin/workers/src/io/bazel/ruleskotlin/workers/utils/PluginUtils.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/utils/PluginUtils.kt
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.utils
+package io.bazel.kotlin.builder.utils
-import io.bazel.ruleskotlin.workers.Context
-import io.bazel.ruleskotlin.workers.KotlinToolchain.CompilerPlugin
-import io.bazel.ruleskotlin.workers.model.CompileDirectories
-import io.bazel.ruleskotlin.workers.model.CompilePluginConfig
-import io.bazel.ruleskotlin.workers.model.PluginDescriptors
+import io.bazel.kotlin.builder.Context
+import io.bazel.kotlin.builder.KotlinToolchain.CompilerPlugin
+import io.bazel.kotlin.builder.model.CompileDirectories
+import io.bazel.kotlin.builder.model.CompilePluginConfig
+import io.bazel.kotlin.builder.model.PluginDescriptors
import java.io.ByteArrayOutputStream
import java.io.ObjectOutputStream
import java.util.*
diff --git a/kotlin/workers/unittests/io/bazel/ruleskotlin/workers/compilers/jvm/utils/JdepsParserTest.java b/kotlin/builder/unittests/io/bazel/kotlin/workers/mode/jvm/utils/JdepsParserTest.java
similarity index 98%
rename from kotlin/workers/unittests/io/bazel/ruleskotlin/workers/compilers/jvm/utils/JdepsParserTest.java
rename to kotlin/builder/unittests/io/bazel/kotlin/workers/mode/jvm/utils/JdepsParserTest.java
index ec49d86..6f43e6e 100644
--- a/kotlin/workers/unittests/io/bazel/ruleskotlin/workers/compilers/jvm/utils/JdepsParserTest.java
+++ b/kotlin/builder/unittests/io/bazel/kotlin/workers/mode/jvm/utils/JdepsParserTest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.bazel.ruleskotlin.workers.compilers.jvm.utils;
+package io.bazel.kotlin.builder.mode.jvm.utils;
import com.google.devtools.build.lib.view.proto.Deps;
import org.junit.Assert;
diff --git a/kotlin/kotlin.bzl b/kotlin/kotlin.bzl
index d624907..346db07 100644
--- a/kotlin/kotlin.bzl
+++ b/kotlin/kotlin.bzl
@@ -152,7 +152,7 @@
cfg = "host",
),
"_kotlinw": attr.label(
- default = Label("//kotlin/workers:compiler_jvm"),
+ default = Label("//kotlin/builder"),
executable = True,
cfg = "host",
),