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

OkBuck fails to download/compile dependencies with repackaged jars #859

Closed
NickFirmani opened this issue Jul 8, 2019 · 1 comment
Closed

Comments

@NickFirmani
Copy link

The AndroidX Emoji library (as well as Room, and others) define a repackaged jar dependency by doing the following in their Gradle build script

dependencies {
  repackage project(path: ':noto-emoji-compat', configuration: "parser")
  // Wrap the noto-emoji-compat dependency in a FileCollection so that the Android Gradle plugin
  // treats this as local jar and package it inside the aar.
  api files(configurations.repackage)
  api("androidx.core:core:1.1.0-rc01")
...

With downloadInBuck = true, this causes a failure after OkBuck runs with the following exception (since this target doesn't exist)

Unable to download: mvn:androidx.emoji:emoji:jar:1.0.0
Building: finished in 4.1 sec (100%) 268/779 jobs, 144 updated
  Total time: 4.6 sec
Command failed with exit code -1.
    When running <curl>.
    When building rule //.okbuck/ext/androidx/emoji:emoji-1.0.0.jar__downloaded.

With downloadInBuck = false a different exception occurs when trying to symlink the downloaded jar to the existing aar

> Task :okbuck FAILED
Could not create symlink .okbuck/ext/androidx/emoji/emoji-1.0.0-sources.jar -> .gradle/caches/modules-2/files-2.1/androidx.emoji/emoji/1.0.0/5315d6ba250959ffc6b999879a48ea78c009b493/emoji-1.0.0-sources.jar

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':okbuck'.
> java.nio.file.FileAlreadyExistsException: .okbuck/ext/androidx/emoji/emoji-1.0.0-sources.jar

It appears that what is happening is that OkBuck in the dependency processing step is collecting both the AAR and the JAR from the artifact because they have the same name, then either trying to make a duplicate symlink or download a jar that doesn't exist

I did a bit of (brutish) exploration here NickFirmani@b8a5c06 to try and fix this, I don't think that this is quite the correct approach, but it does solve the problem, just preferring the AAR over the JAR if both exist.

@kageiit
Copy link
Contributor

kageiit commented Jul 17, 2020

This should not longer be an issue with the latest okbuck. Please re-open if it happens on latest

@kageiit kageiit closed this as completed Jul 17, 2020
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