Giter Site home page Giter Site logo

bazelbuild / examples Goto Github PK

View Code? Open in Web Editor NEW
779.0 779.0 496.0 1.98 MB

Examples for Bazel

Home Page: http://bazel.build

License: Apache License 2.0

Python 1.85% Shell 0.09% Java 4.05% C++ 2.51% HTML 1.02% Batchfile 0.15% Starlark 72.46% C 0.09% Kotlin 1.62% JavaScript 2.12% TypeScript 4.27% CSS 2.76% Vue 7.03%
bazel examples

examples's People

Contributors

ahumesky avatar aiuto avatar alexeagle avatar aranguyen avatar bencodes avatar brandjon avatar brentleyjones avatar c-parsons avatar comius avatar crackcomm avatar damienmg avatar dependabot[bot] avatar dslomov avatar gregestren avatar hanwen avatar jin avatar juliexxia avatar katre avatar kchodorow avatar keith avatar laszlocsomor avatar laurentlb avatar lberki avatar limdor avatar meteorcloudy avatar renovate-bot avatar tualeron avatar vladmos avatar vorburger avatar wyverald 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

examples's Issues

Does not work anylonger

With your files:

bazel build //backend:backend
ERROR: /home//projects/bazel_examples_source/tutorial/backend/BUILD:14:1: every rule of type appengine
_war implicitly depends upon the target '@commons-lang//jar:jar', but this target could not be found because of: no
such package '@commons-lang//jar': error loading package 'external': The repository named 'commons-lang' could not
be resolved.
ERROR: Loading failed; build aborted.

Following the instructions of the tutorial:

bazel build //backend:backend
ERROR: /home//projects/bazel_examples_source/tutorial/WORKSPACE:12:1: appengine-java is not a legal workspace name.
ERROR: /home//projects/bazel_examples_source/tutorial/WORKSPACE:34:1: commons-lang is not a legal workspace name.
ERROR: /home//projects/bazel_examples_source/tutorial/WORKSPACE:39:1: javax-servlet-api is not a legal workspace name.
ERROR: Error evaluating WORKSPACE file.
ERROR: no such package 'external': Package 'external' contains errors.

Add example for cc_library 'toolchains' option to use a different compiler

Hi, I am working on compiling a c++ and cuda project with bazel. In the project, there is a ".cu" file that I want to compile with nvcc to get a .so library, and everything else will be compiled with g++. The g++ binary code can be linked with the library compiled by nvcc.

I found that there is a 'toolchains' option in cc_library I thought I might be able to use the option to let bazel compile the ".cu" file with nvcc.
I am not sure this is the right way to use the 'toolchains' option,
but I did not find any example use case of this option. Can anyone provide one 'cc_library' example that uses the 'toolchains' option?

Thanks.

Doesn't build with bazel 0.20

bazel build:

ERROR: error loading package '': Encountered error while reading extension file 'apple/repositories.bzl': no such package '@build_bazel_rules_apple//apple': The native http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
ERROR: error loading package '': Encountered error while reading extension file 'apple/repositories.bzl': no such package '@build_bazel_rules_apple//apple': The native http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.

bazel build --incompatible_remove_native_http_archive=false:

ERROR: /private/var/tmp/_bazel_tmc/6fae10d35be6ef34e45529ed9cd414f2/external/io_bazel_rules_appengine/appengine/BUILD:27:1: @io_bazel_rules_appengine//appengine:jdk7: no such attribute 'encoding' in 'java_toolchain' rule
ERROR: /Users/tmc/go/src/github.com/bazelbuild/examples/tutorial/backend/BUILD:21:1: Target '@io_bazel_rules_appengine//appengine:javax.servlet.api' contains an error and its package is in error and referenced by '//backend:app'

Deprecated ctx.outputs.executable used in rules/test_rule

In line_length.bzl:

ctx.actions.write(
    output = ctx.outputs.executable,
    content = script,
)

Notice that ctx.outputs.executable default field is used, and the documentation states this is deprecated:

(Deprecated) If the rule is marked executable or test, there is a field named "executable", which is the default executable. It is recommended that instead of using this, you pass another file (either predeclared or not) to the executable arg of DefaultInfo.

Flag --incompatible_load_java_rules_from_bzl will break Bazel Examples in Bazel 1.2.1

Incompatible flag --incompatible_load_java_rules_from_bzl will break Bazel Examples once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Flag --incompatible_no_implicit_file_export will break Bazel Examples in Bazel 1.2.1

Incompatible flag --incompatible_no_implicit_file_export will break Bazel Examples once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Why adding a line of load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") ?

I am new to Bazel and I am going thru the tutorial.

I see that almost all BUILD files added a line of load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library"). I wonder what is the reason?

Build will fail with this line added but succeed without this line. Bazel version # is 0.26.0.

It seems to me that the BUILD file will explicitly load the rule_cc, is this required by newer version of Bazel?

Cannot build end-to-end example with Bazel 2.0.0

