From 9a0a2fcb115ed5ccbfba3e65dfdbe031ab6d99bc Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Fri, 17 May 2024 12:31:06 -0700 Subject: [PATCH] Convert envsetup.sh shell functions to scripts. Bug: 340648588 Test: Run them Change-Id: I19303ac08bd98619f0a8ee4ee5efb6d735538578 --- bin/cgrep | 24 ++++++++++++++++ bin/ggrep | 20 +++++++++++++ bin/gogrep | 20 +++++++++++++ bin/hmm | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/jgrep | 21 ++++++++++++++ bin/jsongrep | 20 +++++++++++++ bin/ktgrep | 1 + bin/m | 24 ++++++++++++++++ bin/mangrep | 20 +++++++++++++ bin/mgrep | 25 +++++++++++++++++ bin/mm | 24 ++++++++++++++++ bin/mma | 24 ++++++++++++++++ bin/mmm | 24 ++++++++++++++++ bin/mmma | 24 ++++++++++++++++ bin/owngrep | 20 +++++++++++++ bin/pygrep | 20 +++++++++++++ bin/rcgrep | 20 +++++++++++++ bin/resgrep | 19 +++++++++++++ bin/rsgrep | 20 +++++++++++++ bin/sepgrep | 19 +++++++++++++ bin/sgrep | 36 ++++++++++++++++++++++++ bin/syswrite | 25 +++++++++++++++++ bin/tomlgrep | 20 +++++++++++++ bin/treegrep | 28 +++++++++++++++++++ 24 files changed, 577 insertions(+) create mode 100755 bin/cgrep create mode 100755 bin/ggrep create mode 100755 bin/gogrep create mode 100755 bin/hmm create mode 100755 bin/jgrep create mode 100755 bin/jsongrep create mode 120000 bin/ktgrep create mode 100755 bin/m create mode 100755 bin/mangrep create mode 100755 bin/mgrep create mode 100755 bin/mm create mode 100755 bin/mma create mode 100755 bin/mmm create mode 100755 bin/mmma create mode 100755 bin/owngrep create mode 100755 bin/pygrep create mode 100755 bin/rcgrep create mode 100755 bin/resgrep create mode 100755 bin/rsgrep create mode 100755 bin/sepgrep create mode 100755 bin/sgrep create mode 100755 bin/syswrite create mode 100755 bin/tomlgrep create mode 100755 bin/treegrep diff --git a/bin/cgrep b/bin/cgrep new file mode 100755 index 000000000..6c9130cd9 --- /dev/null +++ b/bin/cgrep @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.c' \ + -o -name '*.cc' \ + -o -name '*.cpp' \ + -o -name '*.h' \ + -o -name '*.hpp' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/ggrep b/bin/ggrep new file mode 100755 index 000000000..fce8c846a --- /dev/null +++ b/bin/ggrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.gradle' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/gogrep b/bin/gogrep new file mode 100755 index 000000000..0265ccf15 --- /dev/null +++ b/bin/gogrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.go' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/hmm b/bin/hmm new file mode 100755 index 000000000..c3d60fa4d --- /dev/null +++ b/bin/hmm @@ -0,0 +1,79 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +cat <-- + Selects as the product to build, and as the variant to + build, and stores those selections in the environment to be read by subsequent + invocations of 'm' etc. +- tapas: tapas [ ...] [arm|x86|arm64|x86_64] [eng|userdebug|user] + Sets up the build environment for building unbundled apps (APKs). +- banchan: banchan [ ...] \\ + [arm|x86|arm64|riscv64|x86_64|arm64_only|x86_64only] [eng|userdebug|user] + Sets up the build environment for building unbundled modules (APEXes). +- croot: Changes directory to the top of the tree, or a subdirectory thereof. +- m: Makes from the top of the tree. +- mm: Builds and installs all of the modules in the current directory, and their + dependencies. +- mmm: Builds and installs all of the modules in the supplied directories, and their + dependencies. + To limit the modules being built use the syntax: mmm dir/:target1,target2. +- mma: Same as 'mm' +- mmma: Same as 'mmm' +- provision: Flash device with all required partitions. Options will be passed on to fastboot. +- cgrep: Greps on all local C/C++ files. +- ggrep: Greps on all local Gradle files. +- gogrep: Greps on all local Go files. +- jgrep: Greps on all local Java files. +- jsongrep: Greps on all local Json files. +- ktgrep: Greps on all local Kotlin files. +- resgrep: Greps on all local res/*.xml files. +- mangrep: Greps on all local AndroidManifest.xml files. +- mgrep: Greps on all local Makefiles and *.bp files. +- owngrep: Greps on all local OWNERS files. +- rsgrep: Greps on all local Rust files. +- sepgrep: Greps on all local sepolicy files. +- sgrep: Greps on all local source files. +- tomlgrep: Greps on all local Toml files. +- pygrep: Greps on all local Python files. +- godir: Go to the directory containing a file. +- allmod: List all modules. +- gomod: Go to the directory containing a module. +- bmod: Get the Bazel label of a Soong module if it is converted with bp2build. +- pathmod: Get the directory containing a module. +- outmod: Gets the location of a module's installed outputs with a certain extension. +- dirmods: Gets the modules defined in a given directory. +- installmod: Adb installs a module's built APK. +- refreshmod: Refresh list of modules for allmod/gomod/pathmod/outmod/installmod. +- syswrite: Remount partitions (e.g. system.img) as writable, rebooting if necessary. + +Environment options: +- SANITIZE_HOST: Set to 'address' to use ASAN for all host modules. +- ANDROID_QUIET_BUILD: set to 'true' to display only the essential messages. + +Look at build/make/envsetup for more functions: +EOF + local T=$(gettop) + local A="" + local i + for i in `(cat $T/build/envsetup.sh | sed -n "/^[[:blank:]]*function /s/function \([a-z]*\).*/\1/p" | sort | uniq`; do + A="$A $i" + done + echo $A diff --git a/bin/jgrep b/bin/jgrep new file mode 100755 index 000000000..afe70dbd0 --- /dev/null +++ b/bin/jgrep @@ -0,0 +1,21 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.java' \ + -o -name '*.kt' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/jsongrep b/bin/jsongrep new file mode 100755 index 000000000..6e14d0c0d --- /dev/null +++ b/bin/jsongrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.json' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/ktgrep b/bin/ktgrep new file mode 120000 index 000000000..9b5149136 --- /dev/null +++ b/bin/ktgrep @@ -0,0 +1 @@ +jgrep \ No newline at end of file diff --git a/bin/m b/bin/m new file mode 100755 index 000000000..edcfce54b --- /dev/null +++ b/bin/m @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright (C) 2024 The Android Open Source Project +# +# 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. + +# Common script utilities +source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../make/shell_utils.sh + +require_top + +_wrap_build "$TOP/build/soong/soong_ui.bash" --build-mode --all-modules --dir="$(pwd)" "$@" + +exit $? diff --git a/bin/mangrep b/bin/mangrep new file mode 100755 index 000000000..a3430006a --- /dev/null +++ b/bin/mangrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name 'AndroidManifest.xml' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/mgrep b/bin/mgrep new file mode 100755 index 000000000..793730d9c --- /dev/null +++ b/bin/mgrep @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name 'Makefile' \ + -o -name 'Makefile.*' \ + -o -name '*.make' \ + -o -name '*.mak' \ + -o -name '*.mk' \ + -o -name '*.bp' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/mm b/bin/mm new file mode 100755 index 000000000..6461b1e53 --- /dev/null +++ b/bin/mm @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright (C) 2024 The Android Open Source Project +# +# 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. + +# Common script utilities +source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../make/shell_utils.sh + +require_top + +_wrap_build "$TOP/build/soong/soong_ui.bash" --build-mode --modules-in-a-dir-no-deps --dir="$(pwd)" "$@" + +exit $? diff --git a/bin/mma b/bin/mma new file mode 100755 index 000000000..6f1c9348d --- /dev/null +++ b/bin/mma @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright (C) 2024 The Android Open Source Project +# +# 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. + +# Common script utilities +source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../make/shell_utils.sh + +require_top + +_wrap_build "$TOP/build/soong/soong_ui.bash" --build-mode --modules-in-a-dir --dir="$(pwd)" "$@" + +exit $? diff --git a/bin/mmm b/bin/mmm new file mode 100755 index 000000000..ab3a6321c --- /dev/null +++ b/bin/mmm @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright (C) 2024 The Android Open Source Project +# +# 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. + +# Common script utilities +source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../make/shell_utils.sh + +require_top + +_wrap_build "$TOP/build/soong/soong_ui.bash" --build-mode --modules-in-dirs-no-deps --dir="$(pwd)" "$@" + +exit $? diff --git a/bin/mmma b/bin/mmma new file mode 100755 index 000000000..d9190e575 --- /dev/null +++ b/bin/mmma @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright (C) 2024 The Android Open Source Project +# +# 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. + +# Common script utilities +source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../make/shell_utils.sh + +require_top + +_wrap_build "$TOP/build/soong/soong_ui.bash" --build-mode --modules-in-dirs --dir="$(pwd)" "$@" + +exit $? diff --git a/bin/owngrep b/bin/owngrep new file mode 100755 index 000000000..26ce6e874 --- /dev/null +++ b/bin/owngrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name 'OWNERS' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/pygrep b/bin/pygrep new file mode 100755 index 000000000..e072289bc --- /dev/null +++ b/bin/pygrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.py' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/rcgrep b/bin/rcgrep new file mode 100755 index 000000000..ff93e5102 --- /dev/null +++ b/bin/rcgrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.rc' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/resgrep b/bin/resgrep new file mode 100755 index 000000000..600091fd4 --- /dev/null +++ b/bin/resgrep @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +for dir in `find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -name res -type d`; do + find $dir -type f -name '*\.xml' -exec grep --color -n "$@" {} + +done diff --git a/bin/rsgrep b/bin/rsgrep new file mode 100755 index 000000000..8c241518d --- /dev/null +++ b/bin/rsgrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.rs' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/sepgrep b/bin/sepgrep new file mode 100755 index 000000000..0e0d1ba8d --- /dev/null +++ b/bin/sepgrep @@ -0,0 +1,19 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -name sepolicy -type d \ + -exec grep --color -n -r --exclude-dir=\.git "$@" {} + +exit $? diff --git a/bin/sgrep b/bin/sgrep new file mode 100755 index 000000000..f18655369 --- /dev/null +++ b/bin/sgrep @@ -0,0 +1,36 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.c' \ + -o -name '*.cc' \ + -o -name '*.cpp' \ + -o -name '*.h' \ + -o -name '*.hpp' \ + -o -name '*.S' \ + -o -name '*.java' \ + -o -name '*.kt' \ + -o -name '*.xml' \ + -o -name '*.sh' \ + -o -name '*.mk' \ + -o -name '*.bp' \ + -o -name '*.aidl' \ + -o -name '*.vts' \ + -o -name '*.proto' \ + -o -name '*.rs' \ + -o -name '*.go' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/syswrite b/bin/syswrite new file mode 100755 index 000000000..46201e3da --- /dev/null +++ b/bin/syswrite @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright (C) 2024 The Android Open Source Project +# +# 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. + +# syswrite - disable verity, reboot if needed, and remount image +# Easy way to make system.img/etc writable + +adb wait-for-device && adb root && adb wait-for-device || exit 1 +if [[ $(adb disable-verity | grep -i "reboot") ]]; then + echo "rebooting" + adb reboot && adb wait-for-device && adb root && adb wait-for-device || exit 1 +fi +adb remount || exit 1 diff --git a/bin/tomlgrep b/bin/tomlgrep new file mode 100755 index 000000000..636ef22da --- /dev/null +++ b/bin/tomlgrep @@ -0,0 +1,20 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.toml' \ + \) -exec grep --color -n "$@" {} + +exit $? diff --git a/bin/treegrep b/bin/treegrep new file mode 100755 index 000000000..b83d41997 --- /dev/null +++ b/bin/treegrep @@ -0,0 +1,28 @@ +#!/bin/bash + +# Copyright (C) 2022 The Android Open Source Project +# +# 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. + +find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( \ + -name '*.c' \ + -o -name '*.cc' \ + -o -name '*.cpp' \ + -o -name '*.h' \ + -o -name '*.hpp' \ + -o -name '*.S' \ + -o -name '*.java' \ + -o -name '*.kt' \ + -o -name '*.xml' \ + \) -exec grep --color -n "$@" {} + +exit $?