Merge branch 'groovy4'

This commit is contained in:
Jörg Prante 2023-05-21 11:00:43 +02:00
commit 4886f894f6
45 changed files with 686 additions and 200 deletions

View file

@ -4,7 +4,7 @@ plugins {
} }
wrapper { wrapper {
gradleVersion = "${project.property('gradle.wrapper.version')}" gradleVersion = libs.versions.gradle.get()
distributionType = Wrapper.DistributionType.ALL distributionType = Wrapper.DistributionType.ALL
} }

View file

@ -1,10 +1,10 @@
group = org.xbib.groovy group = org.xbib.groovy
name = groovy-extensions name = groovy-extensions
version = 0.0.2 version = 4.0.3.0
org.gradle.warning.mode = ALL org.gradle.warning.mode = ALL
groovy.version = 2.5.12 groovy.version = 2.5.12
gradle.wrapper.version = 7.3.2 gradle.wrapper.version = 7.3
files.version = 3.0.0 files.version = 3.0.0
ftp.version = 2.6.0 ftp.version = 2.6.0
mail.version = 1.6.2 mail.version = 1.6.2

View file

@ -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')
}

View file

@ -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
}

View file

@ -1,17 +1,20 @@
apply plugin: 'groovy' apply plugin: 'groovy'
dependencies { dependencies {
implementation "org.codehaus.groovy:groovy:${project.property('groovy.version')}" implementation libs.groovy.core
testImplementation libs.groovy.core
} }
compileGroovy { compileGroovy {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
groovyOptions.configurationScript = rootProject.file('gradle/compile/groovyc.groovy')
} }
compileTestGroovy { compileTestGroovy {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
groovyOptions.configurationScript = rootProject.file('gradle/compile/groovyc.groovy')
} }
tasks.withType(GroovyCompile) { tasks.withType(GroovyCompile) {

View file

@ -0,0 +1,7 @@
import groovy.transform.TypeChecked
import groovy.transform.CompileStatic
withConfig(configuration) {
ast(TypeChecked)
ast(CompileStatic)
}

View file

@ -6,13 +6,13 @@ java {
} }
compileJava { compileJava {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
compileTestJava { compileTestJava {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_17
} }
jar { jar {

View file

@ -6,8 +6,3 @@ idea {
testOutputDir file('build/classes/java/test') testOutputDir file('build/classes/java/test')
} }
} }
if (project.convention.findPlugin(JavaPluginConvention)) {
//sourceSets.main.output.classesDirs = file("build/classes/java/main")
//sourceSets.test.output.classesDirs = file("build/classes/java/test")
}

View file

@ -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 { dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}" testImplementation libs.junit.jupiter.api
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" testImplementation libs.junit.jupiter.params
testImplementation "org.hamcrest:hamcrest-library:${hamcrestVersion}" testImplementation libs.hamcrest
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" testRuntimeOnly libs.junit.jupiter.engine
} }
test { test {
useJUnitPlatform() useJUnitPlatform()
failFast = false failFast = false
systemProperty 'java.util.logging.config.file', 'src/test/resources/logging.properties'
testLogging { testLogging {
events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED' events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED'
} }

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

@ -1,17 +1,6 @@
= Groovy crypt library = 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) 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 was derived from crypt4j by Carl Harris https://github.com/soulwing/crypt4j

View file

@ -1 +1 @@
version = 2.2.0 version = 4.0.0

View file

@ -102,10 +102,12 @@ class MersenneTwisterRandom extends Random {
} }
private static int[] convertBytesToInts(byte[] bytes) { 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") 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++) { for (int i = 0; i < ints.length; i++) {
ints[i] = convertBytesToInt(bytes, i * 4) ints[i] = convertBytesToInt(bytes, i * 4)
} }

202
groovy-ftp/LICENSE.txt Normal file
View file

@ -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.

View file

@ -1,5 +1,5 @@
apply from: rootProject.file('gradle/compile/groovy.gradle') apply from: rootProject.file('gradle/compile/groovy.gradle')
dependencies { dependencies {
api "org.xbib:ftp-fs:${project.property('ftp.version')}" api libs.ftp.fs
} }

View file

@ -1 +1 @@
version = 2.6.0 version = 4.0.0

202
groovy-ftps/LICENSE.txt Normal file
View file

@ -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.

View file

@ -1,5 +1,5 @@
apply from: rootProject.file('gradle/compile/groovy.gradle') apply from: rootProject.file('gradle/compile/groovy.gradle')
dependencies { dependencies {
api "org.xbib:ftp-fs:${project.property('ftp.version')}" api libs.ftp.fs
} }