At 84f2980 with Bazel 2.0.0 on Linux, I cannot bazel build --nobuild //backend (in tutorial/).

Log:
https://buildkite.com/bazel/bazel-bazel-examples/builds/311#481754ba-b78b-43b2-abef-f0865ce85b29

Local repro:

INFO: Repository 'remote_java_tools_linux' used the following cache hits instead of downloading the corresponding file.
 * Hash '3ff465e82954a70f49982610dd63f6f651beaa83c707dd637870b0e41cdcd2f0' for https://mirror.bazel.build/bazel_java_tools/releases/javac11/v7.0/java_tools_javac11_linux-v7.0.zip
If the definition of 'remote_java_tools_linux' was updated, verify that the hashes were also updated.
ERROR: /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/io_bazel_rules_appengine/appengine/BUILD:2:1: @io_bazel_rules_appengine//appengine:javax.servlet.api depends on @javax_servlet_api//jar:jar in repository @javax_servlet_api which failed to fetch. no such package '@javax_servlet_api//jar': java.io.IOException: Error downloading [http://central.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar] to /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/javax_servlet_api/javax.servlet-api-3.1.0.jar: GET returned 501 HTTPS Required
ERROR: Analysis of target '//backend:backend' failed; build aborted: no such package '@javax_servlet_api//jar': java.io.IOException: Error downloading [http://central.maven.org/maven2/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar] to /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/javax_servlet_api/javax.servlet-api-3.1.0.jar: GET returned 501 HTTPS Required

Other Bazel CI projects also broke with similar errors. Culprit is, Maven repository no longer supports "http" fetches. Example fix in another repo: bazelbuild/codelabs#30

Hey

I can't wait

Android NDK example is not building on Windows

See https://buildkite.com/bazel/bazel-bazel-examples/builds/8#2bad9c2a-6d02-452e-a068-2aaafd62bac7


ERROR: D:/b/bk-windows-java8-sd54/bazel/bazel-bazel-examples/android/ndk/app/src/main/BUILD.bazel:16:1: Couldn't build file app/src/main/_objs/jni_lib/native-lib.o: undeclared inclusion(s) in rule '//app/src/main:jni_lib':
--
  | this rule is missing dependency declarations for the following files included by 'app/src/main/cpp/native-lib.cpp':
  | 'D:/b/4siup6ez/execroot/__main__/external/androidndk/ndk/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/5.0.300080/include/stdarg.h'
  | 'D:/b/4siup6ez/execroot/__main__/external/androidndk/ndk/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/5.0.300080/include/stddef.h'
  | 'D:/b/4siup6ez/execroot/__main__/external/androidndk/ndk/toolchains/llvm/prebuilt/windows-x86_64/lib64/clang/5.0.300080/include/float.h'
  | Target //app/src/main:app failed to build


emit_size() rule in rules/shell_command/rules.bzl fails on macOS

https://buildkite.com/bazel/bazel-bazel-examples/builds/54#d3ab95d6-7c36-473b-a4ea-935ccd30e105

(02:04:43) ERROR: /Users/buildkite/builds/bk-imacpro-13/bazel/bazel-bazel-examples/rules/shell_command/BUILD:10:1: Couldn't build file shell_command/foo.size: error executing shell command: '/bin/bash -c stat -L -c%s 'shell_command/foo.txt' > 'bazel-out/darwin-fastbuild/bin/shell_command/foo.size'' failed (Exit 1) bash failed: error executing command
--
  | (cd /private/var/tmp/_bazel_buildkite/498b38e3f668fa53ddf838edc27b273f/sandbox/darwin-sandbox/7/execroot/__main__ && \
  | exec env - \
  | /bin/bash -c 'stat -L -c%s '\''shell_command/foo.txt'\'' > '\''bazel-out/darwin-fastbuild/bin/shell_command/foo.size'\''')
  | Execution platform: @bazel_tools//platforms:host_platform
  |  
  | Use --sandbox_debug to see verbose messages from the sandbox
  | stat: illegal option -- c
  | usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]

The rule executes stat -L -c%s <path> but -c is not supported on macOS.

Android NDK tuorial: immediate crash after start

Ubuntu :19.04
Bazel : 1.1.0
SDK API :29
NDK : 20

Binary is built with --fat_apk_cpu=armeabi-v7a,arm64-v8a flag. Both so files are in place, but both of them don't have the native method from native-lib.cpp

FATAL EXCEPTION: main
Process: com.example.android.bazel, PID: 30069
AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String com.example.android.bazel.MainActivity.stringFromJNI() (tried Java_com_example_android_bazel_MainActivity_stringFromJNI and Java_com_example_android_bazel_MainActivity_stringFromJNI__)
 	at com.example.android.bazel.MainActivity.stringFromJNI(Native Method)
 	at com.example.android.bazel.MainActivity.onCreate(MainActivity.java:20)
 	at android.app.Activity.performCreate(Activity.java:7802)
 	at android.app.Activity.performCreate(Activity.java:7791)
 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
 	at android.os.Handler.dispatchMessage(Handler.java:107)
 	at android.os.Looper.loop(Looper.java:214)
 	at android.app.ActivityThread.main(ActivityThread.java:7356)
 	at java.lang.reflect.Method.invoke(Native Method)
 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Cannot build Android Firebase example on Windows

Broken at 84f2980 with Bazel 2.0.0 on Windows, on Bazel CI:

https://buildkite.com/bazel/bazel-bazel-examples/builds/311#bd238f11-740a-4370-ad76-803852013ba5


(00:14:18) ERROR: D:/b/hdfb3qyi/external/maven/BUILD:86:1: Couldn't build file external/maven/com_android_support_appcompat_v7_symbols/symbols.zip: Compiling Android resources for @maven//:com_android_support_appcompat_v7 failed (Exit 1)
--
  | Jan 22, 2020 12:14:17 AM java.util.stream.ForEachOps$ForEachOp$OfRef accept
  | SEVERE: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-hdpi-v4\abc_textfield_default_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-hdpi-v4\abc_textfield_default_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-hdpi-v4\abc_textfield_default_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | Jan 22, 2020 12:14:17 AM java.util.stream.ForEachOps$ForEachOp$OfRef accept
  | SEVERE: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | Jan 22, 2020 12:14:17 AM java.util.stream.ForEachOps$ForEachOp$OfRef accept
  | SEVERE: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_scrubber_track_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_scrubber_track_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_scrubber_track_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | Jan 22, 2020 12:14:17 AM java.util.stream.ForEachOps$ForEachOp$OfRef accept
  | SEVERE: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | Jan 22, 2020 12:14:17 AM java.util.stream.ForEachOps$ForEachOp$OfRef accept
  | SEVERE: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_list_divider_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_list_divider_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_list_divider_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | Jan 22, 2020 12:14:17 AM java.util.stream.ForEachOps$ForEachOp$OfRef accept
  | SEVERE: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_scrubber_primary_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_scrubber_primary_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_scrubber_primary_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | Exception in thread "main" com.google.devtools.build.android.aapt2.ResourceCompiler$CompileError
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileError.of(ResourceCompiler.java:110)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompilingVisitor.getCompiledArtifacts(ResourceCompiler.java:422)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler.getCompiledArtifacts(ResourceCompiler.java:456)
  | at com.google.devtools.build.android.UnvalidatedAndroidData.compile(UnvalidatedAndroidData.java:103)
  | at com.google.devtools.build.android.CompileLibraryResourcesAction.main(CompileLibraryResourcesAction.java:140)
  | at com.google.devtools.build.android.ResourceProcessorBusyBox$Tool$10.call(ResourceProcessorBusyBox.java:120)
  | at com.google.devtools.build.android.ResourceProcessorBusyBox.processRequest(ResourceProcessorBusyBox.java:237)
  | at com.google.devtools.build.android.ResourceProcessorBusyBox.main(ResourceProcessorBusyBox.java:198)
  | Suppressed: java.lang.RuntimeException: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-hdpi-v4\abc_textfield_default_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-hdpi-v4\abc_textfield_default_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-hdpi-v4\abc_textfield_default_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | at com.google.devtools.build.android.CommandHelper.execute(CommandHelper.java:42)
  | at com.google.devtools.build.android.AaptCommandBuilder.execute(AaptCommandBuilder.java:297)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.compile(ResourceCompiler.java:226)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:173)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:120)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
  | at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  | at java.base/java.lang.Thread.run(Thread.java:834)
  | Suppressed: java.lang.RuntimeException: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_list_divider_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | at com.google.devtools.build.android.CommandHelper.execute(CommandHelper.java:42)
  | at com.google.devtools.build.android.AaptCommandBuilder.execute(AaptCommandBuilder.java:297)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.compile(ResourceCompiler.java:226)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:173)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:120)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
  | at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  | at java.base/java.lang.Thread.run(Thread.java:834)
  | Suppressed: java.lang.RuntimeException: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_scrubber_track_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_scrubber_track_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_scrubber_track_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | at com.google.devtools.build.android.CommandHelper.execute(CommandHelper.java:42)
  | at com.google.devtools.build.android.AaptCommandBuilder.execute(AaptCommandBuilder.java:297)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.compile(ResourceCompiler.java:226)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:173)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:120)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
  | at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  | at java.base/java.lang.Thread.run(Thread.java:834)
  | Suppressed: java.lang.RuntimeException: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xhdpi-v4\abc_textfield_search_activated_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | at com.google.devtools.build.android.CommandHelper.execute(CommandHelper.java:42)
  | at com.google.devtools.build.android.AaptCommandBuilder.execute(AaptCommandBuilder.java:297)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.compile(ResourceCompiler.java:226)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:173)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:120)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
  | at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  | at java.base/java.lang.Thread.run(Thread.java:834)
  | Suppressed: java.lang.RuntimeException: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_list_divider_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_list_divider_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_list_divider_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | at com.google.devtools.build.android.CommandHelper.execute(CommandHelper.java:42)
  | at com.google.devtools.build.android.AaptCommandBuilder.execute(AaptCommandBuilder.java:297)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.compile(ResourceCompiler.java:226)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:173)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:120)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
  | at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  | at java.base/java.lang.Thread.run(Thread.java:834)
  | Suppressed: java.lang.RuntimeException: Error during Compiling bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_scrubber_primary_mtrl_alpha.9.png:
  | Command: external\androidsdk\build-tools\29.0.2\aapt2.exe\
  | compile\
  | -v\
  | --legacy\
  | -o\
  | D:\temp\android_resources_tmp632513122984622880\compiled\bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_scrubber_primary_mtrl_alpha.9.png
  | Output:
  | bazel-out\android-armeabi-v7a-fastbuild\bin\external\maven\_aar\unzipped\resources\com_android_support_appcompat_v7\res\drawable-xxhdpi-v4\abc_scrubber_primary_mtrl_alpha.9.png: note: compiling PNG.
  |  
  | at com.google.devtools.build.android.CommandHelper.execute(CommandHelper.java:42)
  | at com.google.devtools.build.android.AaptCommandBuilder.execute(AaptCommandBuilder.java:297)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.compile(ResourceCompiler.java:226)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:173)
  | at com.google.devtools.build.android.aapt2.ResourceCompiler$CompileTask.call(ResourceCompiler.java:120)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
  | at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
  | at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
  | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  | at java.base/java.lang.Thread.run(Thread.java:834)

