Skip to content

Commit 877c016

Browse files
committed
Issue #529: Deprecate launch.groovy and merge functionality into diff.groovy
1 parent 24731e5 commit 877c016

File tree

7 files changed

+1066
-43
lines changed

7 files changed

+1066
-43
lines changed

.ci/travis.sh

+66-1
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ patch-diff-report-tool)
3434
checkstyle-tester-launch-groovy)
3535
checkout_from https://github.com/checkstyle/checkstyle
3636
cd .ci-temp/checkstyle
37+
LOCAL_GIT_REPO=$(pwd)
3738
mvn --batch-mode clean install -Passembly
3839
cd ../../checkstyle-tester
39-
groovy launch.groovy -l projects-for-travis.properties -c my_check.xml -i
40+
groovy diff.groovy -r "$LOCAL_GIT_REPO" -l projects-for-travis.properties --patchConfig my_check.xml \
41+
--patchBranch master --mode single --allowExcludes
4042
;;
4143

4244
checkstyle-tester-diff-groovy-patch)
@@ -69,6 +71,69 @@ checkstyle-tester-diff-groovy-patch-only)
6971
-pc my_check.xml -p patch-branch -r ../.ci-temp/checkstyle -m single
7072
;;
7173

74+
checkstyle-tester-diff-groovy-regression-single)
75+
# Check out lateset checkstyle from master
76+
checkout_from https://github.com/checkstyle/checkstyle
77+
78+
# Run report from master branch of contribution
79+
checkout_from https://github.com/checkstyle/contribution
80+
cd .ci-temp/contribution/checkstyle-tester
81+
sed -i'' 's/^guava/#guava/' projects-to-test-on.properties
82+
sed -i'' 's/#checkstyle|/checkstyle|/' projects-to-test-on.properties
83+
export MAVEN_OPTS="-Xmx2048m"
84+
groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \
85+
-pc ../../../checkstyle-tester/diff-groovy-regression-config.xml \
86+
-r ../../checkstyle \
87+
-m single -p master
88+
89+
# Run report with current branch
90+
cd ../../../checkstyle-tester/
91+
sed -i'' 's/^guava/#guava/' projects-to-test-on.properties
92+
sed -i'' 's/#checkstyle|/checkstyle|/' projects-to-test-on.properties
93+
rm -rf reports repositories
94+
groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \
95+
-pc diff-groovy-regression-config.xml -r ../.ci-temp/checkstyle/ \
96+
-m single -p master
97+
98+
cd ..
99+
# We need to ignore file paths below, since they will be different between reports
100+
diff -I "contribution" checkstyle-tester/reports/diff/checkstyle/index.html \
101+
.ci-temp/contribution/checkstyle-tester/reports/diff/checkstyle/index.html
102+
;;
103+
104+
checkstyle-tester-diff-groovy-regression)
105+
# Check out latest checkstyle from master
106+
checkout_from https://github.com/checkstyle/checkstyle
107+
cd .ci-temp/checkstyle
108+
MASTER_BRANCH_SHA=$(git log -n 1 --pretty=format:"%H")
109+
cd ../..
110+
111+
# Run report from master branch of contribution
112+
checkout_from https://github.com/checkstyle/contribution
113+
cd .ci-temp/contribution/checkstyle-tester
114+
sed -i'' 's/^guava/#guava/' projects-to-test-on.properties
115+
sed -i'' 's/#checkstyle|/checkstyle|/' projects-to-test-on.properties
116+
export MAVEN_OPTS="-Xmx2048m"
117+
groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \
118+
-c ../../../checkstyle-tester/diff-groovy-regression-config.xml \
119+
-r ../../checkstyle \
120+
-b "$MASTER_BRANCH_SHA" -p 7190c47ca5515ad8cb827bc4065ae7664d2766c1
121+
122+
# Run report with current branch
123+
cd ../../../checkstyle-tester/
124+
sed -i'' 's/^guava/#guava/' projects-to-test-on.properties
125+
sed -i'' 's/#checkstyle|/checkstyle|/' projects-to-test-on.properties
126+
rm -rf reports repositories
127+
groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \
128+
-c diff-groovy-regression-config.xml -r ../.ci-temp/checkstyle/ \
129+
-b "$MASTER_BRANCH_SHA" -p 7190c47ca5515ad8cb827bc4065ae7664d2766c1
130+
131+
cd ..
132+
# We need to ignore file paths below, since they will be different between reports
133+
diff -I "contribution" checkstyle-tester/reports/diff/checkstyle/index.html \
134+
.ci-temp/contribution/checkstyle-tester/reports/diff/checkstyle/index.html
135+
;;
136+
72137
codenarc)
73138
cd checkstyle-tester
74139
./codenarc.sh . diff.groovy > diff.log && cat diff.log && grep '(p1=0; p2=0; p3=0)' diff.log

.travis.yml

+10
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ matrix:
4444
- DESC="checkstyle-tester (diff.groovy) on linux with enabled patchOnly"
4545
- CMD="./.ci/travis.sh checkstyle-tester-diff-groovy-patch-only"
4646

