aboutsummaryrefslogtreecommitdiff
path: root/javatests
diff options
context:
space:
mode:
authortomlu <tomlu@google.com>2018-02-28 19:15:42 -0800
committerLiam Miller-Cushon <cushon@stagyn.svl.corp.google.com>2018-03-08 17:12:58 -0800
commitca435805dc9ec0a4008bb8139cec08314f9d7717 (patch)
treeae7b8ebd63c3e958c37856291b30ede69d9698f8 /javatests
parent6001880e3739adbae492f22c44a83d76ad80bf8c (diff)
downloadturbine-ca435805dc9ec0a4008bb8139cec08314f9d7717.tar.gz
Change the strict deps plugin to read jar owner from manifest.
The plugin tries to read the following attributes: Target-Label: <label> Injecting-Rule-Kind: <rule kind> These are used instead of the jar owners passed to JavaBuilder from blaze. Any owners currently passed from blaze are now ignored. This CL also half-reverts the command line syntax for JavaBuilder and Turbine. It is now: --classpath <jar1> <jar2> ... --direct_dependencies <jar1> ... MOE_MIGRATED_REVID=187419469
Diffstat (limited to 'javatests')
-rw-r--r--javatests/com/google/turbine/deps/DependenciesTest.java13
-rw-r--r--javatests/com/google/turbine/options/TurbineOptionsTest.java49
2 files changed, 10 insertions, 52 deletions
diff --git a/javatests/com/google/turbine/deps/DependenciesTest.java b/javatests/com/google/turbine/deps/DependenciesTest.java
index 36535b8..70377fb 100644
--- a/javatests/com/google/turbine/deps/DependenciesTest.java
+++ b/javatests/com/google/turbine/deps/DependenciesTest.java
@@ -22,6 +22,7 @@ import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import com.google.turbine.binder.Binder;
import com.google.turbine.binder.Binder.BindingResult;
import com.google.turbine.binder.ClassPathBinder;
@@ -256,9 +257,9 @@ public class DependenciesTest {
ImmutableList.of(
"a.jar", "b.jar", "c.jar", "d.jar", "e.jar", "f.jar", "g.jar", "h.jar", "i.jar",
"j.jar");
- ImmutableMap<String, String> directJarsToTargets = ImmutableMap.of();
+ ImmutableSet<String> directJars = ImmutableSet.of();
ImmutableList<String> depsArtifacts = ImmutableList.of();
- assertThat(Dependencies.reduceClasspath(classpath, directJarsToTargets, depsArtifacts))
+ assertThat(Dependencies.reduceClasspath(classpath, directJars, depsArtifacts))
.isEqualTo(classpath);
}
@@ -271,11 +272,7 @@ public class DependenciesTest {
ImmutableList.of(
"a.jar", "b.jar", "c.jar", "d.jar", "e.jar", "f.jar", "g.jar", "h.jar", "i.jar",
"j.jar");
- ImmutableMap<String, String> directJarsToTargets =
- ImmutableMap.of(
- "c.jar", "//a",
- "d.jar", "//d",
- "g.jar", "//e");
+ ImmutableSet<String> directJars = ImmutableSet.of("c.jar", "d.jar", "g.jar");
ImmutableList<String> depsArtifacts =
ImmutableList.of(cdeps.toString(), ddeps.toString(), gdeps.toString());
writeDeps(
@@ -289,7 +286,7 @@ public class DependenciesTest {
"f.jar", DepsProto.Dependency.Kind.UNUSED,
"j.jar", DepsProto.Dependency.Kind.UNUSED));
writeDeps(gdeps, ImmutableMap.of("i.jar", DepsProto.Dependency.Kind.IMPLICIT));
- assertThat(Dependencies.reduceClasspath(classpath, directJarsToTargets, depsArtifacts))
+ assertThat(Dependencies.reduceClasspath(classpath, directJars, depsArtifacts))
.containsExactly("b.jar", "c.jar", "d.jar", "e.jar", "g.jar", "i.jar")
.inOrder();
}
diff --git a/javatests/com/google/turbine/options/TurbineOptionsTest.java b/javatests/com/google/turbine/options/TurbineOptionsTest.java
index d625a1f..b548d8b 100644
--- a/javatests/com/google/turbine/options/TurbineOptionsTest.java
+++ b/javatests/com/google/turbine/options/TurbineOptionsTest.java
@@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -54,11 +53,9 @@ public class TurbineOptionsTest {
"--processorpath",
"libproc1.jar",
"libproc2.jar",
- "--dependencies",
+ "--classpath",
"lib1.jar",
- "//:lib1",
"lib2.jar",
- "//:lib2",
"--bootclasspath",
"rt.jar",
"zipfs.jar",
@@ -102,15 +99,11 @@ public class TurbineOptionsTest {
@Test
public void strictJavaDepsArgs() throws Exception {
String[] lines = {
- "--dependencies",
+ "--classpath",
"blaze-out/foo/libbar.jar",
- "//foo/bar",
"blaze-out/foo/libbaz1.jar",
- "//foo/baz1",
"blaze-out/foo/libbaz2.jar",
- "//foo/baz2",
"blaze-out/proto/libproto.jar",
- "//proto;java_proto_library",
"--direct_dependencies",
"blaze-out/foo/libbar.jar",
"--deps_artifacts",
@@ -123,21 +116,6 @@ public class TurbineOptionsTest {
TurbineOptionsParser.parse(Iterables.concat(BASE_ARGS, Arrays.asList(lines)));
assertThat(options.targetLabel()).hasValue("//java/com/google/test");
- assertThat(options.directJarsToTargets())
- .containsExactlyEntriesIn(ImmutableMap.of("blaze-out/foo/libbar.jar", "//foo/bar"));
- assertThat(options.indirectJarsToTargets())
- .containsExactlyEntriesIn(
- ImmutableMap.of(
- "blaze-out/foo/libbaz1.jar", "//foo/baz1",
- "blaze-out/foo/libbaz2.jar", "//foo/baz2",
- "blaze-out/proto/libproto.jar", "//proto;java_proto_library"));
- assertThat(options.jarToTarget())
- .containsExactlyEntriesIn(
- ImmutableMap.of(
- "blaze-out/foo/libbar.jar", "//foo/bar",
- "blaze-out/foo/libbaz1.jar", "//foo/baz1",
- "blaze-out/foo/libbaz2.jar", "//foo/baz2",
- "blaze-out/proto/libproto.jar", "//proto;java_proto_library"));
assertThat(options.directJars()).containsExactly("blaze-out/foo/libbar.jar");
assertThat(options.depsArtifacts()).containsExactly("foo.jdeps", "bar.jdeps");
}
@@ -170,27 +148,16 @@ public class TurbineOptionsTest {
TurbineOptionsParser.parse(Iterables.concat(BASE_ARGS, Arrays.asList(lines)));
assertThat(options.targetLabel()).hasValue("//java/com/google/test");
- assertThat(options.directJarsToTargets())
- .containsExactlyEntriesIn(ImmutableMap.of("blaze-out/foo/libbar.jar", "//foo/bar"));
- assertThat(options.indirectJarsToTargets())
- .containsExactlyEntriesIn(
- ImmutableMap.of(
- "blaze-out/foo/libbaz1.jar", "//foo/baz1",
- "blaze-out/foo/libbaz2.jar", "//foo/baz2",
- "blaze-out/proto/libproto.jar", "//proto"));
assertThat(options.depsArtifacts()).containsExactly("foo.jdeps", "bar.jdeps");
}
@Test
public void classpathArgs() throws Exception {
String[] lines = {
- "--dependencies",
+ "--classpath",
"liba.jar",
- "//:liba",
"libb.jar",
- "//:libb",
"libc.jar",
- "//:libc",
"--processorpath",
"libpa.jar",
"libpb.jar",
@@ -209,13 +176,10 @@ public class TurbineOptionsTest {
@Test
public void repeatedClasspath() throws Exception {
String[] lines = {
- "--dependencies",
+ "--classpath",
"liba.jar",
- "//:liba",
"libb.jar",
- "//:libb",
"libc.jar",
- "//:libc",
"--processorpath",
"libpa.jar",
"libpb.jar",
@@ -236,13 +200,10 @@ public class TurbineOptionsTest {
String[] lines = {
"--output",
"out.jar",
- "--dependencies",
+ "--classpath",
"liba.jar",
- "//:liba",
"libb.jar",
- "//:libb",
"libc.jar",
- "//:libc",
"--processorpath",
"libpa.jar",
"libpb.jar",