Add examples of using tests

I think everyone agrees that testing is important. Yet, these examples omit the topic entirely.

I think that there should be tests in each example project, especially C++ ones.

Add protobuf examples

Please add some examples for compiling protocol buffers using bazel, especially for Android where they are specially useful as Parcelable replacements.

I couldn't get a protocol lite library to compile on the Android bazel example and I couldn't find any guide on the steps to follow to make it work.

Use clang under Windows 10

I use example code the cpp-tutorial/stage1 under Windows 10. I use clang Pre-Built Binary Windows (64-bit) compiler which is installed in
c:\Program Files\LLVM\bin\

Building with bazel build //main:hello-world ends up with following errors

(base) C:\DATA\bazel\examples\cpp-tutorial\stage1>bazel build //main:hello-world
INFO: Analyzed target //main:hello-world (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: C:/data/bazel/examples/cpp-tutorial/stage1/main/BUILD:3:10: C++ compilation of rule '//main:hello-world' failed (Exit 1)

The target you are compiling requires Visual C++ build tools.
Bazel couldn't find a valid Visual C++ build tools installation on your machine.
Please check your installation following https://docs.bazel.build/versions/master/windows.html#using

Target //main:hello-world failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.651s, Critical Path: 0.24s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

How to get working this example under Win10 with clang?

