This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch polish-java-ci in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit e822619edb7581e0f242fe8e26eee77f6e98fb1c Author: Xuanwo <[email protected]> AuthorDate: Thu Sep 14 10:01:04 2023 +0800 ci(binding/java): Use cargo profile instead of --release Signed-off-by: Xuanwo <[email protected]> --- .github/workflows/release_java.yml | 2 +- bindings/java/pom.xml | 5 +++-- bindings/java/tools/build.py | 12 +++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release_java.yml b/.github/workflows/release_java.yml index c9f2e3148..6afd3c607 100644 --- a/.github/workflows/release_java.yml +++ b/.github/workflows/release_java.yml @@ -67,7 +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 \ + -Dcargo-build.profile=release \ -DaltStagingDirectory=local-staging \ -DskipRemoteStaging=true \ -DserverId=apache.releases.https \ diff --git a/bindings/java/pom.xml b/bindings/java/pom.xml index a7c8bfc13..2dea1f63f 100644 --- a/bindings/java/pom.xml +++ b/bindings/java/pom.xml @@ -52,7 +52,7 @@ <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <cargo-build.release>--no-release</cargo-build.release> + <cargo-build.profile>dev</cargo-build.profile> <jni.classifier>${os.detected.classifier}</jni.classifier> <assertj.version>3.23.1</assertj.version> @@ -191,7 +191,8 @@ <argument>${project.basedir}/tools/build.py</argument> <argument>--classifier</argument> <argument>${jni.classifier}</argument> - <argument>${cargo-build.release}</argument> + <argument>--profile</argument> + <argument>${cargo-build.profile}</argument> </arguments> </configuration> </execution> diff --git a/bindings/java/tools/build.py b/bindings/java/tools/build.py index 0e706b5ce..17ea8b9b9 100755 --- a/bindings/java/tools/build.py +++ b/bindings/java/tools/build.py @@ -52,14 +52,10 @@ if __name__ == '__main__': parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter) parser.add_argument('--classifier', type=str, required=True) - parser.add_argument('--release', action=BooleanOptionalAction) + parser.add_argument('--profile', type=str, default='dev') args = parser.parse_args() - cmd = ['cargo', 'build', '--color=always'] - profile = 'debug' - if args.release: - profile = 'release' - cmd.append('--release') + cmd = ['cargo', 'build', '--color=always', f'--profile={args.profile}'] target = classifier_to_target(args.classifier) if target: @@ -75,8 +71,10 @@ if __name__ == '__main__': print('$ ' + subprocess.list2cmdline(cmd)) subprocess.run(cmd, cwd=basedir, check=True) + # History reason of cargo profiles. + profile_output = 'debug' if args.profile in ['dev', 'test', 'bench'] else args.profile artifact = get_cargo_artifact_name(args.classifier) - src = output / target / profile / artifact + src = output / target / profile_output / artifact dst = basedir / 'target' / 'classes' / 'native' / args.classifier / artifact dst.parent.mkdir(exist_ok=True, parents=True) shutil.copy2(src, dst)
