-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathin
executable file
·42 lines (32 loc) · 975 Bytes
/
in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/bash -eu
set -o pipefail
DEST_DIR="$1"
echo "DEST_DIR is $DEST_DIR [$1]" >&2
GIT_DEST_DIR="$(mktemp -d -t git-resource-destination.XXXXXX)"
/opt/resource/git/in "$GIT_DEST_DIR"
cd "$GIT_DEST_DIR"
[[ -f build.gradle ]] || { echo "There is no build.gradle in the project root" >&2; exit 1; }
[[ -x gradlew ]] || { echo "There is no gradle wrapper in the project root" >&2; exit 1; }
cat >>build.gradle <<-EOF
allprojects {
task __cacheDependencies << {
def ignore = [
'apiElements',
'implementation',
'runtimeElements',
'runtimeOnly',
'testImplementation',
'testRuntimeOnly'
]
configurations.forEach {
println "Config: " + it
if( !ignore.contains(it.name) ){
it.files
}
}
}
}
EOF
./gradlew __cacheDependencies >&2
cp -a ~/.gradle "$DEST_DIR/"
echo "Cached $(du -hs "$DEST_DIR/" | cut -f 1) in $(find "$DEST_DIR/" -type f | wc -l) files" >&2