blob: 251d7aa5f0b15a76c00e1a0cfdfe6d3f20624454 [file] [log] [blame]
sophiez02347372021-11-02 17:58:02 -07001#!/bin/bash -e
2
3# Copyright 2020 Google Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17printHelp() {
18 echo "**************************** Usage Instructions ****************************"
19 echo "This script is used to generate the Mainline modules used-by Java symbols."
20 echo ""
21 echo "To run this script use: ./gen_java_usedby_apex.sh \$BINARY_DEXDEPS_PATH \$OUTPUT_FILE_PATH \$JAR_AND_APK_LIST"
22 echo "For example: If all jar and apk files are '/myJar.jar /myApk.apk' and output write to /myModule.txt then the command would be:"
23 echo "./gen_java_usedby_apex.sh \$BINARY_DEXDEPS_PATH /myModule.txt /myJar.jar /myApk.apk"
24}
25
26genUsedByList() {
27 dexdeps="$1"
28 shift
29 out="$1"
30 shift
31 rm -f "$out"
32 touch "$out"
33 for x in "$@"; do
34 "$dexdeps" "$x" >> "$out" || true
35 done
36}
37
38if [[ "$1" == "help" ]]
39then
40 printHelp
41elif [[ "$#" -lt 2 ]]
42then
43 echo "Wrong argument length. Expecting at least 2 argument representing dexdeps path, output path, followed by a list of jar or apk files in the Mainline module."
44else
45 genUsedByList "$@"
46fi