Skip to content

Instantly share code, notes, and snippets.

@koumaza
Last active December 11, 2020 21:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koumaza/6e1d10d89be967fa05ae4b3a31ddcefb to your computer and use it in GitHub Desktop.
Save koumaza/6e1d10d89be967fa05ae4b3a31ddcefb to your computer and use it in GitHub Desktop.
Android_Dependencies to Manifest.xml
#!/usr/bin/env fish
set -gx srcdepend (echo $argv|awk '{print $1}')
set -gx spdoutput (echo $argv|awk '{print $2}')
if cat $srcdepend|jq . > /dev/null
if test -e "$spdoutput"
while true
echo -e "$spdoutput"' is exiting!'\n'Overwriting?'
read ugoto -p "echo -e 'Y/N > '"
if test $ugoto = N -o $ugoto = n
read spdoutput -p "echo -e 'Enter FileName > '"
echo -n > $spdoutput
set -gx outputfile $spdoutput
break
end
if test $ugoto = Y -o $ugoto = y
echo -n > $spdoutput
break
end
end
else
if test -z "$spdoutput"
set -gx spdoutput output.xml
echo -n > $spdoutput
end
end
for n in (seq 0 (math (cat $srcdepend|jq '.|length') - 1))
set imrepo (cat $srcdepend|jq -r .[$n].repository)
set impath (cat $srcdepend|jq -r .[$n].target_path)
set imbrnc (cat $srcdepend|jq -r .[$n].branch)
set imrmte (cat $srcdepend|jq -r .[$n].remote)
echo "<project path=\"$impath\" name=\"$imrepo\" remote=\"$imrmte\" revision=\"$imbrnc\" />" >> $spdoutput
end
echo -e Output Completed!\nSee \"$spdoutput\"
end

Example

./ad2mf.sh aosp.dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment