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

mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new 6af6c0678 AVRO-3529: Rust: Use git-archive to make a source 
distribution of the Rust SDK (#1713)
6af6c0678 is described below

commit 6af6c06786081a6baed1ca03101c3becad4396b2
Author: Martin Grigorov <[email protected]>
AuthorDate: Tue Jun 7 22:35:10 2022 +0300

    AVRO-3529: Rust: Use git-archive to make a source distribution of the Rust 
SDK (#1713)
    
    * AVRO-3529: Rust: Use git-archive to make a source distribution of the 
Rust SDK
    
    Re-order the modules in the main Cargo.toml so that 'cargo ...' commands
    are executed in the preferred order.
    
    Export special Rust env vars for better diagnostics for the interop
    tasks.
    
    Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
    
    * AVRO-3529: Export the RUST_** env vars only for the cargo command 
execution
    
    Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
    (cherry picked from commit e1206ade30daca0cae5399fb1d88179bf3dbe7ec)
---
 lang/rust/Cargo.toml |  4 ++--
 lang/rust/build.sh   | 24 +++++++++---------------
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/lang/rust/Cargo.toml b/lang/rust/Cargo.toml
index 527bfb3fe..bcda788a7 100644
--- a/lang/rust/Cargo.toml
+++ b/lang/rust/Cargo.toml
@@ -18,6 +18,6 @@
 [workspace]
 members = [
     "avro_test_helper",
-    "avro",
-    "avro_derive"
+    "avro_derive",
+    "avro"
 ]
diff --git a/lang/rust/build.sh b/lang/rust/build.sh
index e8f9bf69f..90691bee2 100755
--- a/lang/rust/build.sh
+++ b/lang/rust/build.sh
@@ -20,12 +20,9 @@ set -e  # exit on error
 build_dir="../../build/rust"
 dist_dir="../../dist/rust"
 
-
 function clean {
-  if [ -d $build_dir ]; then
-    find $build_dir | xargs chmod 755
-    rm -rf $build_dir
-  fi
+  rm -rf $build_dir
+  rm -rf $dist_dir
 }
 
 
@@ -49,24 +46,21 @@ do
       cargo test
       ;;
     dist)
-      cargo build --release --lib --all-features
-      cargo package
-      mkdir -p  ../../dist/rust
-      cp target/package/apache-avro-*.crate $dist_dir
+      mkdir -p ${dist_dir}
+      cargo build --release --lib --all-features --workspace
+      git archive --output=apache-avro.tgz HEAD
+      mv apache-avro.tgz ${dist_dir}/
       ;;
     interop-data-generate)
       prepare_build
-      export RUST_LOG=apache_avro=debug
-      export RUST_BACKTRACE=1
-      cargo run  --features snappy,zstandard,bzip,xz --example 
generate_interop_data
+      RUST_LOG=apache_avro=debug RUST_BACKTRACE=1 cargo run --features 
snappy,zstandard,bzip,xz --example generate_interop_data
       ;;
-
     interop-data-test)
       prepare_build
       echo "Running interop data tests"
-      cargo run --features snappy,zstandard,bzip,xz --example test_interop_data
+      RUST_LOG=apache_avro=debug RUST_BACKTRACE=1 cargo run --features 
snappy,zstandard,bzip,xz --example test_interop_data
       echo -e "\nRunning single object encoding interop data tests"
-      cargo run --example test_interop_single_object_encoding
+      RUST_LOG=apache_avro=debug RUST_BACKTRACE=1 cargo run --example 
test_interop_single_object_encoding
       ;;
     *)
       echo "Usage: $0 
{lint|test|dist|clean|interop-data-generate|interop-data-test}" >&2

Reply via email to