Skip to content

Instantly share code, notes, and snippets.

@jin
jin / vivian_balakrishnan_sudoku.js
Last active February 14, 2016 03:59
@VivianBalakrishnan's translation of Lee Hsien Loong's Sudoku solver.
/****************************************************************
* Sudoku Solver
*
* Translated into Javascript from original code in C++
* by Lee Hsien Loong
* The MIT License (MIT)
* Copyright (c) 2015 Vivian Balakrishnan
*
*
****************************************************************/
@jin
jin / BUILD.bazel
Created March 16, 2018 17:24
grep "cc_toolchain(" BUILD.bazel -A 30 -B 5
################################################################
# aarch64-linux-android-clang5.0.300080-gnu-libstdcpp
################################################################
cc_toolchain(
name = "aarch64-linux-android-clang5.0.300080-gnu-libstdcpp",
all_files = ":aarch64-linux-android-clang5.0.300080-gnu-libstdcpp-all_files",
ar_files = ":aarch64-linux-android-clang5.0.300080-gnu-libstdcpp-all_files",
as_files = ":aarch64-linux-android-clang5.0.300080-gnu-libstdcpp-all_files",
@jin
jin / setup.md
Last active April 11, 2018 07:19
Setup for Bazel's Android Instrumentation Tests on CI (Google Compute Engine)

Bazel Android Team

Setup Instructions for Android Instrumentation Tests with Bazel

Test project: https://github.com/googlesamples/android-testing

Tested with Bazel version 0.12.0rc2

Tested on fresh GCE Ubuntu 14.04 and 16.04 images with nested KVM support

# https://github.com/googlesamples/android-testing#experimental-bazel-support
---
platforms:
ubuntu1404:
build_targets:
- "//ui/..."
test_flags:
- "--spawn_strategy=local" # Required due to unified launcher bug
- "--local_test_jobs=8" # Run at most 8 tests (= emulators) in parallel
test_targets:
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
Previous Daemon (93713) stopped at
@jin
jin / .bazelrc
Last active July 24, 2018 20:19
Use JDK8 as Bazel's --host_javabase
# 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
@jin
jin / bazel-aquery.txt
Last active August 12, 2018 21:07
bazel aquery //main:hello-world --noimplicit_deps --output=text
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 / local-OK-symbols.log.txt
Last active October 15, 2018 19:45
execution log snippets for action generating symbols.zip
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 / BUILD.bazel
Last active December 28, 2018 21:15
BUILD file for com.android.support:design:28.0.0
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 February 26, 2019 23:04
Android bazelrc configuration for remote execution and dynamic builds on GCP Remote Build Execution
# 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