From 1cdb612e31448c2f6eb25b8aa67d406152275482 Mon Sep 17 00:00:00 2001 From: Laurent Le Brun Date: Tue, 27 Nov 2018 20:29:23 +0100 Subject: [PATCH] Update skylib dependency This fixes a few issues regarding --all_incompatible_changes. I also separated a tool from the inputs (wich is affecting anyone dependending on skydoc). --- WORKSPACE | 4 ++-- skylark/BUILD | 7 +++---- skylark/skylark.bzl | 17 +++++++++-------- stardoc/BUILD | 11 +++++++---- stardoc/stardoc.bzl | 13 +++++++------ 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 8770006..d2a5003 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -5,12 +5,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") git_repository( name = "io_bazel_rules_sass", remote = "https://github.com/bazelbuild/rules_sass.git", - commit = "8b61ad6953fde55031658e1731c335220f881369" + commit = "8ccf4f1c351928b55d5dddf3672e3667f6978d60" ) git_repository( name = "bazel_skylib", remote = "https://github.com/bazelbuild/bazel-skylib.git", - tag = "0.5.0", + tag = "0.6.0", ) git_repository( name = "io_bazel", diff --git a/skylark/BUILD b/skylark/BUILD index 57c908b..29e4dbf 100644 --- a/skylark/BUILD +++ b/skylark/BUILD @@ -2,14 +2,14 @@ licenses(["notice"]) # Apache 2.0 package(default_visibility = ["//visibility:public"]) -load("@bazel_skylib//:skylark_library.bzl", "skylark_library") +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("//skylark:skylark.bzl", "skylark_doc") -skylark_library( +bzl_library( name = "skylark", srcs = ["skylark.bzl"], deps = [ - "@bazel_skylib//:skylark_library", + "@bazel_skylib//:bzl_library", ], ) @@ -20,4 +20,3 @@ skylark_doc( strip_prefix = "skylark", deps = [":skylark"], ) - diff --git a/skylark/skylark.bzl b/skylark/skylark.bzl index ed41549..c9defcf 100644 --- a/skylark/skylark.bzl +++ b/skylark/skylark.bzl @@ -16,7 +16,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_skylib//:skylark_library.bzl", "SkylarkLibraryInfo") +load("@bazel_skylib//:bzl_library.bzl", "StarlarkLibraryInfo") _SKYLARK_FILETYPE = [".bzl"] @@ -34,15 +34,15 @@ def _skylark_doc_impl(ctx): transitive = [] skydoc = _skydoc(ctx) for dep in ctx.attr.srcs: - if SkylarkLibraryInfo in dep: - direct.extend(dep[SkylarkLibraryInfo].srcs) - transitive.append(dep[SkylarkLibraryInfo].transitive_srcs) + if StarlarkLibraryInfo in dep: + direct.extend(dep[StarlarkLibraryInfo].srcs) + transitive.append(dep[StarlarkLibraryInfo].transitive_srcs) else: direct.extend(dep.files.to_list()) inputs = depset(order = "postorder", direct = direct, transitive = transitive + [ - dep[SkylarkLibraryInfo].transitive_srcs + dep[StarlarkLibraryInfo].transitive_srcs for dep in ctx.attr.deps - ] + [depset([skydoc])]) + ]) sources = [source.path for source in direct] flags = [ "--format=%s" % ctx.attr.format, @@ -60,6 +60,7 @@ def _skylark_doc_impl(ctx): flags += ["--site_root=%s" % ctx.attr.site_root] ctx.actions.run( inputs = inputs, + tools = [skydoc], executable = skydoc, arguments = flags + sources, outputs = [skylark_doc_zip], @@ -73,11 +74,11 @@ skylark_doc = rule( _skylark_doc_impl, attrs = { "srcs": attr.label_list( - providers = [SkylarkLibraryInfo], + providers = [StarlarkLibraryInfo], allow_files = _SKYLARK_FILETYPE, ), "deps": attr.label_list( - providers = [SkylarkLibraryInfo], + providers = [StarlarkLibraryInfo], allow_files = False, ), "format": attr.string(default = "markdown"), diff --git a/stardoc/BUILD b/stardoc/BUILD index fe35657..47ae2e2 100644 --- a/stardoc/BUILD +++ b/stardoc/BUILD @@ -2,14 +2,14 @@ licenses(["notice"]) # Apache 2.0 package(default_visibility = ["//visibility:public"]) -load("@bazel_skylib//:skylark_library.bzl", "skylark_library") +load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("//stardoc:stardoc.bzl", "stardoc") -skylark_library( +bzl_library( name = "stardoc_lib", srcs = ["stardoc.bzl"], deps = [ - "@bazel_skylib//:skylark_library", + "@bazel_skylib//:bzl_library", ], ) @@ -17,6 +17,9 @@ stardoc( name = "stardoc_doc", out = "stardoc_doc.md", input = ":stardoc.bzl", - symbol_names = ["stardoc", "_stardoc_impl"], + symbol_names = [ + "stardoc", + "_stardoc_impl", + ], deps = [":stardoc_lib"], ) diff --git a/stardoc/stardoc.bzl b/stardoc/stardoc.bzl index 61eef2e..8fe9fbb 100644 --- a/stardoc/stardoc.bzl +++ b/stardoc/stardoc.bzl @@ -14,23 +14,24 @@ """Starlark rule for stardoc: a documentation generator tool written in Java.""" -load("@bazel_skylib//:skylark_library.bzl", "SkylarkLibraryInfo") +load("@bazel_skylib//:bzl_library.bzl", "StarlarkLibraryInfo") def _stardoc_impl(ctx): """Implementation of the stardoc rule.""" for semantic_flag in ctx.attr.semantic_flags: - if not semantic_flag.startswith("--"): - fail("semantic_flags entry '%s' must start with '--'" % semantic_flag) + if not semantic_flag.startswith("--"): + fail("semantic_flags entry '%s' must start with '--'" % semantic_flag) out_file = ctx.outputs.out input_files = depset(direct = [ctx.file.input], transitive = [ - dep[SkylarkLibraryInfo].transitive_srcs + dep[StarlarkLibraryInfo].transitive_srcs for dep in ctx.attr.deps ]) args = [ "--input=" + str(ctx.file.input.owner), "--output=" + ctx.outputs.out.path, ] + [ - ("--symbols=" + symbol) for symbol in ctx.attr.symbol_names + ("--symbols=" + symbol) + for symbol in ctx.attr.symbol_names ] + ctx.attr.semantic_flags stardoc = ctx.executable.stardoc ctx.actions.run( @@ -57,7 +58,7 @@ This rule is an experimental replacement for the existing skylark_doc rule. ), "deps": attr.label_list( doc = "A list of skylark_library dependencies which the input depends on.", - providers = [SkylarkLibraryInfo], + providers = [StarlarkLibraryInfo], ), "out": attr.output( doc = "The (markdown) file to which documentation will be output.",