Skip to content

Instantly share code, notes, and snippets.

Avatar

Jin jin

View GitHub Profile
View gist:aa85362728574aca2a205687b9d05bc7
$ bazel cquery //src/main/... --output=providers
INFO: Analyzed 1014 targets (0 packages loaded, 0 targets configured).
INFO: Found 1014 targets...
//src/main/protobuf:_command_server_cc_grpc_grpc_codegen [OutputGroupInfo]
//src/main/protobuf:action_cache_java_proto [JavaInfo, OutputGroupInfo]
//src/main/protobuf:action_cache_java_proto [JavaInfo, OutputGroupInfo]
//src/main/protobuf:action_cache_java_proto_srcs [OutputGroupInfo]
//src/main/protobuf:action_cache_proto [ProtoInfo, OutputGroupInfo]
//src/main/protobuf:action_cache_proto [ProtoInfo, OutputGroupInfo]
//src/main/protobuf:analysis_java_proto [JavaInfo, OutputGroupInfo]
View gist:e5f17e4ff222f7f46382ae84e363c26f
$ cat WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_tweag_rules_nixpkgs",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/v0.5.2.tar.gz"],
strip_prefix = "rules_nixpkgs-0.5.2",
sha256 = "5a384daa57b49abf9f0b672852f1a66a3c52aecf9d4d2ac64f6de0fd307690c8",
)
@jin
jin / gist:19c9b2971c832d17c131fcda23b840bd
Last active Mar 28, 2019
Set up local private Artifactory instance in Docker
View gist:19c9b2971c832d17c131fcda23b840bd
$ docker pull docker.bintray.io/jfrog/artifactory-oss:latest
$ docker run --name artifactory -d -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss:latest
# Go to http://localhost:8081, set up admin password, skip proxy setup.
# Add a new remote Maven repo for Google Maven. URL: https://maven.google.com
# In rules_jvm_external,
maven_install(
artifacts = [
@jin
jin / BUILD.bazel
Last active Dec 28, 2018
BUILD file for com.android.support:design:28.0.0
View BUILD.bazel
package(default_visibility = ["//visibility:public"])
java_import(
name = "android_arch_core_common_1_1_1",
jars = ["https/maven.google.com/android/arch/core/common/1.1.1/common-1.1.1.jar"],
deps = [
":com_android_support_support_annotations_28_0_0",
],
)
aar_import(
name = "android_arch_core_runtime_aar_1_1_1",
@jin
jin / .bazelrc
Last active Feb 26, 2019
Android bazelrc configuration for remote execution and dynamic builds on GCP Remote Build Execution
View .bazelrc
# Requires Bazel built from HEAD (after https://github.com/bazelbuild/bazel/commit/b6f2ff19727c150cd745cff3d6365eb40935253e)
# ... import /path/to/bazel-toolchains/bazelrc/bazel-0.19.2.bazelrc
## Configuration to build Android apps remotely
# bazel build //android:app --config=remote_android
build:remote_android --config=remote # Reuse remote config from RBE bazelrc
build:remote_android --strategy=CppCompile=remote # RBE C++ toolchain is built for RBE container
build:remote_android --strategy=CppLink=remote # RBE C++ toolchain is built for RBE container
build:remote_android --strategy=DexBuilder=remote # RBE C++ toolchain is built for RBE container
build:remote_android --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=0
@jin
jin / local-OK-symbols.log.txt
Last active Oct 15, 2018
execution log snippets for action generating symbols.zip
View local-OK-symbols.log.txt
command_args: "bazel-out/host/bin/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/ResourceProcessorBusyBox"
command_args: "--tool"
command_args: "COMPILE_LIBRARY_RESOURCES"
command_args: "--"
command_args: "--aapt2"
command_args: "bazel-out/host/bin/external/androidsdk/aapt2_binary"
command_args: "--resources"
command_args: "bazel-out/android-armeabi-v7a-fastbuild/bin/external/com_android_support_support_compat_28_0_0/_aar/unzipped/resources/com_android_support_support_compat_28_0_0/res:"
command_args: "--output"
command_args: "bazel-out/android-armeabi-v7a-fastbuild/bin/external/com_android_support_support_compat_28_0_0/com_android_support_support_compat_28_0_0_symbols/symbols.zip"
@jin
jin / bazel-aquery.txt
Last active Aug 12, 2018
bazel aquery //main:hello-world --noimplicit_deps --output=text
View bazel-aquery.txt
action 'Compiling main/hello-world.cc'
Mnemonic: CppCompile
Owner: //main:hello-world
Configuration: darwin-fastbuild
ActionKey: 3ffd28bdc51685c24941885b8ac01f22
Inputs: [external/bazel_tools/tools/cpp/grep-includes.sh, external/local_config_cc/cc_wrapper.sh, external/local_config_cc/libtool, external/local_config_cc/make_hashed_objlist.py, external/local_config_cc/wrapped_ar, external/local_config_cc/wrapped_clang, external/local_config_cc/wrapped_clang_pp, external/local_config_cc/xcrunwrapper.sh, main/hello-world.cc]
Outputs: [bazel-out/darwin-fastbuild/bin/main/_objs/hello-world/hello-world.d, bazel-out/darwin-fastbuild/bin/main/_objs/hello-world/hello-world.o]
action 'Linking main/hello-world'
Mnemonic: CppLink
@jin
jin / .bazelrc
Last active Jul 24, 2018
Use JDK8 as Bazel's --host_javabase
View .bazelrc
# Run with Bazel with 88a20ee08c0af7cf187893bcafe0771e5a19ff9d reverted
# This commit adds a JDK9+ opt into desugar.sh to silence warnings
# $ git revert 88a20ee08c0af7cf187893bcafe0771e5a19ff9d
# After that, run bazel build --config=jdk8 //...
build:jdk8 --javabase=@local_jdk//:jdk
build:jdk8 --host_javabase=@local_jdk//:jdk
build:jdk8 --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:jdk8 --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
View analyze-profile.py
#!/usr/bin/env python3
"""Script for analyzing raw data `bazel analyze-profile --dump=raw`
Usage:
First obtain the raw profile data of your build.
$ bazel build --profile=my_profile.dat //some:target
$ bazel analyze-profile my_profile.dat --dump=raw > my_profile.raw
View simple_comparison_gradle_info.log
This file has been truncated, but you can view the full file.
Initialized native services in: /usr/local/google/home/jingwen/.gradle/native
Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{pid=93713, address=[cd576c87-a5c3-4e22-98e8-cbc3f6d741bf port:39205, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1525194598789, context=DefaultDaemonContext[uid=c4f8c627-92e7-4337-ab9d-2ed56e9d2341,javaHome=/usr/local/buildtools/java/jdk8-google-v7-64,daemonRegistryDir=/usr/local/google/home/jingwen/.gradle/daemon,pid=93713,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}
Removing 0 daemon stop events from registry
Previous Daemon (73687) stopped at Tue May 01 13:07:12 EDT 2018 by user or operating system
Previous Daemon (92142) stopped at Tue May 01 13:08:26 EDT 2018 by user or operating system
Previous Daemon (93524) stopped at Tue May 01 13:09:51 EDT 2018 by user or operating system
You can’t perform that action at this time.