ic-mops 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## 0.44.0
6
+ - Optimized toolchain `moc` resolving (~30% faster builds).
7
+
5
8
  ## 0.43.0
6
9
  - Add `mops cache show` command
7
10
  - Fix github legacy deps install
@@ -1,3 +1,40 @@
1
1
  #!/bin/bash
2
- mocPath="$(mops toolchain bin moc --fallback)"
3
- $mocPath "$@"
2
+
3
+ # set -e
4
+
5
+ findRootDir() {
6
+ dir="$(pwd)"
7
+ while [[ "$dir" != "" && ! -e "$dir/mops.toml" ]]; do
8
+ dir=${dir%/*}
9
+ done
10
+ echo "$dir"
11
+ }
12
+
13
+ rootDir=$(findRootDir)
14
+ mopsToml="$rootDir/mops.toml"
15
+
16
+ if [[ $rootDir == "" ]] || [[ ! -f $mopsToml ]]; then
17
+ echo "mops.toml not found in $rootDir or its parent directories"
18
+ exit 1;
19
+ fi;
20
+
21
+ if command -v openssl &> /dev/null; then
22
+ mopsTomlHash=$(openssl sha256 $mopsToml | awk -F'= ' '{print $2}')
23
+ else
24
+ mopsTomlHash=$(shasum $mopsToml -a 256 | awk -F' ' '{print $1}')
25
+ fi;
26
+
27
+ cached="$rootDir/.mops/moc-$mopsTomlHash"
28
+
29
+ if [ -f $cached ]; then
30
+ mocPath=$(cat $cached)
31
+ if [[ "$mocPath" != *"/moc" ]] ; then
32
+ mocPath="$(mops toolchain bin moc --fallback)"
33
+ echo -n $mocPath > "$cached"
34
+ fi;
35
+ else
36
+ mocPath="$(mops toolchain bin moc --fallback)"
37
+ echo -n $mocPath > "$cached"
38
+ fi;
39
+
40
+ $mocPath "$@"