Mac internal git libs buggy

This is for the basic exemplar found at https://docs.bazel.build/versions/3.7.0/tutorial/ios-app.html
Invoking the build per instructions yields the following internal error. Something about the a function signature mismatch.

This is the WORKSPACE and BUILD file used.
Archive.zip

ERROR: /private/var/tmp/_bazel_vn50v8w/9436d7f4fd0a1cbeb36c80d117002bf1/external/build_bazel_rules_apple/apple/internal/BUILD:478:18: in environment_plist rule @bu load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") ild_bazel_rules_apple//apple/internal:environment_plist_ios: Traceback (most recent call last): File "/private/var/tmp/_bazel_vn50v8w/9436d7f4fd0a1cbeb36c80d117002bf1/external/build_bazel_rules_apple/apple/internal/environment_plist.bzl", line 39, column 23, in _environment_plist legacy_actions.run( File "/private/var/tmp/_bazel_vn50v8w/9436d7f4fd0a1cbeb36c80d117002bf1/external/build_bazel_rules_apple/apple/internal/utils/legacy_actions.bzl", line 88, column 49, in _run ctx.actions.run(**_kwargs_for_apple_platform(ctx, **kwargs)) File "/private/var/tmp/_bazel_vn50v8w/9436d7f4fd0a1cbeb36c80d117002bf1/external/build_bazel_rules_apple/apple/internal/utils/legacy_actions.bzl", line 63, column 92, in _kwargs_for_apple_platform execution_requirement_dicts.append(apple_support.action_required_execution_requirements(ctx)) File "/private/var/tmp/_bazel_vn50v8w/9436d7f4fd0a1cbeb36c80d117002bf1/external/build_bazel_apple_support/lib/apple_support.bzl", line 187, column 5, in _action_required_execution_requirements def _action_required_execution_requirements(): Error: _action_required_execution_requirements() does not accept positional arguments, but got 1 ERROR: Analysis of target '//ios-app:ios-app' failed; build aborted: Analysis of target '@build_bazel_rules_apple//apple/internal:environment_plist_ios' failed

