Coder Social home page Coder Social logo

facebook / buck Goto Github PK

View Code? Open in Web Editor NEW
8.4K 315.0 1.2K 1.93 GB

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.

Home Page: https://buck.build

License: Apache License 2.0

Shell 0.11% PowerShell 0.01% Python 2.06% Java 90.52% Makefile 0.01% C 0.67% HTML 0.01% CSS 0.15% JavaScript 2.50% Batchfile 0.01% Smalltalk 0.01% Thrift 0.05% Kotlin 0.07% Lex 0.04% Dockerfile 0.01% Starlark 3.79%
build-tool java python android ios buck

buck's People

Contributors

aiked avatar alisdair04 avatar andrewjcg avatar asp2insp avatar bhamiltoncx avatar bobyangyf avatar bolinfest avatar carljparker avatar cjhopman avatar dreiss avatar illicitonion avatar ilya-klyuchnikov avatar jkeljo avatar jtorkkola avatar k21 avatar milend avatar mkosiba avatar mzlee avatar nataliejameson avatar natthu avatar plamenko avatar rajyengi avatar ruibm avatar sbalabanov-zz avatar sdwilsh avatar shivanker avatar shs96c avatar stepancheg avatar ttsugriy avatar yiding avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buck's Issues

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.

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

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'

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.

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

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.

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

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.

Add LICENSE

Hard to tell what Buck is licensed under.

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

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๐Ÿ’ฏ 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.

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.

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.

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.

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.

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().

Add versioning

deniz$ buck -V
buck version *562b76e65fa794e2ed19fc2949104f7278767022

Can we please have tags? I created a homebrew formula, however it's --HEAD only.

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

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.

  1. project sdk is not set, I have set it to android 4.2.2

  2. project output direct is not set, I have set it to /project/root/build

  3. 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

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.

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

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 :-)

`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

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

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).

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?

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

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

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.

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

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.

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

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.

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.

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.

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 $SRCDIR/ui_opt.zip;mkdir -p $(dirname $OUT);zip -qr $OUT ." with exit code 9

$ 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/...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.