-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
new_http_archive should support specifying a root directory #221
Comments
Good idea. I'll add an attribute, maybe something like |
Just adding a +1 here! |
@kchodorow thanks!! 👍 |
This is adapting from a BUILD file I had that lived along side sqlite3 source, hence swaths of commented out targets. The use of SRC_PREFIX throughout to deal with the source archive's root dir will be unnecessary after a `root_directory` attributed is added to the `new_http_archive` repository rule. See bazelbuild/bazel#221
Does this actually work? I tried to use it and it doesn't seem to do the right thing. My example: https://github.com/kamalmarhubi/sqlite3-bazel/tree/use-strip-prefix, I get errors about missing input. The test
Full output at: https://gist.github.com/kamalmarhubi/1128b38948a4077e376c |
That's from running
|
Arg, sorry about this. I changed the name of the attribute at the 11th hour in code review and the test wasn't run by our CI because it's marked as manual. The actual fix should be in Monday, but changing these to strip_prefix should fix it: https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/bazel/repository/NewHttpArchiveFunction.java#L84-L86 |
@kchodorow this was still buggy for zip archives, crashing out with NPE. fixed and submitted for review: https://bazel-review.googlesource.com/#/c/2084/ :-) |
The removal of the prefix was incorrectly applied to the zip entry instead of the destination. Fixes #221 Tested: - Added a copy of the existing integration test with zip archive - bash compile.sh all -- Change-Id: I5d5f75f66a17eb6f146afafb1f347a781490e616 Reviewed-on: https://bazel-review.googlesource.com/#/c/2084/ MOS_MIGRATED_REVID=104774296
This does not seem to work for:
) I get a similar error as @kamalmarhubi |
And I ran into #520. Not sure, whether it is a variant of these problems... |
@abergmeier the option is strip_prefix, not skip_prefix (see http://bazel.io/docs/build-encyclopedia.html#new_http_archive.strip_prefix). Regardless, you should not be getting a stack trace, can you paste your output? |
i have a svn path, http://xxx.com/xxx/tag/xxx.1.0.1 for example. |
At the moment, new_http_archive requires all rules in the BUILD file to be relative to the root of the archive. However, standard operating procedure for source code archives is to bundle files beneath a single directory which typically includes the project name and version (e.g. libfoo-1.2.4a.zip would unpack to libfoo-1.2.4a/). In particular, GitHub zip files follow this procedure. Being able to specify an archive root directory would make maintaining external BUILD files for these archives much simpler and seems like it should be relatively straightforward to support.
The text was updated successfully, but these errors were encountered: