You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ks...@apache.org on 2020/08/11 15:57:41 UTC

[arrow] 12/22: ARROW-9600: [Rust][Arrow] pin older version of proc-macro2 during build

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

kszucs pushed a commit to branch maint-1.0.x
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit b9ed76f1654008331826c3c4494d2c28072ba01d
Author: alamb <an...@nerdnetworks.org>
AuthorDate: Thu Jul 30 15:03:57 2020 -0600

    ARROW-9600: [Rust][Arrow] pin older version of proc-macro2 during build
    
    When used as a crate dependency, arrow-flight is rebuilt on every invocation of cargo build
    
    # Repro:
    
    Create a new repo, add `arrow=1.0.0` as a dependency, and then run `cargo build`
    
    *Expected behavior*: After the first successful invocation of `cargo build`, arrow-flight will not recompile if no other changes are made.
    
    *Actual behavior*: After every invocation of `cargo build`, arrow-flight is recompiled, even when nothing has changed
    
    Here is an example:
    
    Create a new crate
    ```
    alamb@ip-192-168-0-129 arrow_rebuilds % cargo new too_many_rebuilds --bin
    cargo new too_many_rebuilds --bin
         Created binary (application) `too_many_rebuilds` package
    ```
    
    Add arrow as a dependency in Cargo.toml:
    
    ```
    diff --git a/Cargo.toml b/Cargo.toml
    index a239680..44ed358 100644
    --- a/Cargo.toml
    +++ b/Cargo.toml
    @@ -5,3 +5,6 @@ authors = ["alamb <an...@nerdnetworks.org>"]
     edition = "2018"
    
     # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    +
    +[dependencies]
    +arrow = "1.0.0"
    
    ```
    >
    Now, all invocations of `cargo build` will rebuild arrow, even though nothing in the code has changed:
    
    ```
    alamb@ip-192-168-0-129 too_many_rebuilds % cargo build
    cargo build
       Compiling arrow-flight v1.0.0
       Compiling arrow v1.0.0
       Compiling too_many_rebuilds v0.1.0 (/Users/alamb/Software/bugs/arrow_rebuilds/too_many_rebuilds)
        Finished dev [unoptimized + debuginfo] target(s) in 8.70s
    alamb@ip-192-168-0-129 too_many_rebuilds % cargo build
    cargo build
       Compiling arrow-flight v1.0.0
       Compiling arrow v1.0.0
       Compiling too_many_rebuilds v0.1.0 (/Users/alamb/Software/bugs/arrow_rebuilds/too_many_rebuilds)
        Finished dev [unoptimized + debuginfo] target(s) in 8.65s
    ```
    You can see what is happening by checking out a fresh copy of arrow/master (no Cargo.log) and running `cargo build` -- you'll see your local checkout has changes in rust/arrow-flight/src/arrow.flight.protocol.rs:
    
    There is more detail on https://issues.apache.org/jira/browse/ARROW-9600
    
    # Proposed Fix:
    This proposed patch pins to the same version of proc-macro2 that was used to create the currently checked in version of rust/arrow-flight/src/arrow.flight.protocol.rs.
    
    Alternately, I could pin to the newer version of proc-macro2 and update the checked in version of rust/arrow-flight/src/arrow.flight.protocol.rs.
    
    Closes #7867 from alamb/alamb/arrow-9600
    
    Authored-by: alamb <an...@nerdnetworks.org>
    Signed-off-by: Andy Grove <an...@gmail.com>
---
 rust/arrow-flight/Cargo.toml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rust/arrow-flight/Cargo.toml b/rust/arrow-flight/Cargo.toml
index 5d36c47..c15da50 100644
--- a/rust/arrow-flight/Cargo.toml
+++ b/rust/arrow-flight/Cargo.toml
@@ -35,8 +35,10 @@ futures = { version = "0.3", default-features = false, features = ["alloc"]}
 
 [build-dependencies]
 tonic-build = "0.2"
+# Pin specific version of the tonic-build dependencies to avoid auto-generated
+# (and checked in) arrow.flight.protocol.rs from changing
+proc-macro2="1.0.18"
 
 [lib]
 name = "flight"
 path = "src/lib.rs"
-