Skip to content

Commit

Permalink
Run Buildifier to reformat files and apply automated fixes (bazelbuil…
Browse files Browse the repository at this point in the history
…d#166)

- In kotlin.bzl, explicitly re-export symbols

Progress towards bazelbuild#165
  • Loading branch information
laurentlb authored Nov 28, 2018
1 parent 0eff49f commit 1b64e49
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 77 deletions.
4 changes: 1 addition & 3 deletions kotlin/internal/js/js.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ kt_js_library = rule(
"data": attr.label_list(
allow_files = True,
default = [],
cfg = "data",
),
"deps": attr.label_list(
doc = """A list of other kotlin JS libraries.""",
Expand Down Expand Up @@ -119,9 +118,8 @@ kt_js_import = rule(
mandatory = True,
),
"srcjar": attr.label(
allow_files = ["-sources.jar"],
mandatory = False,
single_file = True,
allow_single_file = ["-sources.jar"],
),
"runtime_deps": attr.label_list(
default = [],
Expand Down
6 changes: 3 additions & 3 deletions kotlin/internal/jvm/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _fold_jars_action(ctx, rule_kind, output_jar, input_jars):
])
args.add("--output", output_jar)
args.add_all(input_jars, before_each = "--sources")
ctx.action(
ctx.actions.run(
mnemonic = "KotlinFoldJars",
inputs = input_jars,
outputs = [output_jar],
Expand Down Expand Up @@ -98,7 +98,7 @@ def _build_resourcejar_action(ctx):
"""
resources_jar_output = ctx.actions.declare_file(ctx.label.name + "-resources.jar")
zipper_args = _resourcejar_args_action(ctx)
ctx.action(
ctx.actions.run_shell(
mnemonic = "KotlinZipResourceJar",
inputs = ctx.files.resources + [ctx.executable._zipper, zipper_args],
outputs = [resources_jar_output],
Expand Down Expand Up @@ -285,7 +285,7 @@ def kt_jvm_produce_jar_actions(ctx, rule_kind):
# If the merge list is not empty the kotlin compiler should compile to an intermediate jar.
if len(output_merge_list) > 0:
# Declare the intermediate jar
kt_compile_output_jar = ctx.new_file(ctx.label.name + "-ktclass.jar")
kt_compile_output_jar = ctx.actions.declare_file(ctx.label.name + "-ktclass.jar")

# the first entry in the merge list is the result of the kotlin compile action.
output_merge_list = [kt_compile_output_jar] + output_merge_list
Expand Down
2 changes: 1 addition & 1 deletion kotlin/internal/jvm/impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def kt_jvm_import_impl(ctx):
source_jars += jar[JavaInfo].transitive_source_jars.to_list()
else:
# this branch occurs when the attr was a filegroup.
for file in jar.files:
for file in jar.files.to_list():
if file.basename.endswith("-sources.jar"):
source_jars.append(file)
elif file.basename.endswith(".jar"):
Expand Down
6 changes: 1 addition & 5 deletions kotlin/internal/jvm/jvm.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,14 @@ kt_jvm_binary(

load(
"//kotlin/internal:defs.bzl",
_KT_COMPILER_REPO = "KT_COMPILER_REPO",
_KtJvmInfo = "KtJvmInfo",
_TOOLCHAIN_TYPE = "TOOLCHAIN_TYPE",
)
load(
"//kotlin/internal/jvm:plugins.bzl",
_kt_jvm_plugin_aspect = "kt_jvm_plugin_aspect",
)
load(
"//kotlin/internal:defs.bzl",
_KT_COMPILER_REPO = "KT_COMPILER_REPO",
)
load(
"//kotlin/internal/jvm:impl.bzl",
_kt_jvm_binary_impl = "kt_jvm_binary_impl",
Expand Down Expand Up @@ -180,7 +177,6 @@ _common_attr = _implicit_deps + {
doc = """The list of files needed by this rule at runtime. See general comments about `data` at
[Attributes common to all build rules](https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes).""",
allow_files = True,
cfg = "data",
),
"plugins": attr.label_list(
default = [],
Expand Down
22 changes: 15 additions & 7 deletions kotlin/kotlin.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,25 @@
# 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/repositories:repositories.bzl",
"kotlin_repositories",
_kotlin_repositories = "kotlin_repositories",
)
load(
"//kotlin/internal:toolchains.bzl",
"kt_register_toolchains",
_kt_register_toolchains = "kt_register_toolchains",
)
load(
"//kotlin/internal/jvm:jvm.bzl",
"kt_jvm_binary",
"kt_jvm_import",
"kt_jvm_library",
"kt_jvm_test",
_kt_jvm_binary = "kt_jvm_binary",
_kt_jvm_import = "kt_jvm_import",
_kt_jvm_library = "kt_jvm_library",
_kt_jvm_test = "kt_jvm_test",
)
load(
"//kotlin/internal/jvm:android.bzl",
"kt_android_library",
_kt_android_library = "kt_android_library",
)
load(
"//kotlin/internal/js:js.bzl",
Expand All @@ -38,3 +39,10 @@ load(

kt_js_library = _kt_js_library
kt_js_import = _kt_js_import
kt_register_toolchains = _kt_register_toolchains
kotlin_repositories = _kotlin_repositories
kt_jvm_binary = _kt_jvm_binary
kt_jvm_import = _kt_jvm_import
kt_jvm_library = _kt_jvm_library
kt_jvm_test = _kt_jvm_test
kt_android_library = _kt_android_library
Loading

0 comments on commit 1b64e49

Please sign in to comment.