aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/ijar/test
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-02-08 09:31:48 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-08 09:33:22 -0800
commit13962bf49cc756b49d9f114baf454f428a18acac (patch)
tree7a6728c98378e4afe1b886e7e1bd2ed3175d379c /third_party/ijar/test
parentc89e1f3d662f78ec995209a8c3fd83dc26630f79 (diff)
Accept --target_label, --injecting_rule_kind in ijar.
The values (if present) are written into the manifest with this format: Target-Label: <label> Injecting-Rule-Kind: <kind> In the future, JavaBuilder will make sure of this instead of command line arguments to find owners for jars for its add_dep commands. PiperOrigin-RevId: 185006704
Diffstat (limited to 'third_party/ijar/test')
-rw-r--r--third_party/ijar/test/IjarTests.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/third_party/ijar/test/IjarTests.java b/third_party/ijar/test/IjarTests.java
index 4e0fb5d839..d07b37e3d2 100644
--- a/third_party/ijar/test/IjarTests.java
+++ b/third_party/ijar/test/IjarTests.java
@@ -30,8 +30,10 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.jar.Manifest;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.annotation.processing.AbstractProcessor;
@@ -274,4 +276,15 @@ public class IjarTests {
assertThat(new String(lib.get("module-info.class"), UTF_8)).isEqualTo("hello");
assertThat(new String(lib.get("foo/module-info.class"), UTF_8)).isEqualTo("goodbye");
}
+
+ @Test
+ public void testTargetLabel() throws Exception {
+ try (JarFile jf =
+ new JarFile("third_party/ijar/test/interface_ijar_testlib_with_target_label.jar")) {
+ Manifest manifest = jf.getManifest();
+ Attributes attributes = manifest.getMainAttributes();
+ assertThat(attributes.getValue("Target-Label")).isEqualTo("//foo:foo");
+ assertThat(attributes.getValue("Injecting-Rule-Kind")).isEqualTo("foo_library");
+ }
+ }
}