Revamp support for building third-party apps via maven
- Publish onos-dependencies (autogenerated from deps.json). With most
3rd-party dependencies listed as <dependencyManagement> to avoid
version conflicts, and a minimal set listed as <dependencies> to
simplify child poms. Similarly, we provide a number of plugins already
configured as <pluginManagement> to support the whole life-cycle of
apps (from build, to reporting and release).
- Update Maven plugins to work with JDK 11 (checkstyle, pmd, etc.)
- Publish onos-build-conf (with common checkstyle and pmd confs)
- Removed unused checkstyle code
- Fix OSGi version mismatch in deps.json to consistently depend on
release 6 (the one supported by Karaf 4)
- Update/simplify archetypes to use onos-dependencies as the parent pom
Change-Id: Ic09b34e13fb49eb3d96df623b53a3617bbf7b7e4
diff --git a/tools/build/bazel/pom_file.bzl b/tools/build/bazel/pom_file.bzl
index e3c5689..c291d4c 100644
--- a/tools/build/bazel/pom_file.bzl
+++ b/tools/build/bazel/pom_file.bzl
@@ -14,7 +14,7 @@
load("//tools/build/bazel:generate_workspace.bzl", "maven_coordinates")
-def _impl(ctx):
+def _impl_pom_file(ctx):
arguments = [
ctx.outputs.pom.path,
maven_coordinates(ctx.attr.artifact),
@@ -42,6 +42,47 @@
default = Label("//tools/build/bazel:pom_generator"),
),
},
- implementation = _impl,
+ implementation = _impl_pom_file,
+ outputs = {"pom": "%{name}.pom"},
+)
+
+def _impl_dependencies_pom(ctx):
+ arguments = [
+ "-o",
+ ctx.outputs.pom.path,
+ "-p",
+ ctx.file.pom_template.path,
+ "-d",
+ ] + [maven_coordinates(d.label) for d in ctx.attr.deps] + [
+ "-c",
+ ] + [maven_coordinates(d.label) for d in ctx.attr.deps_provided] + [
+ "-t",
+ ] + [maven_coordinates(d.label) for d in ctx.attr.deps_test] + [
+ "-v",
+ ] + ctx.attr.vars
+
+ ctx.actions.run(
+ inputs = [ctx.file.pom_template],
+ outputs = [ctx.outputs.pom],
+ progress_message = "Generating dependencies pom for %s" % ctx.attr.name,
+ arguments = arguments,
+ executable = ctx.executable._pom_generator,
+ )
+
+dependencies_pom = rule(
+ attrs = {
+ "pom_template": attr.label(allow_single_file = True),
+ "deps_provided": attr.label_list(),
+ "deps_test": attr.label_list(),
+ "deps": attr.label_list(),
+ "vars": attr.string_list(),
+ "_pom_generator": attr.label(
+ executable = True,
+ cfg = "host",
+ allow_files = True,
+ default = Label("//tools/build/bazel:dependencies_pom_generator"),
+ ),
+ },
+ implementation = _impl_dependencies_pom,
outputs = {"pom": "%{name}.pom"},
)