Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Update to include 27.0.2 support libraries.
Browse files Browse the repository at this point in the history
Also, make the parser resilient to dependencies without scopes.
  • Loading branch information
aj-michael committed Jan 11, 2018
1 parent ccf6e13 commit 5e89b7c
Show file tree
Hide file tree
Showing 2 changed files with 5,335 additions and 8 deletions.
14 changes: 7 additions & 7 deletions GMavenToBazel.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ public static void main(String[] args) throws Exception {


PrintWriter bzlWriter = new PrintWriter(new FileWriter(OUTPUT_FILE));
// TODO: Get maven_jar and maven_aar from @bazel_tools and delete local copy after bazel 0.9.0
// bzlWriter.println(
// "load('@bazel_tools//tools/build_defs/repo:maven_rules.bzl', 'maven_jar', 'maven_aar')");
bzlWriter.println("load('//:maven_rules.bzl', 'maven_jar', 'maven_aar')");
bzlWriter.println(
"load('@bazel_tools//tools/build_defs/repo:maven_rules.bzl', 'maven_jar', 'maven_aar')");
bzlWriter.println("def gmaven_rules():");
for (String repositoryName : repositoryNameToRuleType.keySet()) {
String ruleType = repositoryNameToRuleType.get(repositoryName);
Expand Down Expand Up @@ -157,9 +155,11 @@ private static Set<String> getDependencyRepositoryNames(Document pom) throws Exc
String groupId = dependency.getElementsByTagName("groupId").item(0).getTextContent();
String artifactId = dependency.getElementsByTagName("artifactId").item(0).getTextContent();
String version = getDependencyVersion(dependency);
String scope = dependency.getElementsByTagName("scope").item(0).getTextContent();
if (scope.equals("test")) {
continue;
if (dependency.getElementsByTagName("scope").item(0) != null) {
String scope = dependency.getElementsByTagName("scope").item(0).getTextContent();
if (scope.equals("test")) {
continue;
}
}
result.add(getRepositoryName(groupId, artifactId, version));
}
Expand Down
Loading

0 comments on commit 5e89b7c

Please sign in to comment.