ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1798338 - in /webservices/axiom/trunk: WORKSPACE axiom-api/BUILD buildutils/BUILD buildutils/bnd.bzl buildutils/version.bzl
Date Sat, 10 Jun 2017 21:13:39 GMT
Author: veithen
Date: Sat Jun 10 21:13:38 2017
New Revision: 1798338

URL: http://svn.apache.org/viewvc?rev=1798338&view=rev
Log:
Enable building the axiom-api bundle with Bazel.

Added:
    webservices/axiom/trunk/buildutils/bnd.bzl
    webservices/axiom/trunk/buildutils/version.bzl
Modified:
    webservices/axiom/trunk/WORKSPACE
    webservices/axiom/trunk/axiom-api/BUILD
    webservices/axiom/trunk/buildutils/BUILD

Modified: webservices/axiom/trunk/WORKSPACE
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/WORKSPACE?rev=1798338&r1=1798337&r2=1798338&view=diff
==============================================================================
--- webservices/axiom/trunk/WORKSPACE (original)
+++ webservices/axiom/trunk/WORKSPACE Sat Jun 10 21:13:38 2017
@@ -36,6 +36,12 @@ maven_jar(
 )
 
 maven_jar(
+    name = "bnd",
+    artifact = "biz.aQute.bnd:biz.aQute.bnd:3.3.0",
+    sha1 = "aa45ab294fe338bf86485549e8996bee5a8765ce",
+)
+
+maven_jar(
     name = "byte_buddy",
     artifact = "net.bytebuddy:byte-buddy:jar:1.4.26",
     sha1 = "c56b0e90e3b6f9f117a0a0356674e86e86ba8652",

Modified: webservices/axiom/trunk/axiom-api/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/BUILD?rev=1798338&r1=1798337&r2=1798338&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/BUILD (original)
+++ webservices/axiom/trunk/axiom-api/BUILD Sat Jun 10 21:13:38 2017
@@ -19,6 +19,8 @@
 
 package(default_visibility = ["//visibility:public"])
 
+load("//buildutils:bnd.bzl", "bundle")
+
 java_library(
     name = "ext-activation",
     srcs = glob(["src/main/java/org/apache/axiom/ext/activation/*.java"]),
@@ -178,9 +180,40 @@ java_library(
 )
 
 java_library(
+    name = "locator",
+    srcs = glob(["src/main/java/org/apache/axiom/locator/*.java"]),
+    deps = [
+        "@commons_logging//jar",
+        "@osgi_core//jar",
+        ":axiom-api",
+        ":locator-loader",
+    ],
+)
+
+java_library(
     name = "locator-loader",
     srcs = glob(["src/main/java/org/apache/axiom/locator/loader/*.java"]),
     deps = [
         ":axiom-api",
     ],
 )
+
+bundle(
+    name = "bundle",
+    symbolic_name = "org.apache.ws.commons.axiom.axiom-api",
+    private_packages = [],
+    export_packages = [
+        "org.apache.axiom.*;-split-package:=merge-first;-noimport:=true",
+    ],
+    import_packages = [
+        "org.jaxen.*;resolution:=optional",
+        "org.codehaus.stax2;resolution:=optional",
+        "org.apache.james.mime4j.*;version=\"${range;[==,=+)}\"",
+        "*"
+    ],
+    activator = "org.apache.axiom.locator.Activator",
+    activation_policy = "lazy",
+    deps = [
+        ":locator",
+    ],
+)

Modified: webservices/axiom/trunk/buildutils/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/BUILD?rev=1798338&r1=1798337&r2=1798338&view=diff
==============================================================================
--- webservices/axiom/trunk/buildutils/BUILD (original)
+++ webservices/axiom/trunk/buildutils/BUILD Sat Jun 10 21:13:38 2017
@@ -17,11 +17,20 @@
 # under the License.
 #
 
+package(default_visibility = ["//visibility:public"])
+
 java_binary(
     name = "ajc",
     runtime_deps = [
         "@aspectj_tools//jar",
     ],
     main_class = "org.aspectj.tools.ajc.Main",
-    visibility = ["//visibility:public"],
+)
+
+java_binary(
+    name = "bnd",
+    runtime_deps = [
+        "@bnd//jar",
+    ],
+    main_class = "aQute.bnd.main.bnd",
 )

Added: webservices/axiom/trunk/buildutils/bnd.bzl
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/bnd.bzl?rev=1798338&view=auto
==============================================================================
--- webservices/axiom/trunk/buildutils/bnd.bzl (added)
+++ webservices/axiom/trunk/buildutils/bnd.bzl Sat Jun 10 21:13:38 2017
@@ -0,0 +1,76 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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(":version.bzl", "VERSION")
+
+def _impl(ctx):
+  bnd_file = ctx.new_file(ctx.configuration.bin_dir, "bnd_file")
+  instructions = {
+      "Bundle-Version": VERSION,
+      "Bundle-SymbolicName": ctx.attr.symbolic_name,
+      "Private-Package": ",".join(ctx.attr.private_packages),
+      "Export-Package": ",".join(ctx.attr.export_packages),
+      "Import-Package": ",".join(ctx.attr.import_packages),
+      "-removeheaders": "Bnd-LastModified,Build-Jdk,Built-By,Private-Package,Include-Resource",
+      "-nodefaultversion": "true",
+      "-consumer-policy": "",
+  }
+  if ctx.attr.activator:
+    instructions["Bundle-Activator"] = ctx.attr.activator
+  if ctx.attr.activation_policy:
+    instructions["Bundle-ActivationPolicy"] = ctx.attr.activation_policy
+  ctx.file_action(
+      output = bnd_file,
+      content = "\n".join(["%s: %s" % e for e in instructions.items()]))
+  bundle_jar = ctx.outputs.bundle_jar
+  dep_jars = list(java_common.merge([dep[java_common.provider] for dep in ctx.attr.deps]).transitive_runtime_jars)
+  args = ["buildx", "-f", "-o", bundle_jar.path.split("/")[-1]]
+  for f in dep_jars:
+    args.extend(["-c", f.path])
+  args.append(bnd_file.path)
+  ctx.action(
+      inputs=dep_jars + [bnd_file],
+      outputs=[bundle_jar],
+      arguments=args,
+      progress_message="Building bundle %s" % bundle_jar.short_path,
+      executable=ctx.executable._bnd)
+
+bundle = rule(
+    implementation = _impl,
+    attrs = {
+        "deps": attr.label_list(
+            allow_files=False,
+        ),
+        "symbolic_name": attr.string(mandatory=True),
+        "private_packages": attr.string_list(),
+        "export_packages": attr.string_list(),
+        "import_packages": attr.string_list(),
+        "activator": attr.string(),
+        "activation_policy": attr.string(),
+        "_bnd": attr.label(
+            default=Label("//buildutils:bnd"),
+            allow_files=True,
+            executable=True,
+            cfg="host",
+        ),
+    },
+    outputs = {
+        "bundle_jar": "%{name}.jar",
+    },
+)

Added: webservices/axiom/trunk/buildutils/version.bzl
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/version.bzl?rev=1798338&view=auto
==============================================================================
--- webservices/axiom/trunk/buildutils/version.bzl (added)
+++ webservices/axiom/trunk/buildutils/version.bzl Sat Jun 10 21:13:38 2017
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, 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.
+#
+
+VERSION = "1.3.0"



Mime
View raw message