Skip to content

Commit 011619a

Browse files
authored
Keep tracked files when cljd init runs in a fresh checkout (#1089)
1 parent f3229af commit 011619a

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

script/test/cljd

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ set -eo pipefail
44

55
if [ ! -f pubspec.yaml ]; then
66
echo 'Initializing ClojureDart project'
7-
clojure -M:cljd init
8-
# drop the generated sample test, only sci tests should run
9-
rm -f test/sci_test.dart
7+
# init runs dart create --force, which overwrites these tracked files
8+
kept=(README.md CHANGELOG.md .gitignore)
9+
saved=$(mktemp -d)
10+
cp "${kept[@]}" "$saved"
11+
restore() { for f in "${kept[@]}"; do cp "$saved/$f" "$f"; done; rm -rf "$saved"; }
12+
clojure -M:cljd init || { restore; exit 1; }
13+
restore
14+
# drop the generated sample test, only sci tests should run. dart create
15+
# names it after the checkout directory.
16+
rm -f "test/$(basename "$PWD" | tr '[:upper:]-' '[:lower:]_')_test.dart"
1017
fi
1118

1219
# Test namespaces that compile and pass on ClojureDart. Extend this list as

0 commit comments

Comments
 (0)