+
+
+ Buck is a build tool. To see what Buck can do for you, check out the documentation at http://buck.build/. +
[](https://circleci.com/gh/facebook/buck) @@ -17,6 +21,8 @@ Since Buck is used to build Buck, the initial build process involves 2 phases: 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. + ##### 2. Use bootstrapped version of Buck to build Buck: ./bin/buck build --show-output buck @@ -28,6 +34,8 @@ Since Buck is used to build Buck, the initial build process involves 2 phases: Pre-built binaries of buck for any buck `sha` can be downloaded from `https://jitpack.io/com/github/facebook/buck/For more examples, check out our + href="https://github.com/facebook/buck/tree/master/test/com/facebook/buck/features/rust/testdata/"> integration tests.
{/template} diff --git a/docs/__table_of_contents.soy b/docs/__table_of_contents.soy index 80782e3d8da..596a441114a 100644 --- a/docs/__table_of_contents.soy +++ b/docs/__table_of_contents.soy @@ -253,6 +253,12 @@ {param page: 'visibility' /} {param text: 'Visibility' /} {/call} + {call navigation.link} + {param currentnavid: $navid /} + {param folder: 'concept' /} + {param page: 'flavors' /} + {param text: 'Flavors' /} + {/call} {call navigation.link} {param currentnavid: $navid /} {param folder: 'concept' /} diff --git a/docs/about/showcase.soy b/docs/about/showcase.soy index b6bac62a77c..5fc5c6c4d5e 100644 --- a/docs/about/showcase.soy +++ b/docs/about/showcase.soy @@ -267,6 +267,11 @@ {param imgSrc: 'https://lh5.ggpht.com/CfRup8ZMEbNpd4sf8PDUWzbnFIq0QINZpJ96M6V0-8wLmyqKD0ORSqPOq5EKdL1OskE=w100' /} {/call} + {call .item} + {param name: 'Easynvest' /} + {param imgSrc: 'https://theme.zdassets.com/theme_assets/1130385/0290357291ec4f3e2975f9b58183a608414fbf8d.png' /} + {/call} + {/param} {/call} diff --git a/docs/command/install.soy b/docs/command/install.soy index c3a5fe38e7e..373108cc9b1 100644 --- a/docs/command/install.soy +++ b/docs/command/install.soy @@ -151,7 +151,7 @@ Builds and installs the APK for anandroid_binary
or target.
{param name: 'simulator-name' /}
{param alias: 'n'/}
{param desc}
- Use simulator with specific name (defaults to iPhone 6s
)
+ Use simulator with specific name (defaults to iPhone 8
)
{/param}
{/call}
diff --git a/docs/concept/buckd.soy b/docs/concept/buckd.soy
index 2d505fd8bbc..7a9d7bff3b4 100644
--- a/docs/concept/buckd.soy
+++ b/docs/concept/buckd.soy
@@ -40,26 +40,26 @@ graph and action graph.
The Buck daemon writes its port, process id, and log output to files in
a .buckd
{sp} directory that the daemon creates in the
-project root directory. Subsequent Buck commands use these files to
+project root directory. Subsequent Buck commands use these files to
find the daemon process, and a new Buck daemon process will use
them to kill any already-existing daemon process.
It is safe to run multiple Buck daemons started from different project
-directories as they do not interfere with each other,
-making buckd
suitable for use in shared-server environments
+directories as they do not interfere with each other,
+making buckd
suitable for use in shared-server environments
or where several projects are being worked on concurrently.
While it runs, the Buck daemon process monitors the project's file
system and invalidates cached build rules if any build input files
-change. The Buck daemon excludes from monitoring any subtrees of the
+change. The Buck daemon excludes from monitoring any subtrees of the
project file system that are specified in
the {call buckconfig.project_ignore /} setting
-of .buckconfig
. By adding project-specific output
-directories and source-control directories, such as.git
, to
+of .buckconfig
. By adding project-specific output
+directories and source-control directories, such as.git
, to
this setting, you can significantly improve performance; this might be necessary
to avoid file-change overflows when using Buck daemons to build large
projects.
@@ -81,7 +81,7 @@ The Buck daemon process is killed if
-You can also kill the Buck daemon explicitly by
+You can also kill the Buck daemon explicitly by
running {call buck.cmd_kill /} in the directory tree for your project.
Note that if—for some reason—multiple instances of the
daemon are running, the buck kill
command kills only one of
@@ -95,7 +95,7 @@ restarts.
-To disable the daemon and prevent it from starting, set the environment
+To disable the daemon and prevent it from starting, set the environment
variable {sp}NO_BUCKD
to 1
. For example:
If you change Buck's configuration, it invalidates any cached state
-stored by the Buck daemon—unless that change is to
-a small subset of configuration settings that are whitelisted
+stored by the Buck daemon—unless that change is to
+a small subset of configuration settings that are supported
in AbstractConfigIgnoredByDaemon.java
.
{literal} -Invalidating internal cached state: -Buck configuration options changed between invocations. +Invalidating internal cached state: +Buck configuration options changed between invocations. This may cause slower builds. {/literal}
-Note that a Buck configuration change that invalidates the daemon's state can be
-caused not only by explicitly changing a setting in one of Buck's
-configuration files, such as .buckconfig
or .buckconfig.local
, but also by using
-the --config
, --flagfile
, or --config-file
{call buck.cmd_link}{param name: 'common_parameters' /}{param rendered_text: ' command-line parameters' /}{/call}.
+Note that a Buck configuration change that invalidates the daemon's state can be
+caused not only by explicitly changing a setting in one of Buck's
+configuration files, such as .buckconfig
or .buckconfig.local
, but also by using
+the --config
, --flagfile
, or --config-file
{call buck.cmd_link}{param name: 'common_parameters' /}{param rendered_text: ' command-line parameters' /}{/call}.
+Flavors in Buck are a way to specify different variations of a build that +otherwise share most configuration specifications. +
+ ++Flavors can also be used to simultaneously build for two different platforms, +such as iOS and watchOS. Being able to build for both of these at the same +time is important because iOS application can have a dependency on the Watch +application. +
+ ++Flavors fall into a number of different categories: +
++A flavor is specified as a suffix to a build target, with the hash mark (#) +used as a separator between the target and flavor. +Examples: +
+{literal} ++buck build :cxx_gr_name#default +buck build :cxx_gr_name#iphonesimulator-x86_64 ++{/literal} + +
+You can specify multiple flavors for a single target by separating the flavors +with commas: +
+{literal} ++buck build Libraries/3rdParty/openssl:ssl#android-armv7,static-pic +buck build Libraries/3rdParty/openssl:ssl#android-x86,static-pic +buck build :bundle#iphoneos-x86_64,strip-all,dwarf-and-dsym ++{/literal} + +
+NOTE: Buck supports
+a {call buck.concept_link}{param page: 'build_target_pattern' /}{param name: 'build target pattern' /}{/call},
+...
, as in, //apps/...
, that specifies that Buck
+should recurse through build files in subdirectories, building all build
+targets in any build files it finds. This build target pattern does not
+support specifying flavors.
+
+The cxx_library
and apple_library
rules support
+specifying default flavors, which pertain if a build target is
+specified 1) explicitly-that is, not using
+a {call buck.concept_link}{param page: 'build_target_pattern' /}{param name: 'build target pattern' /}{/call}
+-and 2) without a flavor.
+
+A flavor may also be specified as a suffix to an @file or --flagfile argument. +These flavors are used within the flagfile only and do not directly change +the target flavor. The separator is '#' as above, and if the separator and +flavor are present, the @file (aka flagfile) must end in ".py" and be a +Python script. The script will be called as follows: +
+ +{literal} ++python /path/to/flagfile.py --flavors+{/literal} + ++
+These flavors denote a toolchain to use for compiling. You can also use them to +control conditional fields in the Buck target's rule. +
+ +Flavor | +Meaning | +
---|---|
android-armv7 | +32-bit Android device | +
android-x86 | +32-bit Android emulator | +
iphoneos | ++ |
iphoneos-armv7 | +32-bit iPhone device | +
iphoneos-arm64 | +64-bit iPhone device | +
iphoneos-i386 | ++ |
iphoneos-x86_64 | ++ |
iphonesimulator | ++ |
iphonesimulator-i386 | +Simulator on 32-bit Mac | +
iphonesimulator-x86_64 | +Simulator on 64-bit Mac | +
macosx-x86_64 | +Native x86_64 OSX application | +
macosx-arm64 | +Native arm64 OSX application | +
windows-x86_64 | +Native Windows application | +
+Sighted in the wild: +
+ +{literal} ++buck build :main#android-arm64,shared ++{/literal} + +
+static ++{/literal} +
+Static library (.a) +
+ ++static-pic ++{/literal} +
+Static library that generates position-independent code (PIC). Note that on the Apple platforms, everything is PIC. +
+ ++A shared library (so) or dynamically-loaded module (.dylib on Mac, .dll on Windows). +
+ ++shared-interface ++{/literal} +
+A stub library that only lists the imports and exports of a shared library. +You can link against this library, but it doesn't have any executable code. +
+ ++no-linkermap ++{/literal} + +
+Specifying this flavor suppresses the generation of a LinkMap.txt file, +which is normally generated by the Apple linker (ld). +
+ ++check ++{/literal} + +
+The Rust compiler has a build mode which quickly checks syntax and type +correctness, but avoids codegen (which is the slowest phase of Rust +compilation). This flavor invokes check on the suffixed build target. +
+ +{literal} ++save-analysis ++{/literal} +
+The #save-analysis
flavor is an extension of #check. It performs
+the same actions as a #check build, but also emits a .json file containing
+full type/symbol cross-reference information, for consumption by tools like
+RLS (Rust Language Services).
+
+doc ++{/literal} + +
+The #doc
flavor is the equivalent of the cargo doc command. It
+uses the rustdoc tool to generate documentation for a target and its dependencies.
+
+If you specify one of these flavors, Buck generates analysis information about +your build. +
+{literal} ++compilation-database ++{/literal} + +
+Produces a JSON file that contains (an approximation of) the compiler commands +for compiling each file. The output is in +the +clang compilation database format. +
+ ++infer-analyze +infer-capture-all ++{/literal} + +
+These flavors run Facebook's Infer tool and +generate intermediate Infer output. +
+ ++These flavor control how symbols are stripped from an output binary. +
+ ++strip-debug ++{/literal} + +
+Strip debug symbols; equivalent to strip -S
.
+
+strip-non-global ++{/literal} + +
+Strip debug and non-external symbols; equivalent to strip -x
.
+
+strip-all ++{/literal} +
+Strip all the things; equivalent to strip with no arguments. +
+ ++These flavors are used with C++ header files, in the deps or exported_deps +attributes of a Buck target. +
+ ++private-headers ++{/literal} +
+Symlink tree, or header map, of headers used for compiling a library's own files. +
+ ++headers ++{/literal} + +
+Symlink tree, or header map, of headers used to compile files for other +libraries that depend on this library. +
+ ++Selects the actual binary used to represent a {call buck.cxx_binary /}. +
+ ++no-debug ++{/literal} + +
+Selects the stripped binary +
+ ++dwarf ++{/literal} + +
+Selects the unstripped binary +
+ ++dwarf-and-dsym ++{/literal} + +
+Selects the unstripped binary, and the dsym file. +
+ ++apple-debuggable-binary ++{/literal} + +
+Could be stripped and unstripped, depending on requirements. +
+ ++These flavors are legacy methods of creating app and framework bundles. +
++You should not use these. +
++Instead of these flavors, we now use the Buck rule, {call buck.apple_bundle /} +
+ ++app +binary#app ++{/literal} + +
+Generates an app bundle. +
+ ++framework +library#framework ++{/literal} + +
+Generates a framework. +
+ + {/param} + {/call} +{/template} diff --git a/docs/concept/visibility.soy b/docs/concept/visibility.soy index 35b1a1e1561..362ef8ba7bf 100644 --- a/docs/concept/visibility.soy +++ b/docs/concept/visibility.soy @@ -44,7 +44,7 @@ targets a target can depend on.
-Both attributes act as whitelists, with some exceptions. In general, if a target
+Both attributes act as allowlists, with some exceptions. In general, if a target
is not listed, there may be no dependency relationship. If
the within_view
list is empty or unset, however, its check is
bypassed. Similarly, targets defined in the same build file always act as if
diff --git a/docs/files-and-dirs/buckconfig.soy b/docs/files-and-dirs/buckconfig.soy
index 29ed31f9581..85a3eaa044f 100644
--- a/docs/files-and-dirs/buckconfig.soy
+++ b/docs/files-and-dirs/buckconfig.soy
@@ -592,6 +592,7 @@ $ buck targets --resolve-alias app#src_jar
ANDROID_SDK
ANDROID_SDK_ROOT
ANDROID_HOME
Platform: | ++ Android + MacOS + Linux + | +
Development OS: | ++ macOS + Linux + | +
Language: | ++ Java + Kotlin + Rust + | +
@@ -54,11 +83,10 @@ sudo ln -s ${PWD}/bin/buckd /usr/bin/buckd {/literal} -
- We are going to build a sample Android application. We should start our project in an empty directory, so create a new one and navigate to it: + We are going to build a sample application. We should start our project in an empty directory, so create a new one and navigate to it:
{literal}@@ -74,14 +102,16 @@ cd ~/my-first-buck-project/{/literal}Compile Your Code
+- Android applications are typically written in Java, so the first thing we will do is configure Buck to compile Java code against the Android API. To do so, Buck needs to know where your Android SDK is. Assuming that your Android SDK is installed in
{literal}~/android-sdk
, run the following command to set aANDROID_SDK
environment variable that tells Buck where to find your Android SDK: + Android applications are typically written in Java and kotlin, so the first thing we will do is to configure Buck to compile code against the Android API. To do so, Buck needs to know where your Android SDK is. Assuming that your Android SDK is installed in~/android-sdk
, run the following command to set aANDROID_SDK
environment variable that tells Buck where to find your Android SDK:export ANDROID_SDK=$HOME/android-sdk{/literal} +Now that Buck can locate your Android SDK, it is time to compile some Java code. First, we create a simple
@@ -126,6 +156,124 @@ echo "android_library( +Activity
atjava/com/example/activity/MyFirstActivity.java
:+ + Now that Buck can locate your Android SDK, it is time to compile some kotlin code. First, we create a simple
+ +{literal}Activity
atkotlin/com/example/activity/MyFirstActivity.kt
: ++mkdir -p kotlin/com/example/activity/ +echo "package com.example.activity + +import android.app.Activity +import android.os.Bundle + +class MyFirstActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + } +}" > kotlin/com/example/activity/MyFirstActivity.kt +{/literal} + ++ Now we need a build file that defines a build rule to compile this kotlin code, so we create an
+ +{literal}android_library()
rule inkotlin/com/example/activity/BUCK
: ++echo "android_library( + name = 'activity', + srcs = glob(['*.kt']), + language = "KOTLIN", + visibility = [ 'PUBLIC' ], +)" > kotlin/com/example/activity/BUCK +{/literal} + ++ Now we can compile our Java code using Buck: +
+ +buck build{sp}//kotlin/com/example/activity:activity+ ++
+ Buck generates its output in the+ + +buck-out
directory, so this is a good time to specifybuck-out
as something that should be ignored by your version control system. ++ + First, we create rust source files and directories: +
+{literal}+mkdir -p src/front_of_house +echo "mod front_of_house; + +pub use crate::front_of_house::hosting; +pub use crate::front_of_house::serving; + +fn main() { + hosting::add_to_waitlist(); + hosting::seat_at_table(); + serving::take_order(); + serving::serve_order(); + serving::take_payment(); +}" > src/main.rs + +echo "pub mod hosting; +pub mod serving;" > src/front_of_house.rs + +echo "pub fn add_to_waitlist() { + println!(\"Added to watinglist.\"); +} + +pub fn seat_at_table() { + println!(\"Seated at table.\"); +}" > src/front_of_house/hosting.rs + +echo "pub fn take_order() { + println!(\"Ordered.\"); +} + +pub fn serve_order() { + println!(\"Order served.\"); +} + +pub fn take_payment() { + println!(\"Payment done.\"); +}" > src/front_of_house/serving.rs +{/literal} + ++ Now we need a build file that defines a build rule to compile this rust code, so we create an
rust_binary()
rule inBUCK
: +{literal}+echo "rust_binary( + name = 'restaurant', + srcs = glob( + ['src/**/*.rs'], + ), +)" >BUCK +{/literal} + + ++Now we can build our rust code using Buck: +
+ +buck build{sp}:restaurant+ ++And run the sample: +
+buck run{sp}:restaurant+ ++
+ Buck generates its output in the+ + +buck-out
directory, so this is a good time to specifybuck-out
as something that should be ignored by your version control system. +Package Resources
@@ -229,8 +377,8 @@ echo "android_binary( manifest_entries = { 'version_code': 1, 'version_name': '1.0', - 'min_sdk_version': 16, - 'target_sdk_version': 23 + 'min_sdk_version': 26, + 'target_sdk_version': 29 }, keystore = ':debug_keystore', deps = [ @@ -279,6 +427,7 @@ echo "[alias]
buck install app+Create an IntelliJ Project
@@ -324,4 +473,100 @@ echo "/.buckd {/param} {/call} + +{literal} + +{/literal} + {/template} diff --git a/docs/publish.sh b/docs/publish.sh index 56d1fd460ad..7e5a01c8641 100755 --- a/docs/publish.sh +++ b/docs/publish.sh @@ -38,6 +38,8 @@ EOF exit 1 } +GIT_USER="buck-bot" +CNAME="buck.build" START_SOYWEB=0 KEEP_FILES=0 SOYWEB_PID=0 @@ -83,14 +85,14 @@ echo "Documentation working directory is ${STATIC_FILES_DIR}" # Create a clean checkout of the gh-pages branch with no data: if [ -z "$1" ] then - git clone git@github.com:facebook/buck.git $STATIC_FILES_DIR + git clone https://${GIT_USER}:${GITHUB_TOKEN}@github.com/facebook/buck.git $STATIC_FILES_DIR else cp -r "$1" $STATIC_FILES_DIR fi cd $STATIC_FILES_DIR # May need to do this if you are creating gh-pages for the first time. -git checkout master +git checkout main git checkout --orphan gh-pages git rm -rf . @@ -101,6 +103,8 @@ cd - # Commit the new version of the docs: cd $STATIC_FILES_DIR +echo "${CNAME}" > CNAME +git config --global user.name "${GIT_USER}" git add . git commit -m "Updated HTML documentation." diff --git a/docs/rule/android_library.soy b/docs/rule/android_library.soy index 012c1df4eb0..d52313ed03a 100644 --- a/docs/rule/android_library.soy +++ b/docs/rule/android_library.soy @@ -163,7 +163,7 @@ compiled class files and resources. {/call} {call buck.arg} - {param name: 'extra_kotlinc_arguments' /} + {param name: 'free_compiler_args' /} {param default : '[]' /} {param desc} List of additional arguments to pass into the Kotlin compiler. diff --git a/docs/rule/kotlin_library.soy b/docs/rule/kotlin_library.soy index 674da84802f..396e2006a5e 100644 --- a/docs/rule/kotlin_library.soy +++ b/docs/rule/kotlin_library.soy @@ -72,8 +72,8 @@ the
resources
argument. Kotlin compiler plugins to use when compiling this library. This takes a list of source paths, each of which will be prefixed with-Xplugin=
and passed as extra arguments to the compiler. - Unlikeextra_kotlinc_arguments
, these can be source paths, - not just strings (thoughextra_kotlinc_arguments
should be used + Unlikefree_compiler_args
, these can be source paths, + not just strings (thoughfree_compiler_args
should be used to specify plugin compiler options with-P
).For example, if you want to use{sp} @@ -115,10 +115,109 @@ remote_file( {/call} {call buck.arg} - {param name: 'extra_kotlinc_arguments' /} + {param name: 'free_compiler_args' /} {param default: '[]' /} {param desc} - List of additional arguments to pass into the Kotlin compiler. + A list of additional compiler arguments. + {/param} +{/call} + +{call buck.arg} + {param name: 'all_warnings_as_errors' /} + {param default: 'false' /} + {param desc} + Report an error if there are any warnings. + {/param} +{/call} + +{call buck.arg} + {param name: 'suppress_warnings' /} + {param default: 'false' /} + {param desc} + Generate no warnings. + {/param} +{/call} + +{call buck.arg} + {param name: 'verbose' /} + {param default: 'false' /} + {param desc} + Enable verbose logging output. + {/param} +{/call} + +{call buck.arg} + {param name: 'include_runtime' /} + {param default: 'false' /} + {param desc} + Include Kotlin runtime in to resulting .jar + {/param} +{/call} + +{call buck.arg} + {param name: 'jvm_target' /} + {param default: '1.6' /} + {param desc} + Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6 + Possible values: "1.6", "1.8" + {/param} +{/call} + +{call buck.arg} + {param name: 'jdk_home' /} + {param default: 'None' /} + {param desc} + Path to JDK home directory to include into classpath, if differs from default JAVA_HOME + {/param} +{/call} + +{call buck.arg} + {param name: 'no_jdk' /} + {param default: 'false' /} + {param desc} + Don't include Java runtime into classpath. + {/param} +{/call} + +{call buck.arg} + {param name: 'no_stdlib' /} + {param default: 'true' /} + {param desc} + Don't include kotlin-stdlib.jar or kotlin-reflect.jar into classpath. + {/param} +{/call} + +{call buck.arg} + {param name: 'no_reflect' /} + {param default: 'true' /} + {param desc} + Don't include kotlin-reflect.jar into classpath. + {/param} +{/call} + +{call buck.arg} + {param name: 'java_parameters' /} + {param default: 'false' /} + {param desc} + Generate metadata for Java 1.8 reflection on method parameters. + {/param} +{/call} + +{call buck.arg} + {param name: 'api_version' /} + {param default: 'None' /} + {param desc} + Allow to use declarations only from the specified version of bundled libraries. + Possible values: "1.0", "1.1", "1.2", "1.3", "1.4 (EXPERIMENTAL)". + {/param} +{/call} + +{call buck.arg} + {param name: 'language_version' /} + {param default: 'None' /} + {param desc} + Provide source compatibility with specified language version. + Possible values: "1.0", "1.1", "1.2", "1.3", "1.4 (EXPERIMENTAL)". {/param} {/call} diff --git a/docs/rule/robolectric_test.soy b/docs/rule/robolectric_test.soy index b31dad439a6..cb8972a2f8e 100644 --- a/docs/rule/robolectric_test.soy +++ b/docs/rule/robolectric_test.soy @@ -69,7 +69,7 @@ with Robolectric test runner. It extends from
java_test()
rule. {call test_common.contacts_arg /} {call buck.arg} - {param name: 'extra_kotlinc_arguments' /} + {param name: 'free_compiler_args' /} {param default : '[]' /} {param desc} List of additional arguments to pass into the Kotlin compiler. diff --git a/docs/setup/getting_started.soy b/docs/setup/getting_started.soy index edf13122f05..987b3fefed0 100644 --- a/docs/setup/getting_started.soy +++ b/docs/setup/getting_started.soy @@ -302,10 +302,9 @@ xcode-select --install # Download and Install Java SE 8 from: +# https://www.oracle.com/technetwork/java/javase/downloads/index.html. +# This installs the JDK 8, a superset of the JRE. -+# Alternatively, install AdoptOpenJDK 8 with Homebrew Cask: -+brew tap homebrew/cask-cask -+brew tap homebrew/cask-versions -+brew cask install homebrew/cask-versions/adoptopenjdk8 ++# Alternatively, install AdoptOpenJDK 8 with Homebrew: ++brew tap AdoptOpenJDK/openjdk ++brew install --cask adoptopenjdk8
ANDROID_HOME
environment variable
ANDROID_SDK_ROOT
environment variable
+ .buckconfig
.
@@ -779,6 +781,7 @@ $ env | grep ANDROID_
ANDROID_HOME=<path-to-sdk>
ANDROID_NDK_REPOSITORY=<path-to-ndk>
ANDROID_SDK=<path-to-sdk>
+ANDROID_SDK_ROOT=<path-to-sdk>
{/literal}
diff --git a/docs/soy2html.py b/docs/soy2html.py
index 369eeb7f4c6..89e54f4f85c 100644
--- a/docs/soy2html.py
+++ b/docs/soy2html.py
@@ -57,7 +57,7 @@ def main(output_dir):
):
# Copy the static resource to output_dir.
relative_path = os.path.join(root, file_name)
- with open(relative_path) as resource_file:
+ with open(relative_path, "rb") as resource_file:
resource = resource_file.read()
copy_to_output_dir(relative_path, output_dir, resource)
@@ -74,7 +74,7 @@ def ensure_dir(path, output_dir):
def copy_to_output_dir(path, output_dir, content):
output_file = ensure_dir(path, output_dir)
- with open(output_file, "w") as f:
+ with open(output_file, "wb") as f:
f.write(content)
@@ -88,7 +88,6 @@ def pollForServerReady():
time.sleep(1)
print("Server failed to start after %s seconds." % SERVER_START_POLL)
-
if __name__ == "__main__":
output_dir = sys.argv[1]
pollForServerReady()
diff --git a/docs/static/buck.css b/docs/static/buck.css
index ca6b46247f8..8da24a38a8c 100644
--- a/docs/static/buck.css
+++ b/docs/static/buck.css
@@ -552,7 +552,17 @@ footer {
.display-platform-ios .toggler .button-ios,
.display-platform-android .toggler .button-android,
.display-platform-other .toggler .button-other,
-.display-platform-java .toggler .button-java {
+.display-platform-java .toggler .button-java,
+.disp-os-mac .toggler .button-mac,
+.disp-os-linux .toggler .button-linux,
+.disp-os-windows .toggler .button-windows,
+.disp-platform-ios .toggler .button-ios,
+.disp-platform-android .toggler .button-android,
+.disp-platform-macos .toggler .button-macos,
+.disp-platform-linuxos .toggler .button-linuxos,
+.disp-language-java .toggler .button-java,
+.disp-language-kotlin .toggler .button-kotlin,
+.disp-language-rust .toggler .button-rust {
background-color: #05A5D1;
color: white;
}
@@ -561,6 +571,12 @@ block {
display: none;
}
+.disp-platform-android.disp-os-mac.disp-language-java .android.mac.java,
+.disp-platform-android.disp-os-linux.disp-language-java .android.linux.java,
+.disp-platform-android.disp-os-mac.disp-language-kotlin .android.mac.kotlin,
+.disp-platform-android.disp-os-linux.disp-language-kotlin .android.linux.kotlin,
+.disp-platform-macos.disp-os-mac.disp-language-rust .macos.mac.rust,
+.disp-platform-linuxos.disp-os-linux.disp-language-rust .linuxos.linux.rust,
.display-platform-ios.display-os-mac .ios.mac,
.display-platform-ios.display-os-linux .ios.linux,
.display-platform-ios.display-os-windows .ios.windows,
@@ -576,3 +592,16 @@ block {
display: block;
}
+/* Social Banner */
+.socialBanner {
+ font-weight: bold;
+ font-size: 20px;
+ padding: 20px;
+ max-width: 768px;
+ margin: 0 auto;
+ text-align: center;
+}
+
+.socialBanner a {
+ text-decoration: underline;
+}
diff --git a/jitpack.yml b/jitpack.yml
index 13525b7c399..880cce4a4cf 100644
--- a/jitpack.yml
+++ b/jitpack.yml
@@ -1,10 +1,15 @@
install:
- set -exo pipefail
- mkdir python_tmp
- - wget https://github.com/kageiit/jitpack-python/releases/download/2.7/python-2.7.tar.gz -O python_tmp/python.tar.gz
- - tar -C python_tmp -xf python_tmp/python.tar.gz --strip-components=1
+ - wget https://github.com/kageiit/jitpack-python/releases/download/3.8/python-3.8-ubuntu-16.tar.gz -O python_tmp/python.tar.gz
+ - tar -C python_tmp -xf python_tmp/python.tar.gz
- export PATH="$PATH:python_tmp/bin"
- ant
- PEX=$(bin/buck build buck --show-output | awk '{print $2}')
- SHA=$(git rev-parse HEAD)
- mvn install:install-file -Dfile="$PEX" -DgroupId="$GROUP" -DartifactId="$ARTIFACT" -Dversion="$SHA" -Dpackaging="pex" -DgeneratePom=true
+ - export JAVA_HOME="/usr/lib/jvm/jdk-11"
+ - export PATH="/usr/lib/jvm/jdk-11:$PATH"
+ - ant clean && ant
+ - JAVA11_PEX=$(bin/buck build --config java.target_level=11 --config java.source_level=11 buck --show-output | awk '{print $2}')
+ - mvn install:install-file -Dfile="$JAVA11_PEX" -DgroupId="$GROUP" -DartifactId="$ARTIFACT" -Dversion="$SHA" -Dclassifier="java11" -Dpackaging="pex" -DgeneratePom=true
diff --git a/programs/classpaths b/programs/classpaths
index 8ab03688bdd..029e0bf8055 100644
--- a/programs/classpaths
+++ b/programs/classpaths
@@ -59,20 +59,20 @@ third-party/java/jackson/jackson-datatype-jdk8-2.9.7.jar
third-party/java/jackson/jackson-module-kotlin-2.9.9.jar
third-party/java/jdom/jdom-2.0.6.jar
third-party/java/jetty/jetty-all-9.4.9.v20180320-uber.jar
-third-party/java/jna/jna-4.5.1.jar
-third-party/java/jna/jna-platform-4.5.1.jar
+third-party/java/jna/jna-5.6.0.jar
+third-party/java/jna/jna-platform-5.6.0.jar
third-party/java/jopt-simple/jopt-simple-4.6.jar
third-party/java/json-simple/json-simple-1.1.1.jar
third-party/java/jsr/javax.inject-1.jar
third-party/java/jsr/jsr305.jar
third-party/java/kxml2/kxml2-2.3.0.jar
-third-party/java/nailgun/nailgun-server-1.0.0.jar
-third-party/java/nuprocess/nuprocess-1.2.4.jar
-third-party/java/ObjCBridge/ObjCBridge.jar
+third-party/java/nailgun/nailgun-server-1.0.1.jar
+third-party/java/nuprocess/nuprocess-2.0.1.jar
+third-party/java/ObjCBridge/java-objc-bridge-1.1-SNAPSHOT.jar
third-party/java/objenesis/objenesis-1.2.jar
third-party/java/okhttp/okhttp-3.9.0.jar
third-party/java/okio/okio-1.13.0.jar
-third-party/java/oshi/oshi-core-3.3-SNAPSHOT.jar
+third-party/java/oshi/oshi-core-5.2.5.jar
third-party/java/opencensus/opencensus-api-0.24.0.jar
third-party/java/opencensus/opencensus-contrib-grpc-metrics-0.24.0.jar
third-party/java/pf4j/pf4j-2.0.0-SNAPSHOT.jar
diff --git a/programs/gen_buck_info.py b/programs/gen_buck_info.py
index 747a07b957b..1eecb7bcd46 100644
--- a/programs/gen_buck_info.py
+++ b/programs/gen_buck_info.py
@@ -29,9 +29,16 @@
def main(argv):
parser = argparse.ArgumentParser()
- parser.add_argument("--release-version", help="The buck release version")
parser.add_argument(
- "--release-timestamp", help="The unix timestamp when the release happened"
+ "--release-version",
+ nargs = "?",
+ default = None,
+ help="The buck release version")
+ parser.add_argument(
+ "--release-timestamp",
+ nargs = "?",
+ default = None,
+ help="The unix timestamp when the release happened"
)
parser.add_argument(
"--java-version",
@@ -52,7 +59,7 @@ def main(argv):
candidate_paths = []
vcs_module = None
while vcs_module is None and os.path.dirname(path) != path:
- while not os.path.exists(os.path.join(path, ".buckconfig")):
+ while not os.path.exists(os.path.join(path, ".buckconfig")) and os.path.dirname(path) != path:
path = os.path.dirname(path)
for vcs_dir, module in SUPPORTED_VCS.items():
if os.path.exists(os.path.join(path, vcs_dir)):
diff --git a/python-dsl/buck_parser/buck.py b/python-dsl/buck_parser/buck.py
index c9c56767534..a7ce468f5f1 100644
--- a/python-dsl/buck_parser/buck.py
+++ b/python-dsl/buck_parser/buck.py
@@ -303,7 +303,7 @@ def invoke(self, *args, **kwargs):
# Optimistically hope that name is the first arg. It generally is...
name = args[0]
raise IncorrectArgumentsException(
- self.func.func_name, name, missing_args, extra_args
+ self.func.__name__, name, missing_args, extra_args
)
raise
@@ -2262,14 +2262,14 @@ def main():
configs = {}
if options.config is not None:
- with open(options.config, "rb") as f:
+ with open(options.config, "r") as f:
for section, contents in iteritems(json.load(f)):
for field, value in iteritems(contents):
configs[(section, field)] = value
ignore_paths = []
if options.ignore_paths is not None:
- with open(options.ignore_paths, "rb") as f:
+ with open(options.ignore_paths, "r") as f:
ignore_paths = [make_glob(i) for i in json.load(f)]
build_file_processor = BuildFileProcessor(
diff --git a/python-dsl/buck_parser/module_whitelist.py b/python-dsl/buck_parser/module_whitelist.py
index 1c9c1f7d7af..ac032202b11 100644
--- a/python-dsl/buck_parser/module_whitelist.py
+++ b/python-dsl/buck_parser/module_whitelist.py
@@ -75,7 +75,12 @@ def _custom_import(self, name, globals=None, locals=None, fromlist=(), level=-1)
name = name.split(".")[0]
frame = util.get_caller_frame(skip=[__name__])
+ # __import__() can be called during the call to inspect.getframeinfo() and that should
+ # be handled by the ORIGINAL_IMPORT
+ current_import = builtins.__import__
+ builtins.__import__ = ORIGINAL_IMPORT
filename = inspect.getframeinfo(frame).filename
+ builtins.__import__ = current_import
# The import will be always allowed if it was not called from a project file.
if name in self._import_whitelist or not self._path_predicate(filename):
diff --git a/scripts/slice_trace.py b/scripts/slice_trace.py
index fcd2343b346..e1ffc925ed8 100644
--- a/scripts/slice_trace.py
+++ b/scripts/slice_trace.py
@@ -16,8 +16,6 @@
import argparse
import codecs
-import collections
-import json
import math
import os
diff --git a/src/com/facebook/buck/android/AndroidApkBuildable.java b/src/com/facebook/buck/android/AndroidApkBuildable.java
new file mode 100644
index 00000000000..c1432eb4c24
--- /dev/null
+++ b/src/com/facebook/buck/android/AndroidApkBuildable.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.facebook.buck.android;
+
+import com.facebook.buck.android.apkmodule.APKModule;
+import com.facebook.buck.android.exopackage.ExopackageMode;
+import com.facebook.buck.android.toolchain.AndroidSdkLocation;
+import com.facebook.buck.core.model.BuildTarget;
+import com.facebook.buck.core.sourcepath.SourcePath;
+import com.facebook.buck.core.sourcepath.resolver.SourcePathResolverAdapter;
+import com.facebook.buck.core.toolchain.tool.Tool;
+import com.facebook.buck.io.filesystem.ProjectFilesystem;
+import com.facebook.buck.step.Step;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSortedSet;
+import java.nio.file.Path;
+import java.util.EnumSet;
+import java.util.Optional;
+import java.util.function.Supplier;
+
+/**
+ * The class is responsible to create unoptimized apk through {@link ApkBuilderStep}.
+ */
+public class AndroidApkBuildable extends AndroidBinaryBuildable {
+
+ AndroidApkBuildable(
+ BuildTarget buildTarget,
+ ProjectFilesystem filesystem,
+ AndroidSdkLocation androidSdkLocation,
+ SourcePath keystorePath,
+ SourcePath keystorePropertiesPath,
+ EnumSetIf nothing is specified in {@code .buckconfig} the default order is: {@code ANDROID_SDK},
- * {@code ANDROID_HOME}, {@code
- * android_binary(
+ * android_bundle(
* name = 'messenger',
* manifest = 'AndroidManifest.xml',
* deps = [
@@ -75,6 +77,26 @@
* ],
* )
*
+ *
+ * Configuration for dynamic feature (enable use_split_dex, use_dynamic_feature and application_module_configs flags) :
+ * A new configuration application_modules_with_manifest is defined to decouple the manifest behaviour from the resources. This approach is aligned with dynamic features heuristics where base manifest has complete information of the feature manifest
+ *
+ * android_bundle(
+ * name = 'messenger',
+ * manifest = 'AndroidManifest.xml',
+ * deps = [
+ * '//src/com/facebook/messenger:messenger_library',
+ * ],
+ * use_split_dex = True,
+ * use_dynamic_feature = True,
+ * application_module_configs = {
+ * "feature1":['//feature1:module_root'],
+ * },
+ * application_modules_with_manifest = [
+ * "feature1",
+ * ]
+ * )
+ *
*/
public class AndroidBundle extends AbstractBuildRule
implements SupportsInputBasedRuleKey,
@@ -107,6 +129,7 @@ public class AndroidBundle extends AbstractBuildRule
private final BuildRuleParams buildRuleParams;
@AddToRuleKey private final AndroidBinaryBuildable buildable;
+ @AddToRuleKey private final AndroidBinaryOptimizer optimizer;
// TODO(cjhopman): What's the difference between shouldProguard and skipProguard?
AndroidBundle(
@@ -141,7 +164,8 @@ public class AndroidBundle extends AbstractBuildRule
ResourceFilesInfo resourceFilesInfo,
ImmutableSortedSet> blacklistedModules;
@AddToRuleKey private final Set
> blacklistedModules,
Set