Forked from J-Swift/generate_android_sources.sh
Last active
September 30, 2017 07:47
-
-
Save wolkenschieber/d3c50d378b7981b816606c67c3323fff to your computer and use it in GitHub Desktop.
Revisions
-
wolkenschieber revised this gist
Sep 30, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,6 +52,8 @@ package_sources() { maybe_install_sources() { local -r zip_name="${1}" cp "${zip_name}" "${CUR_DIR}/" local -r sources_dir="${ANDROID_HOME}/sources" local -r target_path="${sources_dir}/android-${API_LEVEL}" @@ -62,8 +64,6 @@ maybe_install_sources() { local -r zip_path="${CUR_DIR}/${zip_name}" if [ -f "${zip_path}" ]; then echo "WARN: nevermind, file exists [${zip_path}] skipping..." fi else unzip "${zip_name}" -d "${sources_dir}" @@ -83,7 +83,7 @@ main() { package_sources "${zip_name}" maybe_install_sources "${zip_name}" teardown } main -
wolkenschieber revised this gist
Sep 30, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,7 +83,7 @@ main() { package_sources "${zip_name}" maybe_install_sources "${zip_name}" #teardown } main -
wolkenschieber revised this gist
Sep 30, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ package_sources() { cat development/build/tools/mk_sources_zip.py | sed -e "s/TOP_FOLDER = .*/TOP_FOLDER = \"android-${API_LEVEL}\"/" > my_mk_sources_zip.py # Run the script to create android-26-sources.zip python2 my_mk_sources_zip.py -z source.properties "${zip_name}" . } maybe_install_sources() { -
wolkenschieber revised this gist
Sep 30, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ set -euo pipefail readonly GIT_BRANCH='android-8.0.0_r12' readonly API_LEVEL='26' readonly ANDROID_HOME='/mnt/Storage/android/androidSDK' ########### # Helpers # -
wolkenschieber revised this gist
Sep 30, 2017 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ #!/usr/bin/env bash set -euo pipefail ########## # Config # ########## readonly GIT_BRANCH='android-8.0.0_r12' readonly API_LEVEL='26' ########### -
J-Swift created this gist
Sep 15, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,88 @@ #!/usr/bin/env sh set -euo pipefail ########## # Config # ########## readonly GIT_BRANCH='android-8.0.0_r4' readonly API_LEVEL='26' ########### # Helpers # ########### readonly CUR_DIR=$( pwd ) readonly WORKING_DIR=$( mktemp -d ) setup() { pushd ${WORKING_DIR} mkdir -p frameworks/base } teardown() { popd rm -rf "${WORKING_DIR}" } fetch_sources() { local -r target_branch="${1}" # Fetch repositories that contain the sources we're interested in git clone --depth 1 https://android.googlesource.com/platform/frameworks/base -b "${target_branch}" frameworks/base git clone --depth 1 https://android.googlesource.com/platform/libcore -b "${target_branch}" git clone --depth 1 https://android.googlesource.com/platform/development -b "${target_branch}" } package_sources() { local -r zip_name="${1}" # Create a basic source.properties file echo -e "Pkg.UserSrc=false\nPkg.Revision=1\nAndroidVersion.ApiLevel=${API_LEVEL}" > source.properties # Modify the script to create a sources ZIP to use "android-26" as top-level directory cat development/build/tools/mk_sources_zip.py | sed -e "s/TOP_FOLDER = .*/TOP_FOLDER = \"android-${API_LEVEL}\"/" > my_mk_sources_zip.py # Run the script to create android-26-sources.zip python my_mk_sources_zip.py -z source.properties "${zip_name}" . } maybe_install_sources() { local -r zip_name="${1}" local -r sources_dir="${ANDROID_HOME}/sources" local -r target_path="${sources_dir}/android-${API_LEVEL}" if [ -d "${target_path}" ]; then echo "" echo "WARN: directory exists [${target_path}] copying instead..." local -r zip_path="${CUR_DIR}/${zip_name}" if [ -f "${zip_path}" ]; then echo "WARN: nevermind, file exists [${zip_path}] skipping..." else cp "${zip_name}" "${CUR_DIR}/" fi else unzip "${zip_name}" -d "${sources_dir}" fi } ############### # DO WORK SON # ############### main() { local -r zip_name="android-${API_LEVEL}-sources.zip" setup fetch_sources "${GIT_BRANCH}" package_sources "${zip_name}" maybe_install_sources "${zip_name}" teardown } main