From 32d99ba799ae51d2ecb2cf9e8a07e59923c99cf1 Mon Sep 17 00:00:00 2001 From: Ray Milkey Date: Wed, 6 Jun 2018 14:15:00 -0700 Subject: [PATCH] Formatting changes based on bazel style tool buildifier Change-Id: I2f1536d47f6fd6c80cba45e08b715cd5a14fe5fd --- lib/BUCK | 2 +- tools/build/bazel/generate_workspace.bzl | 3 +- tools/build/bazel/osgi_features.bzl | 53 +++++++++++-------- .../onosproject/libgen/BuckLibGenerator.java | 2 +- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/lib/BUCK b/lib/BUCK index 2a5a685853..bf0b06e654 100644 --- a/lib/BUCK +++ b/lib/BUCK @@ -1,4 +1,4 @@ -# ***** This file was auto-generated at Wed, 6 Jun 2018 17:50:58 GMT. Do not edit this file manually. ***** +# ***** This file was auto-generated at Wed, 6 Jun 2018 21:12:44 GMT. Do not edit this file manually. ***** # ***** Use onos-lib-gen ***** pass_thru_pom( diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl index d3a0197eda..6e3a5d48c9 100644 --- a/tools/build/bazel/generate_workspace.bzl +++ b/tools/build/bazel/generate_workspace.bzl @@ -1,7 +1,8 @@ -# ***** This file was auto-generated at Wed, 6 Jun 2018 17:51:00 GMT. Do not edit this file manually. ***** +# ***** This file was auto-generated at Wed, 6 Jun 2018 21:12:50 GMT. Do not edit this file manually. ***** # ***** Use onos-lib-gen ***** load("//tools/build/bazel:variables.bzl", "ONOS_GROUP_ID", "ONOS_VERSION") + COMPILE = [ "@commons_configuration//jar", "@commons_logging//jar", diff --git a/tools/build/bazel/osgi_features.bzl b/tools/build/bazel/osgi_features.bzl index bc6ec4fc69..7c29e7899f 100644 --- a/tools/build/bazel/osgi_features.bzl +++ b/tools/build/bazel/osgi_features.bzl @@ -15,56 +15,65 @@ """ load("//tools/build/bazel:generate_workspace.bzl", "COMPILE", "TEST", "maven_coordinates") -load("//tools/build/bazel:variables.bzl", "ONOS_VERSION", "ONOS_GROUP_ID") +load("//tools/build/bazel:variables.bzl", "ONOS_GROUP_ID", "ONOS_VERSION") def dump(obj): - for attr in dir(obj): - print("obj.%s = %r" % (attr, getattr(obj, attr))) + for attr in dir(obj): + print("obj.%s = %r" % (attr, getattr(obj, attr))) # Implementation of a rule to produce an OSGi feature XML snippet def _osgi_feature_impl(ctx): output = ctx.outputs.feature_xml - args = [ "-O", output.path, - "-n", ctx.attr.name, - "-v", ctx.attr.version, - "-t", ctx.attr.description, - ] + args = [ + "-O", + output.path, + "-n", + ctx.attr.name, + "-v", + ctx.attr.version, + "-t", + ctx.attr.description, + ] inputs = [] for dep in ctx.attr.included_bundles: - args += [ "-b", maven_coordinates(dep.label) ] + args += ["-b", maven_coordinates(dep.label)] for f in dep.java.outputs.jars: - inputs += [ f.class_jar ] + inputs += [f.class_jar] for dep in ctx.attr.excluded_bundles: - args += [ "-e", maven_coordinates(dep.label) ] + args += ["-e", maven_coordinates(dep.label)] for f in dep.java.outputs.jars: - inputs += [ f.class_jar ] + inputs += [f.class_jar] for f in ctx.attr.required_features: - args += [ "-f", f ] + args += ["-f", f] - args += [ "-F" if ctx.attr.generate_file else "-E" ] + args += ["-F" if ctx.attr.generate_file else "-E"] ctx.actions.run( inputs = inputs, - outputs = [ output ], + outputs = [output], arguments = args, progress_message = "Generating feature %s" % ctx.attr.name, - executable = ctx.executable._writer + executable = ctx.executable._writer, ) osgi_feature = rule( attrs = { "description": attr.string(), "version": attr.string(default = ONOS_VERSION), - "required_features": attr.string_list(default = [ "onos-api" ]), + "required_features": attr.string_list(default = ["onos-api"]), "included_bundles": attr.label_list(), "excluded_bundles": attr.label_list(default = []), "generate_file": attr.bool(default = False), - "_writer": attr.label(executable=True, cfg="host", allow_files=True, - default=Label("//tools/build/bazel:onos_app_writer")), + "_writer": attr.label( + executable = True, + cfg = "host", + allow_files = True, + default = Label("//tools/build/bazel:onos_app_writer"), + ), }, outputs = { "feature_xml": "feature-%{name}.xml", @@ -80,7 +89,7 @@ FEATURES_HEADER = '''\ mvn:org.apache.karaf.features/standard/3.0.8/xml/features ''' % ONOS_VERSION -FEATURES_FOOTER = '' +FEATURES_FOOTER = "" # Implementation of a rule to produce an OSGi feature repo XML file def _osgi_feature_repo_impl(ctx): @@ -90,13 +99,13 @@ def _osgi_feature_repo_impl(ctx): inputs = [] for dep in ctx.attr.exported_features: for f in dep.files.to_list(): - inputs += [ f ] + inputs += [f] cmd += "cat %s;" % f.path cmd += "echo '%s') > %s;" % (FEATURES_FOOTER, output.path) ctx.actions.run_shell( inputs = inputs, - outputs = [ output ], + outputs = [output], progress_message = "Generating feature repo %s" % ctx.attr.name, command = cmd, ) diff --git a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java index 070572aa23..549691527a 100644 --- a/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java +++ b/tools/build/libgen/src/main/java/org/onosproject/libgen/BuckLibGenerator.java @@ -238,7 +238,7 @@ public class BuckLibGenerator { " artifactId = 'onos-dependencies',\n" + ")\n\n"); } else { - writer.write("\nload(\"//tools/build/bazel:variables.bzl\", \"ONOS_GROUP_ID\", \"ONOS_VERSION\")\n"); + writer.write("\nload(\"//tools/build/bazel:variables.bzl\", \"ONOS_GROUP_ID\", \"ONOS_VERSION\")\n\n"); } libraries.forEach(library -> writer.print(library.getFragment()));