This repository was archived by the owner on Jan 27, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·58 lines (45 loc) · 1.38 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·58 lines (45 loc) · 1.38 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
mvn -B install -DskipTests
BASE_DIR=$(pwd)
ROOT_DIR=$(mktemp -d -t speedy-XXXXXXXXXX)
SPEEDY_VERSION=`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`
cp -r examples/multi-module $ROOT_DIR/partial
pushd $ROOT_DIR
cd partial
JAVA_FILE="src/main/java/io/committed/multimodule/Example.java"
FORMATTED_JAVA_FILE=$ROOT_DIR/partial/child/$JAVA_FILE
BASE_JAVA_FILE=$BASE_DIR/examples/multi-module/child/$JAVA_FILE
git init
git config user.email "you@example.com"
git config user.name "Your Name"
git add .
git commit -m initial
# insert incorrect formatting
tmpfile=$(mktemp)
sed 's/;/ ;/g' $FORMATTED_JAVA_FILE >"$tmpfile" && mv "$tmpfile" $FORMATTED_JAVA_FILE
# ensure the formatting is now incorrect
diff $FORMATTED_JAVA_FILE $BASE_JAVA_FILE
error=$?
if [ $error -eq 0 ]
then
echo "Formatting search and replace failed"
exit 1
fi
git add .
# run formatter from child module
pushd child
mvn -X "io.committed:speedy-spotless-maven-plugin:${SPEEDY_VERSION}:staged"
popd
echo $ROOT_DIR
popd
diff $FORMATTED_JAVA_FILE $BASE_JAVA_FILE
error=$?
if [ $error -eq 0 ]
then
echo "Pass: $FORMATTED_JAVA_FILE and $BASE_JAVA_FILE are the same"
exit 0
else
echo "Fail: $FORMATTED_JAVA_FILE and $BASE_JAVA_FILE are not the same!"
echo "speedy-spotless:staged did not apply formatting on Example.java correctly. Check the diff above for more information."
exit 1
fi