Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issue when building using m2Local support + pinning #935

Open
oliviernotteghem opened this issue Jul 24, 2023 · 2 comments
Open

Build issue when building using m2Local support + pinning #935

oliviernotteghem opened this issue Jul 24, 2023 · 2 comments

Comments

@oliviernotteghem
Copy link

oliviernotteghem commented Jul 24, 2023

Error is observed when building an (android) project using local artifact (via 'm2Local' reprository) and pinning.

Repro:

  1. Unzip androidx.zip into~/.m2/repository folder.
  2. Clone https://github.com/oliviernotteghem/rules_jvm_external which contains this commit
  3. cd examples/android_kotlin_app
  4. rm -rf <path to repo cache, ex : /private/var/tmp/_bazel_oliviern/cache/repos/v1>; bazel clean --expunge; bazel build app

Result:
ERROR: /private/var/tmp/_bazel_oliviern/d757db415344097304197092f16ed4d8/external/maven/BUILD:9:11: Stamping the manifest of @maven//:androidx_annotation_annotation failed: missing input file '@maven//:androidx/annotation/annotation/1.5.0-LOCAL/annotation-1.5.0-LOCAL.jar'

Note:
When building without pinning, builds succeeds.

It looks like the issue is due to the symlink from the absolute path of the artifact to the relative path within the output_base/external for local artifact gets wipeout at the beginning of build when pinning is used (i.e maven_install_json attribute is specified)

@oliviernotteghem
Copy link
Author

Possible fix :

def extract_netrc_from_auth_url(url):
    """Return a dict showing the netrc machine, login, and password extracted from a url.
@@ -1005,7 +1005,7 @@ def _coursier_fetch_impl(repository_ctx):
            # b) Otherwise, we clear the url and also simlink the file from the maven local directory
            #    to file within the repository rule workspace
            print("Assuming maven local for artifact: %s" % artifact["coord"])
-            artifact.update({"url": None})
+            artifact.update({"url": "file://" + artifact["file"]})
            if not repository_ctx.attr.name.startswith("unpinned_"):
                artifact.update({"file": _relativize_and_symlink_file_in_maven_local(repository_ctx, artifact["file"])})

@gergelyfabian
Copy link
Contributor

artifact.update({"url": "file://" + artifact["file"]})

Tried applying this fix, but it did not work.
Works with the version from the PR #961.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants