bazelbuild / migration-tooling

Migration tools for Bazel
Apache License 2.0
45 stars 30 forks source link

Implement transitive dependency resolution using Aether #40

Closed petroseskinder closed 7 years ago

petroseskinder commented 7 years ago

In particular, given a set of artifacts, this CL produces a set of Bazel maven_jar rules. Transitive dependency resolution is achieved using aether. I rolled my own solution for serializing aether's dependency graph into a set of build rules. This is accompanied with a set of unit tests

This has not been integrated into the generate_workspace class. It's a slightly better use of time to first figure out how to parse maven artifacts from a set of pom files.

The obscenely large size of the CL is due to changes to generate_workspace.bzl

bazel-io commented 7 years ago

Can one of the admins verify this patch?

petroseskinder commented 7 years ago

I'm not sure why github is stating there are conflicts within generate_workspace.bzl As of commit 9880260, there are no conflicts in generate_workspace.bzl. 😞

kchodorow commented 7 years ago

Checking out this branch, I get:

$ git fetch git://github.com/petroseskinder/migration-tooling.git version-fix
remote: Counting objects: 75, done.
remote: Total 75 (delta 16), reused 16 (delta 16), pack-reused 58
Unpacking objects: 100% (75/75), done.
From git://github.com/petroseskinder/migration-tooling
 * branch            version-fix -> FETCH_HEAD
03:17:13 PM ~/gitroot/migration-tooling (master)$ git reset --hard FETCH_HEAD
HEAD is now at bc0918e Add statement in README acknowledging aether
03:17:22 PM ~/gitroot/migration-tooling (master)$ bazel run //generate_workspace -- -a org.apache.maven:maven-artifact:3.5.0
ERROR: /home/kchodorow/gitroot/migration-tooling/generate_workspace/src/main/java/com/google/devtools/build/workspace/maven/BUILD:1:1: no such package '@org_eclipse_aether_aether_util//jar': The repository could not be resolved and referenced by '//generate_workspace/src/main/java/com/google/devtools/build/workspace/maven:maven'.
ERROR: Analysis of target '//generate_workspace:generate_workspace' failed; build aborted.
INFO: Elapsed time: 1.802s
ERROR: Build failed. Not running target.
petroseskinder commented 7 years ago

Ehh. I see. My apologies. This is from merging the generate_workspace.bzl. It should be fine now. I squashed a number of commits and regenerated the file.

After the repository rule is merged, it makes sense to add this to the gitignore.

petroseskinder commented 7 years ago

It looks like you can get the dependency result from the exception, so you can still return it (and show which dependencies did not resolve).

Please test.

Noted. Can we separate this out to another pull request? Specifically, I would prefer this be in the same PR that rips out Resolver.java

kchodorow commented 7 years ago

Can you resolve the generate_workspace.bzl conflicts & I'll merge?

kchodorow commented 7 years ago

Jenkins, test this please.

petroseskinder commented 7 years ago

jenkins says yay! :)