You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2018/05/26 14:21:01 UTC

[1/3] groovy git commit: GROOVY-8601: Groovy should have a runner for JUnit5 tests (closes #723)

Repository: groovy
Updated Branches:
  refs/heads/master bf21d1027 -> 2c40b0266


GROOVY-8601: Groovy should have a runner for JUnit5 tests (closes #723)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/95dfb2f2
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/95dfb2f2
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/95dfb2f2

Branch: refs/heads/master
Commit: 95dfb2f2f74ca470bd779e17cbd59c47e5677e11
Parents: bf21d10
Author: Paul King <pa...@asert.com.au>
Authored: Thu May 24 22:23:29 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Sat May 26 20:10:03 2018 +1000

----------------------------------------------------------------------
 gradle/assemble.gradle                          |   3 +-
 gradle/binarycompatibility.gradle               |   2 +-
 licenses/LICENSE-BINZIP                         |   9 +-
 licenses/LICENSE-SDK                            |   9 +-
 licenses/junit-BINZIP.txt                       |   9 +-
 licenses/junit-license.txt                      | 227 -------------------
 licenses/junit4-license.txt                     | 227 +++++++++++++++++++
 licenses/junit5-license.txt                     |  87 +++++++
 notices/NOTICE-BINZIP                           |   5 +-
 notices/NOTICE-SDK                              |   5 +-
 notices/junit-BINZIP.txt                        |   5 +-
 settings.gradle                                 |   1 +
 src/spec/doc/core-testing-guide.adoc            |  19 +-
 subprojects/groovy-test-junit5/build.gradle     |  36 +++
 .../plugin/GroovyJUnitRunnerHelper.groovy       |  48 ++++
 .../java/groovy/junit5/plugin/JUnit5Runner.java | 104 +++++++++
 .../org.apache.groovy.plugin.GroovyRunner       |  20 ++
 .../src/spec/doc/testing-with-junit5.adoc       |  30 +++
 .../src/spec/test/MyTestViaRun.groovy           |  81 +++++++
 .../src/test/groovy/MyTestJunit5.groovy         |  36 +++
 20 files changed, 719 insertions(+), 244 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/gradle/assemble.gradle
----------------------------------------------------------------------
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 2f83048..9d67768 100644
--- a/gradle/assemble.gradle
+++ b/gradle/assemble.gradle
@@ -409,7 +409,8 @@ ext.distSpec = copySpec {
         include 'jline2-license.txt'
         include 'jsr166y-license.txt'
         include 'jsr223-license.txt'
-        include 'junit-license.txt'
+        include 'junit4-license.txt'
+        include 'junit5-license.txt'
         include 'xstream-license.txt'
     }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/gradle/binarycompatibility.gradle
----------------------------------------------------------------------
diff --git a/gradle/binarycompatibility.gradle b/gradle/binarycompatibility.gradle
index 274838b..184a2e0 100644
--- a/gradle/binarycompatibility.gradle
+++ b/gradle/binarycompatibility.gradle
@@ -35,7 +35,7 @@ task checkBinaryCompatibility {
 check.dependsOn(checkBinaryCompatibility)
 
 // for comparing between versions with different modules, set excludeModules to differing modules, e.g.
-def excludeModules = ['groovy-cli-picocli', 'groovy-cli-commons', 'groovy-dateutil', 'groovy-datetime', 'performance', 'groovy-macro', 'tests-vm8', 'groovy-json-direct']
+def excludeModules = ['groovy-cli-picocli', 'groovy-cli-commons', 'groovy-dateutil', 'groovy-datetime', 'performance', 'groovy-macro', 'tests-vm8', 'groovy-json-direct', 'groovy-test-junit5']
 //def excludeModules = []
 
 Set projectsToCheck = allprojects.findAll{ !(it.name in excludeModules) }

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/licenses/LICENSE-BINZIP
----------------------------------------------------------------------
diff --git a/licenses/LICENSE-BINZIP b/licenses/LICENSE-BINZIP
index e610786..065d20c 100644
--- a/licenses/LICENSE-BINZIP
+++ b/licenses/LICENSE-BINZIP
@@ -259,10 +259,13 @@ has a BSD-style license. Details can be found in: licenses/jsr223-license.txt
 
 ------------------------------------------------------------------------
 
-JUnit License (optional dependency when using Groovy for testing)
+JUnit Licenses (optional dependencies when using Groovy for testing)
 
-This product bundles the JUnit jar, which is available under the
-Eclipse Public License v1.0.  For details, see licenses/junit-license.
+This product bundles the JUnit 4 jar, which is available under the
+Eclipse Public License v1.0.  For details, see licenses/junit4-license.
+
+This product bundles several JUnit 5 jars, which are available under the
+Eclipse Public License v2.0.  For details, see licenses/junit5-license.
 
 ------------------------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/licenses/LICENSE-SDK
----------------------------------------------------------------------
diff --git a/licenses/LICENSE-SDK b/licenses/LICENSE-SDK
index 6198f15..2ba84ff 100644
--- a/licenses/LICENSE-SDK
+++ b/licenses/LICENSE-SDK
@@ -259,10 +259,13 @@ has a BSD-style license. Details can be found in: licenses/jsr223-license.txt
 
 ------------------------------------------------------------------------
 
-JUnit License (optional dependency when using Groovy for testing)
+JUnit Licenses (optional dependencies when using Groovy for testing)
 
-This product bundles the JUnit jar, which is available under the
-Eclipse Public License v1.0.  For details, see licenses/junit-license.
+This product bundles the JUnit 4 jar, which is available under the
+Eclipse Public License v1.0.  For details, see licenses/junit4-license.
+
+This product bundles several JUnit 5 jars, which are available under the
+Eclipse Public License v2.0.  For details, see licenses/junit5-license.
 
 ------------------------------------------------------------------------
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/licenses/junit-BINZIP.txt
----------------------------------------------------------------------
diff --git a/licenses/junit-BINZIP.txt b/licenses/junit-BINZIP.txt
index 78c3fec..87a82c6 100644
--- a/licenses/junit-BINZIP.txt
+++ b/licenses/junit-BINZIP.txt
@@ -1,4 +1,7 @@
-JUnit License (optional dependency when using Groovy for testing)
+JUnit Licenses (optional dependencies when using Groovy for testing)
 
-This product bundles the JUnit jar, which is available under the
-Eclipse Public License v1.0.  For details, see licenses/junit-license.
+This product bundles the JUnit 4 jar, which is available under the
+Eclipse Public License v1.0.  For details, see licenses/junit4-license.
+
+This product bundles several JUnit 5 jars, which are available under the
+Eclipse Public License v2.0.  For details, see licenses/junit5-license.

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/licenses/junit-license.txt
----------------------------------------------------------------------
diff --git a/licenses/junit-license.txt b/licenses/junit-license.txt
deleted file mode 100644
index 5d80026..0000000
--- a/licenses/junit-license.txt
+++ /dev/null
@@ -1,227 +0,0 @@
-Eclipse Public License - v 1.0
-
-   THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
-   PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
-   THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
-   1. DEFINITIONS
-
-   "Contribution" means:
-
-   a) in the case of the initial Contributor, the initial code and
-   documentation distributed under this Agreement, and
-
-   b) in the case of each subsequent Contributor:
-
-   i) changes to the Program, and
-
-   ii) additions to the Program;
-
-   where such changes and/or additions to the Program originate from and
-   are distributed by that particular Contributor. A Contribution
-   'originates' from a Contributor if it was added to the Program by such
-   Contributor itself or anyone acting on such Contributor's behalf.
-   Contributions do not include additions to the Program which: (i) are
-   separate modules of software distributed in conjunction with the
-   Program under their own license agreement, and (ii) are not derivative
-   works of the Program.
-
-   "Contributor" means any person or entity that distributes the Program.
-
-   "Licensed Patents" mean patent claims licensable by a Contributor which
-   are necessarily infringed by the use or sale of its Contribution alone
-   or when combined with the Program.
-
-   "Program" means the Contributions distributed in accordance with this
-   Agreement.
-
-   "Recipient" means anyone who receives the Program under this Agreement,
-   including all Contributors.
-
-   2. GRANT OF RIGHTS
-
-   a) Subject to the terms of this Agreement, each Contributor hereby
-   grants Recipient a non-exclusive, worldwide, royalty-free copyright
-   license to reproduce, prepare derivative works of, publicly display,
-   publicly perform, distribute and sublicense the Contribution of such
-   Contributor, if any, and such derivative works, in source code and
-   object code form.
-
-   b) Subject to the terms of this Agreement, each Contributor hereby
-   grants Recipient a non-exclusive, worldwide, royalty-free patent
-   license under Licensed Patents to make, use, sell, offer to sell,
-   import and otherwise transfer the Contribution of such Contributor, if
-   any, in source code and object code form. This patent license shall
-   apply to the combination of the Contribution and the Program if, at the
-   time the Contribution is added by the Contributor, such addition of the
-   Contribution causes such combination to be covered by the Licensed
-   Patents. The patent license shall not apply to any other combinations
-   which include the Contribution. No hardware per se is licensed
-   hereunder.
-
-   c) Recipient understands that although each Contributor grants the
-   licenses to its Contributions set forth herein, no assurances are
-   provided by any Contributor that the Program does not infringe the
-   patent or other intellectual property rights of any other entity. Each
-   Contributor disclaims any liability to Recipient for claims brought by
-   any other entity based on infringement of intellectual property rights
-   or otherwise. As a condition to exercising the rights and licenses
-   granted hereunder, each Recipient hereby assumes sole responsibility to
-   secure any other intellectual property rights needed, if any. For
-   example, if a third party patent license is required to allow Recipient
-   to distribute the Program, it is Recipient's responsibility to acquire
-   that license before distributing the Program.
-
-   d) Each Contributor represents that to its knowledge it has sufficient
-   copyright rights in its Contribution, if any, to grant the copyright
-   license set forth in this Agreement.
-
-   3. REQUIREMENTS
-
-   A Contributor may choose to distribute the Program in object code form
-   under its own license agreement, provided that:
-
-   a) it complies with the terms and conditions of this Agreement; and
-
-   b) its license agreement:
-
-   i) effectively disclaims on behalf of all Contributors all warranties
-   and conditions, express and implied, including warranties or conditions
-   of title and non-infringement, and implied warranties or conditions of
-   merchantability and fitness for a particular purpose;
-
-   ii) effectively excludes on behalf of all Contributors all liability
-   for damages, including direct, indirect, special, incidental and
-   consequential damages, such as lost profits;
-
-   iii) states that any provisions which differ from this Agreement are
-   offered by that Contributor alone and not by any other party; and
-
-   iv) states that source code for the Program is available from such
-   Contributor, and informs licensees how to obtain it in a reasonable
-   manner on or through a medium customarily used for software exchange.
-
-   When the Program is made available in source code form:
-
-   a) it must be made available under this Agreement; and
-
-   b) a copy of this Agreement must be included with each copy of the
-   Program.
-
-   Contributors may not remove or alter any copyright notices contained
-   within the Program.
-
-   Each Contributor must identify itself as the originator of its
-   Contribution, if any, in a manner that reasonably allows subsequent
-   Recipients to identify the originator of the Contribution.
-
-   4. COMMERCIAL DISTRIBUTION
-
-   Commercial distributors of software may accept certain responsibilities
-   with respect to end users, business partners and the like. While this
-   license is intended to facilitate the commercial use of the Program,
-   the Contributor who includes the Program in a commercial product
-   offering should do so in a manner which does not create potential
-   liability for other Contributors. Therefore, if a Contributor includes
-   the Program in a commercial product offering, such Contributor
-   ("Commercial Contributor") hereby agrees to defend and indemnify every
-   other Contributor ("Indemnified Contributor") against any losses,
-   damages and costs (collectively "Losses") arising from claims, lawsuits
-   and other legal actions brought by a third party against the
-   Indemnified Contributor to the extent caused by the acts or omissions
-   of such Commercial Contributor in connection with its distribution of
-   the Program in a commercial product offering. The obligations in this
-   section do not apply to any claims or Losses relating to any actual or
-   alleged intellectual property infringement. In order to qualify, an
-   Indemnified Contributor must: a) promptly notify the Commercial
-   Contributor in writing of such claim, and b) allow the Commercial
-   Contributor to control, and cooperate with the Commercial Contributor
-   in, the defense and any related settlement negotiations. The
-   Indemnified Contributor may participate in any such claim at its own
-   expense.
-
-   For example, a Contributor might include the Program in a commercial
-   product offering, Product X. That Contributor is then a Commercial
-   Contributor. If that Commercial Contributor then makes performance
-   claims, or offers warranties related to Product X, those performance
-   claims and warranties are such Commercial Contributor's responsibility
-   alone. Under this section, the Commercial Contributor would have to
-   defend claims against the other Contributors related to those
-   performance claims and warranties, and if a court requires any other
-   Contributor to pay any damages as a result, the Commercial Contributor
-   must pay those damages.
-
-   5. NO WARRANTY
-
-   EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
-   PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-   KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
-   WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
-   FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible
-   for determining the appropriateness of using and distributing the
-   Program and assumes all risks associated with its exercise of rights
-   under this Agreement , including but not limited to the risks and costs
-   of program errors, compliance with applicable laws, damage to or loss
-   of data, programs or equipment, and unavailability or interruption of
-   operations.
-
-   6. DISCLAIMER OF LIABILITY
-
-   EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
-   ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
-   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
-   WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
-   DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
-   HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-   7. GENERAL
-
-   If any provision of this Agreement is invalid or unenforceable under
-   applicable law, it shall not affect the validity or enforceability of
-   the remainder of the terms of this Agreement, and without further
-   action by the parties hereto, such provision shall be reformed to the
-   minimum extent necessary to make such provision valid and enforceable.
-
-   If Recipient institutes patent litigation against any entity (including
-   a cross-claim or counterclaim in a lawsuit) alleging that the Program
-   itself (excluding combinations of the Program with other software or
-   hardware) infringes such Recipient's patent(s), then such Recipient's
-   rights granted under Section 2(b) shall terminate as of the date such
-   litigation is filed.
-
-   All Recipient's rights under this Agreement shall terminate if it fails
-   to comply with any of the material terms or conditions of this
-   Agreement and does not cure such failure in a reasonable period of time
-   after becoming aware of such noncompliance. If all Recipient's rights
-   under this Agreement terminate, Recipient agrees to cease use and
-   distribution of the Program as soon as reasonably practicable. However,
-   Recipient's obligations under this Agreement and any licenses granted
-   by Recipient relating to the Program shall continue and survive.
-
-   Everyone is permitted to copy and distribute copies of this Agreement,
-   but in order to avoid inconsistency the Agreement is copyrighted and
-   may only be modified in the following manner. The Agreement Steward
-   reserves the right to publish new versions (including revisions) of
-   this Agreement from time to time. No one other than the Agreement
-   Steward has the right to modify this Agreement. The Eclipse Foundation
-   is the initial Agreement Steward. The Eclipse Foundation may assign the
-   responsibility to serve as the Agreement Steward to a suitable separate
-   entity. Each new version of the Agreement will be given a
-   distinguishing version number. The Program (including Contributions)
-   may always be distributed subject to the version of the Agreement under
-   which it was received. In addition, after a new version of the
-   Agreement is published, Contributor may elect to distribute the Program
-   (including its Contributions) under the new version. Except as
-   expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
-   rights or licenses to the intellectual property of any Contributor
-   under this Agreement, whether expressly, by implication, estoppel or
-   otherwise. All rights in the Program not expressly granted under this
-   Agreement are reserved.
-
-   This Agreement is governed by the laws of the State of New York and the
-   intellectual property laws of the United States of America. No party to
-   this Agreement will bring a legal action under this Agreement more than
-   one year after the cause of action arose. Each party waives its rights
-   to a jury trial in any resulting litigation.

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/licenses/junit4-license.txt
----------------------------------------------------------------------
diff --git a/licenses/junit4-license.txt b/licenses/junit4-license.txt
new file mode 100644
index 0000000..5d80026
--- /dev/null
+++ b/licenses/junit4-license.txt
@@ -0,0 +1,227 @@
+Eclipse Public License - v 1.0
+
+   THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+   PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+   THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+   1. DEFINITIONS
+
+   "Contribution" means:
+
+   a) in the case of the initial Contributor, the initial code and
+   documentation distributed under this Agreement, and
+
+   b) in the case of each subsequent Contributor:
+
+   i) changes to the Program, and
+
+   ii) additions to the Program;
+
+   where such changes and/or additions to the Program originate from and
+   are distributed by that particular Contributor. A Contribution
+   'originates' from a Contributor if it was added to the Program by such
+   Contributor itself or anyone acting on such Contributor's behalf.
+   Contributions do not include additions to the Program which: (i) are
+   separate modules of software distributed in conjunction with the
+   Program under their own license agreement, and (ii) are not derivative
+   works of the Program.
+
+   "Contributor" means any person or entity that distributes the Program.
+
+   "Licensed Patents" mean patent claims licensable by a Contributor which
+   are necessarily infringed by the use or sale of its Contribution alone
+   or when combined with the Program.
+
+   "Program" means the Contributions distributed in accordance with this
+   Agreement.
+
+   "Recipient" means anyone who receives the Program under this Agreement,
+   including all Contributors.
+
+   2. GRANT OF RIGHTS
+
+   a) Subject to the terms of this Agreement, each Contributor hereby
+   grants Recipient a non-exclusive, worldwide, royalty-free copyright
+   license to reproduce, prepare derivative works of, publicly display,
+   publicly perform, distribute and sublicense the Contribution of such
+   Contributor, if any, and such derivative works, in source code and
+   object code form.
+
+   b) Subject to the terms of this Agreement, each Contributor hereby
+   grants Recipient a non-exclusive, worldwide, royalty-free patent
+   license under Licensed Patents to make, use, sell, offer to sell,
+   import and otherwise transfer the Contribution of such Contributor, if
+   any, in source code and object code form. This patent license shall
+   apply to the combination of the Contribution and the Program if, at the
+   time the Contribution is added by the Contributor, such addition of the
+   Contribution causes such combination to be covered by the Licensed
+   Patents. The patent license shall not apply to any other combinations
+   which include the Contribution. No hardware per se is licensed
+   hereunder.
+
+   c) Recipient understands that although each Contributor grants the
+   licenses to its Contributions set forth herein, no assurances are
+   provided by any Contributor that the Program does not infringe the
+   patent or other intellectual property rights of any other entity. Each
+   Contributor disclaims any liability to Recipient for claims brought by
+   any other entity based on infringement of intellectual property rights
+   or otherwise. As a condition to exercising the rights and licenses
+   granted hereunder, each Recipient hereby assumes sole responsibility to
+   secure any other intellectual property rights needed, if any. For
+   example, if a third party patent license is required to allow Recipient
+   to distribute the Program, it is Recipient's responsibility to acquire
+   that license before distributing the Program.
+
+   d) Each Contributor represents that to its knowledge it has sufficient
+   copyright rights in its Contribution, if any, to grant the copyright
+   license set forth in this Agreement.
+
+   3. REQUIREMENTS
+
+   A Contributor may choose to distribute the Program in object code form
+   under its own license agreement, provided that:
+
+   a) it complies with the terms and conditions of this Agreement; and
+
+   b) its license agreement:
+
+   i) effectively disclaims on behalf of all Contributors all warranties
+   and conditions, express and implied, including warranties or conditions
+   of title and non-infringement, and implied warranties or conditions of
+   merchantability and fitness for a particular purpose;
+
+   ii) effectively excludes on behalf of all Contributors all liability
+   for damages, including direct, indirect, special, incidental and
+   consequential damages, such as lost profits;
+
+   iii) states that any provisions which differ from this Agreement are
+   offered by that Contributor alone and not by any other party; and
+
+   iv) states that source code for the Program is available from such
+   Contributor, and informs licensees how to obtain it in a reasonable
+   manner on or through a medium customarily used for software exchange.
+
+   When the Program is made available in source code form:
+
+   a) it must be made available under this Agreement; and
+
+   b) a copy of this Agreement must be included with each copy of the
+   Program.
+
+   Contributors may not remove or alter any copyright notices contained
+   within the Program.
+
+   Each Contributor must identify itself as the originator of its
+   Contribution, if any, in a manner that reasonably allows subsequent
+   Recipients to identify the originator of the Contribution.
+
+   4. COMMERCIAL DISTRIBUTION
+
+   Commercial distributors of software may accept certain responsibilities
+   with respect to end users, business partners and the like. While this
+   license is intended to facilitate the commercial use of the Program,
+   the Contributor who includes the Program in a commercial product
+   offering should do so in a manner which does not create potential
+   liability for other Contributors. Therefore, if a Contributor includes
+   the Program in a commercial product offering, such Contributor
+   ("Commercial Contributor") hereby agrees to defend and indemnify every
+   other Contributor ("Indemnified Contributor") against any losses,
+   damages and costs (collectively "Losses") arising from claims, lawsuits
+   and other legal actions brought by a third party against the
+   Indemnified Contributor to the extent caused by the acts or omissions
+   of such Commercial Contributor in connection with its distribution of
+   the Program in a commercial product offering. The obligations in this
+   section do not apply to any claims or Losses relating to any actual or
+   alleged intellectual property infringement. In order to qualify, an
+   Indemnified Contributor must: a) promptly notify the Commercial
+   Contributor in writing of such claim, and b) allow the Commercial
+   Contributor to control, and cooperate with the Commercial Contributor
+   in, the defense and any related settlement negotiations. The
+   Indemnified Contributor may participate in any such claim at its own
+   expense.
+
+   For example, a Contributor might include the Program in a commercial
+   product offering, Product X. That Contributor is then a Commercial
+   Contributor. If that Commercial Contributor then makes performance
+   claims, or offers warranties related to Product X, those performance
+   claims and warranties are such Commercial Contributor's responsibility
+   alone. Under this section, the Commercial Contributor would have to
+   defend claims against the other Contributors related to those
+   performance claims and warranties, and if a court requires any other
+   Contributor to pay any damages as a result, the Commercial Contributor
+   must pay those damages.
+
+   5. NO WARRANTY
+
+   EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+   PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+   WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR
+   FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible
+   for determining the appropriateness of using and distributing the
+   Program and assumes all risks associated with its exercise of rights
+   under this Agreement , including but not limited to the risks and costs
+   of program errors, compliance with applicable laws, damage to or loss
+   of data, programs or equipment, and unavailability or interruption of
+   operations.
+
+   6. DISCLAIMER OF LIABILITY
+
+   EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+   ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+   WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+   DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+   HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+   7. GENERAL
+
+   If any provision of this Agreement is invalid or unenforceable under
+   applicable law, it shall not affect the validity or enforceability of
+   the remainder of the terms of this Agreement, and without further
+   action by the parties hereto, such provision shall be reformed to the
+   minimum extent necessary to make such provision valid and enforceable.
+
+   If Recipient institutes patent litigation against any entity (including
+   a cross-claim or counterclaim in a lawsuit) alleging that the Program
+   itself (excluding combinations of the Program with other software or
+   hardware) infringes such Recipient's patent(s), then such Recipient's
+   rights granted under Section 2(b) shall terminate as of the date such
+   litigation is filed.
+
+   All Recipient's rights under this Agreement shall terminate if it fails
+   to comply with any of the material terms or conditions of this
+   Agreement and does not cure such failure in a reasonable period of time
+   after becoming aware of such noncompliance. If all Recipient's rights
+   under this Agreement terminate, Recipient agrees to cease use and
+   distribution of the Program as soon as reasonably practicable. However,
+   Recipient's obligations under this Agreement and any licenses granted
+   by Recipient relating to the Program shall continue and survive.
+
+   Everyone is permitted to copy and distribute copies of this Agreement,
+   but in order to avoid inconsistency the Agreement is copyrighted and
+   may only be modified in the following manner. The Agreement Steward
+   reserves the right to publish new versions (including revisions) of
+   this Agreement from time to time. No one other than the Agreement
+   Steward has the right to modify this Agreement. The Eclipse Foundation
+   is the initial Agreement Steward. The Eclipse Foundation may assign the
+   responsibility to serve as the Agreement Steward to a suitable separate
+   entity. Each new version of the Agreement will be given a
+   distinguishing version number. The Program (including Contributions)
+   may always be distributed subject to the version of the Agreement under
+   which it was received. In addition, after a new version of the
+   Agreement is published, Contributor may elect to distribute the Program
+   (including its Contributions) under the new version. Except as
+   expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
+   rights or licenses to the intellectual property of any Contributor
+   under this Agreement, whether expressly, by implication, estoppel or
+   otherwise. All rights in the Program not expressly granted under this
+   Agreement are reserved.
+
+   This Agreement is governed by the laws of the State of New York and the
+   intellectual property laws of the United States of America. No party to
+   this Agreement will bring a legal action under this Agreement more than
+   one year after the cause of action arose. Each party waives its rights
+   to a jury trial in any resulting litigation.

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/licenses/junit5-license.txt
----------------------------------------------------------------------
diff --git a/licenses/junit5-license.txt b/licenses/junit5-license.txt
new file mode 100644
index 0000000..76bdbaa
--- /dev/null
+++ b/licenses/junit5-license.txt
@@ -0,0 +1,87 @@
+Eclipse Public License - v 2.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. Definitions
+“Contribution” means:
+
+a) in the case of the initial Contributor, the initial content Distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+i) changes to the Program, and
+ii) additions to the Program; where such changes and/or additions to the Program originate from and are Distributed by that particular Contributor. A Contribution “originates” from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include changes or additions to the Program that are not Modified Works.
+“Contributor” means any person or entity that Distributes the Program.
+
+“Licensed Patents” mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+“Program” means the Contributions Distributed in accordance with this Agreement.
+
+“Recipient” means anyone who receives the Program under this Agreement or any Secondary License (as applicable), including Contributors.
+
+“Derivative Works” shall mean any work, whether in Source Code or other form, that is based on (or derived from) the Program and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship.
+
+“Modified Works” shall mean any work in Source Code or other form that results from an addition to, deletion from, or modification of the contents of the Program, including, for purposes of clarity any new file in Source Code form that contains any contents of the Program. Modified Works shall not include works that contain only declarations, interfaces, types, classes, structures, or files of the Program solely in each case in order to link to, bind by name, or subclass the Program or Modified Works thereof.
+
+“Distribute” means the acts of a) distributing or b) making available in any manner that enables the transfer of a copy.
+
+“Source Code” means the form of a Program preferred for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+“Secondary License” means either the GNU General Public License, Version 2.0, or any later versions of that license, including any exceptions or additional permissions as identified by the initial Contributor.
+
+2. Grant of Rights
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, Distribute and sublicense the Contribution of such Contributor, if any, and such Derivative Works.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in Source Code or other form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to Distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+
+e) Notwithstanding the terms of any Secondary License, no Contributor makes additional grants to any Recipient (other than those set forth in this Agreement) as a result of such Recipient's receipt of the Program under the terms of a Secondary License (if permitted under the terms of Section 3).
+
+3. Requirements
+3.1 If a Contributor Distributes the Program in any form, then:
+
+a) the Program must also be made available as Source Code, in accordance with section 3.2, and the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange; and
+
+b) the Contributor may Distribute the Program under a license different than this Agreement, provided that such license:
+
+i) effectively disclaims on behalf of all other Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+ii) effectively excludes on behalf of all other Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+iii) does not attempt to limit or alter the recipients' rights in the Source Code under section 3.2; and
+iv) requires any subsequent distribution of the Program by any party to be under a license that satisfies the requirements of this section 3.
+3.2 When the Program is Distributed as Source Code:
+
+a) it must be made available under this Agreement, or if the Program (i) is combined with other material in a separate file or files made available under a Secondary License, and (ii) the initial Contributor attached to the Source Code the notice described in Exhibit A of this Agreement, then the Program may be made available under the terms of such Secondary Licenses, and
+b) a copy of this Agreement must be included with each copy of the Program.
+3.3 Contributors may not remove or alter any copyright, patent, trademark, attribution notices, disclaimers of warranty, or limitations of liability (“notices”) contained within the Program from any copy of the Program which they Distribute, provided that Contributors may add their own appropriate notices.
+
+4. Commercial Distribution
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor (“Commercial Contributor”) hereby agrees to defend and indemnify every other Contributor (“Indemnified Contributor”) against any losses, damages and costs (collectively “Losses”) arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any c
 laims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. No Warranty
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. Disclaimer of Liability
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. General
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version.
+
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement.
+
+Exhibit A - Form of Secondary Licenses Notice
+“This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}.”
+
+Simply including a copy of this Agreement, including this Exhibit A is not sufficient to license the Source Code under Secondary Licenses.
+
+If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
+
+You may add additional accurate notices of copyright ownership.

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/notices/NOTICE-BINZIP
----------------------------------------------------------------------
diff --git a/notices/NOTICE-BINZIP b/notices/NOTICE-BINZIP
index bf71a55..4d69a76 100644
--- a/notices/NOTICE-BINZIP
+++ b/notices/NOTICE-BINZIP
@@ -10,9 +10,12 @@ developed by Terence Parr 1989-2006
 This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
 Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
 
