You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2017/06/07 23:16:58 UTC

svn commit: r1798008 - in /webservices/axiom/trunk: WORKSPACE buildutils/BUILD buildutils/aspectj.bzl

Author: veithen
Date: Wed Jun  7 23:16:58 2017
New Revision: 1798008

URL: http://svn.apache.org/viewvc?rev=1798008&view=rev
Log:
Add build rule for AspectJ.

Added:
    webservices/axiom/trunk/buildutils/BUILD
    webservices/axiom/trunk/buildutils/aspectj.bzl
Modified:
    webservices/axiom/trunk/WORKSPACE

Modified: webservices/axiom/trunk/WORKSPACE
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/WORKSPACE?rev=1798008&r1=1798007&r2=1798008&view=diff
==============================================================================
--- webservices/axiom/trunk/WORKSPACE (original)
+++ webservices/axiom/trunk/WORKSPACE Wed Jun  7 23:16:58 2017
@@ -1,4 +1,16 @@
 maven_jar(
+    name = "aspectj_runtime",
+    artifact = "org.aspectj:aspectjrt:1.8.7",
+    sha1 = "c4b70e763194d274477da4da9b05ea913e877268",
+)
+
+maven_jar(
+    name = "aspectj_tools",
+    artifact = "org.aspectj:aspectjtools:1.8.7",
+    sha1 = "67aa2f0aeb0e5c1ee7fadb5b0a29a999a31bb6e2",
+)
+
+maven_jar(
     name = "commons_io",
     artifact = "commons-io:commons-io:2.2",
     sha1 = "83b5b8a7ba1c08f9e8c8ff2373724e33d3c1e22a",

Added: webservices/axiom/trunk/buildutils/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/BUILD?rev=1798008&view=auto
==============================================================================
--- webservices/axiom/trunk/buildutils/BUILD (added)
+++ webservices/axiom/trunk/buildutils/BUILD Wed Jun  7 23:16:58 2017
@@ -0,0 +1,8 @@
+java_binary(
+    name = "ajc",
+    runtime_deps = [
+        "@aspectj_tools//jar",
+    ],
+    main_class = "org.aspectj.tools.ajc.Main",
+    visibility = ["//visibility:public"],
+)

Added: webservices/axiom/trunk/buildutils/aspectj.bzl
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/aspectj.bzl?rev=1798008&view=auto
==============================================================================
--- webservices/axiom/trunk/buildutils/aspectj.bzl (added)
+++ webservices/axiom/trunk/buildutils/aspectj.bzl Wed Jun  7 23:16:58 2017
@@ -0,0 +1,40 @@
+# Partially based on bazel/tools/build_rules/java_rules_skylark.bzl
+
+def _impl(ctx):
+  class_jar = ctx.outputs.class_jar
+  ctx.action(
+      inputs=ctx.files.deps + ctx.files._runtime + ctx.files.srcs,
+      outputs=[class_jar],
+      arguments=[
+          "-classpath", ctx.configuration.host_path_separator.join([f.path for f in ctx.files.deps + ctx.files._runtime]),
+          "-outjar", class_jar.path,
+          "-source", "1.7",
+          "-target", "1.7",
+      ] + [f.path for f in ctx.files.srcs],
+      progress_message="Building %s" % class_jar.short_path,
+      executable=ctx.executable._ajc)
+
+aspectj_library = rule(
+    implementation = _impl,
+    attrs = {
+        "srcs": attr.label_list(
+            allow_files=FileType([".java", ".aj"]),
+        ),
+        "deps": attr.label_list(
+            allow_files=False,
+        ),
+        "_ajc": attr.label(
+            default=Label("//buildutils:ajc"),
+            allow_files=True,
+            executable=True,
+            cfg="host",
+        ),
+        "_runtime": attr.label(
+            default=Label("@aspectj_runtime//jar"),
+            allow_files=False,
+        ),
+    },
+    outputs = {
+        "class_jar": "lib%{name}.jar",
+    },
+)