diff --git a/build.gradle b/build.gradle index 32a90550b9d..e487fbb034c 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,9 @@ plugins { id "me.champeau.jmh" version "0.6.8" id "jacoco" + + id "versioning" + id "srcinfo" } import java.text.SimpleDateFormat @@ -87,6 +90,10 @@ subprojects { project -> apply from: "$rootDir/gradle-scripts/subproject-dependencies.gradle" apply from: "$rootDir/gradle-scripts/subproject-config.gradle" + if (project.file("build.gradle").exists()) { + apply from: "$rootDir/gradle-scripts/subproject-srcinfo-plugin.gradle" + } + group='com.commercetools.sdk' version = globalVersion diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index c67d731b37f..00000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id 'org.jetbrains.kotlin.jvm' version "2.0.0" -} - -repositories { - mavenCentral() -} - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(11) - } -} - -dependencies { - implementation "com.github.javaparser:javaparser-symbol-solver-core:3.26.0" - implementation "com.google.code.gson:gson:2.11.0" - implementation 'com.squareup:javapoet:1.13.0' -} diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/srcinfo.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/srcinfo.properties deleted file mode 100644 index 6c9ddb285bc..00000000000 --- a/buildSrc/src/main/resources/META-INF/gradle-plugins/srcinfo.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class=com.commercetools.sdk.plugins.SrcInfoPlugin diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/versioning.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/versioning.properties deleted file mode 100644 index bbd8c3072c6..00000000000 --- a/buildSrc/src/main/resources/META-INF/gradle-plugins/versioning.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class=com.commercetools.sdk.plugins.VersioningPlugin diff --git a/commercetools/internal-docs/src/main/java/com/commercetools/docs/meta/MigrationModelClassMapping.java b/commercetools/internal-docs/src/main/java/com/commercetools/docs/meta/MigrationModelClassMapping.java index 347fd042687..376286401b2 100644 --- a/commercetools/internal-docs/src/main/java/com/commercetools/docs/meta/MigrationModelClassMapping.java +++ b/commercetools/internal-docs/src/main/java/com/commercetools/docs/meta/MigrationModelClassMapping.java @@ -265,6 +265,10 @@ * {@link com.commercetools.api.models.cart.CartChangeTaxRoundingModeAction} * * + * {@link io.sphere.sdk.carts.commands.updateactions.FreezeCart} + * {@link com.commercetools.api.models.cart.CartFreezeCartAction} + * + * * {@link io.sphere.sdk.carts.commands.updateactions.Recalculate} * {@link com.commercetools.api.models.cart.CartRecalculateAction} * @@ -441,6 +445,10 @@ * {@link com.commercetools.api.models.cart.CartSetShippingRateInputAction} * * + * {@link io.sphere.sdk.carts.commands.updateactions.UnfreezeCart} + * {@link com.commercetools.api.models.cart.CartUnfreezeCartAction} + * + * * {@link io.sphere.sdk.carts.commands.updateactions.UpdateItemShippingAddress} * {@link com.commercetools.api.models.cart.CartUpdateItemShippingAddressAction} * diff --git a/common-plugins/build.gradle b/common-plugins/build.gradle new file mode 100644 index 00000000000..0e14c577b39 --- /dev/null +++ b/common-plugins/build.gradle @@ -0,0 +1,36 @@ +plugins { + id 'java-gradle-plugin' + id 'idea' + id 'org.jetbrains.kotlin.jvm' version "2.0.0" +} + +repositories { + mavenCentral() +} + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +group = 'com.commercetools.sdk.plugins' +version = '1.0' + +gradlePlugin { + plugins.register('srcinfo-plugin') { + id = 'srcinfo' + implementationClass = 'com.commercetools.sdk.plugins.SrcInfoPlugin' + } + plugins.register("versioning-plugin") { + id = 'versioning' + implementationClass = 'com.commercetools.sdk.plugins.VersioningPlugin' + } +} + +dependencies { + implementation project(path: ':javaparser', configuration: 'shadow') + implementation "com.google.code.gson:gson:2.11.0" + implementation 'com.squareup:javapoet:1.13.0' + implementation 'com.google.guava:guava:33.3.1-jre' +} diff --git a/common-plugins/javaparser/build.gradle b/common-plugins/javaparser/build.gradle new file mode 100644 index 00000000000..71738bf427f --- /dev/null +++ b/common-plugins/javaparser/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' + id 'com.github.johnrengelman.shadow' version '7.1.2' +} + +group = 'com.commercetools.sdk.plugins' +version = '1.0' + +repositories { + mavenCentral() +} + +shadowJar { + relocate 'com.github.javaparser', 'shadow.javaparser' +} + +dependencies { + implementation 'com.github.javaparser:javaparser-core:3.26.2' +} diff --git a/common-plugins/settings.gradle b/common-plugins/settings.gradle new file mode 100644 index 00000000000..2c36f7d4e1c --- /dev/null +++ b/common-plugins/settings.gradle @@ -0,0 +1 @@ +include("javaparser") diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLPlugin.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLPlugin.kt similarity index 100% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLPlugin.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLPlugin.kt diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLTask.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLTask.kt similarity index 96% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLTask.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLTask.kt index 057ad747382..a7fe3f384ef 100644 --- a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLTask.kt +++ b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/GraphQLTask.kt @@ -1,11 +1,11 @@ package com.commercetools.sdk.plugins -import com.github.javaparser.StaticJavaParser -import com.github.javaparser.ast.CompilationUnit -import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration -import com.github.javaparser.ast.body.ConstructorDeclaration -import com.github.javaparser.ast.body.MethodDeclaration -import com.github.javaparser.ast.body.TypeDeclaration +import shadow.javaparser.StaticJavaParser +import shadow.javaparser.ast.CompilationUnit +import shadow.javaparser.ast.body.ClassOrInterfaceDeclaration +import shadow.javaparser.ast.body.ConstructorDeclaration +import shadow.javaparser.ast.body.MethodDeclaration +import shadow.javaparser.ast.body.TypeDeclaration import com.squareup.javapoet.* import org.gradle.api.DefaultTask import org.gradle.api.plugins.JavaPluginExtension diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPlugin.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPlugin.kt similarity index 89% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPlugin.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPlugin.kt index b5565fb6a0d..3c6a4a9faf2 100644 --- a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPlugin.kt +++ b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPlugin.kt @@ -1,12 +1,13 @@ package com.commercetools.sdk.plugins -import com.github.javaparser.StaticJavaParser -import com.github.javaparser.ast.CompilationUnit -import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration -import com.github.javaparser.ast.body.TypeDeclaration +import shadow.javaparser.StaticJavaParser +import shadow.javaparser.ast.CompilationUnit +import shadow.javaparser.ast.body.ClassOrInterfaceDeclaration +import shadow.javaparser.ast.body.TypeDeclaration import com.google.common.base.CaseFormat import org.gradle.api.Plugin import org.gradle.api.Project +import shadow.javaparser.ast.body.MethodDeclaration import java.io.File import java.io.IOException import java.io.Writer @@ -263,22 +264,22 @@ class MigrationInfoPlugin : Plugin { -// fun classInfo(file: File, info: ClassOrInterfaceDeclaration, hash: String): List>> { -// return info.methods.map { methodInfo -> -// "${info.fullyQualifiedName.get()}#${methodInfo.signature}" to mapOf( -// "type" to "method", -// "gitHash" to hash, -// "methodName" to methodInfo.name.toString(), -// "simpleName" to "${info.name}#${methodInfo.name}", -// "name" to "${info.fullyQualifiedName.get()}#${methodInfo.name}", -// "file" to file.toString(), -// "start" to methodInfo.begin.get().line.toString(), -// "end" to methodInfo.end.get().line.toString(), -// "srcUrl" to "https://github.com/commercetools/commercetools-sdk-java-v2/blob/${hash}/${file}#L${methodInfo.begin.get().line}-L${methodInfo.end.get().line}", -// "sdkV1Method" to methodInfo.methodBody() -// ) -// } -// } + fun classInfo(file: File, info: ClassOrInterfaceDeclaration, hash: String): List>> { + return info.methods.map { methodInfo -> + "${info.fullyQualifiedName.get()}#${methodInfo.signature}" to mapOf( + "type" to "method", + "gitHash" to hash, + "methodName" to methodInfo.name.toString(), + "simpleName" to "${info.name}#${methodInfo.name}", + "name" to "${info.fullyQualifiedName.get()}#${methodInfo.name}", + "file" to file.toString(), + "start" to methodInfo.begin.get().line.toString(), + "end" to methodInfo.end.get().line.toString(), + "srcUrl" to "https://github.com/commercetools/commercetools-sdk-java-v2/blob/${hash}/${file}#L${methodInfo.begin.get().line}-L${methodInfo.end.get().line}", + "sdkV1Method" to methodInfo.methodBody() + ) + } + } fun ClassOrInterfaceDeclaration.v2Class(v2BaseFolder: List): String { @@ -326,33 +327,33 @@ class MigrationInfoPlugin : Plugin { return v2Classes.joinToString(", "); } -// fun ClassOrInterfaceDeclaration.v1CreateCommandClassUsage(): Pair { -// -// if (commandClassUsageV1Mapping.containsKey(this.fullyQualifiedName.get())) { -// return commandClassUsageV1Mapping.get(this.fullyQualifiedName.get()) ?: Pair("", "") -// } -// val v1PackageName = this.fullyQualifiedName.map { it.replace("." + this.name.toString(), "") }.get() -// val v1ModelPackageName = v1PackageName.replace(".commands", ""); -// -// return this.getMethodsByName("of").map { "$v1ModelPackageName.${it.parameters.filter { it.nameAsString.contains("draft", true) }.map { it.typeAsString }.firstOrNull() ?: "" }" to "of(${it.parameters.joinToString(",") { it.typeAsString }})" }.first() -// } -// -// fun ClassOrInterfaceDeclaration.v1UpdateCommandClassUsage(): Pair { -// -// if (commandClassUsageV1Mapping.containsKey(this.fullyQualifiedName.get())) { -// return commandClassUsageV1Mapping.get(this.fullyQualifiedName.get()) ?: Pair("", "") -// } -// -// return this.getMethodsByName("of").filter { it.parameters.any { it.typeAsString.startsWith("UpdateAction") } }.map { "" to "of(${it.parameters.joinToString(",") { it.typeAsString.split("<").first() + if (it.isVarArgs) "..." else "" }})" }.first() -// } -// -// fun ClassOrInterfaceDeclaration.v1DeleteCommandClassUsage(): Pair { -// -// if (commandClassUsageV1Mapping.containsKey(this.fullyQualifiedName.get())) { -// return commandClassUsageV1Mapping.get(this.fullyQualifiedName.get()) ?: Pair("", "") -// } -// return this.getMethodsByName("of").filter { it.parameters.any { it.typeAsString.startsWith("Versioned") } }.map { "" to "of(${it.parameters.joinToString(",") { it.typeAsString.split("<").first() }})" }.firstOrNull() ?: Pair("", "") -// } + fun ClassOrInterfaceDeclaration.v1CreateCommandClassUsage(): Pair { + + if (commandClassUsageV1Mapping.containsKey(this.fullyQualifiedName.get())) { + return commandClassUsageV1Mapping.get(this.fullyQualifiedName.get()) ?: Pair("", "") + } + val v1PackageName = this.fullyQualifiedName.map { it.replace("." + this.name.toString(), "") }.get() + val v1ModelPackageName = v1PackageName.replace(".commands", ""); + + return this.getMethodsByName("of").map { "$v1ModelPackageName.${it.parameters.filter { it.nameAsString.contains("draft", true) }.map { it.typeAsString }.firstOrNull() ?: "" }" to "of(${it.parameters.joinToString(",") { it.typeAsString }})" }.first() + } + + fun ClassOrInterfaceDeclaration.v1UpdateCommandClassUsage(): Pair { + + if (commandClassUsageV1Mapping.containsKey(this.fullyQualifiedName.get())) { + return commandClassUsageV1Mapping.get(this.fullyQualifiedName.get()) ?: Pair("", "") + } + + return this.getMethodsByName("of").filter { it.parameters.any { it.typeAsString.startsWith("UpdateAction") } }.map { "" to "of(${it.parameters.joinToString(",") { it.typeAsString.split("<").first() + if (it.isVarArgs) "..." else "" }})" }.first() + } + + fun ClassOrInterfaceDeclaration.v1DeleteCommandClassUsage(): Pair { + + if (commandClassUsageV1Mapping.containsKey(this.fullyQualifiedName.get())) { + return commandClassUsageV1Mapping.get(this.fullyQualifiedName.get()) ?: Pair("", "") + } + return this.getMethodsByName("of").filter { it.parameters.any { it.typeAsString.startsWith("Versioned") } }.map { "" to "of(${it.parameters.joinToString(",") { it.typeAsString.split("<").first() }})" }.firstOrNull() ?: Pair("", "") + } fun ClassOrInterfaceDeclaration.v2CommandClassUsage(): String { @@ -486,17 +487,18 @@ class MigrationInfoPlugin : Plugin { "io.sphere.sdk.projects.commands.updateactions.ChangeMessages" to "removed", ) -// fun MethodDeclaration.methodBody(): String { -// val methodBody = this.body -// if (!methodBody.isPresent) { -// return "" -// } -// val bodyRange = methodBody.get().tokenRange.get().toString() -// return bodyRange.substring(1, bodyRange.length - 1).trimIndent() -// } + fun MethodDeclaration.methodBody(): String { + val methodBody = this.body + if (!methodBody.isPresent) { + return "" + } + val bodyRange = methodBody.get().tokenRange.get().toString() + return bodyRange.substring(1, bodyRange.length - 1).trimIndent() + } } fun String.packageName(): String { + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this) if (this.isEmpty() or this.contains(".").not()) return "" val packageFolder = Paths.get(this.replace(".", "/")) return packageFolder.parent.toString().replace("/", "."); diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPluginExtension.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPluginExtension.kt similarity index 100% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPluginExtension.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/MigrationInfoPluginExtension.kt diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPlugin.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPlugin.kt similarity index 84% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPlugin.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPlugin.kt index 233bd210047..111045bed7f 100644 --- a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPlugin.kt +++ b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPlugin.kt @@ -1,14 +1,16 @@ package com.commercetools.sdk.plugins; -import com.github.javaparser.StaticJavaParser -import com.github.javaparser.ast.CompilationUnit -import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration -import com.github.javaparser.ast.body.MethodDeclaration -import com.github.javaparser.ast.body.TypeDeclaration -import com.github.javaparser.ast.expr.NormalAnnotationExpr +import shadow.javaparser.ParserConfiguration.LanguageLevel +import shadow.javaparser.ast.CompilationUnit +import shadow.javaparser.ast.body.ClassOrInterfaceDeclaration +import shadow.javaparser.ast.body.MethodDeclaration +import shadow.javaparser.ast.body.TypeDeclaration +import shadow.javaparser.ast.expr.NormalAnnotationExpr import com.google.gson.stream.JsonWriter import org.gradle.api.Plugin import org.gradle.api.Project +import shadow.javaparser.JavaParser +import shadow.javaparser.ParserConfiguration import java.io.File import java.io.IOException import java.io.Writer @@ -32,11 +34,14 @@ class SrcInfoPlugin : Plugin { private fun createExportTask(project: Project) { val extension = project.extensions.create("srcInfo", SrcInfoPluginExtension::class.java) val exportTask = project.task("exportSignatures") + val parserConfiguration = ParserConfiguration() + parserConfiguration.languageLevel = LanguageLevel.JAVA_17 + val javaParser = JavaParser(parserConfiguration) exportTask.group = "documentation" exportTask.doLast { val outputFolder = extension.outputFolder.map { o -> Paths.get(o) }.getOrElse(project.buildDir.resolve("src-info").toPath()) val docsUrnOnly = extension.docsUrnOnly.getOrElse(false) - outputFolder.toFile().mkdir() + outputFolder.toFile().mkdirs() val javaFiles = project.fileTree(mapOf("dir" to extension.baseFolder.getOrElse("src"), "include" to "**/*.java")).files val fileWriter: Writer = Files.newBufferedWriter(outputFolder.resolve(project.name + ".json")) val writer = JsonWriter(fileWriter) @@ -46,7 +51,7 @@ class SrcInfoPlugin : Plugin { writer.beginObject() javaFiles.forEach { file -> run { - javaFileInfo(file, project, hash, extension.includePackages.orNull, docsUrnOnly).forEach { entry -> + javaFileInfo(javaParser, file, project, hash, extension.includePackages.orNull, docsUrnOnly).forEach { entry -> run { writer.name(entry.key) writer.beginObject() @@ -65,8 +70,9 @@ class SrcInfoPlugin : Plugin { } } - private fun javaFileInfo(file: File, project: Project, hash: String, includePackages: List?, docsUrnOnly: Boolean): Map> { - val parse: CompilationUnit = StaticJavaParser.parse(file) + private fun javaFileInfo(javaParser: JavaParser, file: File, project: Project, hash: String, includePackages: List?, docsUrnOnly: Boolean): Map> { + val parse: CompilationUnit = javaParser.parse(file).result.get() + val relativeFile = file.relativeTo(project.rootDir) if (includePackages != null && includePackages.firstOrNull { s: String -> parse.packageDeclaration.get().nameAsString.startsWith(s) } == null) { return emptyMap() diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPluginExtension.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPluginExtension.kt similarity index 100% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPluginExtension.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/SrcInfoPluginExtension.kt diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPlugin.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPlugin.kt similarity index 100% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPlugin.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPlugin.kt diff --git a/buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPluginExtension.kt b/common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPluginExtension.kt similarity index 100% rename from buildSrc/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPluginExtension.kt rename to common-plugins/src/main/kotlin/com/commercetools/sdk/plugins/VersioningPluginExtension.kt diff --git a/gradle-scripts/subproject-config.gradle b/gradle-scripts/subproject-config.gradle index 4990ab02cfd..e3c5557c5a5 100644 --- a/gradle-scripts/subproject-config.gradle +++ b/gradle-scripts/subproject-config.gradle @@ -60,14 +60,6 @@ ext { buildInfoPackage = "io.vrap.rmf.base.client" } -srcInfo { - includePackages = [ - "example", - "commercetools" - ] - docsUrnOnly = true -} - tasks.register('integrationTest', Test) { description = "Runs integration tests." group = "verification" diff --git a/gradle-scripts/subproject-plugins.gradle b/gradle-scripts/subproject-plugins.gradle index cc2769c4c64..12685f874f5 100644 --- a/gradle-scripts/subproject-plugins.gradle +++ b/gradle-scripts/subproject-plugins.gradle @@ -2,5 +2,3 @@ apply plugin: 'idea' apply plugin: 'java' apply plugin: 'java-library' // needed to make sure that transitive deps have 'compile' scope - -apply plugin: 'srcinfo' diff --git a/gradle-scripts/subproject-srcinfo-plugin.gradle b/gradle-scripts/subproject-srcinfo-plugin.gradle new file mode 100644 index 00000000000..81e8278767b --- /dev/null +++ b/gradle-scripts/subproject-srcinfo-plugin.gradle @@ -0,0 +1,9 @@ +apply plugin: 'srcinfo' + +srcInfo { + includePackages = [ + "example", + "commercetools" + ] + docsUrnOnly = true +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ccebba7710d..e6441136f3d 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 8b580b949f3..df97d72b8b9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 79a61d421cc..b740cf13397 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85beec..7101f8e4676 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/javaparser/build.gradle b/javaparser/build.gradle new file mode 100644 index 00000000000..e23611c9905 --- /dev/null +++ b/javaparser/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java' + id 'com.github.johnrengelman.shadow' version '7.1.2' +} + +group = 'com.commercetools.sdk' +version = '1.0' + +repositories { + mavenCentral() +} + +shadowJar { + relocate 'com.github.javaparser', 'shadow.javaparser' +} + +dependencies { + implementation 'com.github.javaparser:javaparser-core:3.26.2' +} diff --git a/settings.gradle b/settings.gradle index 31ab29af597..2a189f771a8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,5 @@ rootProject.name = 'commercetools-sdk-java-v2' +includeBuild 'common-plugins' include 'rmf:rmf-java-base' include 'commercetools:commercetools-okhttp-client3' include 'commercetools:commercetools-okhttp-client4'