Skip to content
Permalink
Browse files

Use new checksum script to generate cache for all build.gradle files

  • Loading branch information...
chrisbanes committed Jun 8, 2018
1 parent 9d3d938 commit c1219aeee9f62600fcd43d7caf1ea21e6e92930f
Showing with 32 additions and 3 deletions.
  1. +9 −3 .circleci/config.yml
  2. +23 −0 checksum.sh
@@ -31,8 +31,11 @@ jobs:
- run:
<<: *update_sdk
- checkout
- run:
name: Generate cache key
command: ./checksum.sh /tmp/checksum.txt
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
key: gradle-{{ checksum "/tmp/checksum.txt" }}
- run:
name: Download Dependencies
command: ./gradlew dependencies
@@ -49,7 +52,7 @@ jobs:
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
key: gradle-{{ checksum "/tmp/checksum.txt" }}
- store_artifacts:
path: app/build/outputs/apk
destination: apks
@@ -72,8 +75,11 @@ jobs:
- run:
<<: *update_sdk
- checkout
- run:
name: Generate cache key
command: ./checksum.sh /tmp/checksum.txt
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
key: gradle-{{ checksum "/tmp/checksum.txt" }}
- attach_workspace:
at: ~/tivi
- run:
@@ -0,0 +1,23 @@
#!/bin/bash
RESULT_FILE=$1

if [ -f $RESULT_FILE ]; then
rm $RESULT_FILE
fi
touch $RESULT_FILE

checksum_file() {
echo `openssl md5 $1 | awk '{print $2}'`
}

FILES=()
while read -r -d ''; do
FILES+=("$REPLY")
done < <(find . -name 'build.gradle' -type f -print0)

# Loop through files and append MD5 to result file
for FILE in ${FILES[@]}; do
echo `checksum_file $FILE` >> $RESULT_FILE
done
# Now sort the file so that it is
sort $RESULT_FILE -o $RESULT_FILE

0 comments on commit c1219ae

Please sign in to comment.
You can’t perform that action at this time.