-This product bundles the JUnit jar (junit.org)
+This product bundles the JUnit4 jar (junit.org)
 which is available under the terms of the Eclipse Public License v1.0
 
+This product bundles several of the JUnit5 jars (junit.org)
+which are available under the terms of the Eclipse Public License v2.0
+
 This product embeds the OpenBeans jar within its grooid jar artifacts
 OpenBeans includes/uses files from Apache Harmony and the following notice applies
 Copyright 2006, 2010 The Apache Software Foundation.

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/notices/NOTICE-SDK
----------------------------------------------------------------------
diff --git a/notices/NOTICE-SDK b/notices/NOTICE-SDK
index e15b426..ed5cf1d 100644
--- a/notices/NOTICE-SDK
+++ b/notices/NOTICE-SDK
@@ -10,9 +10,12 @@ developed by Terence Parr 1989-2006
 This product includes/uses ANTLR4 (https://github.com/antlr/antlr4)
 Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
 
-This product bundles the JUnit jar (junit.org)
+This product bundles the JUnit4 jar (junit.org)
 which is available under the terms of the Eclipse Public License v1.0
 
+This product bundles several of the JUnit5 jars (junit.org)
+which are available under the terms of the Eclipse Public License v2.0
+
 This product embeds the OpenBeans jar within its grooid jar artifacts
 OpenBeans includes/uses files from Apache Harmony and the following notice applies
 Copyright 2006, 2010 The Apache Software Foundation.

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/notices/junit-BINZIP.txt
----------------------------------------------------------------------
diff --git a/notices/junit-BINZIP.txt b/notices/junit-BINZIP.txt
index 7dd1050..7932bdd 100644
--- a/notices/junit-BINZIP.txt
+++ b/notices/junit-BINZIP.txt
@@ -1,2 +1,5 @@
-This product bundles the JUnit jar (junit.org)
+This product bundles the JUnit4 jar (junit.org)
 which is available under the terms of the Eclipse Public License v1.0
+
+This product bundles several of the JUnit5 jars (junit.org)
+which are available under the terms of the Eclipse Public License v2.0

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 0405148..f726532 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -36,6 +36,7 @@ def subprojects = ['groovy-ant',
         'groovy-swing',
         'groovy-templates',
         'groovy-test',
+        'groovy-test-junit5',
         'groovy-testng',
         'groovy-xml',
         'groovy-macro',

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/src/spec/doc/core-testing-guide.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/core-testing-guide.adoc b/src/spec/doc/core-testing-guide.adoc
index 5867a29..b7e4679 100644
--- a/src/spec/doc/core-testing-guide.adoc
+++ b/src/spec/doc/core-testing-guide.adoc
@@ -358,10 +358,21 @@ cobertura {
 Several output formats can be chosen for Cobertura coverage reports and test code coverage reports can be added to
 continuous integration build tasks.
 
-== Unit Tests with JUnit 3 and 4
+== Testing with JUnit
 
-Groovy simplifies JUnit testing, making it more Groovy. In the following sections we will have a closer look at
-JUnit 3/4 Groovy integration.
+Groovy simplifies JUnit testing in the following ways:
+
+* You use the same overall practices as you would when testing with Java but you
+can adopt much of Groovy's concise syntax in your tests making them succinct. You can even use
+the capabilities for writing testing domain specific languages (DSLs) if you feel so inclined.
+* There are numerous helper classes that simplify many testing activities. The details differ
+in some cases depending on the version of JUnit you are using. We'll cover those details shortly.
+* Groovy's PowerAssert mechanism is wonderful to use in your tests
+* Groovy deems that tests are so important you should be able to run them as easily as scripts or classes.
+This is why Groovy includes an automatic test runner when using the `groovy` command or the GroovyConsole.
+This gives you some additional options over and above running your tests
+
+In the following sections we will have a closer look at JUnit 3, 4 and 5 Groovy integration.
 
 === JUnit 3
 
@@ -481,6 +492,8 @@ exception:
 include::{projectdir}/src/spec/test/testingguide/JUnit4ExampleTests.groovy[tags=should_fail_return,indent=0]
 ----
 
+include::{rootProjectDir}/subprojects/groovy-test-junit5/src/spec/doc/testing-with-junit5.adoc[leveloffset=+1]
+
 == Testing with Spock
 
 Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/subprojects/groovy-test-junit5/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-test-junit5/build.gradle b/subprojects/groovy-test-junit5/build.gradle
new file mode 100644
index 0000000..1accebc
--- /dev/null
+++ b/subprojects/groovy-test-junit5/build.gradle
@@ -0,0 +1,36 @@
+/*
+ *  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.
+ */
+dependencies {
+    compile rootProject
+    compile 'org.junit.platform:junit-platform-launcher:1.2.0'
+    runtime 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
+    testCompile 'org.junit.jupiter:junit-jupiter-params:5.2.0'
+    testRuntime 'org.junit.platform:junit-platform-runner:1.2.0'
+    testRuntime 'org.junit.vintage:junit-vintage-engine:5.2.0'
+    testCompile project(':groovy-test')
+}
+
+tasks.withType(JavaCompile) {
+    sourceCompatibility = 1.8
+    targetCompatibility = 1.8
+}
+
+test {
+    useJUnitPlatform()
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/subprojects/groovy-test-junit5/src/main/groovy/groovy/junit5/plugin/GroovyJUnitRunnerHelper.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-test-junit5/src/main/groovy/groovy/junit5/plugin/GroovyJUnitRunnerHelper.groovy b/subprojects/groovy-test-junit5/src/main/groovy/groovy/junit5/plugin/GroovyJUnitRunnerHelper.groovy
new file mode 100644
index 0000000..1c1a1d3
--- /dev/null
+++ b/subprojects/groovy-test-junit5/src/main/groovy/groovy/junit5/plugin/GroovyJUnitRunnerHelper.groovy
@@ -0,0 +1,48 @@
+/*
+ *  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 groovy.junit5.plugin
+
+import org.junit.platform.launcher.Launcher
+import org.junit.platform.launcher.LauncherDiscoveryRequest
+import org.junit.platform.launcher.TestExecutionListener
+import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder
+import org.junit.platform.launcher.core.LauncherFactory
+import org.junit.platform.launcher.listeners.LoggingListener
+import org.junit.platform.launcher.listeners.SummaryGeneratingListener
+
+import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass
+
+class GroovyJUnitRunnerHelper {
+    static Throwable execute(Class testClass) {
+        LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request()
+                .selectors(selectClass(testClass)).build()
+        Launcher launcher = LauncherFactory.create()
+
+        TestExecutionListener listener = new SummaryGeneratingListener()
+        launcher.registerTestExecutionListeners(listener)
+        launcher.registerTestExecutionListeners(LoggingListener.forJavaUtilLogging())
+        launcher.execute(request)
+        println listener.summary.with{ "JUnit5 launcher: passed=$testsSucceededCount, failed=$testsFailedCount, skipped=$testsSkippedCount, time=${timeFinished-timeStarted}ms" }
+        if (listener.summary.failures) {
+            listener.summary.printFailuresTo(new PrintWriter(System.out, true))
+            return listener.summary.failures[0].exception
+        }
+        return null
+    }
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/subprojects/groovy-test-junit5/src/main/java/groovy/junit5/plugin/JUnit5Runner.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-test-junit5/src/main/java/groovy/junit5/plugin/JUnit5Runner.java b/subprojects/groovy-test-junit5/src/main/java/groovy/junit5/plugin/JUnit5Runner.java
new file mode 100644
index 0000000..8cd13f6
--- /dev/null
+++ b/subprojects/groovy-test-junit5/src/main/java/groovy/junit5/plugin/JUnit5Runner.java
@@ -0,0 +1,104 @@
+/*
+ *  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 groovy.junit5.plugin;
+
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyRuntimeException;
+import org.apache.groovy.plugin.GroovyRunner;
+import org.codehaus.groovy.runtime.InvokerHelper;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+/**
+ * Integration code for running JUnit5 tests in Groovy.
+ */
+public class JUnit5Runner implements GroovyRunner {
+
+    /**
+     * Utility method to check via reflection if the parsed class appears to be a JUnit5
+     * test, i.e. checks whether it appears to be using the relevant annotations.
+     *
+     * @param scriptClass the class we want to check
+     * @param loader the GroovyClassLoader to use to find classes
+     * @return true if the class appears to be a compatible test
+     */
+    @Override
+    public boolean canRun(Class<?> scriptClass, GroovyClassLoader loader) {
+        if (isJUnit5AnnotationPresent(scriptClass.getAnnotations(), loader)) {
+            return true;
+        } else {
+            Method[] methods = scriptClass.getMethods();
+            for (Method method : methods) {
+                if (isJUnit5AnnotationPresent(method.getAnnotations(), loader)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    private boolean isJUnit5AnnotationPresent(Annotation[] annotations, GroovyClassLoader loader) {
+        for (Annotation annotation : annotations) {
+            String name = annotation.annotationType().getName();
+            if (name.startsWith("org.junit.jupiter.api.") && tryLoadClass(name, loader)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean tryLoadClass(String name, GroovyClassLoader loader) {
+        try {
+            loader.loadClass("org.junit.jupiter.api.Test");
+            return true;
+        } catch (ClassNotFoundException ignore) {
+            // fall through
+        }
+        return false;
+    }
+
+    /**
+     * Utility method to run a JUnit 5 test.
+     *
+     * @param scriptClass the class we want to run as a test
+     * @param loader the class loader to use
+     * @return the result of running the test
+     */
+    @Override
+    public Object run(Class<?> scriptClass, GroovyClassLoader loader) {
+        try {
+            try {
+                loader.loadClass("org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder");
+            } catch (ClassNotFoundException ignored) {
+                // subsequent steps will bomb out but try to give some more friendly information first
+                System.err.println("WARNING: Required dependency: org.junit.platform:junit-platform-launcher doesn't appear to be on the classpath");
+            }
+            Class<?> helper = loader.loadClass("groovy.junit5.plugin.GroovyJUnitRunnerHelper");
+            Throwable ifFailed = (Throwable) InvokerHelper.invokeStaticMethod(helper, "execute", new Object[]{scriptClass});
+            if (ifFailed != null) {
+                throw new GroovyRuntimeException(ifFailed);
+            }
+            return null;
+        } catch (ClassNotFoundException e) {
+            throw new GroovyRuntimeException("Error running JUnit 5 test.", e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/subprojects/groovy-test-junit5/src/main/resources/META-INF/services/org.apache.groovy.plugin.GroovyRunner
----------------------------------------------------------------------
diff --git a/subprojects/groovy-test-junit5/src/main/resources/META-INF/services/org.apache.groovy.plugin.GroovyRunner b/subprojects/groovy-test-junit5/src/main/resources/META-INF/services/org.apache.groovy.plugin.GroovyRunner
new file mode 100644
index 0000000..a0a7e3d
--- /dev/null
+++ b/subprojects/groovy-test-junit5/src/main/resources/META-INF/services/org.apache.groovy.plugin.GroovyRunner
@@ -0,0 +1,20 @@
+#
+#  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.
+#
+
+groovy.junit5.plugin.JUnit5Runner

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/subprojects/groovy-test-junit5/src/spec/doc/testing-with-junit5.adoc
----------------------------------------------------------------------
diff --git a/subprojects/groovy-test-junit5/src/spec/doc/testing-with-junit5.adoc b/subprojects/groovy-test-junit5/src/spec/doc/testing-with-junit5.adoc
new file mode 100644
index 0000000..b1d915f
--- /dev/null
+++ b/subprojects/groovy-test-junit5/src/spec/doc/testing-with-junit5.adoc
@@ -0,0 +1,30 @@
+== JUnit 5
+
+Much of the approach and helper classes described under JUnit4 apply when using JUnit5 however JUnit5
+uses some slightly different class annotations when writing your tests. See the http://junit.org[JUnit5] documentation
+for more details.
+
+Create your test classes as per normal JUnit5 guidelines as shown in this example:
+
+[source,groovy]
+----
+include::{rootprojectdir}/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy[tags=junit5_test_part1,indent=0]
+include::{rootprojectdir}/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy[tags=junit5_test_part2,indent=0]
+----
+<1> This test requires the additional `org.junit.jupiter:junit-jupiter-params` dependency if not already in your project.
+
+You can run the tests in your IDE or build tool if it supports and is configured for JUnit5.
+If you run the above test in the GroovyConsole or via the `groovy` command, you will see a short text summary of the
+result of running the test:
+
+----
+include::{rootprojectdir}/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy[tags=junit5_test_output,indent=0]
+----
+
+More detailed information is available at the `FINE` logging level. You can configure your logging to display such
+information or do it programmatically as follows:
+
+[source,groovy]
+----
+include::{rootprojectdir}/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy[tags=junit5_test_part3,indent=0]
+----

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy b/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy
new file mode 100644
index 0000000..17b4b32
--- /dev/null
+++ b/subprojects/groovy-test-junit5/src/spec/test/MyTestViaRun.groovy
@@ -0,0 +1,81 @@
+/*
+ *  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.
+ */
+class MyTestViaRun extends GroovyTestCase {
+  void testJunit5ViaRun() {
+    new GroovyShell().run '''
+//@Grab('org.junit.jupiter:junit-jupiter-params:5.2.0')
+import org.junit.jupiter.api.*
+import org.junit.jupiter.params.ParameterizedTest
+import org.junit.jupiter.params.provider.ValueSource
+import java.util.stream.Stream
+import static org.junit.jupiter.api.Assertions.assertTrue
+import static org.junit.jupiter.api.DynamicTest.dynamicTest
+import java.util.logging.ConsoleHandler
+import java.util.logging.Level
+import java.util.logging.Logger
+import org.junit.platform.launcher.listeners.LoggingListener
+
+// tag::junit5_test_part1[]
+class MyTest {
+// end::junit5_test_part1[]
+  // tag::junit5_test_part3[]
+  @BeforeAll
+  static void init() {
+    def logger = Logger.getLogger(LoggingListener.name)
+    logger.level = Level.FINE
+    logger.addHandler(new ConsoleHandler(level: Level.FINE))
+  }
+  // end::junit5_test_part3[]
+
+// tag::junit5_test_part2[]
+  @Test
+  void streamSum() {
+    assertTrue(Stream.of(1, 2, 3)
+      .mapToInt(i -> i)
+      .sum() > 5, () -> "Sum should be greater than 5")
+  }
+
+  @RepeatedTest(value=2, name = "{displayName} {currentRepetition}/{totalRepetitions}")
+  void streamSumRepeated() {
+    assert Stream.of(1, 2, 3).mapToInt(i -> i).sum() == 6
+  }
+
+  private boolean isPalindrome(s) { s == s.reverse()  }
+
+  @ParameterizedTest                                                              // <1>
+  @ValueSource(strings = [ "racecar", "radar", "able was I ere I saw elba" ])
+  void palindromes(String candidate) {
+    assert isPalindrome(candidate)
+  }
+
+  @TestFactory
+  def dynamicTestCollection() {[
+    dynamicTest("Add test") { -> assert 1 + 1 == 2 },
+    dynamicTest("Multiply Test", () -> { assert 2 * 3 == 6 })
+  ]}
+}
+// end::junit5_test_part2[]
+''', "MyTest", []
+  }
+/*
+// tag::junit5_test_output[]
+JUnit5 launcher: passed=8, failed=0, skipped=0, time=246ms
+// end::junit5_test_output[]
+*/
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/95dfb2f2/subprojects/groovy-test-junit5/src/test/groovy/MyTestJunit5.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-test-junit5/src/test/groovy/MyTestJunit5.groovy b/subprojects/groovy-test-junit5/src/test/groovy/MyTestJunit5.groovy
new file mode 100644
index 0000000..69317b3
--- /dev/null
+++ b/subprojects/groovy-test-junit5/src/test/groovy/MyTestJunit5.groovy
@@ -0,0 +1,36 @@
+//@Grab('org.junit.jupiter:junit-jupiter-params:5.2.0')
+import org.junit.jupiter.api.*
+import org.junit.jupiter.params.ParameterizedTest
+import org.junit.jupiter.params.provider.ValueSource
+import java.util.stream.Stream
+import static org.junit.jupiter.api.Assertions.assertTrue
+import static org.junit.jupiter.api.DynamicTest.dynamicTest
+
+class MyTestJUnit5 {
+
+  @Test
+  void streamSum() {
+    assertTrue(Stream.of(1, 2, 3)
+      .mapToInt(i -> i)
+      .sum() > 5, () -> "Sum should be greater than 5")
+  }
+
+  @RepeatedTest(value=2, name = "{displayName} {currentRepetition}/{totalRepetitions}")
+  void streamSumRepeated() {
+    assert Stream.of(1, 2, 3).mapToInt(i -> i).sum() == 6
+  }
+
+  private boolean isPalindrome(s) { s == s.reverse()  }
+
+  @ParameterizedTest
+  @ValueSource(strings = [ "racecar", "radar", "able was I ere I saw elba" ])
+  void palindromes(String candidate) {
+    assert isPalindrome(candidate)
+  }
+
+  @TestFactory
+  def dynamicTestCollection() {[
+    dynamicTest("Add test") { -> assert 1 + 1 == 2 },
+    dynamicTest("Multiply Test", () -> { assert 2 * 3 == 6 })
+  ]}
+}


[2/3] groovy git commit: GROOVY-8605 Autocompletion for Groovy command line tools

Posted by pa...@apache.org.
GROOVY-8605 Autocompletion for Groovy command line tools


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/34d63691
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/34d63691
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/34d63691

Branch: refs/heads/master
Commit: 34d6369199ee28cbb3a972f3831da359215c0ad4
Parents: 95dfb2f
Author: Remko Popma <re...@yahoo.com>
Authored: Sat May 26 22:33:54 2018 +0900
Committer: Paul King <pa...@asert.com.au>
Committed: Sun May 27 00:18:00 2018 +1000

----------------------------------------------------------------------
 src/bin/grape_completion         | 181 ++++++++++++++++++++++++++++++++++
 src/bin/groovyConsole_completion | 106 ++++++++++++++++++++
 src/bin/groovy_completion        | 106 ++++++++++++++++++++
 src/bin/groovyc_completion       | 142 ++++++++++++++++++++++++++
 src/bin/groovydoc_completion     | 106 ++++++++++++++++++++
 src/bin/groovysh_completion      | 103 +++++++++++++++++++
 6 files changed, 744 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/34d63691/src/bin/grape_completion
----------------------------------------------------------------------
diff --git a/src/bin/grape_completion b/src/bin/grape_completion
new file mode 100644
index 0000000..1c59b0c
--- /dev/null
+++ b/src/bin/grape_completion
@@ -0,0 +1,181 @@
+#!/usr/bin/env bash
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+#
+# grape Bash Completion
+# =======================
+#
+# Bash completion support for the `grape` command,
+# generated by [picocli](http://picocli.info/) version 3.0.2.
+#
+# Installation
+# ------------
+#
+# 1. Source all completion scripts in your .bash_profile
+#
+#   cd $GROOVY_HOME/bin
+#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
+#
+# 2. Open a new bash console, and type `grape [TAB][TAB]`
+#
+# Documentation
+# -------------
+# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
+# 'grape (..)'. By reading entered command line parameters,
+# it determines possible bash completions and writes them to the COMPREPLY variable.
+# Bash then completes the user input if only one entry is listed in the variable or
+# shows the options if more than one is listed in COMPREPLY.
+#
+# References
+# ----------
+# [1] http://stackoverflow.com/a/12495480/1440785
+# [2] http://tiswww.case.edu/php/chet/bash/FAQ
+# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
+# [4] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
+# [5] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
+#
+
+# Enable programmable completion facilities (see [3])
+shopt -s progcomp
+
+# ArrContains takes two arguments, both of which are the name of arrays.
+# It creates a temporary hash from lArr1 and then checks if all elements of lArr2
+# are in the hashtable.
+#
+# Returns zero (no error) if all elements of the 2nd array are in the 1st array,
+# otherwise returns 1 (error).
+#
+# Modified from [4]
+function ArrContains() {
+  local lArr1 lArr2
+  declare -A tmp
+  eval lArr1=("\"\${$1[@]}\"")
+  eval lArr2=("\"\${$2[@]}\"")
+  for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
+  for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
+  return 0
+}
+
+# Bash completion entry point function.
+# _complete_grape finds which commands and subcommands have been specified
+# on the command line and delegates to the appropriate function
+# to generate possible options and subcommands for the last specified subcommand.
+function _complete_grape() {
+  CMDS0=(install)
+  CMDS1=(uninstall)
+  CMDS2=(list)
+  CMDS3=(resolve)
+  CMDS4=(help)
+
+  ArrContains COMP_WORDS CMDS4 && { _picocli_grape_help; return $?; }
+  ArrContains COMP_WORDS CMDS3 && { _picocli_grape_resolve; return $?; }
+  ArrContains COMP_WORDS CMDS2 && { _picocli_grape_list; return $?; }
+  ArrContains COMP_WORDS CMDS1 && { _picocli_grape_uninstall; return $?; }
+  ArrContains COMP_WORDS CMDS0 && { _picocli_grape_install; return $?; }
+
+  # No subcommands were specified; generate completions for the top-level command.
+  _picocli_grape; return $?;
+}
+
+# Generates completions for the options and subcommands of the `grape` command.
+function _picocli_grape() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS="install uninstall list resolve help"
+  FLAG_OPTS="-q --quiet -w --warn -i --info -V --verbose -d --debug -h --help -v --version"
+  ARG_OPTS="-D --define -r --resolver"
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Generates completions for the options and subcommands of the `install` subcommand.
+function _picocli_grape_install() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-h --help -v --version"
+  ARG_OPTS=""
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Generates completions for the options and subcommands of the `uninstall` subcommand.
+function _picocli_grape_uninstall() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-h --help -v --version"
+  ARG_OPTS=""
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Generates completions for the options and subcommands of the `list` subcommand.
+function _picocli_grape_list() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-h --help -v --version"
+  ARG_OPTS=""
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Generates completions for the options and subcommands of the `resolve` subcommand.
+function _picocli_grape_resolve() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-a --ant -d --dos -s --shell -i --ivy -h --help -v --version"
+  ARG_OPTS=""
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Generates completions for the options and subcommands of the `help` subcommand.
+function _picocli_grape_help() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-h --help"
+  ARG_OPTS=""
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Define a completion specification (a compspec) for the
+# `grape`, `grape.sh`, and `grape.bash` commands.
+# Uses the bash `complete` builtin (see [5]) to specify that shell function
+# `_complete_grape` is responsible for generating possible completions for the
+# current word on the command line.
+# The `-o default` option means that if the function generated no matches, the
+# default Bash completions and the Readline default filename completions are performed.
+complete -F _complete_grape -o default grape grape.sh grape.bash

http://git-wip-us.apache.org/repos/asf/groovy/blob/34d63691/src/bin/groovyConsole_completion
----------------------------------------------------------------------
diff --git a/src/bin/groovyConsole_completion b/src/bin/groovyConsole_completion
new file mode 100644
index 0000000..10c777c
--- /dev/null
+++ b/src/bin/groovyConsole_completion
@@ -0,0 +1,106 @@
+#!/usr/bin/env bash
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+#
+# groovyConsole Bash Completion
+# =======================
+#
+# Bash completion support for the `groovyConsole` command,
+# generated by [picocli](http://picocli.info/) version 3.0.2.
+#
+# Installation
+# ------------
+#
+# 1. Source all completion scripts in your .bash_profile
+#
+#   cd $GROOVY_HOME/bin
+#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
+#
+# 2. Open a new bash console, and type `groovyConsole [TAB][TAB]`
+#
+# Documentation
+# -------------
+# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
+# 'groovyConsole (..)'. By reading entered command line parameters,
+# it determines possible bash completions and writes them to the COMPREPLY variable.
+# Bash then completes the user input if only one entry is listed in the variable or
+# shows the options if more than one is listed in COMPREPLY.
+#
+# References
+# ----------
+# [1] http://stackoverflow.com/a/12495480/1440785
+# [2] http://tiswww.case.edu/php/chet/bash/FAQ
+# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
+# [4] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
+# [5] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
+#
+
+# Enable programmable completion facilities (see [3])
+shopt -s progcomp
+
+# ArrContains takes two arguments, both of which are the name of arrays.
+# It creates a temporary hash from lArr1 and then checks if all elements of lArr2
+# are in the hashtable.
+#
+# Returns zero (no error) if all elements of the 2nd array are in the 1st array,
+# otherwise returns 1 (error).
+#
+# Modified from [4]
+function ArrContains() {
+  local lArr1 lArr2
+  declare -A tmp
+  eval lArr1=("\"\${$1[@]}\"")
+  eval lArr2=("\"\${$2[@]}\"")
+  for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
+  for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
+  return 0
+}
+
+# Bash completion entry point function.
+# _complete_groovyConsole finds which commands and subcommands have been specified
+# on the command line and delegates to the appropriate function
+# to generate possible options and subcommands for the last specified subcommand.
+function _complete_groovyConsole() {
+
+
+  # No subcommands were specified; generate completions for the top-level command.
+  _picocli_groovyConsole; return $?;
+}
+
+# Generates completions for the options and subcommands of the `groovyConsole` command.
+function _picocli_groovyConsole() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-cp -classpath --classpath -h --help -V --version -pa --parameters -i --indy"
+  ARG_OPTS="-D --define --configscript"
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Define a completion specification (a compspec) for the
+# `groovyConsole`, `groovyConsole.sh`, and `groovyConsole.bash` commands.
+# Uses the bash `complete` builtin (see [5]) to specify that shell function
+# `_complete_groovyConsole` is responsible for generating possible completions for the
+# current word on the command line.
+# The `-o default` option means that if the function generated no matches, the
+# default Bash completions and the Readline default filename completions are performed.
+complete -F _complete_groovyConsole -o default groovyConsole groovyConsole.sh groovyConsole.bash

http://git-wip-us.apache.org/repos/asf/groovy/blob/34d63691/src/bin/groovy_completion
----------------------------------------------------------------------
diff --git a/src/bin/groovy_completion b/src/bin/groovy_completion
new file mode 100644
index 0000000..13cd712
--- /dev/null
+++ b/src/bin/groovy_completion
@@ -0,0 +1,106 @@
+#!/usr/bin/env bash
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+#
+# groovy Bash Completion
+# =======================
+#
+# Bash completion support for the `groovy` command,
+# generated by [picocli](http://picocli.info/) version 3.0.2.
+#
+# Installation
+# ------------
+#
+# 1. Source all completion scripts in your .bash_profile
+#
+#   cd $GROOVY_HOME/bin
+#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
+#
+# 2. Open a new bash console, and type `groovy [TAB][TAB]`
+#
+# Documentation
+# -------------
+# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
+# 'groovy (..)'. By reading entered command line parameters,
+# it determines possible bash completions and writes them to the COMPREPLY variable.
+# Bash then completes the user input if only one entry is listed in the variable or
+# shows the options if more than one is listed in COMPREPLY.
+#
+# References
+# ----------
+# [1] http://stackoverflow.com/a/12495480/1440785
+# [2] http://tiswww.case.edu/php/chet/bash/FAQ
+# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
+# [4] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
+# [5] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
+#
+
+# Enable programmable completion facilities (see [3])
+shopt -s progcomp
+
+# ArrContains takes two arguments, both of which are the name of arrays.
+# It creates a temporary hash from lArr1 and then checks if all elements of lArr2
+# are in the hashtable.
+#
+# Returns zero (no error) if all elements of the 2nd array are in the 1st array,
+# otherwise returns 1 (error).
+#
+# Modified from [4]
+function ArrContains() {
+  local lArr1 lArr2
+  declare -A tmp
+  eval lArr1=("\"\${$1[@]}\"")
+  eval lArr2=("\"\${$2[@]}\"")
+  for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
+  for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
+  return 0
+}
+
+# Bash completion entry point function.
+# _complete_groovy finds which commands and subcommands have been specified
+# on the command line and delegates to the appropriate function
+# to generate possible options and subcommands for the last specified subcommand.
+function _complete_groovy() {
+
+
+  # No subcommands were specified; generate completions for the top-level command.
+  _picocli_groovy; return $?;
+}
+
+# Generates completions for the options and subcommands of the `groovy` command.
+function _picocli_groovy() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-d --debug -n -p -pa --parameters --indy -h --help -v --version"
+  ARG_OPTS="-cp -classpath --classpath -D --define --disableopt -c --encoding -e -i -l -a --autosplit --configscript -b --basescript"
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Define a completion specification (a compspec) for the
+# `groovy`, `groovy.sh`, and `groovy.bash` commands.
+# Uses the bash `complete` builtin (see [5]) to specify that shell function
+# `_complete_groovy` is responsible for generating possible completions for the
+# current word on the command line.
+# The `-o default` option means that if the function generated no matches, the
+# default Bash completions and the Readline default filename completions are performed.
+complete -F _complete_groovy -o default groovy groovy.sh groovy.bash

http://git-wip-us.apache.org/repos/asf/groovy/blob/34d63691/src/bin/groovyc_completion
----------------------------------------------------------------------
diff --git a/src/bin/groovyc_completion b/src/bin/groovyc_completion
new file mode 100644
index 0000000..ebb2a2a
--- /dev/null
+++ b/src/bin/groovyc_completion
@@ -0,0 +1,142 @@
+#!/usr/bin/env bash
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+#
+# groovyc Bash Completion
+# =======================
+#
+# Bash completion support for the `groovyc` command,
+# generated by [picocli](http://picocli.info/) version 3.0.2.
+#
+# Installation
+# ------------
+#
+# 1. Source all completion scripts in your .bash_profile
+#
+#   cd $GROOVY_HOME/bin
+#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
+#
+# 2. Open a new bash console, and type `groovyc [TAB][TAB]`
+#
+# Documentation
+# -------------
+# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
+# 'groovyc (..)'. By reading entered command line parameters,
+# it determines possible bash completions and writes them to the COMPREPLY variable.
+# Bash then completes the user input if only one entry is listed in the variable or
+# shows the options if more than one is listed in COMPREPLY.
+#
+# References
+# ----------
+# [1] http://stackoverflow.com/a/12495480/1440785
+# [2] http://tiswww.case.edu/php/chet/bash/FAQ
+# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
+# [4] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
+# [5] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
+#
+
+# Enable programmable completion facilities (see [3])
+shopt -s progcomp
+
+# ArrContains takes two arguments, both of which are the name of arrays.
+# It creates a temporary hash from lArr1 and then checks if all elements of lArr2
+# are in the hashtable.
+#
+# Returns zero (no error) if all elements of the 2nd array are in the 1st array,
+# otherwise returns 1 (error).
+#
+# Modified from [4]
+function ArrContains() {
+  local lArr1 lArr2
+  declare -A tmp
+  eval lArr1=("\"\${$1[@]}\"")
+  eval lArr2=("\"\${$2[@]}\"")
+  for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
+  for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
+  return 0
+}
+
+# Bash completion entry point function.
+# _complete_groovyc finds which commands and subcommands have been specified
+# on the command line and delegates to the appropriate function
+# to generate possible options and subcommands for the last specified subcommand.
+function _complete_groovyc() {
+
+
+  # No subcommands were specified; generate completions for the top-level command.
+  _picocli_groovyc; return $?;
+}
+
+# Generates completions for the options and subcommands of the `groovyc` command.
+function _picocli_groovyc() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-e --exception -pa --parameters -j --jointCompilation --indy -h --help -v --version"
+  ARG_OPTS="-cp -classpath --classpath -sourcepath --sourcepath --temp --encoding -d -b --basescript -J -F --configscript"
+
+  case ${CURR_WORD} in
+    -sourcepath|--sourcepath)
+      compopt -o filenames
+      COMPREPLY=( $( compgen -f -- "" ) ) # files
+      return $?
+      ;;
+    --temp)
+      compopt -o filenames
+      COMPREPLY=( $( compgen -f -- "" ) ) # files
+      return $?
+      ;;
+    -d)
+      compopt -o filenames
+      COMPREPLY=( $( compgen -f -- "" ) ) # files
+      return $?
+      ;;
+    *)
+      case ${PREV_WORD} in
+        -sourcepath|--sourcepath)
+          compopt -o filenames
+          COMPREPLY=( $( compgen -f -- $CURR_WORD ) ) # files
+          return $?
+          ;;
+        --temp)
+          compopt -o filenames
+          COMPREPLY=( $( compgen -f -- $CURR_WORD ) ) # files
+          return $?
+          ;;
+        -d)
+          compopt -o filenames
+          COMPREPLY=( $( compgen -f -- $CURR_WORD ) ) # files
+          return $?
+          ;;
+      esac
+  esac
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Define a completion specification (a compspec) for the
+# `groovyc`, `groovyc.sh`, and `groovyc.bash` commands.
+# Uses the bash `complete` builtin (see [5]) to specify that shell function
+# `_complete_groovyc` is responsible for generating possible completions for the
+# current word on the command line.
+# The `-o default` option means that if the function generated no matches, the
+# default Bash completions and the Readline default filename completions are performed.
+complete -F _complete_groovyc -o default groovyc groovyc.sh groovyc.bash

http://git-wip-us.apache.org/repos/asf/groovy/blob/34d63691/src/bin/groovydoc_completion
----------------------------------------------------------------------
diff --git a/src/bin/groovydoc_completion b/src/bin/groovydoc_completion
new file mode 100644
index 0000000..afcdfc3
--- /dev/null
+++ b/src/bin/groovydoc_completion
@@ -0,0 +1,106 @@
+#!/usr/bin/env bash
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+#
+# groovydoc Bash Completion
+# =======================
+#
+# Bash completion support for the `groovydoc` command,
+# generated by [picocli](http://picocli.info/) version 3.0.2.
+#
+# Installation
+# ------------
+#
+# 1. Source all completion scripts in your .bash_profile
+#
+#   cd $GROOVY_HOME/bin
+#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
+#
+# 2. Open a new bash console, and type `groovydoc [TAB][TAB]`
+#
+# Documentation
+# -------------
+# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
+# 'groovydoc (..)'. By reading entered command line parameters,
+# it determines possible bash completions and writes them to the COMPREPLY variable.
+# Bash then completes the user input if only one entry is listed in the variable or
+# shows the options if more than one is listed in COMPREPLY.
+#
+# References
+# ----------
+# [1] http://stackoverflow.com/a/12495480/1440785
+# [2] http://tiswww.case.edu/php/chet/bash/FAQ
+# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
+# [4] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
+# [5] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
+#
+
+# Enable programmable completion facilities (see [3])
+shopt -s progcomp
+
+# ArrContains takes two arguments, both of which are the name of arrays.
+# It creates a temporary hash from lArr1 and then checks if all elements of lArr2
+# are in the hashtable.
+#
+# Returns zero (no error) if all elements of the 2nd array are in the 1st array,
+# otherwise returns 1 (error).
+#
+# Modified from [4]
+function ArrContains() {
+  local lArr1 lArr2
+  declare -A tmp
+  eval lArr1=("\"\${$1[@]}\"")
+  eval lArr2=("\"\${$2[@]}\"")
+  for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
+  for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
+  return 0
+}
+
+# Bash completion entry point function.
+# _complete_groovydoc finds which commands and subcommands have been specified
+# on the command line and delegates to the appropriate function
+# to generate possible options and subcommands for the last specified subcommand.
+function _complete_groovydoc() {
+
+
+  # No subcommands were specified; generate completions for the top-level command.
+  _picocli_groovydoc; return $?;
+}
+
+# Generates completions for the options and subcommands of the `groovydoc` command.
+function _picocli_groovydoc() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-h -help --help --version -verbose -quiet --debug -classpath -cp --classpath -author -noscripts -nomainforscripts -notimestamp -noversionstamp -public -protected -package -private"
+  ARG_OPTS="-d --destdir -overview -charset -fileEncoding -windowtitle -doctitle -header -footer -exclude -stylesheetfile -sourcepath"
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Define a completion specification (a compspec) for the
+# `groovydoc`, `groovydoc.sh`, and `groovydoc.bash` commands.
+# Uses the bash `complete` builtin (see [5]) to specify that shell function
+# `_complete_groovydoc` is responsible for generating possible completions for the
+# current word on the command line.
+# The `-o default` option means that if the function generated no matches, the
+# default Bash completions and the Readline default filename completions are performed.
+complete -F _complete_groovydoc -o default groovydoc groovydoc.sh groovydoc.bash

http://git-wip-us.apache.org/repos/asf/groovy/blob/34d63691/src/bin/groovysh_completion
----------------------------------------------------------------------
diff --git a/src/bin/groovysh_completion b/src/bin/groovysh_completion
new file mode 100644
index 0000000..5b8869c
--- /dev/null
+++ b/src/bin/groovysh_completion
@@ -0,0 +1,103 @@
+#!/usr/bin/env bash
+# ----------------------------------------------------------------------------
+# 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.
+# ----------------------------------------------------------------------------
+#
+# groovysh Bash Completion
+# =======================
+#
+# Bash completion support for the `groovysh` command,
+# generated by [picocli](http://picocli.info/) version 3.0.2.
+#
+# 1. Source all completion scripts in your .bash_profile
+#
+#   cd $GROOVY_HOME/bin
+#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
+#
+# 2. Open a new bash console, and type `groovysh [TAB][TAB]`
+#
+# Documentation
+# -------------
+# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
+# 'groovysh (..)'. By reading entered command line parameters,
+# it determines possible bash completions and writes them to the COMPREPLY variable.
+# Bash then completes the user input if only one entry is listed in the variable or
+# shows the options if more than one is listed in COMPREPLY.
+#
+# References
+# ----------
+# [1] http://stackoverflow.com/a/12495480/1440785
+# [2] http://tiswww.case.edu/php/chet/bash/FAQ
+# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
+# [4] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
+# [5] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
+#
+
+# Enable programmable completion facilities (see [3])
+shopt -s progcomp
+
+# ArrContains takes two arguments, both of which are the name of arrays.
+# It creates a temporary hash from lArr1 and then checks if all elements of lArr2
+# are in the hashtable.
+#
+# Returns zero (no error) if all elements of the 2nd array are in the 1st array,
+# otherwise returns 1 (error).
+#
+# Modified from [4]
+function ArrContains() {
+  local lArr1 lArr2
+  declare -A tmp
+  eval lArr1=("\"\${$1[@]}\"")
+  eval lArr2=("\"\${$2[@]}\"")
+  for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
+  for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
+  return 0
+}
+
+# Bash completion entry point function.
+# _complete_groovysh finds which commands and subcommands have been specified
+# on the command line and delegates to the appropriate function
+# to generate possible options and subcommands for the last specified subcommand.
+function _complete_groovysh() {
+
+
+  # No subcommands were specified; generate completions for the top-level command.
+  _picocli_groovysh; return $?;
+}
+
+# Generates completions for the options and subcommands of the `groovysh` command.
+function _picocli_groovysh() {
+  # Get completion data
+  CURR_WORD=${COMP_WORDS[COMP_CWORD]}
+  PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
+
+  COMMANDS=""
+  FLAG_OPTS="-cp -classpath --classpath -h --help -V --version -v --verbose -q --quiet -d --debug -pa --parameters"
+  ARG_OPTS="-e --evaluate -C --color -D --define -T --terminal"
+
+  COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${COMMANDS}" -- ${CURR_WORD}) )
+}
+
+# Define a completion specification (a compspec) for the
+# `groovysh`, `groovysh.sh`, and `groovysh.bash` commands.
+# Uses the bash `complete` builtin (see [5]) to specify that shell function
+# `_complete_groovysh` is responsible for generating possible completions for the
+# current word on the command line.
+# The `-o default` option means that if the function generated no matches, the
+# default Bash completions and the Readline default filename completions are performed.
+complete -F _complete_groovysh -o default groovysh groovysh.sh groovysh.bash


[3/3] groovy git commit: GROOVY-8608: Bump picocli version to 3.0.2 from 3.0.1

Posted by pa...@apache.org.
GROOVY-8608: Bump picocli version to 3.0.2 from 3.0.1


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/2c40b026
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2c40b026
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2c40b026

Branch: refs/heads/master
Commit: 2c40b0266df30285bac73dfb1cb88d703777fd55
Parents: 34d6369
Author: Daniel Sun <re...@hotmail.com>
Authored: Sun May 27 00:20:45 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Sun May 27 00:20:45 2018 +1000

----------------------------------------------------------------------
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/2c40b026/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index b1f95ee..ef73861 100644
--- a/build.gradle
+++ b/build.gradle
@@ -163,7 +163,7 @@ ext {
     luceneVersion = '4.7.2'
     openbeansVersion = '1.0'
     openejbVersion = '1.0'
-    picocliVersion = '3.0.1'
+    picocliVersion = '3.0.2'
     qdoxVersion = '1.12.1'
     slf4jVersion = '1.7.21'
     xmlunitVersion = '1.6'