Update to HEAD for bazel-integration-testing
This enable testing with latest versions of Bazel.
diff --git a/.classpath b/.classpath
index 0d26dc0..3936e91 100644
--- a/.classpath
+++ b/.classpath
@@ -9,6 +9,6 @@
<classpathentry kind="lib" path="runfiles/com_google_truth/jar/truth-0.31.jar"/>
<classpathentry kind="lib" path="runfiles/org_junit/jar/junit-4.11.jar"/>
<classpathentry kind="lib" path="runfiles/org_hamcrest_core/jar/hamcrest-core-1.3.jar"/>
- <classpathentry kind="lib" path="runfiles/build_bazel_integration_testing/java/build/bazel/tests/integration/libintegration.jar"/>
+ <classpathentry kind="lib" path="runfiles/build_bazel_integration_testing/java/build/bazel/tests/integration/libworkspace_driver.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/WORKSPACE b/WORKSPACE
index f469cd9..4cd8a15 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -12,9 +12,9 @@
# TODO(dmarting): switch to release version of integration testing
http_archive(
name = "build_bazel_integration_testing",
- url = "https://github.com/bazelbuild/bazel-integration-testing/archive/55a6a70dbcc2cc7699ee715746fb1452788f8d3c.zip",
- sha256 = "b505866c12b9f6ce08b96a16305407deae43bef7655a8e7c2197d08c24c6cb04",
- strip_prefix = "bazel-integration-testing-55a6a70dbcc2cc7699ee715746fb1452788f8d3c",
+ url = "https://github.com/bazelbuild/bazel-integration-testing/archive/7ace2e7fbfc32f89222a85804b574a1e07583ddc.zip",
+ sha256 = "44de2377d38ad2386be132a21bae9b61291d546303747d72b454a735e18fa923",
+ strip_prefix = "bazel-integration-testing-7ace2e7fbfc32f89222a85804b574a1e07583ddc",
)
load("@build_bazel_integration_testing//tools:bazel_java_integration_test.bzl", "bazel_java_integration_test_deps")
diff --git a/javatests/com/google/devtools/bazel/e4b/integration/AspectIntegrationTest.java b/javatests/com/google/devtools/bazel/e4b/integration/AspectIntegrationTest.java
index 08855a3..a14fc29 100644
--- a/javatests/com/google/devtools/bazel/e4b/integration/AspectIntegrationTest.java
+++ b/javatests/com/google/devtools/bazel/e4b/integration/AspectIntegrationTest.java
@@ -18,35 +18,44 @@
import static org.junit.Assert.assertEquals;
import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import build.bazel.tests.integration.Command;
-import build.bazel.tests.integration.BazelBaseTestCase;
+import build.bazel.tests.integration.WorkspaceDriver;
+import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.bazel.e4b.command.IdeBuildInfo;
/** Integration test for the aspect used by the plugin. */
-public final class AspectIntegrationTest extends BazelBaseTestCase {
+public final class AspectIntegrationTest {
- private File aspectWorkspace;
+ private WorkspaceDriver driver = new WorkspaceDriver();
+ private Path aspectWorkspace;
+
+ @BeforeClass
+ public static void setUpClass() throws IOException {
+ WorkspaceDriver.setUpClass();
+ }
@Before
- @Override
public void setUp() throws Exception {
- super.setUp();
- aspectWorkspace = workspace;
- copyFromRunfiles("build_bazel_eclipse/resources/e4b_aspect.bzl", "e4b_aspect.bzl");
- scratchFile("BUILD");
- newWorkspace();
+ driver.setUp();
+ aspectWorkspace = driver.currentWorkspace();
+ driver.copyFromRunfiles("build_bazel_eclipse/resources/e4b_aspect.bzl", "e4b_aspect.bzl");
+ driver.scratchFile("BUILD");
+ driver.newWorkspace();
createJavaProgram();
}
private void createJavaProgram() throws Exception {
- scratchFile("java/my/pkg/Main.java", // force-new-line
+ driver.scratchFile("java/my/pkg/Main.java", // force-new-line
"package my.pkg;", // force-new-line
"import my.other.pkg.Annex;", // force-new-line
"public class Main {", // force-new-line
@@ -54,11 +63,11 @@
" System.out.println(new Annex().helloWorld());", // force-new-line
" }", // force-new-line
"}");
- scratchFile("java/my/pkg/BUILD", // force-new-line
+ driver.scratchFile("java/my/pkg/BUILD", // force-new-line
"java_binary(name='pkg',", // force-new-line
" srcs=['Main.java'],", // force-new-line
" deps=['//java/my/other/pkg:Annex'])");
- scratchFile("java/my/other/pkg/Annex.java", // force-new-line
+ driver.scratchFile("java/my/other/pkg/Annex.java", // force-new-line
"package my.other.pkg;", // force-new-line
@@ -69,11 +78,11 @@
" return \"Hello, World!\";", // force-new-line
" }", // force-new-line
"}");
- scratchFile("java/my/other/pkg/BUILD", // force-new-line
+ driver.scratchFile("java/my/other/pkg/BUILD", // force-new-line
"java_library(name='Annex',", // force-new-line
" srcs=['Annex.java'],", // force-new-line
" visibility = ['//visibility:public'])");
- scratchFile("javatests/my/other/pkg/AnnexTest.java", // force-new-line
+ driver.scratchFile("javatests/my/other/pkg/AnnexTest.java", // force-new-line
"package my.other.pkg;", // force-new-line
"import static org.junit.Assert.assertEquals;", // force-new-line
@@ -86,7 +95,7 @@
" assertEquals(\"Hello, World!\", new Annex().helloWorld());", // force-new-line
" }", // force-new-line
"}");
- scratchFile("javatests/my/other/pkg/BUILD", // force-new-line
+ driver.scratchFile("javatests/my/other/pkg/BUILD", // force-new-line
"java_test(name='AnnexTest',", // force-new-line
" srcs=['AnnexTest.java'],", // force-new-line
" deps=['//java/my/other/pkg:Annex'])");
@@ -94,12 +103,12 @@
@Test
public void testAspectGenerateJson() throws Exception {
- Command cmd = bazel("build", "--override_repository=local_eclipse_aspect=" + aspectWorkspace,
+ Command cmd = driver.bazelCommand("build", "--override_repository=local_eclipse_aspect=" + aspectWorkspace,
"--aspects=@local_eclipse_aspect//:e4b_aspect.bzl%e4b_aspect", "-k",
"--output_groups=ide-info-text,ide-resolve,-_,-defaults", "--experimental_show_artifacts",
- "//...");
+ "//...").build();
int retCode = cmd.run();
- assertEquals("Bazel failed to build, stderr: " + LINE_JOINER.join(cmd.getErrorLines()),
+ assertEquals("Bazel failed to build, stderr: " + Joiner.on("\n").join(cmd.getErrorLines()),
0, retCode);
String[] jsonFiles = cmd.getErrorLines().stream().filter((s) -> {
return s.startsWith(">>>") && s.endsWith(".json");
diff --git a/javatests/com/google/devtools/bazel/e4b/integration/BUILD b/javatests/com/google/devtools/bazel/e4b/integration/BUILD
index ead98ca..aafae9e 100644
--- a/javatests/com/google/devtools/bazel/e4b/integration/BUILD
+++ b/javatests/com/google/devtools/bazel/e4b/integration/BUILD
@@ -6,6 +6,8 @@
data = ["//resources:srcs"],
deps = [
"//java/com/google/devtools/bazel/e4b/command",
+ "@org_junit//jar",
+ "@org_hamcrest_core//jar",
"@com_google_guava//jar",
"@com_google_truth//jar",
],
diff --git a/runfiles b/runfiles
index 859b3f5..f72392e 120000
--- a/runfiles
+++ b/runfiles
@@ -1 +1 @@
-bazel-bin/javatests/com/google/devtools/bazel/e4b/integration/AspectIntegrationTest/bazel0.5.0.runfiles
\ No newline at end of file
+bazel-bin/javatests/com/google/devtools/bazel/e4b/integration/AspectIntegrationTest/bazel0.10.0.runfiles
\ No newline at end of file