diff --git a/.gitignore b/.gitignore index 23507e158..b85e86ae0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ **/.ijwb **/.aswb **/.vscode -**/trace.profile.gz +trace.profile.gz diff --git a/BUILD b/BUILD index ef5d666ea..42a7c57b5 100644 --- a/BUILD +++ b/BUILD @@ -39,11 +39,10 @@ test_suite( # Release target. release_archive( name = "rules_kotlin_release", - dist_files = { - "BUILD": "", - "WORKSPACE": """workspace(name = "io_bazel_rules_kotlin")""", + src_map = { + "BUILD.release.bazel.bazel" : "BUILD.bazel", + "WORKSPACE.release.bazel" : "WORKSPACE", }, - extension = "tgz", deps = [ "//kotlin:pkg", "//src/main/kotlin:pkg", diff --git a/BUILD.release.bazel b/BUILD.release.bazel new file mode 100644 index 000000000..a8c9e0a5f --- /dev/null +++ b/BUILD.release.bazel @@ -0,0 +1,13 @@ +# Copyright 2020 The Bazel Authors. All rights reserved. +# +# 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. \ No newline at end of file diff --git a/WORKSPACE.release.bazel b/WORKSPACE.release.bazel new file mode 100644 index 000000000..093556198 --- /dev/null +++ b/WORKSPACE.release.bazel @@ -0,0 +1,14 @@ +# Copyright 2018 The Bazel Authors. All rights reserved. +# +# 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. +workspace(name = "io_bazel_rules_kotlin") \ No newline at end of file diff --git a/kotlin/internal/BUILD b/kotlin/internal/BUILD index 3f19ab5f0..4e70dae66 100644 --- a/kotlin/internal/BUILD +++ b/kotlin/internal/BUILD @@ -24,11 +24,8 @@ release_archive( name = "pkg", visibility = ["//visibility:public"], srcs = glob(["*.bzl"]), - dist_files = { - "BUILD": """ -load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains") -kt_configure_toolchains() -""", + src_map = { + "BUILD.release.bazel.bazel" : "BUILD.bazel", }, deps = [ "//kotlin/internal/js:pkg", diff --git a/kotlin/internal/BUILD.release.bazel b/kotlin/internal/BUILD.release.bazel new file mode 100644 index 000000000..71eaa250a --- /dev/null +++ b/kotlin/internal/BUILD.release.bazel @@ -0,0 +1,16 @@ +# Copyright 2020 The Bazel Authors. All rights reserved. +# +# 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. + +load("//kotlin/internal:toolchains.bzl", "kt_configure_toolchains") +kt_configure_toolchains() \ No newline at end of file diff --git a/kotlin/internal/js/BUILD b/kotlin/internal/js/BUILD index 29e4c981d..1df9fb3b4 100644 --- a/kotlin/internal/js/BUILD +++ b/kotlin/internal/js/BUILD @@ -26,12 +26,7 @@ release_archive( "*.bzl", "*.py", ]), - dist_files = { - "BUILD": """ -py_binary( - name = "importer", - srcs = ["importer.py"], - visibility = ["//visibility:public"], -)""", - }, + src_map = { + "BUILD.release.bazel" : "BUILD.bazel" + } ) diff --git a/kotlin/internal/js/BUILD.release.bazel b/kotlin/internal/js/BUILD.release.bazel new file mode 100644 index 000000000..15963e227 --- /dev/null +++ b/kotlin/internal/js/BUILD.release.bazel @@ -0,0 +1,19 @@ +# Copyright 2018 The Bazel Authors. All rights reserved. +# +# 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. + +py_binary( + name = "importer", + srcs = ["importer.py"], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/kotlin/internal/repositories/BUILD b/kotlin/internal/repositories/BUILD index 502110d72..20f51c974 100644 --- a/kotlin/internal/repositories/BUILD +++ b/kotlin/internal/repositories/BUILD @@ -19,7 +19,7 @@ release_archive( "BUILD", "BUILD.com_github_jetbrains_kotlin", ], - renames = { + src_map = { "nomaven_repositories.bzl" : "repositories.bzl", } ) diff --git a/kotlin/internal/utils/packager.bzl b/kotlin/internal/utils/packager.bzl index 7e46c4cc7..0ed94227a 100644 --- a/kotlin/internal/utils/packager.bzl +++ b/kotlin/internal/utils/packager.bzl @@ -14,9 +14,9 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar") -def release_archive(name, dist_files = {}, srcs = None, renames = {}, **kwargs): +def release_archive(name, srcs = None, src_map = {}, package_dir = None, extension="tgz", deps=None): """ - Creates an tar of the srcs, dist_files, and renamed label artifacts. + Creates an tar of the srcs, and renamed label artifacts. Usage: @@ -24,11 +24,10 @@ def release_archive(name, dist_files = {}, srcs = None, renames = {}, **kwargs): load("//kotlin/internal/utils:packager.bzl", "release_archive") release_archive( name = "release_archive", - dist_files = { - "BUILD": "", - "WORKSPACE": "workspace(name = "io_bazel_rules_kotlin")", + src_map = { + "BUILD.release.bazel.bazel": "BUILD.bazel", + "WORKSPACE.release.bazel": "WORKSPACE", }, - extension = "tgz", deps = [ "//dep:pkg" ], @@ -46,34 +45,25 @@ def release_archive(name, dist_files = {}, srcs = None, renames = {}, **kwargs): Args: name: target identifier, points to a pkg_tar target. - package_dir: directory to place the srcs, renames, and dist_files under. Defaults to the current directory. + package_dir: directory to place the srcs, src_map, and dist_files under. Defaults to the current directory. dist_files: dict of : for files to be generated in the distribution artifact. - renames: dict of