diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 27671c9..62c6054 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 - name: Publish package - uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c + uses: gradle/gradle-build-action@8f08e41675472b8aa0aa2c356e8b2c1561af3bf9 with: arguments: publish env: diff --git a/.github/workflows/regen.yml b/.github/workflows/regen.yml index 5bc2e6f..c56ed28 100644 --- a/.github/workflows/regen.yml +++ b/.github/workflows/regen.yml @@ -29,8 +29,8 @@ jobs: token: ${{ secrets.GH_CQ_BOT }} branch: fix/gen_proto base: main - title: "fix: Generate Python Code from `plugin-pb`" - commit-message: "fix: Generate Python Code from `plugin-pb`" - body: This PR was created by a scheduled workflow to regenerate the Python code from `plugin-pb`. + title: "fix: Generate Java Code from `plugin-pb`" + commit-message: "fix: Generate Java Code from `plugin-pb`" + body: This PR was created by a scheduled workflow to regenerate the Java code from `plugin-pb`. author: cq-bot labels: automerge diff --git a/CHANGELOG.md b/CHANGELOG.md index ab60f79..de60a66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.0.7](https://github.com/cloudquery/plugin-pb-java/compare/v0.0.6...v0.0.7) (2023-09-01) + + +### Bug Fixes + +* **deps:** Update dependency com.google.protobuf:protobuf-java-util to v3.24.2 ([#39](https://github.com/cloudquery/plugin-pb-java/issues/39)) ([d7f73c5](https://github.com/cloudquery/plugin-pb-java/commit/d7f73c519d6b7b0071aeb54c8e4c8dc02038f43c)) +* **deps:** Update dependency gradle to v8.3 ([#40](https://github.com/cloudquery/plugin-pb-java/issues/40)) ([0d054f8](https://github.com/cloudquery/plugin-pb-java/commit/0d054f8fcdace8763f9aed244f1c76b62ccf30a8)) +* **deps:** Update dependency org.mockito:mockito-core to v5.5.0 ([#41](https://github.com/cloudquery/plugin-pb-java/issues/41)) ([4e2a329](https://github.com/cloudquery/plugin-pb-java/commit/4e2a3298470e16f02123105068f8e5924720713d)) +* **deps:** Update grpcVersion to v1.57.2 ([#37](https://github.com/cloudquery/plugin-pb-java/issues/37)) ([26666fe](https://github.com/cloudquery/plugin-pb-java/commit/26666fe0abdf2a518e9be7450f1fab00f4eafb9f)) +* Generate Java Code from `plugin-pb` ([#42](https://github.com/cloudquery/plugin-pb-java/issues/42)) ([53e032f](https://github.com/cloudquery/plugin-pb-java/commit/53e032f752eb0fd07999cbca2bb083d9eea5f560)) + ## [0.0.6](https://github.com/cloudquery/plugin-pb-java/compare/v0.0.5...v0.0.6) (2023-08-08) diff --git a/build.gradle b/build.gradle index 907c9c7..6039876 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ mainClassName = 'main.Main' group 'io.cloudquery' // x-release-please-start-version -version = '0.0.6' +version = '0.0.7' // x-release-please-end repositories { @@ -23,8 +23,8 @@ repositories { sourceCompatibility = 1.8 targetCompatibility = 1.8 -def grpcVersion = '1.57.1' -def protobufVersion = '3.23.4' +def grpcVersion = '1.57.2' +def protobufVersion = '3.24.2' def protocVersion = protobufVersion dependencies { @@ -40,7 +40,7 @@ dependencies { testImplementation "io.grpc:grpc-testing:${grpcVersion}" testImplementation "junit:junit:4.13.2" - testImplementation "org.mockito:mockito-core:5.4.0" + testImplementation "org.mockito:mockito-core:5.5.0" } protobuf { diff --git a/build/generated/source/proto/main/grpc/io/cloudquery/discovery/v1/DiscoveryGrpc.java b/build/generated/source/proto/main/grpc/io/cloudquery/discovery/v1/DiscoveryGrpc.java index 0d39d41..2b6ca39 100644 --- a/build/generated/source/proto/main/grpc/io/cloudquery/discovery/v1/DiscoveryGrpc.java +++ b/build/generated/source/proto/main/grpc/io/cloudquery/discovery/v1/DiscoveryGrpc.java @@ -5,7 +5,7 @@ /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.57.1)", + value = "by gRPC proto compiler (version 1.57.2)", comments = "Source: cloudquery/discovery/v1/discovery.proto") @io.grpc.stub.annotations.GrpcGenerated public final class DiscoveryGrpc { diff --git a/build/generated/source/proto/main/grpc/io/cloudquery/plugin/v3/PluginGrpc.java b/build/generated/source/proto/main/grpc/io/cloudquery/plugin/v3/PluginGrpc.java index 57ac1e9..f2cbada 100644 --- a/build/generated/source/proto/main/grpc/io/cloudquery/plugin/v3/PluginGrpc.java +++ b/build/generated/source/proto/main/grpc/io/cloudquery/plugin/v3/PluginGrpc.java @@ -5,7 +5,7 @@ /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.57.1)", + value = "by gRPC proto compiler (version 1.57.2)", comments = "Source: cloudquery/plugin/v3/plugin.proto") @io.grpc.stub.annotations.GrpcGenerated public final class PluginGrpc { diff --git a/build/generated/source/proto/main/java/io/cloudquery/discovery/v1/GetVersions.java b/build/generated/source/proto/main/java/io/cloudquery/discovery/v1/GetVersions.java index 0ca8a9c..278a054 100644 --- a/build/generated/source/proto/main/java/io/cloudquery/discovery/v1/GetVersions.java +++ b/build/generated/source/proto/main/java/io/cloudquery/discovery/v1/GetVersions.java @@ -494,7 +494,8 @@ protected java.lang.Object newInstance( public static final int VERSIONS_FIELD_NUMBER = 1; @SuppressWarnings("serial") - private com.google.protobuf.Internal.IntList versions_; + private com.google.protobuf.Internal.IntList versions_ = + emptyIntList(); /** * repeated int32 versions = 1; * @return A list containing the versions. @@ -756,22 +757,17 @@ public io.cloudquery.discovery.v1.GetVersions.Response build() { @java.lang.Override public io.cloudquery.discovery.v1.GetVersions.Response buildPartial() { io.cloudquery.discovery.v1.GetVersions.Response result = new io.cloudquery.discovery.v1.GetVersions.Response(this); - buildPartialRepeatedFields(result); if (bitField0_ != 0) { buildPartial0(result); } onBuilt(); return result; } - private void buildPartialRepeatedFields(io.cloudquery.discovery.v1.GetVersions.Response result) { - if (((bitField0_ & 0x00000001) != 0)) { - versions_.makeImmutable(); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.versions_ = versions_; - } - private void buildPartial0(io.cloudquery.discovery.v1.GetVersions.Response result) { int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + versions_.makeImmutable(); + result.versions_ = versions_; + } } @java.lang.Override @@ -821,7 +817,8 @@ public Builder mergeFrom(io.cloudquery.discovery.v1.GetVersions.Response other) if (!other.versions_.isEmpty()) { if (versions_.isEmpty()) { versions_ = other.versions_; - bitField0_ = (bitField0_ & ~0x00000001); + versions_.makeImmutable(); + bitField0_ |= 0x00000001; } else { ensureVersionsIsMutable(); versions_.addAll(other.versions_); @@ -889,10 +886,10 @@ public Builder mergeFrom( private com.google.protobuf.Internal.IntList versions_ = emptyIntList(); private void ensureVersionsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - versions_ = mutableCopy(versions_); - bitField0_ |= 0x00000001; + if (!versions_.isModifiable()) { + versions_ = makeMutableCopy(versions_); } + bitField0_ |= 0x00000001; } /** * repeated int32 versions = 1; @@ -900,8 +897,8 @@ private void ensureVersionsIsMutable() { */ public java.util.List getVersionsList() { - return ((bitField0_ & 0x00000001) != 0) ? - java.util.Collections.unmodifiableList(versions_) : versions_; + versions_.makeImmutable(); + return versions_; } /** * repeated int32 versions = 1; @@ -929,6 +926,7 @@ public Builder setVersions( ensureVersionsIsMutable(); versions_.setInt(index, value); + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -941,6 +939,7 @@ public Builder addVersions(int value) { ensureVersionsIsMutable(); versions_.addInt(value); + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -954,6 +953,7 @@ public Builder addAllVersions( ensureVersionsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, versions_); + bitField0_ |= 0x00000001; onChanged(); return this; } diff --git a/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/GetTables.java b/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/GetTables.java index ef73054..51842cc 100644 --- a/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/GetTables.java +++ b/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/GetTables.java @@ -989,7 +989,7 @@ private Response(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } private Response() { - tables_ = java.util.Collections.emptyList(); + tables_ = emptyList(com.google.protobuf.ByteString.class); } @java.lang.Override @@ -1014,7 +1014,8 @@ protected java.lang.Object newInstance( public static final int TABLES_FIELD_NUMBER = 1; @SuppressWarnings("serial") - private java.util.List tables_; + private com.google.protobuf.Internal.ProtobufList tables_ = + emptyList(com.google.protobuf.ByteString.class); /** *
      * marshalled []arrow.Schema
@@ -1250,7 +1251,7 @@ private Builder(
       public Builder clear() {
         super.clear();
         bitField0_ = 0;
-        tables_ = java.util.Collections.emptyList();
+        tables_ = emptyList(com.google.protobuf.ByteString.class);
         return this;
       }
 
@@ -1277,22 +1278,17 @@ public io.cloudquery.plugin.v3.GetTables.Response build() {
       @java.lang.Override
       public io.cloudquery.plugin.v3.GetTables.Response buildPartial() {
         io.cloudquery.plugin.v3.GetTables.Response result = new io.cloudquery.plugin.v3.GetTables.Response(this);
-        buildPartialRepeatedFields(result);
         if (bitField0_ != 0) { buildPartial0(result); }
         onBuilt();
         return result;
       }
 
-      private void buildPartialRepeatedFields(io.cloudquery.plugin.v3.GetTables.Response result) {
-        if (((bitField0_ & 0x00000001) != 0)) {
-          tables_ = java.util.Collections.unmodifiableList(tables_);
-          bitField0_ = (bitField0_ & ~0x00000001);
-        }
-        result.tables_ = tables_;
-      }
-
       private void buildPartial0(io.cloudquery.plugin.v3.GetTables.Response result) {
         int from_bitField0_ = bitField0_;
+        if (((from_bitField0_ & 0x00000001) != 0)) {
+          tables_.makeImmutable();
+          result.tables_ = tables_;
+        }
       }
 
       @java.lang.Override
@@ -1342,7 +1338,8 @@ public Builder mergeFrom(io.cloudquery.plugin.v3.GetTables.Response other) {
         if (!other.tables_.isEmpty()) {
           if (tables_.isEmpty()) {
             tables_ = other.tables_;
-            bitField0_ = (bitField0_ & ~0x00000001);
+            tables_.makeImmutable();
+            bitField0_ |= 0x00000001;
           } else {
             ensureTablesIsMutable();
             tables_.addAll(other.tables_);
@@ -1398,12 +1395,12 @@ public Builder mergeFrom(
       }
       private int bitField0_;
 
-      private java.util.List tables_ = java.util.Collections.emptyList();
+      private com.google.protobuf.Internal.ProtobufList tables_ = emptyList(com.google.protobuf.ByteString.class);
       private void ensureTablesIsMutable() {
-        if (!((bitField0_ & 0x00000001) != 0)) {
-          tables_ = new java.util.ArrayList(tables_);
-          bitField0_ |= 0x00000001;
+        if (!tables_.isModifiable()) {
+          tables_ = makeMutableCopy(tables_);
         }
+        bitField0_ |= 0x00000001;
       }
       /**
        * 
@@ -1415,8 +1412,8 @@ private void ensureTablesIsMutable() {
        */
       public java.util.List
           getTablesList() {
-        return ((bitField0_ & 0x00000001) != 0) ?
-                 java.util.Collections.unmodifiableList(tables_) : tables_;
+        tables_.makeImmutable();
+        return tables_;
       }
       /**
        * 
@@ -1456,6 +1453,7 @@ public Builder setTables(
         if (value == null) { throw new NullPointerException(); }
         ensureTablesIsMutable();
         tables_.set(index, value);
+        bitField0_ |= 0x00000001;
         onChanged();
         return this;
       }
@@ -1472,6 +1470,7 @@ public Builder addTables(com.google.protobuf.ByteString value) {
         if (value == null) { throw new NullPointerException(); }
         ensureTablesIsMutable();
         tables_.add(value);
+        bitField0_ |= 0x00000001;
         onChanged();
         return this;
       }
@@ -1489,6 +1488,7 @@ public Builder addAllTables(
         ensureTablesIsMutable();
         com.google.protobuf.AbstractMessageLite.Builder.addAll(
             values, tables_);
+        bitField0_ |= 0x00000001;
         onChanged();
         return this;
       }
@@ -1501,7 +1501,7 @@ public Builder addAllTables(
        * @return This builder for chaining.
        */
       public Builder clearTables() {
-        tables_ = java.util.Collections.emptyList();
+        tables_ = emptyList(com.google.protobuf.ByteString.class);
         bitField0_ = (bitField0_ & ~0x00000001);
         onChanged();
         return this;
diff --git a/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Sync.java b/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Sync.java
index bc8a29e..be5a77f 100644
--- a/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Sync.java
+++ b/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Sync.java
@@ -1924,6 +1924,7 @@ protected java.lang.Object newInstance(
               io.cloudquery.plugin.v3.Sync.Request.class, io.cloudquery.plugin.v3.Sync.Request.Builder.class);
     }
 
+    private int bitField0_;
     public static final int TABLES_FIELD_NUMBER = 1;
     @SuppressWarnings("serial")
     private com.google.protobuf.LazyStringArrayList tables_ =
@@ -2028,7 +2029,7 @@ public boolean getDeterministicCqId() {
      */
     @java.lang.Override
     public boolean hasBackend() {
-      return backend_ != null;
+      return ((bitField0_ & 0x00000001) != 0);
     }
     /**
      * .cloudquery.plugin.v3.Sync.BackendOptions backend = 5;
@@ -2072,7 +2073,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
       if (deterministicCqId_ != false) {
         output.writeBool(4, deterministicCqId_);
       }
-      if (backend_ != null) {
+      if (((bitField0_ & 0x00000001) != 0)) {
         output.writeMessage(5, getBackend());
       }
       getUnknownFields().writeTo(output);
@@ -2108,7 +2109,7 @@ public int getSerializedSize() {
         size += com.google.protobuf.CodedOutputStream
           .computeBoolSize(4, deterministicCqId_);
       }
-      if (backend_ != null) {
+      if (((bitField0_ & 0x00000001) != 0)) {
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(5, getBackend());
       }
@@ -2288,13 +2289,19 @@ public static final class Builder extends
 
       // Construct using io.cloudquery.plugin.v3.Sync.Request.newBuilder()
       private Builder() {
-
+        maybeForceBuilderInitialization();
       }
 
       private Builder(
           com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
         super(parent);
-
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessageV3
+                .alwaysUseFieldBuilders) {
+          getBackendFieldBuilder();
+        }
       }
       @java.lang.Override
       public Builder clear() {
@@ -2358,11 +2365,14 @@ private void buildPartial0(io.cloudquery.plugin.v3.Sync.Request result) {
         if (((from_bitField0_ & 0x00000008) != 0)) {
           result.deterministicCqId_ = deterministicCqId_;
         }
+        int to_bitField0_ = 0;
         if (((from_bitField0_ & 0x00000010) != 0)) {
           result.backend_ = backendBuilder_ == null
               ? backend_
               : backendBuilder_.build();
+          to_bitField0_ |= 0x00000001;
         }
+        result.bitField0_ |= to_bitField0_;
       }
 
       @java.lang.Override
@@ -2862,8 +2872,10 @@ public Builder mergeBackend(io.cloudquery.plugin.v3.Sync.BackendOptions value) {
         } else {
           backendBuilder_.mergeFrom(value);
         }
-        bitField0_ |= 0x00000010;
-        onChanged();
+        if (backend_ != null) {
+          bitField0_ |= 0x00000010;
+          onChanged();
+        }
         return this;
       }
       /**
diff --git a/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Write.java b/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Write.java
index b82abd0..2827995 100644
--- a/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Write.java
+++ b/build/generated/source/proto/main/java/io/cloudquery/plugin/v3/Write.java
@@ -1198,6 +1198,7 @@ protected java.lang.Object newInstance(
               io.cloudquery.plugin.v3.Write.MessageDeleteStale.class, io.cloudquery.plugin.v3.Write.MessageDeleteStale.Builder.class);
     }
 
+    private int bitField0_;
     public static final int TABLE_FIELD_NUMBER = 1;
     private com.google.protobuf.ByteString table_ = com.google.protobuf.ByteString.EMPTY;
     /**
@@ -1262,7 +1263,7 @@ public java.lang.String getSourceName() {
      */
     @java.lang.Override
     public boolean hasSyncTime() {
-      return syncTime_ != null;
+      return ((bitField0_ & 0x00000001) != 0);
     }
     /**
      * .google.protobuf.Timestamp sync_time = 3;
@@ -1339,7 +1340,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
       if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sourceName_)) {
         com.google.protobuf.GeneratedMessageV3.writeString(output, 2, sourceName_);
       }
-      if (syncTime_ != null) {
+      if (((bitField0_ & 0x00000001) != 0)) {
         output.writeMessage(3, getSyncTime());
       }
       if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(tableName_)) {
@@ -1361,7 +1362,7 @@ public int getSerializedSize() {
       if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sourceName_)) {
         size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, sourceName_);
       }
-      if (syncTime_ != null) {
+      if (((bitField0_ & 0x00000001) != 0)) {
         size += com.google.protobuf.CodedOutputStream
           .computeMessageSize(3, getSyncTime());
       }
@@ -1534,13 +1535,19 @@ public static final class Builder extends
 
       // Construct using io.cloudquery.plugin.v3.Write.MessageDeleteStale.newBuilder()
       private Builder() {
-
+        maybeForceBuilderInitialization();
       }
 
       private Builder(
           com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
         super(parent);
-
+        maybeForceBuilderInitialization();
+      }
+      private void maybeForceBuilderInitialization() {
+        if (com.google.protobuf.GeneratedMessageV3
+                .alwaysUseFieldBuilders) {
+          getSyncTimeFieldBuilder();
+        }
       }
       @java.lang.Override
       public Builder clear() {
@@ -1593,14 +1600,17 @@ private void buildPartial0(io.cloudquery.plugin.v3.Write.MessageDeleteStale resu
         if (((from_bitField0_ & 0x00000002) != 0)) {
           result.sourceName_ = sourceName_;
         }
+        int to_bitField0_ = 0;
         if (((from_bitField0_ & 0x00000004) != 0)) {
           result.syncTime_ = syncTimeBuilder_ == null
               ? syncTime_
               : syncTimeBuilder_.build();
+          to_bitField0_ |= 0x00000001;
         }
         if (((from_bitField0_ & 0x00000008) != 0)) {
           result.tableName_ = tableName_;
         }
+        result.bitField0_ |= to_bitField0_;
       }
 
       @java.lang.Override
@@ -1916,8 +1926,10 @@ public Builder mergeSyncTime(com.google.protobuf.Timestamp value) {
         } else {
           syncTimeBuilder_.mergeFrom(value);
         }
-        bitField0_ |= 0x00000004;
-        onChanged();
+        if (syncTime_ != null) {
+          bitField0_ |= 0x00000004;
+          onChanged();
+        }
         return this;
       }
       /**
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 033e24c..7f93135 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 9f4197d..ac72c34 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
 networkTimeout=10000
 validateDistributionUrl=true
 zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
index fcb6fca..0adc8e1 100755
--- a/gradlew
+++ b/gradlew
@@ -83,7 +83,8 @@ done
 # This is normally unused
 # shellcheck disable=SC2034
 APP_BASE_NAME=${0##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+# 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