By removing the 'ctx' param in the following line, the build ran as expected:
/external/build_bazel_rules_apple/apple/internal/utils/legacy_actions.bzl
# Add the execution requirements last to avoid clients overriding this value. execution_requirement_dicts.append(apple_support.action_required_execution_requirements())

java examples error

when importing examples/java-tutorial into Intellij 2018.3 (using latest Bazel plugin) I see the following error:

Error:(1, 1) no such target '//:greeter': target 'greeter' not declared in package '' defined by /Users/aaron/bazel/examples/java-tutorial/BUILD and referenced by '//src/main/java/com/example/cmdline:runner'.

Not able to build the android-ndk example

Hi,

I am having difficulties building the android-ndk example.
Android SDK: 27.0.3
NDK version: R14b
Operating system: Ubuntu 16.04

Following is the error message.
ERROR: /home/yitao/.cache/bazel/bazel_yitao/2e4a3bcbc24ccbd22986f56e063d359f/external/com_android_support_appcompat_v7_26_1_0/BUILD:7:1: Validating Android resources for @com_android
support_appcompat_v7_26_1_0//:com_android_support_appcompat_v7_26_1_0 failed (Exit 1)
Error: /tmp/resource_validator_tmp6621564669915564245/tmp-expanded/res/values-v26/values.xml:17: error: Error: No resource found that matches the given name: attr 'android:keyboardNavi
gationCluster'.

Any help is appreciated!

Best,
Yitao

Android example README inaccurate

The readme for the android app tutorial target reads:

"Once these are done, set up the android_sdk_repository rule in the WORKSPACE file, following the instructions in the comments there."

There are no such instructions nor inline comments in the WORKSPACE file.

As such, I can't build //android. I'm undoubtedly missing some SDK configuration step.

Flag --incompatible_load_cc_rules_from_bzl will break Bazel Examples in Bazel 1.2.1

Incompatible flag --incompatible_load_cc_rules_from_bzl will break Bazel Examples once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Tutorial instructions for building `ios-app.xcodeproj` seem incorrect

The README.md in the tutorial for building an iOS app states:

"Bazel will generate some output files, most notably bazel-bin/ios-app/ios-app.xcodeproj"

But when I run bazel build //ios-app

It appears that no ios-app.xcodeproj is generated in the bazel-bin folder.

Running bazel 0.5.4-homebrew

Toolchain error when building webapp

From examples/tutorial/backend

bazel build //:*

results in:

bazel build //:* INFO: Invocation ID: 3a2f84b0-b461-4acb-b276-c990de13e1e6 ERROR: No toolchain found for cpu 'ios_x86_64'. Valid cpus from default_toolchain entries are: [ ]. Valid toolchains are: [ stub_armeabi-v7a: --cpu='armeabi-v7a' --compiler='compiler', local: --cpu='darwin' --compiler='compiler', msys_x64_mingw: --cpu='x64_windows' --compiler='mingw-gcc', msvc_x64: --cpu='x64_windows' --compiler='msvc-cl', ] ERROR: Analysis of target '//:all' failed; build aborted: No toolchain found for cpu 'ios_x86_64'. Valid cpus from default_toolchain entries are: [ ]. Valid toolchains are: [ stub_armeabi-v7a: --cpu='armeabi-v7a' --compiler='compiler', local: --cpu='darwin' --compiler='compiler', msys_x64_mingw: --cpu='x64_windows' --compiler='mingw-gcc', msvc_x64: --cpu='x64_windows' --compiler='msvc-cl', ] INFO: Elapsed time: 0.147s INFO: 0 processes. FAILED: Build did NOT complete successfully (3 packages loaded, 0 targets configured) currently loading: @com_google_appengine_java// ... (2 packages)

UnsatisfiedLinkError occurs in com.example.android.bazel.

Do the following:

  1. $ cd android/ndk/
  2. $ bazel mobile-install //app/src/main:app --fat_apk_cpu=armeabi-v7a,arm64-v8a,x86,x86_64 --start_app

The following exception occurs.

05-18 22:16:48.039 10071 10071 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String com.example.android.bazel.MainActivity.stringFromJNI() (tried Java_com_example_android_bazel_MainActivity_stringFromJNI and Java_com_example_android_bazel_MainActivity_stringFromJNI__)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at com.example.android.bazel.MainActivity.stringFromJNI(Native Method)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at com.example.android.bazel.MainActivity.onCreate(MainActivity.java:20)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7023)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7014)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2734)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2859)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.ActivityThread.-wrap11(Unknown Source:0)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1592)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6518)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
05-18 22:16:48.039 10071 10071 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Bazel

bazel 3.0.0

iOS example failing using Bazel version 1.1.0

Hello,

Using Bazel version 1.1.0 installed using Homebrew and following the steps on the documentation https://docs.bazel.build/versions/master/tutorial/ios-app.html, I got the following error trying to build the iOS project :

➜  tutorial git:(source-only) ✗ bazel build //ios-app:ios-app