View file

@ -1 +1 @@
version = 2.6.0 version = 4.0.0

View file

@ -1,8 +1,7 @@
apply from: rootProject.file('gradle/compile/groovy.gradle') apply from: rootProject.file('gradle/compile/groovy-dynamic-tests.gradle')
dependencies { dependencies {
api "org.eclipse.jgit:org.eclipse.jgit:${project.property('jgit.version')}" api libs.jgit
testImplementation "org.codehaus.groovy:groovy:${project.property('groovy.version')}" testImplementation libs.spock.core
testImplementation "org.spockframework:spock-core:${project.property('spock.version')}" testImplementation libs.spock.junit4
testImplementation "org.spockframework:spock-junit4:${project.property('spock.version')}"
} }

View file

@ -1 +1 @@
version = 2.1.0 version = 4.0.0

View file

@ -9,35 +9,35 @@ import groovy.transform.ToString
@EqualsAndHashCode @EqualsAndHashCode
@ToString(includeNames=true) @ToString(includeNames=true)
class Status { class Status {
final Changes staged Changes staged
final Changes unstaged Changes unstaged
final Set<String> conflicts Set<String> conflicts
Status(Map args = [:]) { Status(Map args = [:]) {
def invalidArgs = args.keySet() - ['staged', 'unstaged', 'conflicts'] def invalidArgs = args.keySet() - ['staged', 'unstaged', 'conflicts']
if (invalidArgs) { if (invalidArgs) {
throw new IllegalArgumentException("Following keys are not supported: ${invalidArgs}") throw new IllegalArgumentException("Following keys are not supported: ${invalidArgs}")
} }
this.staged = 'staged' in args ? new Changes(args.staged) : new Changes() this.staged = 'staged' in args ? new Changes(args['staged'] as Map) : new Changes()
this.unstaged = 'unstaged' in args ? new Changes(args.unstaged) : new Changes() this.unstaged = 'unstaged' in args ? new Changes(args['unstaged'] as Map) : new Changes()
this.conflicts = 'conflicts' in args ? args.conflicts : [] this.conflicts = 'conflicts' in args ? args['conflicts'] as Set<String> : [] as Set<String>
} }
@EqualsAndHashCode @EqualsAndHashCode
@ToString(includeNames=true) @ToString(includeNames=true)
class Changes { class Changes {
final Set<String> added Set<String> added
final Set<String> modified Set<String> modified
final Set<String> removed Set<String> removed
Changes(Map args = [:]) { Changes(Map args = [:]) {
def invalidArgs = args.keySet() - ['added', 'modified', 'removed'] def invalidArgs = args.keySet() - ['added', 'modified', 'removed']
if (invalidArgs) { if (invalidArgs) {
throw new IllegalArgumentException("Following keys are not supported: ${invalidArgs}") throw new IllegalArgumentException("Following keys are not supported: ${invalidArgs}")
} }
this.added = 'added' in args ? args.added : [] this.added = 'added' in args ? args['added'] as Set<String> : [] as Set<String>
this.modified = 'modified' in args ? args.modified : [] this.modified = 'modified' in args ? args['modified'] as Set<String> : [] as Set<String>
this.removed = 'removed' in args ? args.removed : [] this.removed = 'removed' in args ? args['removed'] as Set<String> : [] as Set<String>
} }
/** /**

View file

@ -52,6 +52,6 @@ class AuthConfig {
* @throws IllegalArgumentException if force is set to an invalid option * @throws IllegalArgumentException if force is set to an invalid option
*/ */
static AuthConfig fromSystem() { static AuthConfig fromSystem() {
return fromMap(System.properties, System.env) return fromMap(System.properties as Map, System.getenv() as Map)
} }
} }

View file

@ -18,7 +18,7 @@ public final class AnnotateAtRuntimeASTTransformation extends AbstractASTTransfo
AnnotatedNode parent = (AnnotatedNode) nodes[1]; AnnotatedNode parent = (AnnotatedNode) nodes[1];
ClassNode clazz = (ClassNode) parent; ClassNode clazz = (ClassNode) parent;
List<String> annotations = getMemberList(annotation, "annotations"); List<String> annotations = getMemberStringList(annotation, "annotations");
for (String name : annotations) { for (String name : annotations) {
// !!! UGLY HACK !!! // !!! UGLY HACK !!!
// Groovy won't think the class is an annotation when creating a ClassNode just based on the name. // Groovy won't think the class is an annotation when creating a ClassNode just based on the name.

View file

@ -14,7 +14,7 @@ class OpSyntax {
def op = opClass.newInstance(classArgs) def op = opClass.newInstance(classArgs)
args.forEach { key, value -> args.forEach { key, value ->
op[key] = value op[key as String] = value
} }
return op.call() return op.call()

View file

@ -42,13 +42,17 @@ public class WithOperationsASTTransformation extends AbstractASTTransformation {
if (parent instanceof ClassNode) { if (parent instanceof ClassNode) {
ClassNode clazz = (ClassNode) parent; ClassNode clazz = (ClassNode) parent;
List<ClassNode> staticOps = getClassList(annotation, "staticOperations"); List<ClassNode> staticOps = getMemberClassList(annotation, "staticOperations");
List<ClassNode> instanceOps = getClassList(annotation, "instanceOperations"); List<ClassNode> instanceOps = getMemberClassList(annotation, "instanceOperations");
if (staticOps != null) {
staticOps.forEach(op -> makeMethods(clazz, op, true)); staticOps.forEach(op -> makeMethods(clazz, op, true));
}
if (instanceOps != null) {
instanceOps.forEach(op -> makeMethods(clazz, op, false)); instanceOps.forEach(op -> makeMethods(clazz, op, false));
} }
} }
}
private void makeMethods(ClassNode targetClass, ClassNode opClass, boolean isStatic) { private void makeMethods(ClassNode targetClass, ClassNode opClass, boolean isStatic) {
AnnotationNode annotation = opClass.getAnnotations(classFromType(Operation.class)).stream() AnnotationNode annotation = opClass.getAnnotations(classFromType(Operation.class)).stream()

View file

@ -53,7 +53,7 @@ class FetchOp implements Callable<Void> {
TransportOpUtil.configure(cmd, repo.credentials) TransportOpUtil.configure(cmd, repo.credentials)
if (remote) { cmd.remote = remote } if (remote) { cmd.remote = remote }
cmd.refSpecs = refSpecs.collect { cmd.refSpecs = refSpecs.collect {
new RefSpec(it) new RefSpec(it as String)
} }
cmd.removeDeletedRefs = prune cmd.removeDeletedRefs = prune
cmd.tagOpt = tagMode.jgit cmd.tagOpt = tagMode.jgit

View file

@ -1,5 +1,7 @@
package org.xbib.groovy.git.operation package org.xbib.groovy.git.operation
import org.eclipse.jgit.lib.Ref
import java.util.concurrent.Callable import java.util.concurrent.Callable
import org.xbib.groovy.git.Repository import org.xbib.groovy.git.Repository
import org.xbib.groovy.git.internal.Operation import org.xbib.groovy.git.internal.Operation
@ -60,7 +62,7 @@ class MergeOp implements Callable<Void> {
* we want to preserve ref name in merge commit msg. if it's a ref, don't * we want to preserve ref name in merge commit msg. if it's a ref, don't
* resolve down to commit id * resolve down to commit id
*/ */
def ref = repo.jgit.repository.findRef(head) Ref ref = repo.jgit.repository.findRef(head as String)
if (ref == null) { if (ref == null) {
def revstr = new ResolveService(repo).toRevisionString(head) def revstr = new ResolveService(repo).toRevisionString(head)
cmd.include(GitUtil.resolveObject(repo, revstr)) cmd.include(GitUtil.resolveObject(repo, revstr))

View file

@ -1,5 +1,7 @@
package org.xbib.groovy.git.operation package org.xbib.groovy.git.operation
import org.eclipse.jgit.lib.Ref
import java.util.concurrent.Callable import java.util.concurrent.Callable
import org.xbib.groovy.git.PushException import org.xbib.groovy.git.PushException
import org.xbib.groovy.git.Repository import org.xbib.groovy.git.Repository
@ -63,7 +65,11 @@ class PushOp implements Callable<Void> {
cmd.remote = remote cmd.remote = remote
} }
refsOrSpecs.each { 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) { if (all) {
cmd.setPushAll() cmd.setPushAll()

View file

@ -60,10 +60,10 @@ class RemoteAddOp implements Callable<Remote> {
throw new IllegalStateException("remote $name already exists") throw new IllegalStateException("remote $name already exists")
} }
def toUri = { def toUri = {
url -> new URIish(url) url -> new URIish(url as String)
} }
def toRefSpec = { def toRefSpec = {
spec -> new RefSpec(spec) spec -> new RefSpec(spec as String)
} }
RemoteConfig remote = new RemoteConfig(config, name) RemoteConfig remote = new RemoteConfig(config, name)
if (url) { if (url) {
@ -72,7 +72,7 @@ class RemoteAddOp implements Callable<Remote> {
if (pushUrl) { if (pushUrl) {
remote.addPushURI(toUri(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<RefSpec>
remote.pushRefSpecs = pushRefSpecs.collect(toRefSpec) remote.pushRefSpecs = pushRefSpecs.collect(toRefSpec)
remote.mirror = mirror remote.mirror = mirror
remote.update(config) remote.update(config)

View file

@ -1,5 +1,7 @@
package org.xbib.groovy.git.operation package org.xbib.groovy.git.operation
import org.eclipse.jgit.lib.AnyObjectId
import java.util.concurrent.Callable import java.util.concurrent.Callable
import org.xbib.groovy.git.CommitDiff import org.xbib.groovy.git.CommitDiff
@ -44,8 +46,8 @@ class ShowOp implements Callable<CommitDiff> {
walk.recursive = true walk.recursive = true
if (parentId) { if (parentId) {
walk.addTree(parentId.tree) walk.addTree(parentId['tree'] as AnyObjectId)
walk.addTree(commitId.tree) walk.addTree(commitId['tree'] as AnyObjectId)
List initialEntries = DiffEntry.scan(walk) List initialEntries = DiffEntry.scan(walk)
RenameDetector detector = new RenameDetector(repo.jgit.repository) RenameDetector detector = new RenameDetector(repo.jgit.repository)
detector.addAll(initialEntries) detector.addAll(initialEntries)
@ -61,7 +63,7 @@ class ShowOp implements Callable<CommitDiff> {
renamed: entriesByType[ChangeType.RENAME].collect { it.newPath } renamed: entriesByType[ChangeType.RENAME].collect { it.newPath }
) )
} else { } else {
walk.addTree(commitId.tree) walk.addTree(commitId['tree'] as AnyObjectId)
def added = [] def added = []
while (walk.next()) { while (walk.next()) {
added << walk.pathString added << walk.pathString

View file

@ -138,11 +138,11 @@ class ResolveService {
*/ */
Tag toTag(Object object) { Tag toTag(Object object) {
if (object == null) { if (object == null) {
return object return object as Tag
} else if (object instanceof Tag) { } else if (object instanceof Tag) {
return object return object
} else if (object instanceof String || object instanceof GString) { } else if (object instanceof String || object instanceof GString) {
GitUtil.resolveTag(repository, object) GitUtil.resolveTag(repository, object as String)
} else { } else {
throwIllegalArgument(object) throwIllegalArgument(object)
} }

View file

@ -68,7 +68,7 @@ class GitUtil {
RevCommit rev = walk.parseCommit(id) RevCommit rev = walk.parseCommit(id)
return rev.parents.collect { return rev.parents.collect {
walk.parseCommit(it) walk.parseCommit(it)
} } as Set<ObjectId>
} }
/** /**
@ -126,7 +126,7 @@ class GitUtil {
* @return the resolved tag * @return the resolved tag
*/ */
static Tag resolveTag(Repository repo, String name) { 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) return resolveTag(repo, ref)
} }
@ -144,7 +144,7 @@ class GitUtil {
RevTag rev = walk.parseTag(ref.objectId) RevTag rev = walk.parseTag(ref.objectId)
RevObject target = walk.peel(rev) RevObject target = walk.peel(rev)
walk.parseBody(rev.object) walk.parseBody(rev.object)
props.commit = convertCommit(repo, target) props.commit = convertCommit(repo, target as RevCommit)
PersonIdent tagger = rev.taggerIdent PersonIdent tagger = rev.taggerIdent
props.tagger = new Person(tagger.name, tagger.emailAddress) props.tagger = new Person(tagger.name, tagger.emailAddress)
props.fullMessage = rev.fullMessage props.fullMessage = rev.fullMessage
@ -185,7 +185,7 @@ class GitUtil {
} }
Map props = [:] Map props = [:]
props.fullName = ref.name 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 Config config = repo.jgit.repository.config
BranchConfig branchConfig = new BranchConfig(config, shortName) BranchConfig branchConfig = new BranchConfig(config, shortName)
if (branchConfig.trackingBranch) { if (branchConfig.trackingBranch) {

View file

@ -1,6 +1 @@
apply from: rootProject.file('gradle/compile/groovy.gradle') apply from: rootProject.file('gradle/compile/groovy-dynamic-tests.gradle')
dependencies {
testImplementation "org.codehaus.groovy:groovy:${project.property('groovy.version')}"
testImplementation "junit:junit:${project.property('junit4.version')}"
}

View file

@ -1 +1 @@
version = 2.2.0 version = 4.0.0

View file

@ -384,6 +384,9 @@ public class LDAP {
} }
public static String escapeValue(String filter) { public static String escapeValue(String filter) {
if (filter == null) {
return null;
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < filter.length(); i++) { for (int i = 0; i < filter.length(); i++) {
switch (filter.charAt(i)) { switch (filter.charAt(i)) {
@ -423,5 +426,4 @@ public class LDAP {
} }
return sb.toString(); return sb.toString();
} }
} }

View file

@ -1,8 +1,7 @@
package org.xbib.groovy.ldap; package org.xbib.groovy.ldap;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertEquals;
public class JavaSearchTest { public class JavaSearchTest {

View file

@ -1,5 +1,5 @@
apply from: rootProject.file('gradle/compile/groovy.gradle') apply from: rootProject.file('gradle/compile/groovy.gradle')
dependencies { dependencies {
api "com.sun.mail:javax.mail:${project.property('mail.version')}" api libs.mail
} }

View file

@ -1 +1 @@
version = 2.2.1 version = 4.0.0

View file

@ -120,11 +120,8 @@ public class SMTP {
} }
public void send(String subject, public void send(String subject,
Address from, Address from, Address[] replyTo,
Address[] replyTo, Address[] to, Address[] cc, Address[] bcc,
Address[] to,
Address[] cc,
Address[] bcc,
String text) throws Exception { String text) throws Exception {
Multipart multipart = new MimeMultipart("mixed"); Multipart multipart = new MimeMultipart("mixed");
MimeBodyPart mimeBodyPart = new MimeBodyPart(); MimeBodyPart mimeBodyPart = new MimeBodyPart();
@ -165,7 +162,7 @@ public class SMTP {
try { try {
if (url != null) { if (url != null) {
ctx = new SmtpContext(); ctx = new SmtpContext();
ctx.properties = createEnvironment(url, debug); ctx.properties = createEnvironment(url);
ctx.session = username != null ? ctx.session = username != null ?
Session.getDefaultInstance(ctx.properties, new SMTPAuthenticator()) : Session.getDefaultInstance(ctx.properties, new SMTPAuthenticator()) :
Session.getDefaultInstance(ctx.properties); Session.getDefaultInstance(ctx.properties);
@ -180,7 +177,7 @@ public class SMTP {
} }
} }
private static Properties createEnvironment(String urlSpec, boolean debug) { private static Properties createEnvironment(String urlSpec) {
URI uri = URI.create(urlSpec); URI uri = URI.create(urlSpec);
Properties env = new Properties(); Properties env = new Properties();
env.setProperty("mail.smtp.auth", "false"); env.setProperty("mail.smtp.auth", "false");
@ -188,7 +185,7 @@ public class SMTP {
env.setProperty("mail.smtp.port", Integer.toString(uri.getPort())); env.setProperty("mail.smtp.port", Integer.toString(uri.getPort()));
boolean secure = uri.getScheme().equals("smtps") || 995 == uri.getPort(); boolean secure = uri.getScheme().equals("smtps") || 995 == uri.getPort();
env.setProperty("mail.smtp.ssl.enable", secure ? "true" : "false"); env.setProperty("mail.smtp.ssl.enable", secure ? "true" : "false");
env.setProperty("mail.debug", Boolean.toString(debug)); env.setProperty("mail.debug", "true");
return env; return env;
} }

View file

@ -1,5 +1,5 @@
apply from: rootProject.file('gradle/compile/groovy.gradle') apply from: rootProject.file('gradle/compile/groovy.gradle')
dependencies { dependencies {
api "org.xbib:files-sftp-fs:${project.property('files.version')}" api libs.files.sftp.fs
} }

View file

@ -1 +1 @@
version = 3.0.0.0 version = 4.0.0

View file

@ -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-crypt'
include 'groovy-mail'
include 'groovy-ftp' include 'groovy-ftp'
include 'groovy-ftps' include 'groovy-ftps'
include 'groovy-sshd'
include 'groovy-git' include 'groovy-git'
include 'groovy-ldap'
include 'groovy-mail'
include 'groovy-sshd'