Skip to content

Commit

Permalink
ci(binding/java): Enable release when OPENDAL_RELEASE is on (apache#3057
Browse files Browse the repository at this point in the history
)

* 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]>
  • Loading branch information
Xuanwo and tisonkun authored Sep 13, 2023
1 parent 9143523 commit aad56c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 4 additions & 2 deletions bindings/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
11 changes: 8 additions & 3 deletions bindings/java/tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -52,9 +52,14 @@ def get_cargo_artifact_name(classifier: str) -> str:

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:
Expand All @@ -71,7 +76,7 @@ def get_cargo_artifact_name(classifier: str) -> str:
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)

0 comments on commit aad56c4

Please sign in to comment.