Formatting changes based on bazel style tool buildifier

Change-Id: I2f1536d47f6fd6c80cba45e08b715cd5a14fe5fd
This commit is contained in:
Ray Milkey 2018-06-06 14:15:00 -07:00
parent aab45d17c7
commit 32d99ba799
4 changed files with 35 additions and 25 deletions

View File

@ -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(

View File

@ -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",

View File

@ -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 = '''\
<repository>mvn:org.apache.karaf.features/standard/3.0.8/xml/features</repository>
''' % ONOS_VERSION
FEATURES_FOOTER = '</features>'
FEATURES_FOOTER = "</features>"
# 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,
)

View File

@ -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()));