diff --git a/build.gradle b/build.gradle index 6c2cdde..d9cef1b 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } wrapper { - gradleVersion = "${project.property('gradle.wrapper.version')}" + gradleVersion = libs.versions.gradle.get() distributionType = Wrapper.DistributionType.ALL } diff --git a/gradle.properties b/gradle.properties index d9689c1..c1714d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,5 @@ group = org.xbib.groovy name = groovy-extensions -version = 4.0.2.0 +version = 4.0.3.0 org.gradle.warning.mode = ALL -groovy.version = 4.0.2 -gradle.wrapper.version = 7.3.2 -files.version = 3.0.0 -ftp.version = 2.6.0 -mail.version = 1.6.2 -sshd.version = 2.6.0.0 -junit4.version = 4.13.2 -jgit.version = 5.13.0.202109080827-r -spock.version = 2.2-M1-groovy-4.0 diff --git a/gradle/compile/groovy-dynamic-tests.gradle b/gradle/compile/groovy-dynamic-tests.gradle new file mode 100644 index 0000000..4efae2b --- /dev/null +++ b/gradle/compile/groovy-dynamic-tests.gradle @@ -0,0 +1,29 @@ +apply plugin: 'groovy' + +dependencies { + implementation libs.groovy.core + testImplementation libs.groovy.core +} + +compileGroovy { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + groovyOptions.configurationScript = rootProject.file('gradle/compile/groovyc.groovy') +} + +compileTestGroovy { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.withType(GroovyCompile) { + options.compilerArgs + if (!options.compilerArgs.contains("-processor")) { + options.compilerArgs << '-proc:none' + } +} + +task groovydocJar(type: Jar, dependsOn: 'groovydoc') { + from groovydoc.destinationDir + archiveClassifier.set('javadoc') +} diff --git a/gradle/compile/groovy-dynamic.gradle b/gradle/compile/groovy-dynamic.gradle new file mode 100644 index 0000000..e044cbf --- /dev/null +++ b/gradle/compile/groovy-dynamic.gradle @@ -0,0 +1,31 @@ +apply plugin: 'groovy' + +dependencies { + implementation libs.groovy.core + testImplementation libs.groovy.core +} + +compileGroovy { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +compileTestGroovy { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +tasks.withType(GroovyCompile) { + if (!options.compilerArgs.contains("-processor")) { + options.compilerArgs.add('-proc:none') + } +} + +task groovydocJar(type: Jar, dependsOn: 'groovydoc') { + from groovydoc.destinationDir + archiveClassifier.set('groovydoc') +} + +artifacts { + archives groovydocJar +} diff --git a/gradle/compile/groovy.gradle b/gradle/compile/groovy.gradle index b7a58d4..0cfc34e 100644 --- a/gradle/compile/groovy.gradle +++ b/gradle/compile/groovy.gradle @@ -1,17 +1,20 @@ apply plugin: 'groovy' dependencies { - implementation "org.apache.groovy:groovy:${project.property('groovy.version')}" + implementation libs.groovy.core + testImplementation libs.groovy.core } compileGroovy { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 + groovyOptions.configurationScript = rootProject.file('gradle/compile/groovyc.groovy') } compileTestGroovy { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 + groovyOptions.configurationScript = rootProject.file('gradle/compile/groovyc.groovy') } tasks.withType(GroovyCompile) { diff --git a/gradle/compile/groovyc.groovy b/gradle/compile/groovyc.groovy new file mode 100644 index 0000000..d5db92a --- /dev/null +++ b/gradle/compile/groovyc.groovy @@ -0,0 +1,7 @@ +import groovy.transform.TypeChecked +import groovy.transform.CompileStatic + +withConfig(configuration) { + ast(TypeChecked) + ast(CompileStatic) +} diff --git a/gradle/test/junit5.gradle b/gradle/test/junit5.gradle index 692ad51..c62d04a 100644 --- a/gradle/test/junit5.gradle +++ b/gradle/test/junit5.gradle @@ -1,17 +1,14 @@ - -def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.8.0' -def hamcrestVersion = project.hasProperty('hamcrest.version')?project.property('hamcrest.version'):'2.2' - dependencies { - testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}" - testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" - testImplementation "org.hamcrest:hamcrest-library:${hamcrestVersion}" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" + testImplementation libs.junit.jupiter.api + testImplementation libs.junit.jupiter.params + testImplementation libs.hamcrest + testRuntimeOnly libs.junit.jupiter.engine } test { useJUnitPlatform() failFast = false + systemProperty 'java.util.logging.config.file', 'src/test/resources/logging.properties' testLogging { events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED' } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..41d9927 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac0b842..92f06b5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/groovy-crypt/README.adoc b/groovy-crypt/README.adoc index 8a8c0d6..4da0343 100644 --- a/groovy-crypt/README.adoc +++ b/groovy-crypt/README.adoc @@ -1,17 +1,6 @@ = Groovy crypt library -image:https://api.travis-ci.org/xbib/groovy-crypt.svg[title="Build status", link="https://travis-ci.org/xbib/groovy-crypt/"] -image:https://maven-badges.herokuapp.com/maven-central/org.xbib.groovy/groovy-crypt/badge.svg[title="Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Cxbib%20groovy-crypt"] -image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[title="Apache License 2.0", link="https://opensource.org/licenses/Apache-2.0"] -image:https://img.shields.io/twitter/url/https/twitter.com/xbib.svg?style=social&label=Follow%20%40xbib[title="Twitter", link="https://twitter.com/xbib"] - -image:https://sonarqube.com/api/badges/gate?key=org.xbib.groovy:groovy-crypt[title="Quality Gate", link="https://sonarqube.com/dashboard/index?id=org.xbib.groovy%3Agroovy-crypt"] -image:https://sonarqube.com/api/badges/measure?key=org.xbib.groovy:groovy-crypt&metric=coverage[title="Coverage", link="https://sonarqube.com/dashboard/index?id=org.xbib.groovy%3Agroovy-crypt"] -image:https://sonarqube.com/api/badges/measure?key=org.xbib.groovy:groovy-crypt&metric=vulnerabilities[title="Vulnerabilities", link="https://sonarqube.com/dashboard/index?id=org.xbib.groovy%3Agroovy-crypt"] -image:https://sonarqube.com/api/badges/measure?key=org.xbib.groovy:groovy-crypt&metric=bugs[title="Bugs", link="https://sonarqube.com/dashboard/index?id=org.xbib.groovy%3Agroovy-crypt"] -image:https://sonarqube.com/api/badges/measure?key=org.xbib.groovy:groovy-crypt&metric=sqale_debt_ratio[title="Technical debt ratio", link="https://sonarqube.com/dashboard/index?id=org.xbib.groovy%3Agroovy-crypt"] - This Groovy crypt implementation of the `crypt(3)` function provided in the GNU C library (glibc) was derived from crypt4j by Carl Harris https://github.com/soulwing/crypt4j diff --git a/groovy-crypt/gradle.properties b/groovy-crypt/gradle.properties new file mode 100644 index 0000000..543c1fe --- /dev/null +++ b/groovy-crypt/gradle.properties @@ -0,0 +1 @@ +version = 4.0.0 diff --git a/groovy-crypt/src/main/groovy/org/xbib/groovy/crypt/random/MersenneTwisterRandom.groovy b/groovy-crypt/src/main/groovy/org/xbib/groovy/crypt/random/MersenneTwisterRandom.groovy index ae43b20..c1378eb 100644 --- a/groovy-crypt/src/main/groovy/org/xbib/groovy/crypt/random/MersenneTwisterRandom.groovy +++ b/groovy-crypt/src/main/groovy/org/xbib/groovy/crypt/random/MersenneTwisterRandom.groovy @@ -102,10 +102,12 @@ class MersenneTwisterRandom extends Random { } private static int[] convertBytesToInts(byte[] bytes) { - if (bytes.length % 4 != 0) { + int l = bytes.length + if (l % 4 != 0) { throw new IllegalArgumentException("number of input bytes must be a multiple of 4") } - int[] ints = new int[bytes.length / 4] + int size = l.intdiv(4) + int[] ints = new int[size] for (int i = 0; i < ints.length; i++) { ints[i] = convertBytesToInt(bytes, i * 4) } diff --git a/groovy-ftp/LICENSE.txt b/groovy-ftp/LICENSE.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/groovy-ftp/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) 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. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/groovy-ftp/build.gradle b/groovy-ftp/build.gradle index 45fa40f..d3a9396 100644 --- a/groovy-ftp/build.gradle +++ b/groovy-ftp/build.gradle @@ -1,5 +1,5 @@ apply from: rootProject.file('gradle/compile/groovy.gradle') dependencies { - api "org.xbib:ftp-fs:${project.property('ftp.version')}" + api libs.ftp.fs } diff --git a/groovy-ftp/gradle.properties b/groovy-ftp/gradle.properties new file mode 100644 index 0000000..543c1fe --- /dev/null +++ b/groovy-ftp/gradle.properties @@ -0,0 +1 @@ +version = 4.0.0 diff --git a/groovy-ftps/LICENSE.txt b/groovy-ftps/LICENSE.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/groovy-ftps/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) 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. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. diff --git a/groovy-ftps/build.gradle b/groovy-ftps/build.gradle index 45fa40f..d3a9396 100644 --- a/groovy-ftps/build.gradle +++ b/groovy-ftps/build.gradle @@ -1,5 +1,5 @@ apply from: rootProject.file('gradle/compile/groovy.gradle') dependencies { - api "org.xbib:ftp-fs:${project.property('ftp.version')}" + api libs.ftp.fs } diff --git a/groovy-ftps/gradle.properties b/groovy-ftps/gradle.properties new file mode 100644 index 0000000..543c1fe --- /dev/null +++ b/groovy-ftps/gradle.properties @@ -0,0 +1 @@ +version = 4.0.0 diff --git a/groovy-git/build.gradle b/groovy-git/build.gradle index f760d32..498767d 100644 --- a/groovy-git/build.gradle +++ b/groovy-git/build.gradle @@ -1,8 +1,7 @@ -apply from: rootProject.file('gradle/compile/groovy.gradle') +apply from: rootProject.file('gradle/compile/groovy-dynamic-tests.gradle') dependencies { - api "org.eclipse.jgit:org.eclipse.jgit:${project.property('jgit.version')}" - testImplementation "org.apache.groovy:groovy:${project.property('groovy.version')}" - testImplementation "org.spockframework:spock-core:${project.property('spock.version')}" - testImplementation "org.spockframework:spock-junit4:${project.property('spock.version')}" + api libs.jgit + testImplementation libs.spock.core + testImplementation libs.spock.junit4 } diff --git a/groovy-git/gradle.properties b/groovy-git/gradle.properties new file mode 100644 index 0000000..543c1fe --- /dev/null +++ b/groovy-git/gradle.properties @@ -0,0 +1 @@ +version = 4.0.0 diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/Status.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/Status.groovy index 445f4d9..5686b3c 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/Status.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/Status.groovy @@ -9,35 +9,35 @@ import groovy.transform.ToString @EqualsAndHashCode @ToString(includeNames=true) class Status { - final Changes staged - final Changes unstaged - final Set conflicts + Changes staged + Changes unstaged + Set conflicts Status(Map args = [:]) { def invalidArgs = args.keySet() - ['staged', 'unstaged', 'conflicts'] if (invalidArgs) { throw new IllegalArgumentException("Following keys are not supported: ${invalidArgs}") } - this.staged = 'staged' in args ? new Changes(args.staged) : new Changes() - this.unstaged = 'unstaged' in args ? new Changes(args.unstaged) : new Changes() - this.conflicts = 'conflicts' in args ? args.conflicts : [] + this.staged = 'staged' in args ? new Changes(args['staged'] as Map) : new Changes() + this.unstaged = 'unstaged' in args ? new Changes(args['unstaged'] as Map) : new Changes() + this.conflicts = 'conflicts' in args ? args['conflicts'] as Set : [] as Set } @EqualsAndHashCode @ToString(includeNames=true) class Changes { - final Set added - final Set modified - final Set removed + Set added + Set modified + Set removed Changes(Map args = [:]) { def invalidArgs = args.keySet() - ['added', 'modified', 'removed'] if (invalidArgs) { throw new IllegalArgumentException("Following keys are not supported: ${invalidArgs}") } - this.added = 'added' in args ? args.added : [] - this.modified = 'modified' in args ? args.modified : [] - this.removed = 'removed' in args ? args.removed : [] + this.added = 'added' in args ? args['added'] as Set : [] as Set + this.modified = 'modified' in args ? args['modified'] as Set : [] as Set + this.removed = 'removed' in args ? args['removed'] as Set : [] as Set } /** diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/auth/AuthConfig.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/auth/AuthConfig.groovy index 730d045..39b3e08 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/auth/AuthConfig.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/auth/AuthConfig.groovy @@ -52,6 +52,6 @@ class AuthConfig { * @throws IllegalArgumentException if force is set to an invalid option */ static AuthConfig fromSystem() { - return fromMap(System.properties, System.env) + return fromMap(System.properties as Map, System.getenv() as Map) } } diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/internal/OpSyntax.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/internal/OpSyntax.groovy index 547997a..4d15e8f 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/internal/OpSyntax.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/internal/OpSyntax.groovy @@ -14,7 +14,7 @@ class OpSyntax { def op = opClass.newInstance(classArgs) args.forEach { key, value -> - op[key] = value + op[key as String] = value } return op.call() diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/FetchOp.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/FetchOp.groovy index 50f7e8f..b2af5c6 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/FetchOp.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/FetchOp.groovy @@ -53,7 +53,7 @@ class FetchOp implements Callable { TransportOpUtil.configure(cmd, repo.credentials) if (remote) { cmd.remote = remote } cmd.refSpecs = refSpecs.collect { - new RefSpec(it) + new RefSpec(it as String) } cmd.removeDeletedRefs = prune cmd.tagOpt = tagMode.jgit diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/MergeOp.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/MergeOp.groovy index 3964d42..2c7b064 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/MergeOp.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/MergeOp.groovy @@ -1,5 +1,7 @@ package org.xbib.groovy.git.operation +import org.eclipse.jgit.lib.Ref + import java.util.concurrent.Callable import org.xbib.groovy.git.Repository import org.xbib.groovy.git.internal.Operation @@ -60,7 +62,7 @@ class MergeOp implements Callable { * we want to preserve ref name in merge commit msg. if it's a ref, don't * resolve down to commit id */ - def ref = repo.jgit.repository.findRef(head) + Ref ref = repo.jgit.repository.findRef(head as String) if (ref == null) { def revstr = new ResolveService(repo).toRevisionString(head) cmd.include(GitUtil.resolveObject(repo, revstr)) diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/PushOp.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/PushOp.groovy index bf2e9d3..12e6547 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/PushOp.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/PushOp.groovy @@ -1,5 +1,7 @@ package org.xbib.groovy.git.operation +import org.eclipse.jgit.lib.Ref + import java.util.concurrent.Callable import org.xbib.groovy.git.PushException import org.xbib.groovy.git.Repository @@ -63,7 +65,11 @@ class PushOp implements Callable { cmd.remote = remote } refsOrSpecs.each { - cmd.add(it) + if (it instanceof Ref) { + cmd.add(it as Ref) + } else if (it instanceof String) { + cmd.add(it as String) + } } if (all) { cmd.setPushAll() diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/RemoteAddOp.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/RemoteAddOp.groovy index 553a34b..69bdfe6 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/RemoteAddOp.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/RemoteAddOp.groovy @@ -60,10 +60,10 @@ class RemoteAddOp implements Callable { throw new IllegalStateException("remote $name already exists") } def toUri = { - url -> new URIish(url) + url -> new URIish(url as String) } def toRefSpec = { - spec -> new RefSpec(spec) + spec -> new RefSpec(spec as String) } RemoteConfig remote = new RemoteConfig(config, name) if (url) { @@ -72,7 +72,7 @@ class RemoteAddOp implements Callable { if (pushUrl) { remote.addPushURI(toUri(pushUrl)) } - remote.fetchRefSpecs = (fetchRefSpecs ?: ["+refs/heads/*:refs/remotes/$name/*"]).collect(toRefSpec) + remote.fetchRefSpecs = (fetchRefSpecs ?: ["+refs/heads/*:refs/remotes/$name/*"]).collect(toRefSpec) as List remote.pushRefSpecs = pushRefSpecs.collect(toRefSpec) remote.mirror = mirror remote.update(config) diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/ShowOp.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/ShowOp.groovy index 554c62d..b9658a1 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/ShowOp.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/operation/ShowOp.groovy @@ -1,5 +1,7 @@ package org.xbib.groovy.git.operation +import org.eclipse.jgit.lib.AnyObjectId + import java.util.concurrent.Callable import org.xbib.groovy.git.CommitDiff @@ -44,8 +46,8 @@ class ShowOp implements Callable { walk.recursive = true if (parentId) { - walk.addTree(parentId.tree) - walk.addTree(commitId.tree) + walk.addTree(parentId['tree'] as AnyObjectId) + walk.addTree(commitId['tree'] as AnyObjectId) List initialEntries = DiffEntry.scan(walk) RenameDetector detector = new RenameDetector(repo.jgit.repository) detector.addAll(initialEntries) @@ -61,7 +63,7 @@ class ShowOp implements Callable { renamed: entriesByType[ChangeType.RENAME].collect { it.newPath } ) } else { - walk.addTree(commitId.tree) + walk.addTree(commitId['tree'] as AnyObjectId) def added = [] while (walk.next()) { added << walk.pathString diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/service/ResolveService.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/service/ResolveService.groovy index 07b223e..0dddba5 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/service/ResolveService.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/service/ResolveService.groovy @@ -138,11 +138,11 @@ class ResolveService { */ Tag toTag(Object object) { if (object == null) { - return object + return object as Tag } else if (object instanceof Tag) { return object } else if (object instanceof String || object instanceof GString) { - GitUtil.resolveTag(repository, object) + GitUtil.resolveTag(repository, object as String) } else { throwIllegalArgument(object) } diff --git a/groovy-git/src/main/groovy/org/xbib/groovy/git/util/GitUtil.groovy b/groovy-git/src/main/groovy/org/xbib/groovy/git/util/GitUtil.groovy index 2a21b8b..1b97296 100644 --- a/groovy-git/src/main/groovy/org/xbib/groovy/git/util/GitUtil.groovy +++ b/groovy-git/src/main/groovy/org/xbib/groovy/git/util/GitUtil.groovy @@ -68,7 +68,7 @@ class GitUtil { RevCommit rev = walk.parseCommit(id) return rev.parents.collect { walk.parseCommit(it) - } + } as Set } /** @@ -126,7 +126,7 @@ class GitUtil { * @return the resolved tag */ static Tag resolveTag(Repository repo, String name) { - Ref ref = repo.jgit.repository.getRef(name) + Ref ref = repo.jgit.repository.getRefDatabase().findRef(name) return resolveTag(repo, ref) } @@ -144,7 +144,7 @@ class GitUtil { RevTag rev = walk.parseTag(ref.objectId) RevObject target = walk.peel(rev) walk.parseBody(rev.object) - props.commit = convertCommit(repo, target) + props.commit = convertCommit(repo, target as RevCommit) PersonIdent tagger = rev.taggerIdent props.tagger = new Person(tagger.name, tagger.emailAddress) props.fullMessage = rev.fullMessage @@ -185,7 +185,7 @@ class GitUtil { } Map props = [:] props.fullName = ref.name - String shortName = org.eclipse.jgit.lib.Repository.shortenRefName(props.fullName) + String shortName = org.eclipse.jgit.lib.Repository.shortenRefName(props['fullName'] as String) Config config = repo.jgit.repository.config BranchConfig branchConfig = new BranchConfig(config, shortName) if (branchConfig.trackingBranch) { diff --git a/groovy-ldap/build.gradle b/groovy-ldap/build.gradle index 603972d..ec19562 100644 --- a/groovy-ldap/build.gradle +++ b/groovy-ldap/build.gradle @@ -1,6 +1 @@ -apply from: rootProject.file('gradle/compile/groovy.gradle') - -dependencies { - testImplementation "org.apache.groovy:groovy:${project.property('groovy.version')}" - testImplementation "junit:junit:${project.property('junit4.version')}" -} +apply from: rootProject.file('gradle/compile/groovy-dynamic-tests.gradle') diff --git a/groovy-ldap/gradle.properties b/groovy-ldap/gradle.properties new file mode 100644 index 0000000..543c1fe --- /dev/null +++ b/groovy-ldap/gradle.properties @@ -0,0 +1 @@ +version = 4.0.0 diff --git a/groovy-ldap/src/test/java/org/xbib/groovy/ldap/JavaSearchTest.java b/groovy-ldap/src/test/java/org/xbib/groovy/ldap/JavaSearchTest.java index 7281def..2294cb8 100644 --- a/groovy-ldap/src/test/java/org/xbib/groovy/ldap/JavaSearchTest.java +++ b/groovy-ldap/src/test/java/org/xbib/groovy/ldap/JavaSearchTest.java @@ -1,8 +1,7 @@ package org.xbib.groovy.ldap; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; public class JavaSearchTest { diff --git a/groovy-mail/build.gradle b/groovy-mail/build.gradle index f37d65f..b18a920 100644 --- a/groovy-mail/build.gradle +++ b/groovy-mail/build.gradle @@ -1,5 +1,5 @@ apply from: rootProject.file('gradle/compile/groovy.gradle') dependencies { - api "com.sun.mail:javax.mail:${project.property('mail.version')}" + api libs.mail } diff --git a/groovy-mail/gradle.properties b/groovy-mail/gradle.properties new file mode 100644 index 0000000..543c1fe --- /dev/null +++ b/groovy-mail/gradle.properties @@ -0,0 +1 @@ +version = 4.0.0 diff --git a/groovy-sshd/build.gradle b/groovy-sshd/build.gradle index 4363b9e..74ab3cd 100644 --- a/groovy-sshd/build.gradle +++ b/groovy-sshd/build.gradle @@ -1,5 +1,5 @@ apply from: rootProject.file('gradle/compile/groovy.gradle') dependencies { - api "org.xbib:files-sftp-fs:${project.property('files.version')}" + api libs.files.sftp.fs } diff --git a/groovy-sshd/gradle.properties b/groovy-sshd/gradle.properties new file mode 100644 index 0000000..543c1fe --- /dev/null +++ b/groovy-sshd/gradle.properties @@ -0,0 +1 @@ +version = 4.0.0 diff --git a/settings.gradle b/settings.gradle index 53017c0..7a2d8ce 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,8 +1,31 @@ -include 'groovy-ldap' +dependencyResolutionManagement { + versionCatalogs { + libs { + version('gradle', '7.4.2') + version('groovy', '4.0.3') + version('spock', '2.2-M1-groovy-4.0') + version('junit', '5.8.2') + library('groovy-core', 'org.apache.groovy', 'groovy').versionRef('groovy') + library('spock-core', 'org.spockframework', 'spock-core').versionRef('spock') + library('spock-junit4', 'org.spockframework', 'spock-junit4').versionRef('spock') + library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit') + library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit') + library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit') + library('junit4', 'junit', 'junit').version('4.13.2') + library('hamcrest', 'org.hamcrest', 'hamcrest-library').version('2.2') + library('ftp-fs', 'org.xbib', 'ftp-fs').version('2.6.0') + library('files-sftp-fs', 'org.xbib', 'files-sftp-fs').version('3.0.0') + library('jgit', 'org.eclipse.jgit', 'org.eclipse.jgit').version('6.2.0.202206071550-r') + library('mail', 'com.sun.mail', 'javax.mail').version('1.6.2') + } + } +} + include 'groovy-crypt' -include 'groovy-mail' include 'groovy-ftp' include 'groovy-ftps' -include 'groovy-sshd' include 'groovy-git' +include 'groovy-ldap' +include 'groovy-mail' +include 'groovy-sshd'