mirror of https://github.com/apache/cassandra
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
This commit is contained in:
parent
c273017b25
commit
ad26ffcd57
|
|
@ -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 $?
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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 $?
|
||||
|
|
|
|||
|
|
@ -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 -->
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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 $?
|
||||
|
|
|
|||
|
|
@ -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 '~'
|
||||
|
|
|
|||
|
|
@ -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}"
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
72
build.xml
72
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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue