-
Notifications
You must be signed in to change notification settings - Fork 6
/
run-gradle-android.sh
81 lines (67 loc) · 2.64 KB
/
run-gradle-android.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
# Copyright (c) 2015 noboru-i
# https://github.com/noboru-i/android-saddler-sample/blob/master/scripts/saddler.sh
echo "********************"
echo "* install gems *"
echo "********************"
gem install --no-document checkstyle_filter-git saddler saddler-reporter-github findbugs_translate_checkstyle_format android_lint_translate_checkstyle_format pmd_translate_checkstyle_format
if [ $? -ne 0 ]; then
echo 'Failed to install gems.'
exit 1
fi
echo "********************"
echo "* exec gradle *"
echo "********************"
./gradlew app:check
if [ $? -ne 0 ]; then
echo 'Failed gradle check task.'
exit 1
fi
echo "********************"
echo "* save outputs *"
echo "********************"
LINT_RESULT_DIR="$CIRCLE_ARTIFACTS/lint"
mkdir "$LINT_RESULT_DIR"
cp -v "app/build/reports/checkstyle/checkstyle.xml" "$LINT_RESULT_DIR/"
cp -v "app/build/reports/findbugs/findbugs.xml" "$LINT_RESULT_DIR/"
cp -v "app/build/outputs/lint-results.xml" "$LINT_RESULT_DIR/"
if [ -z "${CI_PULL_REQUEST}" ]; then
# when not pull request
REPORTER=Saddler::Reporter::Github::CommitReviewComment
else
REPORTER=Saddler::Reporter::Github::PullRequestReviewComment
fi
echo "********************"
echo "* checkstyle *"
echo "********************"
cat app/build/reports/checkstyle/checkstyle.xml \
| checkstyle_filter-git diff origin/master \
| saddler report --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* findbugs *"
echo "********************"
cat app/build/reports/findbugs/findbugs.xml \
| findbugs_translate_checkstyle_format translate \
| checkstyle_filter-git diff origin/master \
| saddler report --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* PMD *"
echo "********************"
cat app/build/reports/pmd/pmd.xml \
| pmd_translate_checkstyle_format translate \
| checkstyle_filter-git diff origin/master \
| saddler report --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* PMD-CPD *"
echo "********************"
cat app/build/reports/pmd/cpd.xml \
| pmd_translate_checkstyle_format translate --cpd-translate \
| checkstyle_filter-git diff origin/master \
| saddler report --require saddler/reporter/github --reporter $REPORTER
echo "********************"
echo "* android lint *"
echo "********************"
cat app/build/outputs/lint-results.xml \
| android_lint_translate_checkstyle_format translate \
| checkstyle_filter-git diff origin/master \
| saddler report --require saddler/reporter/github --reporter $REPORTER