Repository: yetus Updated Branches: refs/heads/master c533842b4 -> d3d0ea672
YETUS-144. mvn install usually required on mvn builds Signed-off-by: Sean Busbey <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/d3d0ea67 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/d3d0ea67 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/d3d0ea67 Branch: refs/heads/master Commit: d3d0ea6727545c5d9f0e8f486a7767b57839d6d4 Parents: c533842 Author: Allen Wittenauer <[email protected]> Authored: Fri Feb 12 18:27:43 2016 -0800 Committer: Allen Wittenauer <[email protected]> Committed: Mon Feb 29 08:33:43 2016 -0800 ---------------------------------------------------------------------- .../in-progress/precommit-advanced.md | 1 + .../in-progress/precommit-buildtools.md | 6 +-- precommit/test-patch.d/checkstyle.sh | 21 ++++++++ precommit/test-patch.d/findbugs.sh | 11 +++++ precommit/test-patch.d/java.sh | 4 ++ precommit/test-patch.d/maven.sh | 51 +++++++++++++++++--- precommit/test-patch.d/scala.sh | 38 +++++++++++++++ 7 files changed, 122 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/d3d0ea67/asf-site-src/source/documentation/in-progress/precommit-advanced.md ---------------------------------------------------------------------- diff --git a/asf-site-src/source/documentation/in-progress/precommit-advanced.md b/asf-site-src/source/documentation/in-progress/precommit-advanced.md index cd256be..3a66799 100644 --- a/asf-site-src/source/documentation/in-progress/precommit-advanced.md +++ b/asf-site-src/source/documentation/in-progress/precommit-advanced.md @@ -136,6 +136,7 @@ add_test_type <pluginname> - This allows for custom log file difference calculation used to determine the before and after views. The default is to use the last column of a colon delimited line of output and perform a diff. If the plug-in does not provide enough context, this may result in error skew. For example, if three lines in a row have "Missing period." as the error, test-patch will not be able to determine exactly which line caused the error. Plug-ins that have this issue will want to use this or potentially modify the normal tool's output (e.g., checkstyle) to provide a more accurate way to determine differences. + NOTE: If the plug-in has support for maven, the maven_add_install `pluginname` should be executed. See more information in Custom Maven Tests in the build tool documentation. # Personalities http://git-wip-us.apache.org/repos/asf/yetus/blob/d3d0ea67/asf-site-src/source/documentation/in-progress/precommit-buildtools.md ---------------------------------------------------------------------- diff --git a/asf-site-src/source/documentation/in-progress/precommit-buildtools.md b/asf-site-src/source/documentation/in-progress/precommit-buildtools.md index 1b31940..98d94e9 100644 --- a/asf-site-src/source/documentation/in-progress/precommit-buildtools.md +++ b/asf-site-src/source/documentation/in-progress/precommit-buildtools.md @@ -164,6 +164,6 @@ By default, test-patch will pass -Ptest-patch to Maven. This will allow you to c ## Custom Maven Tests -* Maven will trigger a maven install as part of the precompile. -* Maven will test eclipse integration as part of the postcompile. -* If src/site is modified, maven site tests are executed. +Maven will test eclipse and site if maven is being used as the build tool and appropriate files trigger them. + +Maven will trigger add a maven install test when the `maven_add_install` function has been used and the related tests are requierd. Plug-ins that need to run maven before MUST call it as part of their respective initialize functions, otherwise maven may fail unexpectedly. All Yetus provided plug-ins that require maven will trigger the maven install functionality. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/yetus/blob/d3d0ea67/precommit/test-patch.d/checkstyle.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/checkstyle.sh b/precommit/test-patch.d/checkstyle.sh index ce50b49..1ad657a 100755 --- a/precommit/test-patch.d/checkstyle.sh +++ b/precommit/test-patch.d/checkstyle.sh @@ -34,11 +34,21 @@ function checkstyle_filefilter fi } +## @description usage help for checkstyle +## @audience private +## @stability evolving +## @replaceable no function checkstyle_usage { yetus_add_option "--checkstyle-goal=<goal>" "Checkstyle maven plugin goal to use, 'check' and 'checkstyle' supported. Defaults to '${CHECKSTYLE_GOAL_DEFAULT}'." } +## @description parse checkstyle args +## @audience private +## @stability evolving +## @replaceable no +## @param arg +## @param .. function checkstyle_parse_args { local i @@ -62,6 +72,17 @@ function checkstyle_parse_args done } +## @description initialize the checkstyle plug-in +## @audience private +## @stability evolving +## @replaceable no +function checkstyle_initialize +{ + if declare -f maven_add_install >/dev/null 2>&1; then + maven_add_install checkstyle + fi +} + ## @description checkstyle plug-in specific difference calculator ## @audience private ## @stability evolving http://git-wip-us.apache.org/repos/asf/yetus/blob/d3d0ea67/precommit/test-patch.d/findbugs.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/findbugs.sh b/precommit/test-patch.d/findbugs.sh index a923cb9..da073a0 100755 --- a/precommit/test-patch.d/findbugs.sh +++ b/precommit/test-patch.d/findbugs.sh @@ -42,6 +42,17 @@ function findbugs_parse_args done } +## @description initialize the findbugs plug-in +## @audience private +## @stability evolving +## @replaceable no +function findbugs_initialize +{ + if declare -f maven_add_install >/dev/null 2>&1; then + maven_add_install findbugs + fi +} + function findbugs_filefilter { local filename=$1 http://git-wip-us.apache.org/repos/asf/yetus/blob/d3d0ea67/precommit/test-patch.d/java.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/java.sh b/precommit/test-patch.d/java.sh index b77f6b5..f6880ee 100755 --- a/precommit/test-patch.d/java.sh +++ b/precommit/test-patch.d/java.sh @@ -39,6 +39,10 @@ function initialize_java return 0 fi + if declare -f maven_add_install >/dev/null 2>&1; then + maven_add_install javadoc + fi + if [[ -z ${JAVA_HOME:-} ]]; then case ${OSTYPE} in Darwin) http://git-wip-us.apache.org/repos/asf/yetus/blob/d3d0ea67/precommit/test-patch.d/maven.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/maven.sh b/precommit/test-patch.d/maven.sh index 241ec1a..f311d64 100755 --- a/precommit/test-patch.d/maven.sh +++ b/precommit/test-patch.d/maven.sh @@ -30,6 +30,26 @@ add_test_type mvnsite add_test_type mvneclipse add_build_tool maven +## @description Add the given test type as requiring a mvn install during the branch phase +## @audience public +## @stability stable +## @replaceable yes +## @param test +function maven_add_install +{ + yetus_add_entry MAVEN_NEED_INSTALL "${1}" +} + +## @description Remove the given test type as requiring a mvn install +## @audience public +## @stability stable +## @replaceable yes +## @param test +function maven_delete_install +{ + yetus_delete_entry MAVEN_NEED_INSTALL "${1}" +} + function maven_usage { yetus_add_option "--mvn-cmd=<cmd>" "The 'mvn' command to use (default \${MAVEN_HOME}/bin/mvn, or 'mvn')" @@ -75,8 +95,12 @@ function maven_parse_args function maven_initialize { - # we need to do this before docker does it as root + maven_add_install mvneclipse + maven_add_install mvnsite + maven_add_install unit + + # we need to do this before docker does it as root if [[ ! ${MAVEN_CUSTOM_REPOS_DIR} =~ ^/ ]]; then yetus_error "ERROR: --mvn-custom-repos-dir must be an absolute path." return 1 @@ -433,7 +457,6 @@ function mvnsite_postcompile big_console_header "Patch maven site verification" fi - personality_modules "${repostatus}" mvnsite modules_workers "${repostatus}" mvnsite clean site site:stage result=$? @@ -490,18 +513,32 @@ function maven_precompile { declare repostatus=$1 declare result=0 + declare need=false if [[ ${BUILDTOOL} != maven ]]; then return 0 fi - verify_needed_test javadoc - result=$? - verify_needed_test javac - ((result = result + $? )) - if [[ ${result} == 0 ]]; then + if [[ $? == 1 ]]; then + need=true + else + # not everything needs a maven install + # but quite a few do ... + # shellcheck disable=SC2086 + for index in ${MAVEN_NEED_INSTALL}; do + verify_needed_test ${index} + if [[ $? == 1 ]]; then + need=branch + fi + done + fi + + if [[ "${need}" = false ]]; then return 0 + elif [[ "${need}" = branch + && "${repostatus}" = patch ]]; then + return 0 fi if [[ "${repostatus}" = branch ]]; then http://git-wip-us.apache.org/repos/asf/yetus/blob/d3d0ea67/precommit/test-patch.d/scala.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/scala.sh b/precommit/test-patch.d/scala.sh index dee2bd2..87d092c 100755 --- a/precommit/test-patch.d/scala.sh +++ b/precommit/test-patch.d/scala.sh @@ -17,6 +17,8 @@ add_test_type scalac add_test_type scaladoc +SCALA_INITIALIZED=false + function scalac_filefilter { declare filename=$1 @@ -38,6 +40,42 @@ function scaladoc_filefilter fi } +## @description initialize the scala plug-in +## @audience private +## @stability evolving +## @replaceable no +function scala_initialize +{ + if [[ ${SCALA_INITIALIZED} == true ]]; then + return + else + SCALA_INITIALIZED=true + fi + + if declare -f maven_add_install >/dev/null 2>&1; then + maven_add_install scaladoc + maven_add_install scalac + fi +} + +## @description initialize the scalac plug-in +## @audience private +## @stability evolving +## @replaceable no +function scalac_initialize +{ + scala_initialize +} + +## @description initialize the scaladoc plug-in +## @audience private +## @stability evolving +## @replaceable no +function scaladoc_initialize +{ + scala_initialize +} + ## @description ## @audience private ## @stability stable
