From 0b7a051b79c7a394e9bd4f57bd40778fb5f29897 Mon Sep 17 00:00:00 2001 From: Artur Souza Date: Wed, 23 Oct 2024 09:59:01 -0700 Subject: [PATCH] Fix script tp update release version. (#1153) --- .github/scripts/update_docs.sh | 14 ++++++-- .github/scripts/update_sdk_version.sh | 4 +++ .github/workflows/validate-docs.yml | 34 +++++++++++++++++++ .../data/PostgreSQLDaprKeyValueAdapter.java | 3 +- .../query/DaprPredicateBuilder.java | 25 +++++++++----- dapr-spring/pom.xml | 8 ++--- 6 files changed, 72 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/validate-docs.yml diff --git a/.github/scripts/update_docs.sh b/.github/scripts/update_docs.sh index 829b4b486..aacc4ccb7 100755 --- a/.github/scripts/update_docs.sh +++ b/.github/scripts/update_docs.sh @@ -4,20 +4,28 @@ set -uex DAPR_JAVA_SDK_VERSION=$1 +# Alpha artifacts of the sdk tracks the regular SDK minor and patch versions, just not the major. +# Replaces the SDK major version to 0 for alpha artifacts. +DAPR_JAVA_SDK_ALPHA_VERSION=`echo $DAPR_JAVA_SDK_VERSION | sed 's/^[0-9]*\./0./'` + if [[ "$OSTYPE" == "darwin"* ]]; then sed -i bak "s/.*<\/version>\$/${DAPR_JAVA_SDK_VERSION}<\/version>/g" README.md sed -i bak "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" README.md sed -i bak "s/.*<\/version>\$/${DAPR_JAVA_SDK_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/_index.md sed -i bak "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" daprdocs/content/en/java-sdk-docs/_index.md + sed -i bak "s/.*<\/version>\$/${DAPR_JAVA_SDK_ALPHA_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/spring-boot/_index.md rm README.mdbak else sed -i "s/.*<\/version>\$/${DAPR_JAVA_SDK_VERSION}<\/version>/g" README.md sed -i "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" README.md sed -i "s/.*<\/version>\$/${DAPR_JAVA_SDK_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/_index.md sed -i "s/compile('io.dapr:\(.*\):.*')/compile('io.dapr:\\1:${DAPR_JAVA_SDK_VERSION}')/g" daprdocs/content/en/java-sdk-docs/_index.md + sed -i "s/.*<\/version>\$/${DAPR_JAVA_SDK_ALPHA_VERSION}<\/version>/g" daprdocs/content/en/java-sdk-docs/spring-boot/_index.md fi -rm -rf docs -mvn -Dmaven.test.skip=false -Djacoco.skip=true clean install -mvn site-deploy rm -f daprdocs/content/en/java-sdk-docs/_index.mdbak || echo +rm -f daprdocs/content/en/java-sdk-docs/spring-boot/_index.md/_index.mdbak || echo + +rm -rf docs +./mvnw -Dmaven.test.skip=false -Djacoco.skip=true clean install +./mvnw site-deploy diff --git a/.github/scripts/update_sdk_version.sh b/.github/scripts/update_sdk_version.sh index 307a150c0..fba6ff9af 100755 --- a/.github/scripts/update_sdk_version.sh +++ b/.github/scripts/update_sdk_version.sh @@ -10,6 +10,7 @@ DAPR_JAVA_SDK_ALPHA_VERSION=`echo $DAPR_JAVA_SDK_VERSION | sed 's/^[0-9]*\./0./' mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_VERSION mvn versions:set-property -Dproperty=dapr.sdk.alpha.version -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION +mvn versions:set-property -Dproperty=dapr.sdk.version -DnewVersion=$DAPR_JAVA_SDK_VERSION mvn versions:set-property -Dproperty=dapr.sdk.version -DnewVersion=$DAPR_JAVA_SDK_VERSION -f sdk-tests/pom.xml mvn versions:set-property -Dproperty=dapr.sdk.alpha.version -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f sdk-tests/pom.xml @@ -23,4 +24,7 @@ mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f sdk-workflows/pom. # testcontainers-dapr mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f testcontainers-dapr/pom.xml +# dapr-spring +mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f dapr-spring/pom.xml + git clean -f diff --git a/.github/workflows/validate-docs.yml b/.github/workflows/validate-docs.yml new file mode 100644 index 000000000..fa9662612 --- /dev/null +++ b/.github/workflows/validate-docs.yml @@ -0,0 +1,34 @@ +name: Validate Javadocs Generation + +on: + workflow_dispatch: + push: + branches: + - master + - release-* + tags: + - v* + + pull_request: + branches: + - master + - release-* + +jobs: + build: + name: "Validate Javadocs generation" + runs-on: linux-arm64-latest-4-cores + timeout-minutes: 30 + env: + JDK_VER: 17 + steps: + - uses: actions/checkout@v4 + - name: Set up OpenJDK ${{ env.JDK_VER }} + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ env.JDK_VER }} + - name: Install jars + run: ./mvnw install -q -B -DskipTests + - name: Validate Java docs generation + run: ./mvnw site-deploy diff --git a/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/PostgreSQLDaprKeyValueAdapter.java b/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/PostgreSQLDaprKeyValueAdapter.java index e5cbf2b48..c66ea50d8 100644 --- a/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/PostgreSQLDaprKeyValueAdapter.java +++ b/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/PostgreSQLDaprKeyValueAdapter.java @@ -152,7 +152,8 @@ private String createSql(String sqlPattern, String keyspace) { private String createSql(String sqlPattern, String keyspace, Object criteria) { String keyspaceFilter = getKeyspaceFilter(keyspace); - if (criteria instanceof DaprPredicate daprPredicate) { + if (criteria instanceof DaprPredicate) { + var daprPredicate = (DaprPredicate) criteria; String path = daprPredicate.getPath().toString(); String pathWithOutType = String.format("'%s'", path.substring(path.indexOf(".") + 1)); String value = String.format("'%s'", daprPredicate.getValue().toString()); diff --git a/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/repository/query/DaprPredicateBuilder.java b/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/repository/query/DaprPredicateBuilder.java index 1eff32b98..c57bd5650 100644 --- a/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/repository/query/DaprPredicateBuilder.java +++ b/dapr-spring/dapr-spring-data/src/main/java/io/dapr/spring/data/repository/query/DaprPredicateBuilder.java @@ -46,7 +46,9 @@ public Predicate isFalse() { public Predicate isEqualTo(Object value) { return new DaprPredicate(part.getProperty(), value, o -> { if (!ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) { - if (o instanceof String s1 && value instanceof String s2) { + if ((o instanceof String) && (value instanceof String)) { + var s1 = (String)o; + var s2 = (String)value; return s1.equalsIgnoreCase(s2); } } @@ -85,7 +87,8 @@ public Predicate matches(Object value) { return ObjectUtils.nullSafeEquals(o, value); } - if (value instanceof Pattern pattern) { + if (value instanceof Pattern) { + var pattern = (Pattern)value; return pattern.matcher(o.toString()).find(); } @@ -95,8 +98,10 @@ public Predicate matches(Object value) { public Predicate in(Object value) { return new DaprPredicate(part.getProperty(), value, o -> { - if (value instanceof Collection collection) { - if (o instanceof Collection subSet) { + if (value instanceof Collection) { + var collection = (Collection)value; + if (o instanceof Collection) { + var subSet = (Collection)o; return collection.containsAll(subSet); } @@ -117,7 +122,8 @@ public Predicate contains(Object value) { return false; } - if (o instanceof Collection collection) { + if (o instanceof Collection) { + var collection = (Collection)o; return collection.contains(value); } @@ -125,7 +131,8 @@ public Predicate contains(Object value) { return ObjectUtils.containsElement(ObjectUtils.toObjectArray(o), value); } - if (o instanceof Map map) { + if (o instanceof Map) { + var map = (Map)o; return map.containsValue(value); } @@ -145,9 +152,10 @@ public Predicate contains(Object value) { public Predicate startsWith(Object value) { return new DaprPredicate(part.getProperty(), value, o -> { - if (!(o instanceof String s)) { + if (!(o instanceof String)) { return false; } + var s = (String)o; if (ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) { return s.startsWith(value.toString()); @@ -159,10 +167,11 @@ public Predicate startsWith(Object value) { public Predicate endsWith(Object value) { return new DaprPredicate(part.getProperty(), value, o -> { - if (!(o instanceof String s)) { + if (!(o instanceof String)) { return false; } + var s = (String)o; if (ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) { return s.endsWith(value.toString()); } diff --git a/dapr-spring/pom.xml b/dapr-spring/pom.xml index b6cb7b4a2..a7c9474f3 100644 --- a/dapr-spring/pom.xml +++ b/dapr-spring/pom.xml @@ -28,9 +28,9 @@ 3.2.6 - 17 - 17 - 17 + 11 + 11 + 11 @@ -108,7 +108,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.7.0 + 3.2.0 attach-javadocs