This is an automated email from the ASF dual-hosted git repository.
jlewandowski pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new ad26ffcd57 Run checks in a separate task and fix build warnings
ad26ffcd57 is described below
commit ad26ffcd577a09c07fe92bd3ce78ee33dfe0a191
Author: Jacek Lewandowski <[email protected]>
AuthorDate: Mon Jul 17 12:22:33 2023 +0200
Run checks in a separate task and fix build warnings
Patch by Jacek Lewandowski; reviewed by Mick Semb Wever and Stefan
Miklosovic for CASSANDRA-18618
---
.build/build-artifacts.sh | 2 +-
.build/build-checkstyle.xml | 62 ++++++++++++++++++
.build/build-jars.sh | 2 +-
.build/build-rat.xml | 6 +-
.build/build-resolver.xml | 2 +-
.build/check-code.sh | 2 +-
.build/docker/_build-redhat.sh | 2 +-
.build/run-tests.sh | 2 +-
.circleci/config.yml | 12 ++--
.circleci/config.yml.FREE | 12 ++--
.circleci/config.yml.PAID | 12 ++--
.circleci/config_11_and_17.yml | 12 ++--
.circleci/config_11_and_17.yml.FREE | 12 ++--
.circleci/config_11_and_17.yml.PAID | 12 ++--
.circleci/config_template.yml | 12 ++--
.circleci/config_template_11_and_17.yml | 12 ++--
build.xml | 74 +++++++---------------
.../cassandra/anttasks/SetSystemProperty.java | 62 ++++++++++++++++++
18 files changed, 205 insertions(+), 107 deletions(-)
diff --git a/.build/build-artifacts.sh b/.build/build-artifacts.sh
index 9ae577606f..a1fe16399a 100755
--- a/.build/build-artifacts.sh
+++ b/.build/build-artifacts.sh
@@ -24,5 +24,5 @@ command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be
installed"; exit 1
[ -f "${CASSANDRA_DIR}/build.xml" ] || { echo >&2 "${CASSANDRA_DIR}/build.xml
must exist"; exit 1; }
# execute
-ant -f "${CASSANDRA_DIR}/build.xml" artifacts -Dno-checkstyle=true
-Drat.skip=true -Dant.gen-doc.skip=true
+ant -f "${CASSANDRA_DIR}/build.xml" artifacts -Dant.gen-doc.skip=true
-Dcheck.skip=true
exit $?
diff --git a/.build/build-checkstyle.xml b/.build/build-checkstyle.xml
new file mode 100644
index 0000000000..01a4b1ea0e
--- /dev/null
+++ b/.build/build-checkstyle.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+ <project basedir="." name="apache-cassandra-checkstyle"
+ xmlns:rat="antlib:org.apache.rat.anttasks">
+
+ <target name="init-checkstyle"
depends="resolver-retrieve-build,build-project" unless="no-checkstyle">
+ <echo message="checkstyle.version=${checkstyle.version}"/>
+ <!-- Sevntu custom checks are retrieved by Ivy into lib folder
+ and will be accessible to checkstyle-->
+ <taskdef
resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
+ classpathref="checkstyle.classpath"/>
+ </target>
+
+ <target name="checkstyle" depends="init-checkstyle,build-project"
description="Run custom checkstyle code analysis" unless="no-checkstyle">
+ <property name="checkstyle.log.dir" value="${build.dir}/checkstyle" />
+ <property name="checkstyle.report.file"
value="${checkstyle.log.dir}/checkstyle_report.xml"/>
+ <mkdir dir="${checkstyle.log.dir}" />
+
+ <property name="checkstyle.properties"
value="${build.helpers.dir}/checkstyle.xml" />
+ <property name="checkstyle.suppressions"
value="${build.helpers.dir}/checkstyle_suppressions.xml" />
+ <checkstyle config="${checkstyle.properties}"
+ failureProperty="checkstyle.failure"
+ failOnViolation="true">
+ <formatter type="plain"/>
+ <formatter type="xml" tofile="${checkstyle.report.file}"/>
+ <fileset dir="${build.src.java}" includes="**/*.java"/>
+ </checkstyle>
+ </target>
+
+ <target name="checkstyle-test"
depends="init-checkstyle,resolver-retrieve-build,build-project"
description="Run custom checkstyle code analysis on tests"
unless="no-checkstyle">
+ <property name="checkstyle.log.dir" value="${build.dir}/checkstyle" />
+ <property name="checkstyle_test.report.file"
value="${checkstyle.log.dir}/checkstyle_report_test.xml"/>
+ <mkdir dir="${checkstyle.log.dir}" />
+
+ <property name="checkstyle_test.properties"
value="${build.helpers.dir}/checkstyle_test.xml" />
+ <property name="checkstyle.suppressions"
value="${build.helpers.dir}/checkstyle_suppressions.xml" />
+ <checkstyle config="${checkstyle_test.properties}"
+ failureProperty="checkstyle.failure"
+ failOnViolation="true">
+ <formatter type="plain"/>
+ <formatter type="xml" tofile="${checkstyle_test.report.file}"/>
+ <fileset dir="${test.dir}" includes="**/*.java"/>
+ </checkstyle>
+ </target>
+
+</project>
diff --git a/.build/build-jars.sh b/.build/build-jars.sh
index bce912a5ef..cd60e5a130 100755
--- a/.build/build-jars.sh
+++ b/.build/build-jars.sh
@@ -26,5 +26,5 @@ command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be
installed"; exit 1
[ -f "${CASSANDRA_DIR}/build.xml" ] || { echo >&2 "${CASSANDRA_DIR}/build.xml
must exist"; exit 1; }
# execute
-ant -f "${CASSANDRA_DIR}/build.xml" jar -Dno-checkstyle=true -Drat.skip=true
-Dant.gen-doc.skip=true -Dno-javadoc=true
+ant -f "${CASSANDRA_DIR}/build.xml" jar
exit $?
diff --git a/.build/build-rat.xml b/.build/build-rat.xml
index dcb3b0681d..601b4a0a54 100644
--- a/.build/build-rat.xml
+++ b/.build/build-rat.xml
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project basedir="." name="apache-cassandra--rat-tasks"
+<project basedir="." name="apache-cassandra-rat-tasks"
xmlns:rat="antlib:org.apache.rat.anttasks">
<!--
@@ -37,7 +37,7 @@
</condition>
</target>
- <target name="_rat_copy_versioned_files" depends="_build_ratinclude"
unless="${rat.skip}">
+ <target name="_rat_copy_versioned_files" depends="_build_ratinclude"
unless="rat.skip">
<copy file="${build.dir}/.versioned_files"
tofile="${build.dir}/.ratinclude">
<filterchain>
<linecontainsregexp>
@@ -47,7 +47,7 @@
</copy>
</target>
- <target name="rat-check" depends="_rat_copy_versioned_files"
unless="${rat.skip}" description="License checks on source" >
+ <target name="rat-check" depends="_rat_copy_versioned_files"
unless="rat.skip" description="License checks on source" >
<rat:report reportFile="${build.dir}/rat.txt">
<fileset dir="." includesfile="${build.dir}/.ratinclude">
<!-- Config files with not much creativity -->
diff --git a/.build/build-resolver.xml b/.build/build-resolver.xml
index bd1f2f1ae2..708d716662 100644
--- a/.build/build-resolver.xml
+++ b/.build/build-resolver.xml
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project basedir="." name="apache-cassandra--resolver-tasks"
+<project basedir="." name="apache-cassandra-resolver-tasks"
xmlns:resolver="antlib:org.apache.maven.resolver.ant"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
diff --git a/.build/check-code.sh b/.build/check-code.sh
index 662f5e337f..d3baec45d9 100755
--- a/.build/check-code.sh
+++ b/.build/check-code.sh
@@ -24,5 +24,5 @@ command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be
installed"; exit 1
[ -f "${CASSANDRA_DIR}/build.xml" ] || { echo >&2 "${CASSANDRA_DIR}/build.xml
must exist"; exit 1; }
# execute
-ant -f "${CASSANDRA_DIR}/build.xml" rat-check eclipse-warnings checkstyle
checkstyle-test dependency-check
+ant -f "${CASSANDRA_DIR}/build.xml" check dependency-check
exit $?
diff --git a/.build/docker/_build-redhat.sh b/.build/docker/_build-redhat.sh
index ff02931581..37ca50799a 100755
--- a/.build/docker/_build-redhat.sh
+++ b/.build/docker/_build-redhat.sh
@@ -109,7 +109,7 @@ else
fi
# Artifact will only be used internally for build process and won't be found
with snapshot suffix
-ant artifacts -Drelease=true -Dno-checkstyle=true -Drat.skip=true
-Dant.gen-doc.skip=true -Djavadoc.skip=true
+ant artifacts -Drelease=true -Dant.gen-doc.skip=true -Djavadoc.skip=true
-Dcheck.skip=true
cp ${DIST_DIR}/apache-cassandra-*-src.tar.gz ${RPM_BUILD_DIR}/SOURCES/
# if CASSANDRA_VERSION is -alphaN, -betaN, -rcN, then rpmbuild fails on the
'-' char; replace with '~'
diff --git a/.build/run-tests.sh b/.build/run-tests.sh
index 5e987fbeaf..fd6a7da21d 100755
--- a/.build/run-tests.sh
+++ b/.build/run-tests.sh
@@ -159,7 +159,7 @@ _main() {
# ant test setup
export TMP_DIR="${DIST_DIR}/tmp"
mkdir -p "${TMP_DIR}" || true
- export ANT_TEST_OPTS="-Dno-build-test=true -Dtmp.dir=${TMP_DIR}
-Drat.skip=true -Dno-checkstyle=true -Dno-javadoc=true -Dant.gen-doc.skip=true"
+ export ANT_TEST_OPTS="-Dno-build-test=true -Dtmp.dir=${TMP_DIR}"
# fresh virtualenv and test logs results everytime
[[ "/" == "${DIST_DIR}" ]] || rm -rf "${DIST_DIR}/test/{html,output,logs}"
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 15e81d79d1..e56628a52c 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -4133,7 +4133,7 @@ jobs:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -4151,7 +4151,7 @@ jobs:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -8069,11 +8069,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -9523,11 +9523,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
diff --git a/.circleci/config.yml.FREE b/.circleci/config.yml.FREE
index 15e81d79d1..e56628a52c 100644
--- a/.circleci/config.yml.FREE
+++ b/.circleci/config.yml.FREE
@@ -4133,7 +4133,7 @@ jobs:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -4151,7 +4151,7 @@ jobs:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -8069,11 +8069,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -9523,11 +9523,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
diff --git a/.circleci/config.yml.PAID b/.circleci/config.yml.PAID
index 4dcee96a99..d2c06efac7 100644
--- a/.circleci/config.yml.PAID
+++ b/.circleci/config.yml.PAID
@@ -4133,7 +4133,7 @@ jobs:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -4151,7 +4151,7 @@ jobs:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -8069,11 +8069,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -9523,11 +9523,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
diff --git a/.circleci/config_11_and_17.yml b/.circleci/config_11_and_17.yml
index cc72ded3ae..0c247fbc85 100644
--- a/.circleci/config_11_and_17.yml
+++ b/.circleci/config_11_and_17.yml
@@ -4471,11 +4471,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -5078,7 +5078,7 @@ jobs:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -5096,7 +5096,7 @@ jobs:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -8475,11 +8475,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
diff --git a/.circleci/config_11_and_17.yml.FREE
b/.circleci/config_11_and_17.yml.FREE
index cc72ded3ae..0c247fbc85 100644
--- a/.circleci/config_11_and_17.yml.FREE
+++ b/.circleci/config_11_and_17.yml.FREE
@@ -4471,11 +4471,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -5078,7 +5078,7 @@ jobs:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -5096,7 +5096,7 @@ jobs:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -8475,11 +8475,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
diff --git a/.circleci/config_11_and_17.yml.PAID
b/.circleci/config_11_and_17.yml.PAID
index 284c1516a7..b27b59eb74 100644
--- a/.circleci/config_11_and_17.yml.PAID
+++ b/.circleci/config_11_and_17.yml.PAID
@@ -4471,11 +4471,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -5078,7 +5078,7 @@ jobs:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -5096,7 +5096,7 @@ jobs:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -8475,11 +8475,11 @@ jobs:
fi
no_output_timeout: 15m
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
- persist_to_workspace:
root: /home/cassandra
paths:
diff --git a/.circleci/config_template.yml b/.circleci/config_template.yml
index 5fb8062d23..b1a2d7927f 100644
--- a/.circleci/config_template.yml
+++ b/.circleci/config_template.yml
@@ -1698,7 +1698,7 @@ build_common: &build_common
- log_environment
- clone_cassandra
- build_cassandra
- - run_eclipse_warnings
+ - run_static_code_analysis
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -2937,7 +2937,7 @@ commands:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -2955,7 +2955,7 @@ commands:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -2970,14 +2970,14 @@ commands:
ls -l ~/dtest_jars
no_output_timeout: 15m
- run_eclipse_warnings:
+ run_static_code_analysis:
steps:
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
create_junit_containers:
parameters:
diff --git a/.circleci/config_template_11_and_17.yml
b/.circleci/config_template_11_and_17.yml
index 29b49152fe..ab6d5a2d2f 100644
--- a/.circleci/config_template_11_and_17.yml
+++ b/.circleci/config_template_11_and_17.yml
@@ -1681,7 +1681,7 @@ build_common: &build_common
- log_environment
- clone_cassandra
- build_cassandra
- - run_eclipse_warnings
+ - run_static_code_analysis
- persist_to_workspace:
root: /home/cassandra
paths:
@@ -2903,7 +2903,7 @@ commands:
git clean -fd
# Loop to prevent failure due to maven-ant-tasks not downloading a
jar..
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar
dtest-jar -Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -2921,7 +2921,7 @@ commands:
git checkout origin/$CIRCLE_BRANCH
git clean -fd
for x in $(seq 1 3); do
- ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
+ ${ANT_HOME}/bin/ant realclean; ${ANT_HOME}/bin/ant jar dtest-jar
-Dno-checkstyle=true -Drat.skip=true
RETURN="$?"
if [ "${RETURN}" -eq "0" ]; then
cp build/dtest*.jar ~/dtest_jars
@@ -2936,14 +2936,14 @@ commands:
ls -l ~/dtest_jars
no_output_timeout: 15m
- run_eclipse_warnings:
+ run_static_code_analysis:
steps:
- run:
- name: Run eclipse-warnings
+ name: Run static code analysis
command: |
export PATH=$JAVA_HOME/bin:$PATH
cd ~/cassandra
- ant eclipse-warnings
+ ant check
create_junit_containers:
parameters:
diff --git a/build.xml b/build.xml
index b217781a2e..5c4206d1fc 100644
--- a/build.xml
+++ b/build.xml
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project basedir="." default="jar" name="apache-cassandra"
+<project basedir="." default="check" name="apache-cassandra"
xmlns:if="ant:if"
xmlns:unless="ant:unless">
@@ -397,11 +397,18 @@
<mkdir dir="${jacoco.partials.dir}"/>
<!-- Set up jdk specific properties -->
- <javac includes="**/JdkProperties.java" srcdir="test/anttasks"
destdir="${test.classes}" includeantruntime="true" source="${java.default}"
target="${java.default}">
+ <javac includes="**/JdkProperties.java,**/SetSystemProperty.java"
srcdir="test/anttasks" destdir="${test.classes}" includeantruntime="true"
source="${java.default}" target="${java.default}">
<compilerarg value="-Xlint:-options"/>
</javac>
<taskdef name="JdkProperties"
classname="org.apache.cassandra.anttasks.JdkProperties"
classpath="${test.classes}"/>
+ <taskdef name="SetSystemProperty"
classname="org.apache.cassandra.anttasks.SetSystemProperty"
classpath="${test.classes}"/>
+
<JdkProperties/>
+
+ <!--
https://issues.apache.org/jira/browse/CASSANDRA-16391?focusedCommentId=17310803&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17310803
-->
+ <SetSystemProperty name="jmc5.path" value="/tmp"/>
+ <SetSystemProperty name="jmc6.path" value="/tmp"/>
+ <SetSystemProperty name="visualvm.path" value="/tmp"/>
</target>
<target name="clean" description="Remove all locally created artifacts">
@@ -508,8 +515,7 @@
<!--
The build target builds all the .class files
-->
- <target name="build"
depends="resolver-retrieve-build,build-project,checkstyle" description="Compile
Cassandra classes"/>
- <target name="_build_unsafe"
depends="resolver-retrieve-build,build-project" description="Compile Cassandra
classes without checks"/>
+ <target name="build" depends="resolver-retrieve-build,build-project"
description="Compile Cassandra classes"/>
<target name="codecoverage" depends="jacoco-run,jacoco-report"
description="Create code coverage report"/>
<target name="_build_java">
@@ -541,6 +547,13 @@
<copy todir="${basedir}/conf"
file="${build.classes.main}/META-INF/hotspot_compiler"/>
</target>
+ <target name="check" depends="_main-jar,build-test" description="Verifies
the source code and dependencies. This task is intended to run on pre-commit
and locally. It should verify mostly modified files compared to the upstream
base branch." unless="check.skip">
+ <antcall target="rat-check" inheritrefs="true"/>
+ <antcall target="checkstyle" inheritrefs="true"/>
+ <antcall target="checkstyle-test" inheritrefs="true"/>
+ <antcall target="eclipse-warnings" inheritrefs="true"/>
+ </target>
+
<!-- Stress build file -->
<property name="stress.build.src" value="${basedir}/tools/stress/src" />
<property name="stress.test.src" value="${basedir}/tools/stress/test/unit"
/>
@@ -650,11 +663,11 @@
<property name="simulator-bootstrap.build.classes"
value="${build.classes}/simulator-bootstrap" />
<property name="simulator-bootstrap.manifest"
value="${simulator-bootstrap.build.classes}/MANIFEST.MF" />
- <target name="simulator-asm-build" depends="_build_unsafe"
description="build simulator-asm">
+ <target name="simulator-asm-build" depends="build" description="build
simulator-asm">
<antcall target="_simulator-asm_build"/>
</target>
- <target name="simulator-bootstrap-build" depends="_build_unsafe"
description="build simulator-bootstrap">
+ <target name="simulator-bootstrap-build" depends="build"
description="build simulator-bootstrap">
<antcall target="_simulator-bootstrap_build"/>
</target>
@@ -895,7 +908,7 @@
</target>
<!-- creates release tarballs -->
- <target name="artifacts" depends="_artifacts-init,gen-doc,sources-jar"
+ <target name="artifacts"
depends="_artifacts-init,check,gen-doc,sources-jar"
description="Create Cassandra tarball and maven artifacts">
<tar compression="gzip" longfile="gnu"
destfile="${build.dir}/${final.name}-bin.tar.gz">
@@ -1019,7 +1032,7 @@
<antcall target="build-test" inheritRefs="true"/>
</target>
- <target name="build-test"
depends="_main-jar,stress-build-test,fqltool-build,resolver-dist-lib,simulator-jars,checkstyle-test"
+ <target name="build-test"
depends="_main-jar,stress-build-test,fqltool-build,resolver-dist-lib,simulator-jars"
description="Compile test classes">
<antcall target="_build-test"/>
<checktestnameshelper/>
@@ -1651,7 +1664,7 @@
</sequential>
</macrodef>
- <target name="test" depends="eclipse-warnings,maybe-build-test"
description="Test Runner">
+ <target name="test" depends="maybe-build-test" description="Test Runner">
<path id="all-test-classes-path">
<fileset dir="${test.unit.src}" includes="**/${test.name}.java"
excludes="**/distributed/test/UpgradeTest*.java" />
</path>
@@ -1924,7 +1937,7 @@
IDE configuration in .idea/ updated for use with JDK${ant.java.version}.
In IntelliJ verify that the SDK is ${ant.java.version}, and its path is
valid.
- This can be verified in 'Project Structure/Project Setting/Project' and
'Project Structure/Platform Setting/SDKs'.
+ This can be verified in 'Project Structure/Project Setting/Project' and
'Project Structure/Platform Setting/SDKs'.
</echo>
</target>
@@ -2042,46 +2055,6 @@
</java>
</target>
- <target name="init-checkstyle"
depends="resolver-retrieve-build,build-project" unless="no-checkstyle">
- <echo message="checkstyle.version=${checkstyle.version}"/>
- <!-- Sevntu custom checks are retrieved by Ivy into lib folder
- and will be accessible to checkstyle-->
- <taskdef
resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
- classpathref="checkstyle.classpath"/>
- </target>
-
- <target name="checkstyle" depends="init-checkstyle,build-project"
description="Run custom checkstyle code analysis" if="java.version.8"
unless="no-checkstyle">
- <property name="checkstyle.log.dir" value="${build.dir}/checkstyle" />
- <property name="checkstyle.report.file"
value="${checkstyle.log.dir}/checkstyle_report.xml"/>
- <mkdir dir="${checkstyle.log.dir}" />
-
- <property name="checkstyle.properties"
value="${build.helpers.dir}/checkstyle.xml" />
- <property name="checkstyle.suppressions"
value="${build.helpers.dir}/checkstyle_suppressions.xml" />
- <checkstyle config="${checkstyle.properties}"
- failureProperty="checkstyle.failure"
- failOnViolation="true">
- <formatter type="plain"/>
- <formatter type="xml" tofile="${checkstyle.report.file}"/>
- <fileset dir="${build.src.java}" includes="**/*.java"/>
- </checkstyle>
- </target>
-
- <target name="checkstyle-test"
depends="init-checkstyle,resolver-retrieve-build,build-project"
description="Run custom checkstyle code analysis on tests" if="java.version.8"
unless="no-checkstyle">
- <property name="checkstyle.log.dir" value="${build.dir}/checkstyle" />
- <property name="checkstyle_test.report.file"
value="${checkstyle.log.dir}/checkstyle_report_test.xml"/>
- <mkdir dir="${checkstyle.log.dir}" />
-
- <property name="checkstyle_test.properties"
value="${build.helpers.dir}/checkstyle_test.xml" />
- <property name="checkstyle.suppressions"
value="${build.helpers.dir}/checkstyle_suppressions.xml" />
- <checkstyle config="${checkstyle_test.properties}"
- failureProperty="checkstyle.failure"
- failOnViolation="true">
- <formatter type="plain"/>
- <formatter type="xml" tofile="${checkstyle_test.report.file}"/>
- <fileset dir="${test.dir}" includes="**/*.java"/>
- </checkstyle>
- </target>
-
<!-- Installs artifacts to local Maven repository -->
<target name="mvn-install"
depends="jar,sources-jar,javadoc-jar"
@@ -2133,4 +2106,5 @@
<import file="${build.helpers.dir}/build-rat.xml"/>
<import file="${build.helpers.dir}/build-owasp.xml"/>
<import file="${build.helpers.dir}/build-git.xml"/>
+ <import file="${build.helpers.dir}/build-checkstyle.xml"/>
</project>
diff --git a/test/anttasks/org/apache/cassandra/anttasks/SetSystemProperty.java
b/test/anttasks/org/apache/cassandra/anttasks/SetSystemProperty.java
new file mode 100644
index 0000000000..cd20503e54
--- /dev/null
+++ b/test/anttasks/org/apache/cassandra/anttasks/SetSystemProperty.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.anttasks;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.Task;
+
+public class SetSystemProperty extends Task
+{
+ private String name;
+ private String value;
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ public void execute() throws BuildException
+ {
+ if (name == null || name.isEmpty())
+ {
+ throw new BuildException("propertyName attribute is missing or
empty.");
+ }
+
+ if (value == null || value.isEmpty())
+ {
+ throw new BuildException("propertyValue attribute is missing or
empty.");
+ }
+
+ PropertyHelper propertyHelper =
PropertyHelper.getPropertyHelper(getProject());
+ String evaluatedValue = propertyHelper.replaceProperties(value);
+
+ if (evaluatedValue == null)
+ System.getProperties().remove(name);
+ else
+ // checkstyle: suppress below 'blockSystemPropertyUsage'
+ System.setProperty(name, evaluatedValue);
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]