INFO: Writing tracer profile to '/private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/command.profile.gz'
ERROR: /private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/external/build_bazel_rules_apple/apple/bundling/entitlements.bzl:300:25: Traceback (most recent call last):
	File "/private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/external/build_bazel_rules_apple/apple/bundling/entitlements.bzl", line 294
		rule(<3 more arguments>)
	File "/private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/external/build_bazel_rules_apple/apple/bundling/entitlements.bzl", line 300, in rule
		attr.label(<2 more arguments>)
'single_file' is no longer supported. use allow_single_file instead. You can use --incompatible_disable_deprecated_attr_params=false to temporarily disable this check.
ERROR: Skipping '//ios-app:ios-app': error loading package 'ios-app': in /private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/external/build_bazel_rules_apple/apple/ios.bzl: in /private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/external/build_bazel_rules_apple/apple/bundling/binary_support.bzl: Extension file 'apple/bundling/entitlements.bzl' has errors
WARNING: Target pattern parsing failed.
ERROR: error loading package 'ios-app': in /private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/external/build_bazel_rules_apple/apple/ios.bzl: in /private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/external/build_bazel_rules_apple/apple/bundling/binary_support.bzl: Extension file 'apple/bundling/entitlements.bzl' has errors
INFO: Elapsed time: 0.163s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)

With --incompatible_disable_deprecated_attr_params=false I'm getting another error :

➜  tutorial git:(source-only) ✗ bazel build --incompatible_disable_deprecated_attr_params=false //ios-app:ios-app

INFO: Writing tracer profile to '/private/var/tmp/_bazel_mmosbah/50a095adb6c59f331d9d5d198a21d596/command.profile.gz'
ERROR: /Users/user_name/examples/tutorial/ios-app/BUILD:2:1: //ios-app:UrlGetClasses: no such attribute 'xibs' in 'objc_library' rule
ERROR: /Users/user_name/examples/tutorial/ios-app/BUILD:13:1: //ios-app:ios-app.apple_binary: no such attribute 'non_propagated_deps' in 'apple_binary' rule
ERROR: error loading package 'ios-app': Package 'ios-app' contains errors
INFO: Elapsed time: 0.156s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)

If i understand correctly the example project is not up to date with the latest version ?
What's the new equivalent of non_propagated_deps ?

Thanks !

Android Firebase Cloud Messaging failing on Bazel CI

https://buildkite.com/bazel/bazel-bazel-examples/builds/183

(00:01:57) ERROR: An error occurred during the fetch of repository 'maven':
--
  | Error while fetching artifact sources with coursier: Error getting scaladex infos:
  | download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: https://index.scala-lang.org/api/search?q=true&target=JVM&scalaVersion=2.12.7 (Server returned HTTP response code: 403 for URL: https://index.scala-lang.org/api/search?q=true&target=JVM&scalaVersion=2.12.7) while downloading https://index.scala-lang.org/api/search?q=true&target=JVM&scalaVersion=2.12.7

This happens with both Bazel 1.0.0 and Bazel@HEAD

I cannot find where https://index.scala-lang.org/api/search?q=true&target=JVM&scalaVersion=2.12.7 is used. More strangely, visiting the url in browser looks fine.

Unable to deploy example NDK app to Android 9: 'remote secure_mkdirs failed: Operation not permitted'

I'm running bazel 0.17.1, android NDK r17b. When I try to deploy to an Android 9 device I get:

