File tree 1 file changed +20
-0
lines changed 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,29 @@ LANGUAGE=$1
11
11
CLIENT=$2
12
12
GENERATOR=" $1 -$2 "
13
13
14
+ compute_hash () {
15
+ cacheSpec=$( find specs/$CLIENT -type f -print0 | xargs -0 sha1sum | sha1sum | tr -d ' ' )
16
+ cacheCommon=$( find specs/common -type f -print0 | xargs -0 sha1sum | sha1sum | tr -d ' ' )
17
+ echo " $cacheSpec$cacheCommon "
18
+ }
19
+
14
20
# build spec before generating client
15
21
build_spec () {
22
+ # check if file and cache exist
23
+ cacheFile=" specs/dist/$CLIENT .cache"
24
+ if [[ -f specs/dist/$CLIENT .yml ]]; then
25
+ cache=$( compute_hash)
26
+ # compare with stored cache
27
+ if [[ -f $cacheFile && $( cat $cacheFile ) == $cache ]]; then
28
+ echo " > Skipped building spec because the files did not change..."
29
+ return
30
+ fi
31
+ fi
16
32
yarn build:specs $CLIENT
33
+
34
+ # store hash
35
+ cache=$( compute_hash)
36
+ echo $cache > $cacheFile
17
37
}
18
38
19
39
# Run the pre generation script if it exists.
You can’t perform that action at this time.
0 commit comments