Skip to content

Commit

Permalink
Add a //file target to external jar repositories
Browse files Browse the repository at this point in the history
Fixes #990.

It's sometimes useful to be able to access the file pulled down
with maven_jar; for example, scala macro jars don't work with ijar,
so it's necessary to pull them into the compile-time classpath
unharmed.

--
Change-Id: I1d9e1cb30ea6fa56c18cbfcc68ee9b203524dfd4
Reviewed-on: https://bazel-review.googlesource.com/#/c/3550
MOS_MIGRATED_REVID=121379551
  • Loading branch information
colinmarc authored and kchodorow committed May 3, 2016
1 parent f07b76e commit 5666be1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ protected String createBuildFile(String baseName) {
" name = 'jar',",
" jars = ['" + baseName + "'],",
" visibility = ['//visibility:public']",
")",
"",
"filegroup(",
" name = 'file',",
" srcs = ['" + baseName + "'],",
" visibility = ['//visibility:public']",
")");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ public void setUpFs() throws Exception {
.setArchivePath(jar);
}

@Test
public void testTargets() throws Exception {
Path outputDir = DecompressorValue.decompress(descriptorBuilder.build());
assertThat(outputDir.exists()).isTrue();
String buildContent =
new String(FileSystemUtils.readContentAsLatin1(outputDir.getRelative("jar/BUILD")));
assertThat(buildContent).contains("java_import");
assertThat(buildContent).contains("filegroup");
}

@Test
public void testWorkspaceGen() throws Exception {
Path outputDir = DecompressorValue.decompress(descriptorBuilder.build());
Expand Down

0 comments on commit 5666be1

Please sign in to comment.