jgavris in ~/code/examples/android/ndk on master
λ bazel mobile-install //app/src/main:app --fat_apk_cpu=arm64-v8a --start_app
INFO: Analysed target //app/src/main:app (0 packages loaded).
INFO: Found 1 target...
ERROR: /Users/jgavris/code/examples/android/ndk/app/src/main/BUILD.bazel:21:1: Installing //app/src/main:app failed (Exit 1)
Error:
adb command: ['external/androidsdk/platform-tools/adb', 'push', '/var/folders/q4/yjz6lvkj5hgg3tw1802g76zh0000gn/T/tmpIsCjcL/adbfile_4', u'/data/local/tmp/incrementaldeployment/com.example.android.bazel/native/native_manifest']
return code: 1
stdout: [   ?] /data/local/tmp/incrementaldeployment/com.example.android.bazel/native/native_manifest: 0/?
adb: error: failed to copy '/var/folders/q4/yjz6lvkj5hgg3tw1802g76zh0000gn/T/tmpIsCjcL/adbfile_4' to '/data/local/tmp/incrementaldeployment/com.example.android.bazel/native/native_manifest': remote secure_mkdirs failed: Operation not permitted
/var/folders/q4/yjz6lvkj5hgg3tw1802g76zh0000gn/T/tmpIsCjcL/adbfile_4: 0 files pushed.
stderr:
Updating 1 dex...
Updating application resources...
Updating 0 native libs...
Target //app/src/main:app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.691s, Critical Path: 1.37s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
jgavris in ~/code/examples/android/ndk on master
λ bazel info
bazel-bin: /private/var/tmp/_bazel_jgavris/a529821f4856b67750ce7a4f6d160c6a/execroot/__main__/bazel-out/darwin-fastbuild/bin
bazel-genfiles: /private/var/tmp/_bazel_jgavris/a529821f4856b67750ce7a4f6d160c6a/execroot/__main__/bazel-out/darwin-fastbuild/genfiles
bazel-testlogs: /private/var/tmp/_bazel_jgavris/a529821f4856b67750ce7a4f6d160c6a/execroot/__main__/bazel-out/darwin-fastbuild/testlogs
character-encoding: file.encoding = ISO-8859-1, defaultCharset = ISO-8859-1
command_log: /private/var/tmp/_bazel_jgavris/a529821f4856b67750ce7a4f6d160c6a/command.log
committed-heap-size: 888MB
execution_root: /private/var/tmp/_bazel_jgavris/a529821f4856b67750ce7a4f6d160c6a/execroot/__main__
gc-count: 17
gc-time: 1010ms
install_base: /var/tmp/_bazel_jgavris/install/79d9f22886570ca416e6ffca28ab7725
java-home: /private/var/tmp/_bazel_jgavris/install/79d9f22886570ca416e6ffca28ab7725/_embedded_binaries/embedded_tools/jdk
java-runtime: OpenJDK Runtime Environment (build 9.0.7.1+1) by Azul Systems, Inc.
java-vm: OpenJDK 64-Bit Server VM (build 9.0.7.1+1, mixed mode) by Azul Systems, Inc.
max-heap-size: 3817MB
output_base: /private/var/tmp/_bazel_jgavris/a529821f4856b67750ce7a4f6d160c6a
output_path: /private/var/tmp/_bazel_jgavris/a529821f4856b67750ce7a4f6d160c6a/execroot/__main__/bazel-out
package_path: %workspace%
release: release 0.17.1
repository_cache: /var/tmp/_bazel_jgavris/cache/repos/v1
server_pid: 48463
used-heap-size: 148MB
workspace: /Users/jgavris/code/examples/android/ndk

@jin ?

Flag --incompatible_disallow_empty_glob will break Bazel Examples in Bazel 1.2.1

Incompatible flag --incompatible_disallow_empty_glob will break Bazel Examples once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

bazel build //main:hello-world failed

when i run bazel build //main:hello-world it gives an error like this

No command 'bazel' found, did you mean:
Command 'babel' from package 'babel-1.4.0' (universe)
Command 'babel' from package 'openbabel' (universe)
bazel: command not found

end-to-end example broken with Bazel 0.28.0

The end-to-end example is broken on all platforms: https://buildkite.com/bazel/bazel-bazel-examples/builds/54#8289092a-377c-4687-9ce8-770792a3ae87

ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/1c525a110a1039d4941eb4a8d5fde578/external/io_bazel_rules_appengine/appengine/appengine.bzl:72:16: name 'FileType' is not defined
--
  | ERROR: error loading package '': Extension 'appengine/appengine.bzl' has errors
  | Traceback (most recent call last):
  | File "bazelci.py", line 2778, in <module>
  | sys.exit(main())
  | File "bazelci.py", line 2758, in main
  | bazel_version=task_config.get("bazel") or configs.get("bazel"),
  | File "bazelci.py", line 794, in execute_commands
  | bazel_version = print_bazel_version_info(bazel_binary, platform)
  | File "bazelci.py", line 1006, in print_bazel_version_info
  | + ["--nomaster_bazelrc", "--bazelrc=/dev/null", "info"]
  | File "bazelci.py", line 1623, in execute_command
  | args, shell=shell, check=fail_if_nonzero, env=os.environ, cwd=cwd
  | File "/usr/lib/python3.6/subprocess.py", line 438, in run
  | output=stdout, stderr=stderr)
  | subprocess.CalledProcessError: Command '['bazel', '--nomaster_bazelrc', '--bazelrc=/dev/null', 'info']' returned non-zero exit status 2.

Culprit: @io_bazel_rules_appengine//appengine/appengine.bzl uses deprecated type FileType that was removed in Bazel 0.28.0.

Doesn't build with Bazel 0.24.1

./android/firebase-cloud-messaging fails bazel info:

  $ bazel info
Starting local Bazel server and connecting to it...
INFO: SHA256 (https://github.com/bazelbuild/gmaven_rules/archive/20180530-1.tar.gz) = b86cdfc865cbacb86469b403fc56ef32f0ffcecc099a86370b9f5192a8371b3e
DEBUG: Rule 'gmaven_rules' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = "b86cdfc865cbacb86469b403fc56ef32f0ffcecc099a86370b9f5192a8371b3e"
ERROR: /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/b42e09d2cb32971f7fbda8968001b055/external/gmaven_rules/import_external.bzl:313:9: Traceback (most recent call last):
        File "/usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/b42e09d2cb32971f7fbda8968001b055/external/gmaven_rules/import_external.bzl", line 311
                repository_rule(implementation = _java_import_ex..., ...))
        File "/usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/b42e09d2cb32971f7fbda8968001b055/external/gmaven_rules/import_external.bzl", line 313, in repository_rule
                {"jar_urls": attr.string_list(mandatory = True, allow_empty = False), "jar_sha256": attr.string(mandatory = True), "_packaging": attr.string(default = "jar"), "neverlink": attr.bool(), "runtime_deps": attr.string_list()} + COMMON_ATTRS
