This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new aad56c48a ci(binding/java): Enable release when OPENDAL_RELEASE is on  
(#3057)
aad56c48a is described below

commit aad56c48a44c25c5123a0102efea6679ac8e8edf
Author: Xuanwo <[email protected]>
AuthorDate: Thu Sep 14 01:46:38 2023 +0800

    ci(binding/java): Enable release when OPENDAL_RELEASE is on  (#3057)
    
    * Disable php build
    
    Signed-off-by: Xuanwo <[email protected]>
    
    * feat: Enable release when OPENDAL_RELEASE is on
    
    Signed-off-by: Xuanwo <[email protected]>
    
    * Add comments
    
    Signed-off-by: Xuanwo <[email protected]>
    
    * Fix python
    
    Signed-off-by: Xuanwo <[email protected]>
    
    * revert unrelated changes
    
    Signed-off-by: tison <[email protected]>
    
    * use argument over envvar
    
    Signed-off-by: tison <[email protected]>
    
    * use --release for release
    
    Signed-off-by: tison <[email protected]>
    
    ---------
    
    Signed-off-by: Xuanwo <[email protected]>
    Signed-off-by: tison <[email protected]>
    Co-authored-by: tison <[email protected]>
---
 .github/workflows/release_java.yml |  1 +
 bindings/java/pom.xml              |  6 ++++--
 bindings/java/tools/build.py       | 11 ++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/release_java.yml 
b/.github/workflows/release_java.yml
index fcb6bfe8e..c9f2e3148 100644
--- a/.github/workflows/release_java.yml
+++ b/.github/workflows/release_java.yml
@@ -67,6 +67,7 @@ jobs:
           ./mvnw -Papache-release package verify 
org.sonatype.plugins:nexus-staging-maven-plugin:deploy \
             -DskipTests=true \
             -Djni.classifier=${{ matrix.classifier }} \
+            -Dcargo-build.release=--release \
             -DaltStagingDirectory=local-staging \
             -DskipRemoteStaging=true \
             -DserverId=apache.releases.https \
diff --git a/bindings/java/pom.xml b/bindings/java/pom.xml
index a02c305b1..a7c8bfc13 100644
--- a/bindings/java/pom.xml
+++ b/bindings/java/pom.xml
@@ -52,9 +52,10 @@
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
 
+        <cargo-build.release>--no-release</cargo-build.release>
         <jni.classifier>${os.detected.classifier}</jni.classifier>
 
-        <assertj-version>3.23.1</assertj-version>
+        <assertj.version>3.23.1</assertj.version>
         <lombok.version>1.18.26</lombok.version>
         <slf4j.version>2.0.7</slf4j.version>
         <testcontainers.version>1.18.3</testcontainers.version>
@@ -91,7 +92,7 @@
             <dependency>
                 <groupId>org.assertj</groupId>
                 <artifactId>assertj-core</artifactId>
-                <version>${assertj-version}</version>
+                <version>${assertj.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.projectlombok</groupId>
@@ -190,6 +191,7 @@
                                 
<argument>${project.basedir}/tools/build.py</argument>
                                 <argument>--classifier</argument>
                                 <argument>${jni.classifier}</argument>
+                                <argument>${cargo-build.release}</argument>
                             </arguments>
                         </configuration>
                     </execution>
diff --git a/bindings/java/tools/build.py b/bindings/java/tools/build.py
index bae9f8b78..0e706b5ce 100755
--- a/bindings/java/tools/build.py
+++ b/bindings/java/tools/build.py
@@ -17,7 +17,7 @@
 # under the License.
 
 
-from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
+from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, 
BooleanOptionalAction
 from pathlib import Path
 import shutil
 import subprocess
@@ -52,9 +52,14 @@ if __name__ == '__main__':
 
     parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
     parser.add_argument('--classifier', type=str, required=True)
+    parser.add_argument('--release', action=BooleanOptionalAction)
     args = parser.parse_args()
 
-    cmd = ['cargo', 'build', '--color=always', '--release']
+    cmd = ['cargo', 'build', '--color=always']
+    profile = 'debug'
+    if args.release:
+        profile = 'release'
+        cmd.append('--release')
 
     target = classifier_to_target(args.classifier)
     if target:
@@ -71,7 +76,7 @@ if __name__ == '__main__':
     subprocess.run(cmd, cwd=basedir, check=True)
 
     artifact = get_cargo_artifact_name(args.classifier)
-    src = output / target / 'release' / artifact
+    src = output / target / profile / artifact
     dst = basedir / 'target' / 'classes' / 'native' / args.classifier / 
artifact
     dst.parent.mkdir(exist_ok=True, parents=True)
     shutil.copy2(src, dst)

Reply via email to