ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1798311 - in /webservices/axiom/trunk: ./ buildutils/ testing/axiom-testsuite/ testing/dom-testsuite/ testing/jaxen-testsuite/ testing/soap-testsuite/ testing/testutils/ testing/xml-testsuite/ third_party/
Date Sat, 10 Jun 2017 12:22:24 GMT
Author: veithen
Date: Sat Jun 10 12:22:24 2017
New Revision: 1798311

URL: http://svn.apache.org/viewvc?rev=1798311&view=rev
Log:
Generate JaCoCo coverage data with Bazel.

Modified:
    webservices/axiom/trunk/WORKSPACE
    webservices/axiom/trunk/buildutils/test.bzl
    webservices/axiom/trunk/testing/axiom-testsuite/BUILD
    webservices/axiom/trunk/testing/dom-testsuite/BUILD
    webservices/axiom/trunk/testing/jaxen-testsuite/BUILD
    webservices/axiom/trunk/testing/soap-testsuite/BUILD
    webservices/axiom/trunk/testing/testutils/BUILD
    webservices/axiom/trunk/testing/xml-testsuite/BUILD
    webservices/axiom/trunk/third_party/BUILD

Modified: webservices/axiom/trunk/WORKSPACE
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/WORKSPACE?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/WORKSPACE (original)
+++ webservices/axiom/trunk/WORKSPACE Sat Jun 10 12:22:24 2017
@@ -72,6 +72,18 @@ maven_jar(
 )
 
 maven_jar(
+    name = "hamcrest",
+    artifact = "org.hamcrest:hamcrest-core:jar:1.3",
+    sha1 = "42a25dc3219429f0e5d060061f71acb49bf010a0",
+)
+
+maven_jar(
+    name = "jacoco_agent",
+    artifact = "org.jacoco:org.jacoco.agent:0.7.9",
+    sha1 = "4a936caab50b117a14d9ca3a725fc9b54d0cc3d1",
+)
+
+maven_jar(
     name = "javamail",
     artifact = "org.apache.geronimo.specs:geronimo-javamail_1.4_spec:1.7.1",
     sha1 = "43ad4090b1a07a11c82ac40c01fc4e2fbad20013",

Modified: webservices/axiom/trunk/buildutils/test.bzl
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/test.bzl?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/buildutils/test.bzl (original)
+++ webservices/axiom/trunk/buildutils/test.bzl Sat Jun 10 12:22:24 2017
@@ -16,12 +16,69 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-def test(**kwargs):
+
+# Keep heap size small. We have some unit tests that deal with volumes
+# of data proportional to the heap size (to test that Axiom is streaming
+# the data instead of loading it into memory). Obviously, the execution time of
+# these tests also are proportional to the heap size. To accelerate the execution
+# of the tests, we should use a heap size as small as possible.
+JVM_FLAGS = ["-Xms16m", "-Xmx48m"] 
+
+def _jacoco_impl(ctx):
+  jars = list(ctx.attr.lib[java_common.provider].transitive_runtime_jars)
+  ctx.action(
+      inputs = jars + ctx.files._agent,
+      outputs = [ctx.outputs.exec],
+      arguments = JVM_FLAGS + [
+          "-classpath", ctx.configuration.host_path_separator.join([f.path for f in jars]),
+          "-javaagent:%s=destfile=%s" % (ctx.files._agent[0].path, ctx.outputs.exec.path),
+          "org.junit.runner.JUnitCore",
+          ctx.attr.test_class,
+      ],
+      progress_message = "Generating JaCoCo coverage data for %s" % ctx.attr.test_name,
+      executable = ctx.executable._java)
+
+_jacoco = rule(
+    implementation = _jacoco_impl,
+    attrs = {
+        "test_name": attr.string(),
+        "lib": attr.label(
+            allow_files=False,
+        ),
+        "test_class": attr.string(),
+        "_java": attr.label(
+            default=Label("@local_jdk//:java"),
+            allow_files=True,
+            executable=True,
+            cfg="host",
+        ),
+        "_agent": attr.label(
+            default=Label("//third_party:jacocoagent"),
+            allow_files=False,
+        ),
+    },
+    outputs = {
+        "exec": "%{name}.exec",
+    },
+)
+
+def test(name, srcs, deps, test_class):
+  native.java_library(
+      name = "%s_lib" % name,
+      srcs = srcs,
+      deps = deps + ["//third_party:junit"],
+  )
+
   native.java_test(
-      # Keep heap size small. We have some unit tests that deal with volumes
-      # of data proportional to the heap size (to test that Axiom is streaming
-      # the data instead of loading it into memory). Obviously, the execution time of
-      # these tests also are proportional to the heap size. To accelerate the execution
-      # of the tests, we should use a heap size as small as possible.
-      jvm_flags = ["-Xms16m", "-Xmx48m"],
-      **kwargs)
+      name = name,
+      runtime_deps = ["%s_lib" % name],
+      test_class = test_class,
+      jvm_flags = JVM_FLAGS,
+  )
+
+  _jacoco(
+      name = "%s_jacoco" % name,
+      test_name = name,
+      lib = ":%s_lib" % name,
+      test_class = test_class,
+  )

