Skip to content

Commit

Permalink
consolate all srcs under src
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyed committed Aug 17, 2018
1 parent 643b3e5 commit a4e902d
Show file tree
Hide file tree
Showing 80 changed files with 249 additions and 325 deletions.
9 changes: 4 additions & 5 deletions .bazelproject
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ targets:
//examples/dagger/...
# These targets are built for the ide only. Primary purpose is to ensure the builder can build the targets, but it's
# also a good way of testing the intellij plugin.
//kotlin/builder/src/io/bazel/kotlin/builder:builder_kt_for_ide
//kotlin/builder:compiler_lib_for_ide
//src/main/kotlin/io/bazel/kotlin/builder:builder_kt_for_ide
//src/main/kotlin:compiler_lib_for_ide

test_sources:
*/unittests/*
*/integrationtests/*
src/test/*

additional_languages:
kotlin

import_run_configurations:
tests/Bazel_all_local_tests.xml
src/test/Bazel_all_local_tests.xml
7 changes: 3 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
test_suite(
name = "all_tests",
tests = [
"//kotlin/builder/integrationtests",
"//kotlin/builder/unittests",
"//tests/integrationtests",
"//src/test/kotlin/io/bazel/kotlin:assertion_tests",
"//src/test/kotlin/io/bazel/kotlin/builder:builder_tests",
],
)

Expand All @@ -27,6 +26,6 @@ test_suite(
name = "all_local_tests",
tests = [
":all_tests",
"//tests/integrationtests:integrationtests_local",
"//src/test/kotlin/io/bazel/kotlin:local_assertion_tests",
],
)
19 changes: 0 additions & 19 deletions kotlin/builder/integrationtests/BUILD

This file was deleted.

13 changes: 0 additions & 13 deletions kotlin/builder/integrationtests/KotlinBuilderActionTests.java

This file was deleted.

8 changes: 0 additions & 8 deletions kotlin/builder/integrationtests/KotlinBuilderTestSuite.java

This file was deleted.

26 changes: 0 additions & 26 deletions kotlin/builder/unittests/BUILD

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion kotlin/internal/toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ _kt_toolchain = rule(
),
"kotlinbuilder": attr.label(
doc = "the kotlin builder executable",
default = Label("//kotlin/builder"),
default = Label("//src/main/kotlin:builder"),
executable = True,
allow_files = True,
cfg = "host",
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen_proto_jars
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# If (when) Bazel distributes a host protoc this file can be removed.

WS_ROOT=$(bazel info workspace)
PROTO_PATH=kotlin/builder/proto
PROTO_PATH=src/main/protobuf
JAR_DIR=${WS_ROOT}/${PROTO_PATH}/jars

function build_lib() {
Expand Down
15 changes: 7 additions & 8 deletions kotlin/builder/BUILD → src/main/kotlin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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/builder:bootstrap.bzl", "kt_bootstrap_library")
load("//src/main/kotlin:bootstrap.bzl", "kt_bootstrap_library")
load("//kotlin:kotlin.bzl", "kt_jvm_library")

# The compiler library, this is co-located in the kotlin compiler classloader.
kt_bootstrap_library(
name = "compiler_lib",
srcs = glob(["src/io/bazel/kotlin/compiler/**/*.kt"]),
srcs = glob(["io/bazel/kotlin/compiler/*.kt"]),
neverlink_deps = [
"@com_github_jetbrains_kotlin//:kotlin-compiler",
"@com_github_jetbrains_kotlin//:kotlin-annotation-processing",
Expand All @@ -31,7 +31,7 @@ java_binary(
data = [":compiler_lib.jar"],
main_class = "io.bazel.kotlin.builder.KotlinBuilderMain",
visibility = ["//visibility:public"],
runtime_deps = ["//kotlin/builder/src/io/bazel/kotlin/builder"],
runtime_deps = ["//src/main/kotlin/io/bazel/kotlin/builder"],
)

filegroup(
Expand All @@ -51,15 +51,14 @@ java_library(
testonly = 1,
data = [":data_for_tests"],
visibility = [
"//kotlin/builder/integrationtests:__subpackages__",
"//kotlin/builder/unittests:__subpackages__",
"//src/test:__subpackages__",
],
exports = [
"//kotlin/builder/src/io/bazel/kotlin/builder",
"//src/main/kotlin/io/bazel/kotlin/builder:builder",
"//third_party/jvm/com/google/truth",
"//third_party/jvm/junit",
"@io_bazel_rules_kotlin//kotlin/builder/proto:deps",
"@io_bazel_rules_kotlin//kotlin/builder/proto:kotlin_model",
"//src/main/protobuf:deps",
"//src/main/protobuf:kotlin_model",
"@io_bazel_rules_kotlin_com_google_guava_guava//jar",
"@io_bazel_rules_kotlin_com_google_protobuf_protobuf_java//jar",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ load("//kotlin:kotlin.bzl", _for_ide = "kt_jvm_library")
_BOOTSTRAP_LIB_ARGS = ["-jvm-target", "1.8"]

def _resolve_dep_label(d):
if d.startswith("//kotlin/builder/src/io/bazel/kotlin") and not d.endswith("_for_ide"):
if d.startswith("///src/main/kotlin/io/bazel/kotlin") and not d.endswith("_for_ide"):
prefix, _, target = d.rpartition(":")
if target == None:
# untested
Expand All @@ -32,7 +32,7 @@ def kt_bootstrap_library(name, srcs, deps = [], neverlink_deps = [], runtime_dep
Simple compilation of a kotlin library using a non-persistent worker. The target is a JavaInfo provider.
The target is tagged `"no-ide"` as intellij can't compile it. A seperate private target is created which is suffixed
with `_for_ide`. If the dep is under the package `//kotlin/builder/src/io/bazel/kotlin/builder/...` then it will be
with `_for_ide`. If the dep is under the package `//src/main/kotlin/io/bazel/kotlin/builder/...` then it will be
added to the `_for_ide` target by adding a `_for_ide` prefix.
deps: the dependenices, the are setup as runtime_deps of the library.
Expand Down Expand Up @@ -87,13 +87,14 @@ rm $${NAME}_temp.jar
jars = [jar_label],
tags = ["no-ide"],
runtime_deps = deps + runtime_deps,
visibility = ["//visibility:public"],
visibility = ["//visibility:private"],
)

# hsyed todo this part of the graph should not be wired up outside of development.
_for_ide(
name = name + "_for_ide",
srcs = srcs,
neverlink = 1,
deps = [_resolve_dep_label(d) for d in deps] + neverlink_deps,
visibility = ["//kotlin/builder:__subpackages__"],
visibility = ["//visibility:private"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 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/builder:bootstrap.bzl", "kt_bootstrap_library")
load("//src/main/kotlin:bootstrap.bzl", "kt_bootstrap_library")

kt_bootstrap_library(
name = "builder_kt",
Expand All @@ -22,9 +22,9 @@ kt_bootstrap_library(
]),
deps = [
"@com_github_jetbrains_kotlin//:kotlin-preloader",
"@io_bazel_rules_kotlin//kotlin/builder/proto:deps",
"@io_bazel_rules_kotlin//kotlin/builder/proto:kotlin_model",
"@io_bazel_rules_kotlin//kotlin/builder/proto:worker",
"//src/main/protobuf:deps",
"//src/main/protobuf:kotlin_model",
"//src/main/protobuf:worker",
"@io_bazel_rules_kotlin_com_google_protobuf_protobuf_java//jar",
"@io_bazel_rules_kotlin_com_google_protobuf_protobuf_java_util//jar",
"@io_bazel_rules_kotlin_javax_inject_javax_inject//jar",
Expand All @@ -34,7 +34,7 @@ kt_bootstrap_library(
java_library(
name = "builder",
srcs = glob(["*.java"]),
visibility = ["//kotlin/builder:__subpackages__"],
visibility = ["//src/main/kotlin:__subpackages__"],
exports = [":builder_kt"],
runtime_deps = [
"@com_github_jetbrains_kotlin//:kotlin-stdlib-jdk7",
Expand All @@ -43,7 +43,7 @@ java_library(
],
deps = [
":builder_kt",
"//kotlin/builder/proto:kotlin_model",
"//src/main/protobuf:kotlin_model",
"//third_party:dagger",
"@com_github_jetbrains_kotlin//:kotlin-stdlib",
"@io_bazel_rules_kotlin_com_google_protobuf_protobuf_java//jar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class KotlinToolchain private constructor(
private fun createClassLoader(javaHome: Path, kotlinHome: Path): ClassLoader {
val preloadJars = mutableListOf<File>().also {
it += kotlinHome.resolveVerified("lib", "kotlin-compiler.jar")
it += javaRunfiles.resolveVerified("io_bazel_rules_kotlin", "kotlin", "builder", "compiler_lib.jar")
it += javaRunfiles.resolveVerified("io_bazel_rules_kotlin", "src", "main", "kotlin", "compiler_lib.jar")
if (!isJdk9OrNewer) {
it += javaHome.resolveVerified("lib", "tools.jar")
}
Expand Down
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# 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.
package(default_visibility=["//visibility:private"])
load("//kotlin:kotlin.bzl", "kt_jvm_binary", "kt_jvm_library", "kt_jvm_test")

kt_jvm_binary(
Expand All @@ -33,7 +34,7 @@ kt_jvm_library(
# a test resource library.
java_library(
name = "resourcejar",
resource_strip_prefix = "tests/integrationtests/jvm/basic/resourcejar",
resource_strip_prefix = "src/test/data/jvm/basic/resourcejar",
resources = glob(["resourcejar/**"]),
)

Expand All @@ -54,7 +55,7 @@ kt_jvm_library(
kt_jvm_library(
name = "test_embed_resources_strip_prefix",
srcs = glob(["testresources/src/*.kt"]),
resource_strip_prefix = "tests/integrationtests/jvm/basic/testresources/resources",
resource_strip_prefix = "src/test/data/jvm/basic/testresources/resources",
resources = glob(["testresources/resources/**/*"]),
)

Expand Down Expand Up @@ -103,21 +104,11 @@ java_binary(
kt_jvm_library(
name = "test_friends_library",
srcs = ["test_friends/Service.kt"],
)

# This test should be explicetly executed as module name mangling handling could regress otherwise.
kt_jvm_test(
name = "friends_tests",
srcs = ["test_friends/TestFriendsTest.kt"],
friends = [":test_friends_library"],
test_class = "test.TestFriendsTest",
deps = [
"//third_party/jvm/junit",
],
visibility = ["//src/test/kotlin:__subpackages__"]
)

filegroup(
name = "cases",
name = "basic",
srcs = [
":conventional_strip_resources.jar",
":propagation_ct_consumer",
Expand All @@ -131,5 +122,5 @@ filegroup(
":test_module_name_bin.jar",
":test_module_name_lib",
],
visibility = ["//tests/integrationtests:__subpackages__"],
visibility = ["//visibility:public"],
)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ kt_jvm_library(
)

filegroup(
name = "cases",
name = "kapt",
srcs = [
":ap_kotlin.jar",
":ap_kotlin_mixed",
Expand All @@ -153,5 +153,5 @@ filegroup(
":ap_kotlin_resources",
":ap_kotlin_resources_mixed",
],
visibility = ["//tests/integrationtests:__subpackages__"],
visibility = ["//visibility:public"],
)
Loading

0 comments on commit a4e902d

Please sign in to comment.