Skip to content

Instantly share code, notes, and snippets.

@ktnr74
Created September 10, 2016 16:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ktnr74/d402b6a083f63e0bb4398231e3cfd68d to your computer and use it in GitHub Desktop.
Save ktnr74/d402b6a083f63e0bb4398231e3cfd68d to your computer and use it in GitHub Desktop.
Download all available source code jars for com.android.support.appcompat-v7 package
#!/bin/bash
GOOGLE_SOURCE_URL="https://android.googlesource.com"
REPO="platform/prebuilts/maven_repo/android"
BRANCH="+/master"
PACKAGE="com/android/support/appcompat-v7"
XPATH="/metadata/versioning/versions/version/text()"
GetGoogleSourceFile () {
curl -s --compressed -G -d "format=text" --url "$4/$3/$2/$1" | base64 -d
}
Download () {
GetGoogleSourceFile $PACKAGE/$1 $BRANCH $REPO $GOOGLE_SOURCE_URL
}
for VER in $(Download maven-metadata.xml | xmlstarlet sel -t -v $XPATH); do
for JAR in $(Download $VER/ | awk '/-sources\.jar$/{print $4}'); do
Download $VER/$JAR >$JAR
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment