This repo is dead.
Please see https://github.com/facebook/buck2 for the build system that replaces it.
Old content continues below for historical purposes.
Buck is a build tool. To see what Buck can do for you, check out the documentation at http://buck.build/.
Since Buck is used to build Buck, the initial build process involves 2 phases:
git clone --depth 1 https://github.com/facebook/buck.git
cd buck
ant
You must be using Java 8 or 11 for this to compile successfully. If you see compilation errors from ant, check your JAVA_HOME
is pointing at one of these versions.
./bin/buck build --show-output buck
# output will contain something like
# //programs:buck buck-out/gen/programs/buck.pex
buck-out/gen/programs/buck.pex --help
Pre-built binaries of buck for any buck sha
can be downloaded from https://jitpack.io/com/github/facebook/buck/<sha>/buck-<sha>.pex
. The very first time a version of buck is requested, it is built via jitpack. As a result, it could take a few minutes for this initial binary to become available. Every subsequent request will just serve the built artifact directly. This functionality is available for any fork of buck as well, so you can fetch https://jitpack.io/com/github/<github-user-or-org>/buck/<sha>/buck-<sha>.pex
For buck binaries built for JDK 11, modify end of the url to buck-<sha>-java11.pex
.
Buck tries to move fast with respect to its internals. However, for user facing features (build rules, command line interface, etc), the Buck team tries to have a graceful deprecation process. Note that this generally applies only to documented functionality, or functionality that is less documented, but appears to be in wide use. That process is:
- An issue is opened on Github suggesting what will be deprecated, and when it will be removed. For larger features that are deprecated, there may be a period when the default is the new setting, and the old behavior may only be used with a configuration change.
- In-progress deprecation issues are tagged with 'announcement' and 'deprecation'
- A change is submitted to Buck that puts the old behavior behind a configuration flag and sets the default to the old behavior. These flags can be found at https://buck.build/concept/buckconfig.html#incompatible.
- For larger features, a change eventually is put in place that sets the default to the new behavior. e.g. when Skylark becomes the default build file parser.
- When the removal date is reached, a change is submitted to remove the feature. At this point, the configuration value will still parse, but will not be used by Buck internally.
Apache License 2.0
buck's People
Forkers
cqr dweekly amsantos jordwalke rajeshvv morristech skyisle xuzhuo2012 gandharva xiaomaguoguo eyecatchup alriddoch binaryecho corelchen dennispriess trisix hecao jtraver stsbd elhachimi vikeu mykul aprajapati luxin6 kuguobing frankswu aulanov nouhi yangzx554 pschorf mohankrishna dpursehouse sxhao willknott denizt tenet1ai johngummadi yunshan wfxiang08 wt khalidelsayed georgepapas highgic saper sebrioth ahmedgad xblackmilk josephilipraja alonewolf inazaruk tanaer inzaghi2012 legneato imtech moehrenblitz shs96c overthink bolinfest ankurgarg101 leohchen sunly bingwei amokrane justin312 adrgit khairu mread jasongithub ankitbaderiya stepinto oztc simpleton scholarpallavi gonzojive distrotech rowillia tsuri licong oikmar baixiao xintao222 jacobjennings denniswahome yhtsnda is00hcw qiusean pawandubey jnshilang guoyingshou davcamer jxuin newcomerbh huaci marktseng illicitonion angelcold atsoi liccowee kchodorow midnightradiobuck's Issues
One BUCK is file is enough for one project ???
Hi All,
I am using buck tool for my project.
According to buck guides, Each and every package needs a BUCK file.
I want to build my project with single BUCK file. Is it possible..
FYI : I have more than 10 packages in my project , which are circular dependent,
Please let me know at the earliest.
Thanks,
Mallikarjuna
Jython has slowed down no-op incrementals
On a moderately complex project (45 BUCK and defs files, 2230 lines of definition "code") the introduction of Jython in 5759315 has added over 3.5 seconds of latency to a no-op build of a moderately complicated target.
master
$ time buck build gerrit-gwtui:ui_chrome
real 0m7.474s
user 0m14.332s
sys 0m0.710s
with 5759315 reverted:
$ time buck build gerrit-gwtui:ui_chrome
real 0m3.769s
user 0m4.236s
sys 0m0.735s
Not shelling out is nice, but startup time seems to have been very negatively impacted.
Help With Quick Start / Opening project in Intellij
Getting stuck trying to open the quick start project with Intellij
I am able to build the quick start project with buck build
then generate the project files with buck project
Then I open that project in Intellij and expect to be able to compile the project, but there are multiple problems.
-
project sdk is not set, I have set it to android 4.2.2
-
project output direct is not set, I have set it to /project/root/build
-
I try to build and get
Android Source Generator: [module_res_com_example_activity] AndroidManifest.xml file not found
not sure how to fix that one, I am doing something wrong with the buck files? or what setup do i need to do with Intellij? Adding that to the quick start would be awesome
Buck build failure
---- Just to have a clean start this morning, I threw away my "buck" directory and started again with:
git clone [email protected]:facebook/buck.git
cd buck
ant
---- Following is the result:
Buildfile: /Users/jeromegarcia/bin/buck/build.xml
compile-testrunner:
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/build/testrunner/classes
[javac] Compiling 3 source files to /Users/jeromegarcia/bin/buck/build/testrunner/classes
compile:
init.work.dirs:
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/dist
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/release
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/temp
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/tools/classes
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/classes
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/srcgen
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/res
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/ant/classes
init:
[echo] ANT version: Apache Ant(TM) version 1.8.2 compiled on June 20 2012
[echo] JDK version: 1.6
[echo] build debug flag: on
-timestamp.1:
-timestamp.2:
[echo] build id: 2.0.14823 (unsupported private build)
-timestamp.2a:
-timestamp.3:
build.cvs.ready:
-timestamp.4:
-timestamp.5:
[copy] Copying 1 file to /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/srcgen
[copy] Copying 1 file to /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/temp
timestamp:
-pre-compile:
core.bootstrap.compile:
[javac] Compiling 2 source files to /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/classes
core.java14.compile:
[javac] Compiling 1 source file to /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/classes
core.java13.compile:
[javac] Compiling 1 source file to /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/classes
core.compile:
[javac] Compiling 165 source files to /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/core/classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
tools.compile:
[javac] Compiling 1 source file to /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/tools/classes
[javac] Note: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/tools/java/com/vladium/tools/ClassDep.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
compile:
rtclosure.gen:
core.package:
[jar] Building jar: /Users/jeromegarcia/bin/buck/third-party/java/emma-2.0.5312/out/emma-2.0.5312.jar
[mkdir] Created dir: /Users/jeromegarcia/bin/buck/build/classes
[javac] Compiling 282 source files to /Users/jeromegarcia/bin/buck/build/classes
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:25: package java.nio.file does not exist
[javac] import java.nio.file.FileVisitor;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:26: package java.nio.file does not exist
[javac] import java.nio.file.LinkOption;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:27: package java.nio.file does not exist
[javac] import java.nio.file.Path;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:80: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystem
[javac] public void walkFileTree(Path root, FileVisitor fileVisitor) throws IOException {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:80: cannot find symbol
[javac] symbol : class FileVisitor
[javac] location: class com.facebook.buck.util.ProjectFilesystem
[javac] public void walkFileTree(Path root, FileVisitor fileVisitor) throws IOException {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:80: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystem
[javac] public void walkFileTree(Path root, FileVisitor fileVisitor) throws IOException {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:87: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystem
[javac] public boolean isDirectory(Path child, LinkOption linkOption) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:87: cannot find symbol
[javac] symbol : class LinkOption
[javac] location: class com.facebook.buck.util.ProjectFilesystem
[javac] public boolean isDirectory(Path child, LinkOption linkOption) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/cli/BuildCommand.java:45: package java.nio.file does not exist
[javac] import java.nio.file.FileSystems;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/cli/BuildCommand.java:46: package java.nio.file does not exist
[javac] import java.nio.file.Path;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/cli/BuildCommand.java:47: package java.nio.file does not exist
[javac] import java.nio.file.WatchEvent;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:25: package java.nio.file does not exist
[javac] import java.nio.file.FileVisitResult;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:26: package java.nio.file does not exist
[javac] import java.nio.file.LinkOption;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:27: package java.nio.file does not exist
[javac] import java.nio.file.Path;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:28: package java.nio.file does not exist
[javac] import java.nio.file.SimpleFileVisitor;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:29: package java.nio.file does not exist
[javac] import java.nio.file.StandardWatchEventKinds;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:30: package java.nio.file does not exist
[javac] import java.nio.file.WatchEvent;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:31: package java.nio.file does not exist
[javac] import java.nio.file.WatchKey;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:32: package java.nio.file does not exist
[javac] import java.nio.file.WatchService;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:33: package java.nio.file.attribute does not exist
[javac] import java.nio.file.attribute.BasicFileAttributes;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/cli/BuildCommand.java:236: cannot find symbol
[javac] symbol : class WatchEvent
[javac] location: class com.facebook.buck.cli.BuildCommand
[javac] public void onFileSystemChange(WatchEvent event) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:43: cannot find symbol
[javac] symbol : class WatchService
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] private final WatchService watchService; // TODO(user): use intellij file watching?
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:44: cannot find symbol
[javac] symbol : class WatchKey
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] private final Map keys;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:44: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] private final Map keys;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:52: cannot find symbol
[javac] symbol : class WatchService
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] WatchService watchService) throws IOException {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:62: cannot find symbol
[javac] symbol : class WatchEvent
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] public boolean isPathChangeEvent(WatchEvent event) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:100: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] private boolean shouldIgnore(Path path) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:113: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] private void register(Path dir) throws IOException {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:125: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] private void registerAll(final Path start) throws IOException {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:81: package java.nio.file does not exist
[javac] java.nio.file.Files.walkFileTree(root, fileVisitor);
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystem.java:88: package java.nio.file does not exist
[javac] return java.nio.file.Files.isDirectory(child, linkOption);
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/cli/BuildCommand.java:121: cannot find symbol
[javac] symbol : variable FileSystems
[javac] location: class com.facebook.buck.cli.BuildCommand
[javac] FileSystems.getDefault().newWatchService());
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/cli/BuildCommand.java:240: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.cli.BuildCommand
[javac] Path path = (Path) event.context();
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/cli/BuildCommand.java:240: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.cli.BuildCommand
[javac] Path path = (Path) event.context();
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:58: cannot find symbol
[javac] symbol : method toPath()
[javac] location: class java.io.File
[javac] registerAll(filesystem.getProjectRoot().toPath());
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:63: cannot find symbol
[javac] symbol : variable StandardWatchEventKinds
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] return event.kind() == StandardWatchEventKinds.ENTRY_CREATE ||
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:64: cannot find symbol
[javac] symbol : variable StandardWatchEventKinds
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] event.kind() == StandardWatchEventKinds.ENTRY_MODIFY ||
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:65: cannot find symbol
[javac] symbol : variable StandardWatchEventKinds
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] event.kind() == StandardWatchEventKinds.ENTRY_CREATE;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:70: cannot find symbol
[javac] symbol : class WatchKey
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] WatchKey key;
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:72: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] Path dir = keys.get(key);
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:76: cannot find symbol
[javac] symbol : class WatchEvent
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] for (WatchEvent<?> event : key.pollEvents()) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:78: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] Path name = (Path) event.context();
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:78: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] Path name = (Path) event.context();
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:79: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] Path child = dir.resolve(name);
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:83: cannot find symbol
[javac] symbol : variable LinkOption
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] if (filesystem.isDirectory(child, LinkOption.NOFOLLOW_LINKS)) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:84: cannot find symbol
[javac] symbol : variable StandardWatchEventKinds
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] if (event.kind() == StandardWatchEventKinds.ENTRY_CREATE) {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:101: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] Path normalizedPath = path.normalize();
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:114: cannot find symbol
[javac] symbol : class WatchKey
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] WatchKey key = dir.register(watchService,
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:115: cannot find symbol
[javac] symbol : variable StandardWatchEventKinds
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] StandardWatchEventKinds.ENTRY_CREATE,
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:116: cannot find symbol
[javac] symbol : variable StandardWatchEventKinds
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] StandardWatchEventKinds.ENTRY_DELETE,
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:117: cannot find symbol
[javac] symbol : variable StandardWatchEventKinds
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] StandardWatchEventKinds.ENTRY_MODIFY);
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:126: cannot find symbol
[javac] symbol : class SimpleFileVisitor
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] filesystem.walkFileTree(start, new SimpleFileVisitor() {
[javac] ^
[javac] /Users/jeromegarcia/bin/buck/src/com/facebook/buck/util/ProjectFilesystemWatcher.java:126: cannot find symbol
[javac] symbol : class Path
[javac] location: class com.facebook.buck.util.ProjectFilesystemWatcher
[javac] filesystem.walkFileTree(start, new SimpleFileVisitor() {
[javac] ^
[javac] 53 errors
BUILD FAILED
/Users/jeromegarcia/bin/buck/build.xml:95: Compile failed; see the compiler error output for details.
Quick Start: Make More Readable Code Listings
The commands in this guide are designed to be copy-pasteable, idempotent, and usable on both Mac OS X and Linux.
While the first and third of those are laudable, your approach suffers from a fatal flaw: lack of readability. Documentation is useless if it cannot be understood.
Your examples:
- Assume the reader is good at shell scripting, which will not be the case for every relevant Android developer
- Assume the reader doesn't get confused by unnecessary departures from the norm, such as the use of single-quoted XML attributes to allow the
echo
commands to work
I strongly encourage you to switch to more conventional documentation styles, so that your documentation is not an impediment to your objectives in releasing the project.
genrule() should use set -e to detect failure
This should not succeed:
echo 'genrule(name="fail",cmd="false;echo >&2 hi",srcs=[],deps=[],out="fail")' >BUCK
buck build :fail
.buckconfig documentation mentions buck-out
http://facebook.github.io/buck/concept/buckconfig.html mentions buck-out in the buckd ignore section. But it seems buck now writes buck-bin and buck-gen instead.
How to include external jars to build file
Hi All,
I am trying to use buck build tool for my android project.
I am using java_library() rule, which throws lot of compilation errors related to import, like package com.google.* does not exists
How to fix this ???
Can you please let me know...
Thanks,
Mallikarjuna
Buck won't build: Ant requiring JDK7 but already installed
checkversion fails, but JDK7 and 8 have both been installed.
Update: JAVA_HOME was pointing to Java 6. Changing that to point to Java 8 fixed the issue.
java_test() should use TMP under buck-out
Tests should be given a temporary directory similar to how genrules() inherit a TMP directory. This way tests can write temporary files without polluting /tmp.
buck-android should be under buck-out
The buck-android/ directory should be buck-out/android/.
compiler warnings
I have started looking at the code with Eclipse. I am seeing a bunch of resources that are not closed. Since the code appears to be Java 7, I am using try-with-statements to fix it. Is this reasonable?
I will push a commit that includes all these changes so that you can check it out.
Problem with Quick Start: Keystore
I'm having problems with Quick Start, when I try to build the APK I get this:
Renzos-Mac-mini:my-first-buck-project renzocrisostomo$ buck build //apps/myapp:app
Exception in thread "pool-2-thread-1" com.facebook.buck.util.HumanReadableException: Unable to parse build file:
Traceback (most recent call last):
File "<script>", line 6, in <module>
File "/Users/renzocrisostomo/Documents/buck/src/com/facebook/buck/parser/buck.py", line 666, in main
execfile(os.path.join(project_root, build_file), build_env['BUILD_FILE_SYMBOL_TABLE'])
File "/Users/renzocrisostomo/my-first-buck-project/././apps/myapp/BUCK", line 1, in <module>
android_binary(
TypeError: android_binary() got an unexpected keyword argument 'keystore'
,
at com.facebook.buck.json.ProjectBuildFileParser$BuildFileRunner.run(ProjectBuildFileParser.java:124)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
BUILD FAILED: No rule found when resolving target //apps/myapp:app in build file //apps/myapp/BUCK
missing dep on genrule() claims its a buck bug
I know I should have listed ':bin' in the deps of the genrule(). If I happen to forget, but says its an internal buck bug.
echo '
java_library(name="lib", srcs=["Hello.java"])
java_binary(name="bin", deps=[":lib"], main_class="Hello")
genrule(
name="hi",
cmd="${:bin}>$OUT",
srcs=[],
deps=[],
out="hi.txt",
)'>BUCK
echo '
public class Hello {
public static void main(String[] a) {
System.out.println("Hi");
}
}'>Hello.java
ANDROID_SDK=/tmp buck build :hi
BUILDING //:hi
java.util.concurrent.ExecutionException: java.lang.RuntimeException: No dep named //:bin in ${:bin}>$OUT
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306)
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
at com.facebook.buck.cli.BuildCommand.executeBuildAndPrintAnyFailuresToConsole(BuildCommand.java:140)
,,,
BUILD FAILED: Unexpected internal error (this is probably a buck bug).
Cannot run aapt
I followed the directions for the code sample in Buck Quick Start and everything went well until I ran "buck install //apps/myapp:app" for which the result was:
FP143:my-first-buck-project jeromegarcia$ buck install //apps/myapp:app
BUILDING //apps/myapp:app
java.io.IOException: Cannot run program "/Users/jeromegarcia/android-sdk-macosx/build-tools/17.0.0/aapt" (in directory "."): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
at com.facebook.buck.shell.ShellStep.execute(ShellStep.java:138)
at com.facebook.buck.step.DefaultStepRunner.runStepInternal(DefaultStepRunner.java:79)
at com.facebook.buck.step.DefaultStepRunner.runStepForBuildTarget(DefaultStepRunner.java:68)
at com.facebook.buck.rules.AbstractCachingBuildRule$3.call(AbstractCachingBuildRule.java:434)
at com.facebook.buck.rules.AbstractCachingBuildRule$3.call(AbstractCachingBuildRule.java:421)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 10 more
BUILD FAILED: //apps/myapp:app failed on step "aapt package -J buck-out/bin/apps/myapp/app_uber_rdotjava_src" with exit code 1
I tried various approaches such as creating symbolic links to my Android platform-tools directory which contains aapt, adb, etc. to even copying the entire contents of the platform-tools directory into a "../build-tools/17.0.0" directory I created but they all failed. Has someone else encountered this problem and found a solution?
Thanks,
Jerome E. Garcia
buck test -e no longer means exclude
In c14981b Simon changed -e to mean --emulator instead of --exclude. This was a surprising behavior change. :-(
Allow Buck to run without Android SDK
Add a new option to .buckconfig that indicates the project does not need the Android SDK. Disabling the Android SDK check allows Buck to run for normal Java projects that only need java_library(), java_binary(), and prebuilt_jar().
java_library: provide a way to specify non transitive dependencies
When building a plugin (P) for an existing system (S) which exposes an API in form of library (A) the following idiom is used:
P depends on A but java_binary P must not contain the content of A.
That's because P is deployed in S and all artifacts from A are obviously exist.
Currently it is not possible to express that idiom with Buck's native java_library.
Sugestion: extend java_library with new parameter: compiled_deps.
Alternatively provide a new finction java_library2 that exposes that parameter.
Working use case: java_library2()
that exposes compile_deps parameter in:
https://github.com/davido/gerrit-reviewers-plugin/blob/master/lib/build.defs
To see the difference between call to java_library2 and java_library try to replace it on line 61: in gerrit_plugin()
definition:
java_library(
name = name + '__plugin',
srcs = srcs,
resources = resources,
deps = deps + ['//:%s-lib' % type],
)
With the outcome that reviewers.jar would contain the whole gerrit-plugin-api.jar and not only 4 classes it adds.
Buck website makes unnecessary apologies about ABI fingerprinting.
Under "What Makes Buck so Fast?" -> "A Java rule computes its ABI when it is built".
JLS ABI compatibility is to make sure your ".class" files will still work with a newer version of some library as long as that library remains ABI compatible. That's useful, but that's not what you want for a build tool.
If you add a method to some class in a library, that could cause Java builds to fail, for example, if the name conflicts with a method in a subclass. If Buck only checked JLS ABI compatibility, it could produce incorrect output. It would say "nothing to do" when in fact it should be showing you a compile error because your build is broken -- doing a clean build would yield a compile error.
Very few API changes can guarantee no effect on code that uses it. Even adding a new class can cause name conflicts if someone is doing wildcard import.
What Buck is doing might be simply be termed "checking for visible API changes". I think it's worth updating the docs to make this clearer.
Unexpected internal error associated with src including subdirectory with .aidl file
While trying to build a project in which the src includes a subdirectory containing a .aidl file, I got the following exception which says that it is probably a buck bug. Changing the srcs definition to limit the subdirectory files to ipc/*.java gets rid of this problem but, of course, causes compilation errors. My BUCK file contents and directory tree from which I ran the "buck build" command follow the stack trace.
FP143:trunk jeromegarcia$ buck build //java/com/fullpower/app:app
No Android platform target specified. Using default: Google Inc.:Google APIs:16
BUILDING //java/com/fullpower/app:app
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: All compilation units must be of SOURCE kind
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306)
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
at com.facebook.buck.cli.BuildCommand.executeBuildAndPrintAnyFailuresToConsole(BuildCommand.java:181)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptionsWithTracerRunning(BuildCommand.java:161)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:98)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:55)
at com.facebook.buck.cli.AbstractCommandRunner.runCommand(AbstractCommandRunner.java:92)
at com.facebook.buck.cli.Command.execute(Command.java:72)
at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:93)
at com.facebook.buck.cli.Main.tryRunMainWithExitCode(Main.java:124)
at com.facebook.buck.cli.Main.main(Main.java:134)
Caused by: java.lang.IllegalArgumentException: All compilation units must be of SOURCE kind
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:183)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:68)
at com.facebook.buck.java.JavacInMemoryStep.buildWithClasspath(JavacInMemoryStep.java:139)
at com.facebook.buck.java.DependencyCheckingJavacStep.executeBuild(DependencyCheckingJavacStep.java:143)
at com.facebook.buck.java.JavacInMemoryStep.execute(JavacInMemoryStep.java:119)
at com.facebook.buck.step.DefaultStepRunner.runStepInternal(DefaultStepRunner.java:79)
at com.facebook.buck.step.DefaultStepRunner.runStepForBuildTarget(DefaultStepRunner.java:68)
at com.facebook.buck.rules.AbstractCachingBuildRule$3.call(AbstractCachingBuildRule.java:434)
at com.facebook.buck.rules.AbstractCachingBuildRule$3.call(AbstractCachingBuildRule.java:421)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
BUILD FAILED: Unexpected internal error (this is probably a buck bug).
The BUCK file contains:
FP143:app jeromegarcia$ cat BUCK
android_library(
name = 'app',
srcs = glob(['.java', 'ipc/.*']),
visibility = [ 'PUBLIC' ],
deps = [
'//res/com/fullpower/app:res',
],
)
project_config(
src_target = ':app',
)
The directory structure is:
FP143:trunk jeromegarcia$ pwd
/Users/jeromegarcia/experiments/buckExperiments/thewholething/trunk
FP143:trunk jeromegarcia$ tree
.
├── buck-bin
│ ├── build.log
│ ├── java
│ │ └── com
│ │ └── fullpower
│ │ ├── app
│ │ │ ├── app_rdotjava_bin
│ │ │ │ └── com
│ │ │ │ └── fullpower
│ │ │ │ └── app
│ │ │ │ ├── R$id.class
│ │ │ │ ├── R$layout.class
│ │ │ │ ├── R$string.class
│ │ │ │ └── R.class
│ │ │ ├── app_rdotjava_src
│ │ │ │ └── com.fullpower.app
│ │ │ │ └── R.java
│ │ │ └── lib__app__classes
│ │ └── support
│ │ └── lib__support__classes
│ │ └── com
│ │ └── fullpower
│ │ └── support
│ │ ├── ConsumerThread$1.class
│ │ ├── ConsumerThread$FlushNotification.class
│ │ ├── ConsumerThread.class
│ │ └── Queue.class
│ └── res
│ └── com
│ └── fullpower
│ └── app
│ └── res_text_symbols
│ ├── R.txt
│ └── com
│ └── fullpower
│ └── app
│ └── R.java
├── buck-gen
│ └── java
│ └── com
│ └── fullpower
│ └── support
│ └── lib__support__output
│ └── support.jar
├── java
│ └── com
│ └── fullpower
│ ├── app
│ │ ├── BUCK
│ │ ├── FPLogger.java
│ │ ├── Logger.java
│ │ └── ipc
│ │ ├── ILogger.aidl
│ │ ├── LoggerImpl.java
│ │ └── LoggerShim.java
│ └── support
│ ├── BUCK
│ ├── ConsumerThread.java
│ └── Queue.java
├── local.properties
└── res
└── com
└── fullpower
└── app
├── BUCK
└── res
├── layout
│ └── notes_dialog.xml
└── values
└── strings.xml
44 directories, 26 files
Invalid dep in another BUCK file produces NPE
$ buck build //:test
Exception in thread "main" java.lang.NullPointerException
at com.facebook.buck.parser.Parser$1.findChildren(Parser.java:159)
Reproduction case:
echo "java_library(
name = 'test',
srcs = [],
deps = ['//lib:not_found'],
)" >BUCK
mkdir lib
touch lib/BUCK
buck version 5c10d2d
Add versioning
deniz$ buck -V
buck version *562b76e65fa794e2ed19fc2949104f7278767022
Can we please have tags? I created a homebrew formula, however it's --HEAD only.
java.lang.NoSuchMethodError
Hi,
I'm using buck to build an Android app but since I fetch the latest version (8c4ed0f) from github and rebuild it with the ant
command, I'm getting this stacktrace when I exceute buck project
:
bash-3.2$ buck project
java.lang.NoSuchMethodError: com.facebook.buck.java.JavacOptions$Builder.setAnnotationProcessingData(Lcom/facebook/buck/model/AnnotationProcessingData;)Lcom/facebook/buck/java/JavacOptions$Builder;
at com.facebook.buck.android.AndroidLibraryRule$Builder.build(AndroidLibraryRule.java:117)
at com.facebook.buck.android.AndroidLibraryRule$Builder.build(AndroidLibraryRule.java:105)
at com.facebook.buck.rules.BuildRuleResolver.buildAndAddToIndex(BuildRuleResolver.java:63)
at com.facebook.buck.parser.Parser$2.onNodeExplored(Parser.java:356)
at com.facebook.buck.parser.Parser$2.onNodeExplored(Parser.java:322)
at com.facebook.buck.graph.AbstractAcyclicDepthFirstPostOrderTraversal.traverse(AbstractAcyclicDepthFirstPostOrderTraversal.java:95)
at com.facebook.buck.parser.Parser.findAllTransitiveDependencies(Parser.java:377)
at com.facebook.buck.parser.Parser.parseBuildFilesForTargets(Parser.java:294)
at com.facebook.buck.parser.PartialGraph.createPartialGraph(PartialGraph.java:79)
at com.facebook.buck.cli.ProjectCommand.createPartialGraph(ProjectCommand.java:153)
at com.facebook.buck.cli.ProjectCommand.runCommandWithOptionsInternal(ProjectCommand.java:70)
at com.facebook.buck.cli.ProjectCommand.runCommandWithOptionsInternal(ProjectCommand.java:39)
at com.facebook.buck.cli.AbstractCommandRunner.runCommandWithOptions(AbstractCommandRunner.java:115)
at com.facebook.buck.cli.AbstractCommandRunner.runCommand(AbstractCommandRunner.java:95)
at com.facebook.buck.cli.Command.execute(Command.java:98)
at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:346)
at com.facebook.buck.cli.Main.tryRunMainWithExitCode(Main.java:497)
at com.facebook.buck.cli.Main.main(Main.java:515)
I'm trying to build the sample project from the documenation and this error happens as well when I run buck build app
. Before I updated to this version of buck today, the old version (end of August) was working fine.
Any idea about how this can be fixed?
genrule() should support non-idempotent execution
I want to use this sort of idiom to embed the version into my binary:
genrule(
name = 'git_describe',
cmd = 'mkdir -p $(dirname $OUT); git describe HEAD >$OUT',
srcs = [],
out = 'resources/com/google/gerrit/common/Version',
)
However this requires BUCK to support an uncacheable genrule.
buck doesn't build for me
$ ant
OK.
Then:
$ ./bin/buck build buck
[+] PARSING BUILD FILES...1.4s
java.lang.IncompatibleClassChangeError: Expecting non-static method com.facebook.buck.cli.BuildCommandOptions.findAndroidSdkDir()Lcom/google/common/base/Optional;
at com.facebook.buck.cli.BuildCommandOptions.createBuild(BuildCommandOptions.java:148)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptionsInternal(BuildCommand.java:106)
at com.facebook.buck.cli.BuildCommand.runCommandWithOptionsInternal(BuildCommand.java:44)
at com.facebook.buck.cli.AbstractCommandRunner.runCommandWithOptions(AbstractCommandRunner.java:114)
at com.facebook.buck.cli.AbstractCommandRunner.runCommand(AbstractCommandRunner.java:94)
at com.facebook.buck.cli.Command.execute(Command.java:104)
at com.facebook.buck.cli.Main.runMainWithExitCode(Main.java:392)
at com.facebook.buck.cli.Main.tryRunMainWithExitCode(Main.java:571)
at com.facebook.buck.cli.Main.runMainThenExit(Main.java:588)
[-] PARSING BUILD FILES...FINISHED 1.4s
[+] BUILDING...0.1s
Created JAR at buck-out/... messages can be misleading
java_binary() maybe shouldn't print "Created ..." unless the binary was one of the targets named on the command line.
echo '
java_library(name="lib", srcs=["Hello.java"])
java_binary(name="bin", deps=[":lib"], main_class="Hello")
genrule(
name="hi",
cmd="${:bin}>$OUT",
srcs=[],
deps=[':bin'],
out="hi.txt",
)'>BUCK
echo '
public class Hello {
public static void main(String[] a) {
System.out.println("Hi");
}
}'>Hello.java
$ ANDROID_SDK=/tmp buck build :hi
BUILDING //:hi
Created JAR at buck-out/gen//bin.jar
BUILD SUCCESSFUL
I don't care that it created bin as a transient step towards the target I named, what I want to know is the name of the file I built. I would have preferred to see:
$ ANDROID_SDK=/tmp buck build :hi
BUILDING //:hi
Created buck-out/gen//hi.txt
BUILD SUCCESSFUL
This is somewhat annoying for the Gerrit build where we construct a WAR file as the final artifact by way of a genrule(), but had to make 3 or 4 java_binary() targets on the way there as commands to be executed by intermediate genrule(). So Buck prints out messages that its created a few compilers, and nothing else.
version tagging for Debian packaging
Hello,
The Wikimedia Foundation is packaging Google Gerrit which recently switched to use the Buck packaging tool. https://github.com/azatoth is working on packaging Buck for Debian and we could use version tags in the Buck repository.
Adding version tags would let the Debian tool detects a new version is available and thus easily let us update the package :-)
Generating BuildConfig.java function is missing
After ADT r17, it generate BuildConfig.java which contains a static final boolean DEBUG flag. Many android libraries and app uses BuildConfig.DEBUG to determine current build mode.
Same issue was occurred in maven land.
https://code.google.com/p/maven-android-plugin/issues/detail?id=275
How do you best target multiple platforms using buck?
Our current Ant based system is capable of targeting both Android and J2SE. Is there a best approach toward accomplishing this capability using Buck?
specify minTarget for android_library
It'd be nice to be able to specify the minimum target API needed to build an android_library (in addition to the target already specified on android_binary).
Example: right now, my code builds fine if build via an android_binary (which specifies a target version). However, my build fails when trying to use the android_library target directly, since I use code not available in the default target API.
Specifying a min target on libraries would let the library be re-used by all binaries that meet that API version (i.e., where the library code would actually compile). It also properly allows building the library by itself to do basic compile tests.
Add LICENSE
Hard to tell what Buck is licensed under.
No Android platform target specified. Using default: Google Inc.:Google APIs:18
Hi All,
I am trying to use buck tool to build my android project, but i am getting the following error
I am new to buck, so please help me.......
No Android platform target specified. Using default: Google Inc.:Google APIs:18
invalid resource directory name: res/layout-hdpi/pulse_new_poll.xml
invalid resource directory name: res/layout-hdpi/poll_option.xml
invalid resource directory name: res/layout-hdpi/new_post.xml
BUILD FAILED: //res:layout-hdpi failed on step "aapt_package" with exit code 1
invalid resource directory name: res/layout/new_post_wall_list.xml
invalid resource directory name: res/layout/group_view_item.xml
invalid resource directory name: res/layout/slide_menu.xml
invalid resource directory name: res/layout/video_loading_progress.xml
invalid resource directory name: res/layout/pulse_new_poll.xml
invalid resource directory name: res/layout/members_list.xml
invalid resource directory name: res/layout/display_message_layout.xml
invalid resource directory name: res/layout/link_view.xml
invalid resource directory name: res/layout/attachments_view_item.xml
invalid resource directory name: res/layout/notification_item.xml
invalid resource directory name: res/layout/pulse_no_connection.xml
invalid resource directory name: res/layout/groups_spinner_item.xml
invalid resource directory name: res/layout/imageviewer.xml
invalid resource directory name: res/layout/attachments_view.xml
invalid resource directory name: res/layout/poll_view_option.xml
invalid resource directory name: res/layout/writefeed_header.xml
invalid resource directory name: res/layout/login.xml
invalid resource directory name: res/layout/streamimages.xml
invalid resource directory name: res/layout/poll_option.xml
invalid resource directory name: res/layout/arc_menu.xml
invalid resource directory name: res/layout/temp.xml
invalid resource directory name: res/layout/user_profile_header.xml
invalid resource directory name: res/layout/members_list_item.xml
invalid resource directory name: res/layout/comment_footer.xml
invalid resource directory name: res/layout/stream.xml
invalid resource directory name: res/layout/groups_header.xml
invalid resource directory name: res/layout/loading_screen.xml
invalid resource directory name: res/layout/splash.xml
invalid resource directory name: res/layout/slide_menu_header.xml
invalid resource directory name: res/layout/comment_list_view.xml
invalid resource directory name: res/layout/new_feed_pop_up_window.xml
invalid resource directory name: res/layout/pulse_no_connection_bar.xml
invalid resource directory name: res/layout/image_list.xml
invalid resource directory name: res/layout/pulse_list.xml
invalid resource directory name: res/layout/new_post.xml
invalid resource directory name: res/layout/custom_webview.xml
invalid resource directory name: res/layout/slide_menu_item.xml
invalid resource directory name: res/layout/galleryitem.xml
invalid resource directory name: res/layout/pulse_list_item.xml
invalid resource directory name: res/layout/comment_stream_list.xml
invalid resource directory name: res/layout-xhdpi/new_post.xml
Add missing option "--target eclipse" to Buck's project command
Let's face it: a big part of the Java community is using Eclipse IDE. Buck provides only native support for InteliJ IDE integration with project command:
buck project --target intellij
Gerrit's Buck based build implements Eclipse integration in eclipse.py script [1]. Find a way to integrate it or provide another way to generate .project & .classpath from BUCK build files to be able to import a project in Eclipse IDE:
buck project --target eclipse
[1] https://gerrit.googlesource.com/gerrit/+/master/tools/eclipse/project.py
Quick Start: Add Requirements Section
If you have built an Android application before, then you likely have all of the tools required by Buck installed on your computer already.
This assumes that all Android developers use git
, which is far from the case. Many may not even know what git
is.
Please take the time to at least link to the required software, if not simply list it again.
Supress error on .gitkeep warning from AAPT
We have some .gitkeep files in directories that would otherwise be empty.
aapt outputs the warning:
(skipping file '.gitkeep' due to ANDROID_AAPT_IGNORE pattern '.*')
Which buck dutifully shows as a warning.
It would be great if we could suppress these so as not to ruin the nice buck parallel output every time we build.
accessing java_library() output is messy
Producing the JAR for a java_library under lib__${name}__output/${name}.jar makes it very difficult to access this JAR from another rule. For example I have to use a genrule like this to make it easier to access the JAR, needing to use $SRCS to avoid duplicating the lib__query_lib__output/query_lib.jar part is even messier.
genrule(
name = 'query_link',
cmd = 'ln -s $SRCS $OUT',
srcs = [genfile('lib__query_lib__output/query_lib.jar')],
deps = [':query_lib'],
out = 'query_lib.jar',
)
Ideally the JAR is produced in the same namespace as the out file of a genrule(), making this rule entirely unnecessary.
buck build creates buck-{bin,gen} but buck clean does not delete them
I am trying to upgrade our build to f158d62 + my patches so we can start using buckd. In doing so I discovered outputs are now going to buck-gen rather than buck-out/gen. OK fine, but buck clean
should remove buck-gen.
genrule() documentation has incorrect example
The example for genrule() shows:
cmd = 'python $SRC_0 $SRC_1 > $OUT',
which does not work. $SRC_0 seems to be not implemented in BUCK. I suspect you meant:
cmd = 'python $SRCDIR/basic_to_full_manifest.py $SRCDIR/AndroidManifest.xml'
junit.TestResult does not support @RunWith(Parameterized.class)
java_test() rules should support running test methods whose class have been declared with @RunWith(Parameterized.class). In this case the test method should be invoked once for each permutation of the return from the @parameters annotated method.
Buck cannot handle paths with spaces
aylott in ~/Projects/Design Tools/foo
± |master ✓| → buck targets
Error: Could not find or load main class Tools.foo..buckd
`SuperConsoleEventBusListenerTest` fails because of OS decimal separator setting
I was running "ant test" under FreeBSD with LANG
set to pl_PL.UTF-8
(which has comma as the decimal separator), and this fails:
[junit] Testcase: testSimpleBuild took 0,008 sec
[junit] FAILED
[junit] expected:<...D FILES...FINISHED 0[.]4s
[junit] > but was:<...D FILES...FINISHED 0[,]4s
[junit] >
[junit] junit.framework.AssertionFailedError: expected:<...D FILES...FINISHED 0[.]4s
[junit] > but was:<...D FILES...FINISHED 0[,]4s
[junit] >
[junit] at com.facebook.buck.event.listener.SimpleConsoleEventBusListenerTest.testSimpleBuild(SimpleConsoleEventBusListenerTest.java:89)
[junit]
[junit] TEST com.facebook.buck.event.listener.SimpleConsoleEventBusListenerTest FAILED
[junit] Testsuite: com.facebook.buck.event.listener.SuperConsoleEventBusListenerTest
[junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0,022 sec
[junit]
[junit] Testcase: testSimpleBuild took 0,012 sec
[junit] FAILED
[junit] expected:<[[+] PARSING BUILD FILES...0.3s]> but was:<[[+] PARSING BUILD FILES...0,3s]>
[junit] junit.framework.AssertionFailedError: expected:<[[+] PARSING BUILD FILES...0.3s]> but was:<[[+] PARSING BUILD FILES...0,3s]>
[junit] at com.facebook.buck.event.listener.SuperConsoleEventBusListenerTest.validateConsole(SuperConsoleEventBusListenerTest.java:199)
[junit] at com.facebook.buck.event.listener.SuperConsoleEventBusListenerTest.testSimpleBuild(SuperConsoleEventBusListenerTest.java:85)
[junit]
[junit] TEST com.facebook.buck.event.listener.SuperConsoleEventBusListenerTest FAILED
Provide maven_jar() to fetch artifacts from Maven repository
Let's face it: to implement build process in Java eco system third party libraries must be fetched from the Maven repository. Even if we would replace the word Maven repository with Buck repository in the previous statement we still need a native support in Buck to do that.
Gerrit's Buck based build provides such a method [1]:
def maven_jar(
name,
id,
license,
exclude = [],
exclude_java_sources = False,
unsign = False,
deps = [],
sha1 = '', bin_sha1 = '', src_sha1 = '',
repository = MAVEN_CENTRAL,
attach_source = True,
export_deps = False,
visibility = ['PUBLIC']):
[...]
Which uses download_file.py backend script [2].
Here is another use case: tiny Gerrit plugin that can be built outside of the Gerrit tree with Buck, where the maven_jar()
in simplified form was implemented [3].
[1] https://gerrit.googlesource.com/gerrit/+/master/lib/maven.defs
[2] https://gerrit.googlesource.com/gerrit/+/master/tools/download_file.py
[3] https://gerrit-review.googlesource.com/51225
glob(['src/**']) crashes with ugly jython stack trace
$ echo 'java_library(name="foo",resources=glob(['src/']))' >BUCK
$ buck build :foo
Exception in thread "pool-1-thread-1" java.lang.RuntimeException: javax.script.ScriptException: SyntaxError: no viable alternative at input '' in /Users/sop/git/buck_bugs/././BUCK at line number 1 at column number 44
at com.google.common.base.Throwables.propagate(Throwables.java:160)
at com.facebook.buck.json.BuildFileToJsonParser$BuildFileRunner.run(BuildFileToJsonParser.java:189)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: javax.script.ScriptException: SyntaxError: no viable alternative at input '' in /Users/sop/git/buck_bugs/././BUCK at line number 1 at column number 44
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:190)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:42)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
at com.facebook.buck.json.BuildFileToJsonParser$BuildFileRunner.run(BuildFileToJsonParser.java:186)
... 3 more
Caused by: Traceback (most recent call last):
File "<script>", line 6, in
File "/Users/sop/git/buck/src/com/facebook/buck/parser/buck.py", line 669, in main
execfile(os.path.join(project_root, build_file), build_env['BUILD_FILE_SYMBOL_TABLE'])
File "/Users/sop/git/buck_bugs/././BUCK", line 1
java_library(name="foo",resources=glob([src/]))
^
SyntaxError: no viable alternative at input '**'
at org.python.core.PyException.fillInStackTrace(PyException.java:70)
at java.lang.Throwable.<init>(Throwable.java:181)
at java.lang.Exception.<init>(Exception.java:29)
at java.lang.RuntimeException.<init>(RuntimeException.java:32)
at org.python.core.PyException.<init>(PyException.java:46)
at org.python.core.PyException.<init>(PyException.java:43)
at org.python.core.PyException.<init>(PyException.java:39)
at org.python.core.PySyntaxError.<init>(PySyntaxError.java:22)
at org.python.core.ParserFacade.fixParseError(ParserFacade.java:92)
at org.python.core.ParserFacade.parse(ParserFacade.java:184)
at org.python.core.Py.compile_flags(Py.java:1731)
at org.python.core.__builtin__.execfile_flags(__builtin__.java:514)
at org.python.core.__builtin__.execfile(__builtin__.java:499)
at org.python.core.__builtin__.execfile(__builtin__.java:526)
at org.python.core.BuiltinFunctions.__call__(__builtin__.java:155)
at org.python.core.PyObject.__call__(PyObject.java:408)
at buck$py.main$35(/Users/sop/git/buck/src/com/facebook/buck/parser/buck.py:654)
at buck$py.call_function(/Users/sop/git/buck/src/com/facebook/buck/parser/buck.py)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
at org.python.core.PyFunction.__call__(PyFunction.java:307)
at org.python.pycode._pyx0.f$0(<script>:6)
at org.python.pycode._pyx0.call_function(<script>)
at org.python.core.PyTableCode.call(PyTableCode.java:165)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1275)
at org.python.core.__builtin__.eval(__builtin__.java:484)
at org.python.core.__builtin__.eval(__builtin__.java:488)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:198)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:40)
... 6 more
BUILD FAILED: No rule found when resolving target //:foo in build file //BUCK
incorrect names in genrule srcdir
buck version ef355b5
genrule(
name = 'ui_optdbg',
cmd = 'cd $TMP;' +
'unzip -q $SRCDIR/ui_dbg.zip;' +
'mv' +
' gerrit_ui/gerrit_ui.nocache.js' +
' gerrit_ui/gerrit_dbg.nocache.js;' +
'unzip -qo $SRCDIR/ui_opt.zip;' +
'mkdir -p $(dirname $OUT);' +
'zip -qr $OUT .',
srcs = [
genfile('ui_dbg.zip'),
genfile('ui_opt.zip'),
],
deps = [
':ui_dbg',
':ui_opt',
],
out = 'ui_optdbg.zip',
visibility = ['PUBLIC'],
)
$ buck build gerrit
BUILDING //:gerrit
unzip: cannot find or open /Users/sop/git/gerrit/./buck-out/gen/gerrit-gwtui/ui_optdbg__srcs/ui_dbg.zip, /Users/sop/git/gerrit/./buck-out/gen/gerrit-gwtui/ui_optdbg__srcs/ui_dbg.zip.zip or /Users/sop/git/gerrit/./buck-out/gen/gerrit-gwtui/ui_optdbg__srcs/ui_dbg.zip.ZIP.
BUILD FAILED: //gerrit-gwtui:ui_optdbg failed on step "genrule: cd $TMP;unzip -q $SRCDIR/ui_dbg.zip;mv gerrit_ui/gerrit_ui.nocache.js gerrit_ui/gerrit_dbg.nocache.js;unzip -qo
$ ls buck-out/gen/gerrit-gwtui/ui_optdbg__srcs/
buck-out
$ ls buck-out/gen/gerrit-gwtui/ui_optdbg__srcs/buck-out/gen/gerrit-gwtui/
ui_dbg.zip ui_opt.zip
This isn't correct. $SRCDIR should not reference names using buck-out/gen/...
genrule() sometimes creates incorrect $SRCDIR on Mac OS X
This sporadically fails on my Mac OS 10.8.3 system when the project directory is inside of a path named "Git":
$ mkdir -p Git/buck_test ; cd Git/buck_test ; git init
$ mkdir -p data/src/ ; touch data/src/foo
$ cat >data/BUCK
genrule(
name = 'test',
cmd = 'cd $SRCDIR/src; zip -qr $OUT .',
srcs = glob(['src/**/*']),
deps = [],
out = 'test.zip',
)
$ buck build data:test
Buck fails with a lowercase path appearing in the output:
$ buck build data:test
BUILDING //data:test
/bin/bash: line 0: cd: /Users/sop/git/buck_test/buck-out/gen/data/test__srcs/src: No such file or directory
BUILD FAILED: //data:test failed on step "genrule: cd $SRCDIR/src; zip -qr $OUT ." with exit code 1```
Looking at the gen tree the path within the project is repeated inside of $SRCDIR and should not have:
$ ls buck-out/gen/data/test__srcs/data/src/
foo
I can't consistently reproduce this failure, but once it happens, it happens continuously until I delete the directory and recreate it.
I suspect there is something wrong with the absolute path handling in Buck. If Buck samples the path as "/Users/sop/git/buck_test" and another function gives it "/Users/sop/Git/buck_test" obviously the prefix is not the same and Buck now is unable to generate the correct number of directories to process when writing $SRCDIR.
I wonder if there is something related to the difference in absolute and canonical path:
$ cat >Resolve.java <<EOF
public class Resolve {
public static void main(String[] argv) throws Exception {
System.out.println("abs = " + new java.io.File(argv[0]).getAbsolutePath());
System.out.println("can = " + new java.io.File(argv[0]).getCanonicalPath());
}}
EOF
$ javac Resolve.java
$ pwd
/Users/sop/Git/gerrit_next
$ java -cp . Resolve .
abs = /Users/sop/git/gerrit_next/.
can = /Users/sop/Git/gerrit_next
and the Mac OS process environment just manages to get itself confused.
java_library() breaks package path when resource is genfile()
Commit 2aa814b broke java_library() using a resource from genfile() when the BUCK file is not in the Java package path.
genrule(
name = 'gen',
cmd = 'mkdir -p $(dirname $OUT);echo foo>$OUT',
deps = [],
out = 'resources/com/example/foo.properties',
)
java_library(
name = 'lib',
resources = [genfile('resources/com/example/foo.properties')],
deps = [':gen'],
)
$ buck build :lib
$ jar tf buck-out/gen/lib__lib__output/lib.jar
foo.properties
META-INF/MANIFEST.MF
I expected to see com/example/foo.properties.
java_binary: input MANIFEST file is overridden with the MANIFEST content from dependent JARs
BUCK uses jar -cfm command to assemble the java_binary.
If the dependent JARs also contain MANIFEST.MF file then jar command mess up the content from input MANIFEST.MF and dependent JARs MANIFEST.MF files.
See that change from Gerrit project for more details:
Buck doesn't work with Android Build Tools 22
Google just updated their buildtools and moved the locations of tools buck is looking for.
audit needs to provide path to dependency
audit input, classpath and owner don't let me see the path between a java_binary() and why a particular prebuilt_jar() is appearing in the classpath. The path data is necessary to track down the intermediate offending library and fix its deps statement (which may also require fixing code there, but whatever, that isn't buck's problem).
The problem I have right now is two different incompatible versions of the servlet-api appearing in a java_binary()'s classpath. This fails to package because which javax.servlet.Filter do you include? The one from the 2.5 specification or the one from the 3.0 specification? The developer should fix the library usages to be consistent, but they need to know where in the path to start looking.
Since multiple paths may exist to the same dependency, audit should try to print any paths as it can find, but an iterative approach would also be OK, e.g. fix one edge, re-run audit, fix another, etc.
src_roots only honored for resources within a package
echo '[java]
src_roots = resources' >.buckconfig
mkdir -p src/main/resources; echo msg=hi>src/main/resources/one.properties
mkdir src/main/resources/pkg; echo msg=hi>src/main/resources/pkg/two.properties
echo 'java_library(name='test', resources=glob(['src/main/resources/*/']))' >BUCK
buck build :test
$ jar tf buck-out/gen/lib__test__output/test.jar
pkg/two.properties
src/main/resources/one.properties
META-INF/MANIFEST.MF
I expected to have one.properties, not src/main/resources/one.properties in the output JAR.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.