You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow customizing "BUILD" as a package-specification file #552
👍 It is very common to have a build folder at the top level of an iOS or Android project for Xcode to put locally built artifacts and generated files. We make this assumption on our CI as well.
I wonder why Bazel allows you to customize the location of a BUILD file for an external repo (via the build_file attr on a git_repository) but won't let you customize the BUILD file in the workspace root.
It would be as simple as specifying in the WORKSPACE something like workspace_build_file = "workspace.BUILD".
I don't think that's a good idea. We will ends-up having different build file everywhere. We should instead do file type detection and not try to parse a directory as a build file :)
@damienmg the problem we ran into was the opposite - existing scripts (as well as Gradle, in its default configuration) were stepping on the BUILD files we wrote.
If the concern is that we will have different build files everywhere, maybe we could solve this problem by detecting build files by looking for files either called BUILD (as we do today) or Buildfile (similar to Makefile, Gemfile, etc). That seems unique enough that it won't be trampled by scripts, and also a familiar pattern for developers.
As a transitory aid, until this is done, I made a really simple script to patch Bazel. We managed to transition successfully from pants with a ~2 week overlap and then went back to the vanilla Bazel binary after.
find . -type f | grep -E '\.(md|patch|vm|html|bzl|java|c|cc|h|proto|txt|sh|bash|git_log)$' | xargs sed -r -i"" -e 's/\bBUILD\b/UCBUILD/g'
find . -type f | grep -E '(_bazel|Makefile|WORKSPACE|UCBUILD)' | xargs sed -r -i"" -e 's/\bBUILD\b/UCBUILD/g'
find . -type f | grep 'UCBUILD' | xargs rename 's/\bBUILD\b/UCBUILD/'
I have a change ready and in testing. There's some cleanup I need to do before I can start working to get it out, but it should be in review next week.
Reacted by Jason Lunz, Robert Gay and David Jarvis
Chiming in from Airbnb eng -- we're looking to migrate off of Gradle as well as some of the other folks in this thread and we've run into this issue as well. Would love to see this fix released as soon as it's ready.
I have just this evening submitted the fix for this issue. It should be pushed to GitHub in the next day or so and then be in the December release (presumably 0.4.2, but we will see what the version is).
Reacted by David Jarvis, Jeff Grafton, David Z. Chen and Jeremy Nimmer
Activity
adamhowardprice commentedon Nov 4, 2015
👍 It is very common to have a
buildfolder at the top level of an iOS or Android project for Xcode to put locally built artifacts and generated files. We make this assumption on our CI as well.I wonder why Bazel allows you to customize the location of a
BUILDfile for an external repo (via thebuild_fileattr on agit_repository) but won't let you customize theBUILDfile in the workspace root.It would be as simple as specifying in the
WORKSPACEsomething likeworkspace_build_file = "workspace.BUILD".damienmg commentedon Nov 17, 2015
I don't think that's a good idea. We will ends-up having different build file everywhere. We should instead do file type detection and not try to parse a directory as a build file :)
cgrushko commentedon Nov 17, 2015
@damienmg the problem we ran into was the opposite - existing scripts (as well as Gradle, in its default configuration) were stepping on the BUILD files we wrote.
adamhowardprice commentedon Nov 18, 2015
If the concern is that we will have different build files everywhere, maybe we could solve this problem by detecting build files by looking for files either called
BUILD(as we do today) orBuildfile(similar toMakefile,Gemfile, etc). That seems unique enough that it won't be trampled by scripts, and also a familiar pattern for developers.adamhowardprice commentedon Nov 18, 2015
Alternatively,
Bazelfile?damienmg commentedon Nov 18, 2015
SGTM BUILD.bazel ? (someone was proposing an extension to make it work outside).
dmaclach commentedon Nov 19, 2015
Please don't reuse extensions that are already in use for different file types (i.e. please don't use .bzl). BUILD.bld?
davidzchen commentedon Nov 19, 2015
If we are adding an extension, I vote in favor of
BUILD.bazel. Another benefit of this is that it is straightforward for people to say:Similarly, Gradle's build files are
build.gradle.13 remaining items
katre commentedon Sep 27, 2016
Just as an update, work is in progress, I have a mostly working solution but there are a lot of tests to fix up as a result.
mightyguava commentedon Sep 27, 2016
As a transitory aid, until this is done, I made a really simple script to patch Bazel. We managed to transition successfully from pants with a ~2 week overlap and then went back to the vanilla Bazel binary after.
robertwb commentedon Oct 10, 2016
Has there been any decision as to what the extension/name of this BUILD file not named BUILD is going to be?
katre commentedon Oct 10, 2016
The alternate name will be BUILD.bazel. I have the code for this change
mostly working and plan to pick it back up shortly.
On Mon, Oct 10, 2016, 1:54 PM Robert Bradshaw [email protected]
wrote:
ixdy commentedon Oct 24, 2016
@katre any ETA? this is a pretty frustrating issue for us.
katre commentedon Oct 28, 2016
@ixdy Sorry for the slow reply.
I have a change ready and in testing. There's some cleanup I need to do before I can start working to get it out, but it should be in review next week.
venantius commentedon Nov 10, 2016
Chiming in from Airbnb eng -- we're looking to migrate off of Gradle as well as some of the other folks in this thread and we've run into this issue as well. Would love to see this fix released as soon as it's ready.
katre commentedon Nov 11, 2016
I have just this evening submitted the fix for this issue. It should be pushed to GitHub in the next day or so and then be in the December release (presumably 0.4.2, but we will see what the version is).
Merge pull request #38736 from ixdy/build-tools-rename-back
Support adding packages with BUILD.bazel filenames
Merge pull request #38736 from ixdy/build-tools-rename-back
chore: Rename BUILD files to BUILD.bazel
Merge pull request kubernetes#38736 from ixdy/build-tools-rename-back