diff --git a/.github/dependencies.yml b/.github/dependencies.yml index 98b52ffa9..f760ddcef 100644 --- a/.github/dependencies.yml +++ b/.github/dependencies.yml @@ -32,7 +32,7 @@ dependencies: plugins/gradle: repo: gradle/gradle-completion branch: master - version: ea018400d86610d0f79f84debbb33c2d2ef5dbec + version: 25da917cf5a88f3e58f05be3868a7b2748c8afe6 precopy: | set -e find . ! -name _gradle ! -name LICENSE -delete diff --git a/plugins/gradle/LICENSE b/plugins/gradle/LICENSE new file mode 100644 index 000000000..06edf4af2 --- /dev/null +++ b/plugins/gradle/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 Eric Wendelin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/plugins/gradle/_gradle b/plugins/gradle/_gradle index f8df928b4..ca13fd0b0 100644 --- a/plugins/gradle/_gradle +++ b/plugins/gradle/_gradle @@ -1,28 +1,4 @@ #compdef gradle gradlew gw -# THE LINE ABOVE MUST BE THE FIRST LINE OF THIS FILE IN ORDER FOR COMPLETION TO WORK - -# -# Taken from https://github.com/gradle/gradle-completion -# Copyright (c) 2017 Eric Wendelin -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is furnished to do -# so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# Terms __gradle-set-project-root-dir() { local dir=`pwd` @@ -38,7 +14,7 @@ __gradle-set-project-root-dir() { } __gradle-init-cache-dir() { - cache_dir="$HOME/.gradle/completion" + cache_dir="${GRADLE_USER_HOME:-$HOME/.gradle}/completion" mkdir -p $cache_dir } @@ -98,7 +74,7 @@ __gradle-generate-script-cache() { zle -R "Generating Gradle build script cache" # Cache all Gradle scripts local -a gradle_build_scripts - gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern") ) + gradle_build_scripts=( $(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern") ) printf "%s\n" "${gradle_build_scripts[@]}" >| $cache_dir/$cache_name fi } @@ -125,7 +101,7 @@ __gradle-generate-tasks-cache() { local gradle_all_tasks="" root_tasks="" subproject_tasks="" output_line local -a match for output_line in ${(f)"$(printf "%s\n" "${gradle_tasks_output[@]}")"}; do - if [[ $output_line =~ ^([[:lower:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then + if [[ $output_line =~ ^([[:alpha:]][[:alnum:][:punct:]]*)([[:space:]]-[[:space:]]([[:print:]]*))? ]]; then local task_name="${match[1]}" local task_description="${match[3]}" # Completion for subproject tasks with ':' prefix