github.com/shranet/mobile@v0.0.0-20200814083559-5702cdcd481b/internal/binres/testdata/gen.sh (about)

     1  #! /usr/bin/env bash
     2  
     3  # version of build-tools tests run against
     4  AAPT=${ANDROID_HOME}/build-tools/23.0.1/aapt
     5  
     6  # minimum version of android api for resource identifiers supported
     7  APIJAR=${ANDROID_HOME}/platforms/android-15/android.jar
     8  
     9  for f in *.xml; do
    10  	RES=""
    11  	if [ -d "${f:0:-4}-res" ]; then
    12  		RES="-S ${f:0:-4}-res"
    13  	fi
    14  	cp "$f" AndroidManifest.xml
    15  	"$AAPT" p -M AndroidManifest.xml $RES -I "$APIJAR" -F tmp.apk
    16  	unzip -qq -o tmp.apk AndroidManifest.xml resources.arsc
    17  	mv AndroidManifest.xml "${f:0:-3}bin"
    18  	mv resources.arsc "${f:0:-3}arsc"
    19  	rm tmp.apk
    20  done