Modified: webservices/axiom/trunk/testing/axiom-testsuite/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/BUILD?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/BUILD (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/BUILD Sat Jun 10 12:22:24 2017
@@ -55,7 +55,6 @@ java_library(
         ":identity",
     ],
     resources = glob(["src/main/resources/**/*"]),
-    testonly = 1,
     deps = [
         "@commons_codec//jar",
         "@commons_io//jar",

Modified: webservices/axiom/trunk/testing/dom-testsuite/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/dom-testsuite/BUILD?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/dom-testsuite/BUILD (original)
+++ webservices/axiom/trunk/testing/dom-testsuite/BUILD Sat Jun 10 12:22:24 2017
@@ -17,7 +17,6 @@ java_library(
         "src/main/java/org/apache/axiom/ts/dom/DocumentBuilderFactoryFactory.java",
     ],
     visibility = ["//visibility:public"],
-    testonly = 1,
 )
 
 java_library(
@@ -36,7 +35,6 @@ java_library(
     ]),
     resources = glob(["src/main/resources/**/*"]),
     visibility = ["//visibility:public"],
-    testonly = 1,
     deps = [
         "@truth//jar",
         ":common",
@@ -54,7 +52,6 @@ java_library(
     name = "w3c",
     srcs = glob(["src/main/java/org/apache/axiom/ts/dom/w3c/*.java"]),
     visibility = ["//visibility:public"],
-    testonly = 1,
     deps = [
         "@asm//jar",
         ":common",
@@ -70,7 +67,6 @@ java_library(
         "src/main/java/org/apache/axiom/ts/dom/w3c/level%s/W3CDOMLevel%sTestSuiteBuilder.java"
% (level, level),
     ],
     visibility = ["//visibility:public"],
-    testonly = 1,
     deps = [
         "src/w3c/dom%s-core-tests-20040405.jar" % level,
         ":common",

Modified: webservices/axiom/trunk/testing/jaxen-testsuite/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/jaxen-testsuite/BUILD?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/jaxen-testsuite/BUILD (original)
+++ webservices/axiom/trunk/testing/jaxen-testsuite/BUILD Sat Jun 10 12:22:24 2017
@@ -23,7 +23,6 @@ java_library(
     name = "jaxen-testsuite",
     srcs = glob(["src/main/java/**/*.java"]),
     resources = glob(["src/main/resources/**/*"]),
-    testonly = 1,
     deps = [
         "@jaxen//jar",
         "//third_party:junit",

Modified: webservices/axiom/trunk/testing/soap-testsuite/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/BUILD?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/BUILD (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/BUILD Sat Jun 10 12:22:24 2017
@@ -23,7 +23,6 @@ java_library(
     name = "soap-testsuite",
     srcs = glob(["src/main/java/**/*.java"]),
     resources = glob(["src/main/resources/**/*"]),
-    testonly = 1,
     deps = [
         "//components/xml-utils",
         "//testing/multiton",

Modified: webservices/axiom/trunk/testing/testutils/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/testutils/BUILD?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/testutils/BUILD (original)
+++ webservices/axiom/trunk/testing/testutils/BUILD Sat Jun 10 12:22:24 2017
@@ -22,7 +22,6 @@ package(default_visibility = ["//visibil
 java_library(
     name = "testutils",
     srcs = glob(["src/main/java/**/*.java"]),
-    testonly = 1,
     deps = [
         "@commons_io//jar",
         "@guava//jar",

Modified: webservices/axiom/trunk/testing/xml-testsuite/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/xml-testsuite/BUILD?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/xml-testsuite/BUILD (original)
+++ webservices/axiom/trunk/testing/xml-testsuite/BUILD Sat Jun 10 12:22:24 2017
@@ -30,7 +30,6 @@ java_library(
     srcs = glob(["src/main/java/**/*.java"]),
     resources = glob(["src/main/resources/**/*"]) + ["filelist"],
     visibility = ["//visibility:public"],
-    testonly = 1,
     deps = [
         "@commons_codec//jar",
         "@commons_io//jar",

Modified: webservices/axiom/trunk/third_party/BUILD
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/third_party/BUILD?rev=1798311&r1=1798310&r2=1798311&view=diff
==============================================================================
--- webservices/axiom/trunk/third_party/BUILD (original)
+++ webservices/axiom/trunk/third_party/BUILD Sat Jun 10 12:22:24 2017
@@ -19,12 +19,24 @@
 
 package(default_visibility = ["//visibility:public"])
 
+genrule(
+    name = "jacocoagent",
+    srcs = ["@jacoco_agent//jar"],
+    outs = ["jacocoagent.jar"],
+    cmd = """
+        dir=$$(pwd)
+        cd $(@D)
+        jar xf $$dir/$< jacocoagent.jar""",
+)
+
 java_library(
     name = "junit",
     exports = [
         "@junit//jar",
     ],
-    testonly = 1,
+    runtime_deps = [
+        "@hamcrest//jar",
+    ],
 )
 
 java_library(
@@ -36,7 +48,6 @@ java_library(
         "@byte_buddy//jar",
         "@objenesis//jar",
     ],
-    testonly = 1,
 )
 
 java_library(



Mime
View raw message