bazelbuild / migration-tooling

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

No repositories searched by default #83

Open pgr0ss opened 6 years ago

pgr0ss commented 6 years ago

The commit to enable custom repositories (https://github.com/bazelbuild/migration-tooling/commit/a5e687403ec59db52383a2c0996003e5ad18b6cf) seems to have caused this project to use no repositories by default. Can we return to using default repositories if no repositories are specified?

% bazel run //generate_workspace -- --artifact junit:junit:4.11 --output_dir /tmp
INFO: Analysed target //generate_workspace:generate_workspace (0 packages loaded).
INFO: Found 1 target...
Target //generate_workspace:generate_workspace up-to-date:
  bazel-bin/generate_workspace/generate_workspace.jar
  bazel-bin/generate_workspace/generate_workspace
INFO: Elapsed time: 0.585s, Critical Path: 0.50s
INFO: Build completed successfully, 3 total actions

INFO: Running command line: bazel-bin/generate_workspace/generate_workspace --artifact junit:junit:4.11 --output_dir /tmp
Feb 16, 2018 7:44:16 PM com.google.devtools.build.workspace.maven.Resolver resolveArtifact
WARNING: Could not find any repositories that knew how to resolve junit:junit:4.11 (checked )
Wrote /tmp/generate_workspace.bzl
% cat /tmp/generate_workspace.bzl
# The following dependencies were calculated from:
#
# generate_workspace --artifact junit:junit:4.11 --output_dir /tmp

def generated_maven_jars():
  pass

def generated_java_libraries():
  pass

If I check out an older commit, it works:

% git co 0f25a7e83f2f4b776fad9c8cb929ec9fa7cac87f
Previous HEAD position was a5e6874... Enable custom repositories. (#71)
HEAD is now at 0f25a7e... Switch output from System.out to System.err (#72)

% bazel run //generate_workspace -- --artifact junit:junit:4.11 --output_dir /tmp
INFO: Analysed target //generate_workspace:generate_workspace (1 packages loaded).
INFO: Found 1 target...
Target //generate_workspace:generate_workspace up-to-date:
  bazel-bin/generate_workspace/generate_workspace.jar
  bazel-bin/generate_workspace/generate_workspace
INFO: Elapsed time: 1.159s, Critical Path: 1.06s
INFO: Build completed successfully, 7 total actions

INFO: Running command line: bazel-bin/generate_workspace/generate_workspace --artifact junit:junit:4.11 --output_dir /tmp
Feb 16, 2018 7:45:06 PM com.google.devtools.build.workspace.maven.Resolver traverseDeps
INFO:   Downloading pom for junit:junit:4.11
Feb 16, 2018 7:45:06 PM com.google.devtools.build.workspace.maven.Resolver traverseDeps
INFO:   Downloading pom for org.hamcrest:hamcrest-core:1.3
Wrote /tmp/generate_workspace.bzl
% cat /tmp/generate_workspace.bzl
# The following dependencies were calculated from:
#
# generate_workspace --artifact junit:junit:4.11 --output_dir /tmp

def generated_maven_jars():
  # junit:junit:jar:4.11
  native.maven_jar(
      name = "org_hamcrest_hamcrest_core",
      artifact = "org.hamcrest:hamcrest-core:1.3",
      sha1 = "42a25dc3219429f0e5d060061f71acb49bf010a0",
  )

  native.maven_jar(
      name = "junit_junit",
      artifact = "junit:junit:4.11",
  )

def generated_java_libraries():
  native.java_library(
      name = "org_hamcrest_hamcrest_core",
      visibility = ["//visibility:public"],
      exports = ["@org_hamcrest_hamcrest_core//jar"],
  )

  native.java_library(
      name = "junit_junit",
      visibility = ["//visibility:public"],
      exports = ["@junit_junit//jar"],
      runtime_deps = [
          ":org_hamcrest_hamcrest_core",
      ],
  )
pgr0ss commented 6 years ago

Is this project still active? It seems like this bug would break most people trying to use it?

pgr0ss commented 6 years ago

Bump. Should we avoid this project now? What's the future of maven dependencies in bazel?

petroseskinder commented 6 years ago

@pgr0ss

I don't think it is. During the November Bazel conference, it was decided that the official maven story would be handled with bazel-deps. Unfortunately, the team members involved with this project have moved onto other responsibilities. Whereas @johnnynek is very actively maintaining bazel-deps for use at Stripe.

wstrange commented 6 years ago

This repo should be deleted then - or marked with a big DEPRECATED warning.

If bazel-deps is the way to go, it should be moved under the bazelbuild/ project.

Maven migration is just insanely confusing for any newcomer to Bazel. Searching on google turns up several solutions that "mostly" work - but are not quite 100% (in our case, none seem to handle artifactory authentication...)

Bazel needs a single, well documented, well tested solution for maven migration.