The `+` operator for dicts is deprecated and no longer supported. Please use the `update` method instead. You can temporarily enable the `+` operator by passing the flag --incompatible_disallow_dict_plus=false
ERROR: /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/b42e09d2cb32971f7fbda8968001b055/external/gmaven_rules/import_external.bzl:323:9: Traceback (most recent call last):
        File "/usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/b42e09d2cb32971f7fbda8968001b055/external/gmaven_rules/import_external.bzl", line 321
                repository_rule(implementation = _java_import_ex..., ...))
        File "/usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/b42e09d2cb32971f7fbda8968001b055/external/gmaven_rules/import_external.bzl", line 323, in repository_rule
                {"aar_urls": attr.string_list(mandatory = True, allow_empty = False), "aar_sha256": attr.string(mandatory = True), "_packaging": attr.string(default = "aar")} + COMMON_ATTRS
The `+` operator for dicts is deprecated and no longer supported. Please use the `update` method instead. You can temporarily enable the `+` operator by passing the flag --incompatible_disallow_dict_plus=false
ERROR: error loading package '': in /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/b42e09d2cb32971f7fbda8968001b055/external/gmaven_rules/gmaven.bzl: Extension file 'import_external.bzl' has errors

./tutorial fails bazel info too:

  $ bazel info
DEBUG: Rule 'build_bazel_rules_apple' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "7f65be56ce91f9accde6247f392f2c5c2f54c70f", shallow_since = "1547847504 -0500" and dropping ["tag"]
DEBUG: Rule 'build_bazel_rules_swift' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "001736d056d7eae20f1f4da41bc9e6f036857296", shallow_since = "1547844730 -0800" and dropping ["tag"]
ERROR: /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/io_bazel_rules_appengine/appengine/appengine.bzl:72:16: FileType function is not available. You may use a list of strings instead. You can temporarily reenable the function by passing the flag --incompatible_disallow_filetype=false
ERROR: /usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/io_bazel_rules_appengine/appengine/appengine.bzl:229:27: Traceback (most recent call last):
        File "/usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/io_bazel_rules_appengine/appengine/appengine.bzl", line 203
                rule(_war_impl, attrs = {"_java": attr....()}, <2 more arguments>)
        File "/usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/io_bazel_rules_appengine/appengine/appengine.bzl", line 228, in rule
                attr.label_list(allow_files = jar_filetype, mandat...)
        File "/usr/local/google/home/laszlocsomor/.cache/bazel/_bazel_laszlocsomor/1fc5adba4fa8a524b4199134e1d30997/external/io_bazel_rules_appengine/appengine/appengine.bzl", line 229, in attr.label_list
                jar_filetype
global variable 'jar_filetype' is referenced before assignment.
ERROR: error loading package '': Extension file 'appengine/appengine.bzl' has errors

I'm using Bazel 0.24.1 on Linux.

Flag --incompatible_no_implicit_file_export will break Bazel Examples in a future Bazel release

Incompatible flag --incompatible_no_implicit_file_export will be enabled by default in a future Bazel release [1], thus breaking Bazel Examples.

The flag is documented here: bazelbuild/bazel#10225

Please check the following CI builds for build and test results:

Never heard of incompatible flags before? We have documentation that explains everything.

If you don't want to receive any future issues for Bazel Examples or if you have any questions,
please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

[1] The target release hasn't been determined yet. Our tool will update the issue title once the flag flip has been scheduled.

Flag --incompatible_disable_native_android_rules will break Bazel Examples in Bazel 1.2.1

Incompatible flag --incompatible_disable_native_android_rules will break Bazel Examples once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Flag --incompatible_enable_cc_toolchain_resolution will break Bazel Examples in Bazel 1.2.1

Incompatible flag --incompatible_enable_cc_toolchain_resolution will break Bazel Examples once Bazel 1.2.1 is released.

Please see the following CI builds for more information:

Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration

Important: Please do NOT modify the issue title since that might break our tools.

Add examples for using zipper/singlejar on rules that output unpredictable files

Sometimes builds need to incorporate programs that output unpredictable files in order to create artifacts. For example, a multi-language code generator. If those artifacts need to be collected into a single archive, like a zip or jar, then it's not at all clear how to proceed. Bazel has two tools, zipper and singlejar, that can be used to create zip and jar archives. But the zipper tool requires every file explicitly enumerated, so it can't be used on a group of rule outputs that are unknown in number and name. And singlejar could presumably be used, but it's not clear how to operate it, because java_toolchains don't participate in toolchain resolution and there are multiple platform-specific versions of singlejar, so it's not clear how to get it working.

Examples of using both of these would be welcome.

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.