Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#7 switch to new naming scheme #13

Merged
merged 1 commit into from
Feb 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[Skydoc documentation](https://bazelbuild.github.io/rules_kotlin)

# Overview
# Announcements

* <b>February 5, 2018. JVM rule name change:</b> the prefix has changed from `kotlin_` to `kt_jvm_`.

# Overview

These rules were initially forked from [pubref/rules_kotlin](http://github.com/pubref/rules_kotlin). Key changes:

Expand Down
12 changes: 6 additions & 6 deletions kotlin/kotlin.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ load(
_kotlin_library_impl = "kotlin_library_impl",
)

kotlin_library = rule(
kt_jvm_library = rule(
attrs = dict(_common_attr.items() + {
"exports": attr.label_list(default = []),
}.items()),
Expand All @@ -239,7 +239,7 @@ Args:
deps: A list of dependencies of this rule.See general comments about `deps` at [Attributes common to all build rules](https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes).
"""

kotlin_binary = rule(
kt_jvm_binary = rule(
attrs = dict(_runnable_common_attr.items() + {"main_class": attr.string(mandatory = True)}.items()),
executable = True,
outputs = _binary_outputs,
Expand All @@ -257,7 +257,7 @@ Args:
jvm_flags: A list of flags to embed in the wrapper script generated for running this binary. Note: does not yet support make variable substitution.
"""

kotlin_test = rule(
kt_jvm_test = rule(
attrs = dict(_runnable_common_attr.items() + {
"_bazel_test_runner": attr.label(
default = Label("@bazel_tools//tools/jdk:TestRunner_deploy.jar"),
Expand All @@ -277,7 +277,7 @@ Args:
test_class: The Java class to be loaded by the test runner.
"""

kotlin_import = rule(
kt_jvm_import = rule(
attrs = {
"jars": attr.label_list(
allow_files = True,
Expand All @@ -302,7 +302,7 @@ kotlin_import = rule(

```bzl
# Import a collection of class jars and source jars from filegroup labels.
kotlin_import(
kt_jvm_import(
name = "kodein",
jars = [
"@com_github_salomonbrys_kodein_kodein//jar:file",
Expand All @@ -311,7 +311,7 @@ kotlin_import(
)

# Import a single kotlin jar.
kotlin_import(
kt_jvm_import(
name = "kotlin-runtime",
jars = ["lib/kotlin-runtime.jar"],
srcjar = "lib/kotlin-runtime-sources.jar"
Expand Down
5 changes: 1 addition & 4 deletions kotlin/workers/bootstrap.bzl
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:kotlin.bzl", _for_ide = "kotlin_library")
load("//kotlin:kotlin.bzl", _for_ide = "kt_jvm_library")

_HEADER = """
function join_by { local IFS="$$1"; shift; echo "$$*"; }
Expand Down Expand Up @@ -40,9 +40,6 @@ ARGS="%s"
JAVA_HOME=external/local_jdk ./$(location @com_github_jetbrains_kotlin//:kotlinc) -cp $${CP} -d $(OUTS) $${ARGS} $(SRCS)
""") % (name,args)




def kotlin_worker_lib(srcs =[], args = [], deps=[], runtime_deps=[], exports=[]):
name = "worker"
dep_label = name + "_deps"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class KotlinMainCompile(toolchain: KotlinToolchain) : BuildAction("compile kotli


args.addAll(Metas.ALL_SOURCES.mustGet(ctx))
println(args.joinToString(" "))
return args.toTypedArray()
}

Expand Down
22 changes: 11 additions & 11 deletions tests/smoke/BUILD
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:kotlin.bzl", "kotlin_library", "kotlin_binary", "kotlin_test")
load("//kotlin:kotlin.bzl", "kt_jvm_library", "kt_jvm_binary", "kt_jvm_test")

# a test resource library.
java_library(
Expand All @@ -20,7 +20,7 @@ java_library(
resource_strip_prefix = "tests/smoke/resourcejar"
)

kotlin_test(
kt_jvm_test(
name = "junittest",
srcs = glob(["junittest/JunitTest.kt"]),
test_class="tests.smoke.junittest.JunitTest",
Expand All @@ -29,39 +29,39 @@ kotlin_test(
deps = ["@junit_junit//jar"]
)

kotlin_library(
kt_jvm_library(
name = "test_merge_resourcesjar",
srcs = glob(["testresources/src/*.kt"]),
resource_jars = [":resourcejar"],
)

kotlin_library(
kt_jvm_library(
name = "test_embed_resources",
srcs = glob(["testresources/src/*.kt"]),
resources = glob(["testresources/resources/**/*"]),
visibility = ["//visibility:public"]
)

kotlin_library(
kt_jvm_library(
name = "test_embed_resources_strip_prefix",
srcs = glob(["testresources/src/*.kt"]),
resources = glob(["testresources/resources/**/*"]),
resource_strip_prefix = "tests/smoke/testresources/resources"
)

kotlin_library(
kt_jvm_library(
name = "conventional_strip_resources",
srcs = glob(["testresources/src/*.kt"]),
resources = glob(["conventional_strip_resources/src/main/resources/**/*", "conventional_strip_resources/src/test/resources/**/*"])
)

kotlin_library(
kt_jvm_library(
name = "propagation_test_exporter_lib",
srcs = ["propagation/Stub.kt"],
exports = ["@junit_junit//jar"]
)

kotlin_library(
kt_jvm_library(
name = "propagation_test_runtime_lib",
srcs = ["propagation/Stub.kt"],
runtime_deps = ["@junit_junit//jar"]
Expand Down Expand Up @@ -96,19 +96,19 @@ java_binary(
deps = [":propagation_test_runtime_lib"]
)

kotlin_binary(
kt_jvm_binary(
name="helloworld",
srcs=glob(["helloworld/Main.kt"]),
main_class= "helloworld.Main",
data=glob(["data/*"]),
)

kotlin_library(
kt_jvm_library(
name = "hellojava",
srcs = glob(["hellojava/*.kt", "hellojava/*.java"]),
)

kotlin_library(
kt_jvm_library(
name = "hellojava_withmerge",
resources = glob(["resourcejar/**"]),
srcs = glob(["hellojava/*.kt", "hellojava/*.java"]),
Expand Down