47+
- jdk: openjdk8
48+
env:
49+
- DESC="checkstyle-tester (diff.groovy) regression on linux in single mode"
50+
- CMD="./.ci/travis.sh checkstyle-tester-diff-groovy-regression-single"
51+
52+
- jdk: openjdk8
53+
env:
54+
- DESC="checkstyle-tester (diff.groovy) regression on linux with master specified"
55+
- CMD="./.ci/travis.sh checkstyle-tester-diff-groovy-regression"
56+
4757
# disabled till https://github.com/checkstyle/contribution/issues/448
4858
# - jdk: openjdk8
4959
# env:

appveyor.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ environment:
8383
CMD3: " && cd checkstyle && git checkout -b patch-branch"
8484
CMD4: " "
8585
CMD5: " && cd ..\\checkstyle-tester "
86-
CMD6: " && groovy diff.groovy -l projects-for-travis.properties -c my_check.xml -b master -p patch-branch -r C:\\projects\\contribution\\checkstyle -i -s"
86+
CMD6: " && groovy diff.groovy -l projects-for-travis.properties -c my_check.xml -b master -p patch-branch -r C:\\projects\\contribution\\checkstyle -s"
8787
- JAVA_HOME: C:\Program Files\Java\jdk1.8.0
8888
DESC: "checkstyle-tester (diff.groovy with base and patch configs) on guava"
8989
CMD1: " git clone -q --depth=10 --branch=master "
9090
CMD2: " https://github.com/checkstyle/checkstyle C:\\projects\\contribution\\checkstyle "
9191
CMD3: " && cd checkstyle && git checkout -b patch-branch"
9292
CMD4: " "
9393
CMD5: " && cd ..\\checkstyle-tester "
94-
CMD6: " && groovy diff.groovy -l projects-for-travis.properties -bc my_check.xml -pc my_check.xml -b master -p patch-branch -r C:\\projects\\contribution\\checkstyle -i -s"
94+
CMD6: " && groovy diff.groovy -l projects-for-travis.properties -bc my_check.xml -pc my_check.xml -b master -p patch-branch -r C:\\projects\\contribution\\checkstyle -s"
9595

9696
build_script:
9797
- ps: >

checkstyle-tester/LAUNCH_GROOVY_README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# _LAUNCH.GROOVY IS BEING DEPRECATED!!!_
2+
13
# launch.groovy
24

35
Checkstyle report generation

checkstyle-tester/README.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ you may require other tools like Git or Mericural, for Git and HG repositories r
2626

2727
`diff.groovy` supports the following command line arguments:
2828

29-
**localGitRepo** (r) - path to the local Checkstyle repository (required);
29+
**localGitRepo** (r) - path to the local Checkstyle repository (required in diff mode);
3030

3131
**baseBranch** (b) - name of the base branch in local Checkstyle repository
3232
(optional, if absent, then the tool will use only patchBranch in case the tool
@@ -42,7 +42,7 @@ will finish the execution with the error.
4242
You must specify 'patchBranch' and 'patchConfig' if the mode is 'single', and 'baseBranch',
4343
'baseConfig', 'patchBranch', and 'patchConfig' if the mode is 'diff');
4444

45-
**patchBranch** (p) - name of the branch with your changes (required);
45+
**patchBranch** (p) - name of the branch with your changes (required in diff mode);
4646

4747
**baseConfig** (bc) - path to the base checkstyle configuration file.
4848
It will be applied to base branch (required if patchConfig is specified);
@@ -65,6 +65,24 @@ This option is useful for Windows users where they are restricted to maximum dir
6565
to maven during the Checkstyle regression run. For example, if you want to skip site generation, you
6666
would add `--extraMvnRegressionOptions "-Dmaven.site.skip=true"` to `diff.groovy` execution.
6767

68+
**failsOnError** (f) - this option tells maven to fail if a checkstyle error is encountered during
69+
report generation. This means that your configuration uses the
70+
`<property name="severity" value="warning"/>` property. If Checkstyle reports a violation for any of the projects
71+
that are being tested, the report generation will fail. This option is good for usage in Checkstyle CI for
72+
no-error testing (optional, default is false).
73+
74+
**allowExcludes** (g) - this option tells `diff.groovy` to allow paths and files defined in the file specified for
75+
the `--listOfProjects (-l)` argument to be excluded from report generation (optional, default is false). This option is
76+
used for files that are not compilable or that Checkstyle cannot parse.
77+
78+
**checkstyleVersion** (cv) - used to set the Checkstyle version to be used by maven during report
79+
generation; this option should only be used in continuous integration testing for satellite projects
80+
in single mode. (optional, default is the latest snapshot).
81+
82+
**sevntuVersion** (sv) - used to set the Sevntu-Checkstyle version to be used by maven during
83+
report generation; this option should only be used in continuous integration testing for satellite projects in single
84+
mode. (optional, default is the latest release).
85+
6886
## Outputs
6987

7088
When the script finishes its work the following directory structure will be created

0 commit comments

Comments
 (0)