Reorganize and simplify mixed_target and rust_target interactions. [chromium/src : main]

1 view
Skip to first unread message

danakj (Gerrit)

unread,
Mar 4, 2022, 5:27:58 PM3/4/22
to rust...@chromium.org, Chromium LUCI CQ, Adrian Taylor, chromium...@chromium.org, Łukasz Anforowicz

Attention is currently required from: Adrian Taylor.

Patch set 7:Commit-Queue +1

View Change

    To view, visit change 3503829. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: If2b369dc3b3bb219d42f2c3d6c8ffbd73bb64fbb
    Gerrit-Change-Number: 3503829
    Gerrit-PatchSet: 7
    Gerrit-Owner: danakj <dan...@chromium.org>
    Gerrit-Reviewer: Adrian Taylor <adet...@chromium.org>
    Gerrit-Reviewer: danakj <dan...@chromium.org>
    Gerrit-CC: Łukasz Anforowicz <luk...@chromium.org>
    Gerrit-Attention: Adrian Taylor <adet...@chromium.org>
    Gerrit-Comment-Date: Fri, 04 Mar 2022 22:27:45 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    danakj (Gerrit)

    unread,
    Mar 4, 2022, 5:48:40 PM3/4/22
    to rust...@chromium.org, Chromium LUCI CQ, Adrian Taylor, chromium...@chromium.org, Łukasz Anforowicz

    Attention is currently required from: Adrian Taylor.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #10:

        With this CL (and its dependencies, and the GN patches from https://bugs.chromium.org/p/gn/issues/detail?id=276) I can build rust_gtest_interop_unittests in component build.

        That's through of the use of public_deps in here for anything that should be accessible. (It remains to be seen if Rust symbols are correctly visible across components yet.)

    To view, visit change 3503829. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: If2b369dc3b3bb219d42f2c3d6c8ffbd73bb64fbb
    Gerrit-Change-Number: 3503829
    Gerrit-PatchSet: 10
    Gerrit-Owner: danakj <dan...@chromium.org>
    Gerrit-Reviewer: Adrian Taylor <adet...@chromium.org>
    Gerrit-Reviewer: danakj <dan...@chromium.org>
    Gerrit-CC: Łukasz Anforowicz <luk...@chromium.org>
    Gerrit-Attention: Adrian Taylor <adet...@chromium.org>
    Gerrit-Comment-Date: Fri, 04 Mar 2022 22:48:29 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Adrian Taylor (Gerrit)

    unread,
    Mar 4, 2022, 6:47:49 PM3/4/22
    to danakj, rust...@chromium.org, Chromium LUCI CQ, chromium...@chromium.org, Łukasz Anforowicz

    Attention is currently required from: danakj.

    Patch set 10:Code-Review +1

    View Change

    2 comments:

    • Patchset:

      • Patch Set #10:

        This is fantastic! You seem to have got rid of the biggest ugliest wart on our current gn templates.

    • File build/rust/rust_target.gni:

      • Patch Set #10, Line 139: }

        Nit - wondering if it's worth an assert to cover the case where people define mutually_dependent_public_deps but not the other?

    To view, visit change 3503829. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: If2b369dc3b3bb219d42f2c3d6c8ffbd73bb64fbb
    Gerrit-Change-Number: 3503829
    Gerrit-PatchSet: 10
    Gerrit-Owner: danakj <dan...@chromium.org>
    Gerrit-Reviewer: Adrian Taylor <adet...@chromium.org>
    Gerrit-Reviewer: danakj <dan...@chromium.org>
    Gerrit-CC: Łukasz Anforowicz <luk...@chromium.org>
    Gerrit-Attention: danakj <dan...@chromium.org>
    Gerrit-Comment-Date: Fri, 04 Mar 2022 23:47:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    danakj (Gerrit)

    unread,
    Mar 7, 2022, 9:43:47 AM3/7/22
    to rust...@chromium.org, Adrian Taylor, Chromium LUCI CQ, chromium...@chromium.org, Łukasz Anforowicz

    View Change

    1 comment:

    • File build/rust/rust_target.gni:

      • Nit - wondering if it's worth an assert to cover the case where people define mutually_dependent_pub […]

        Done

    To view, visit change 3503829. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: If2b369dc3b3bb219d42f2c3d6c8ffbd73bb64fbb
    Gerrit-Change-Number: 3503829
    Gerrit-PatchSet: 11
    Gerrit-Owner: danakj <dan...@chromium.org>
    Gerrit-Reviewer: Adrian Taylor <adet...@chromium.org>
    Gerrit-Reviewer: danakj <dan...@chromium.org>
    Gerrit-CC: Łukasz Anforowicz <luk...@chromium.org>
    Gerrit-Comment-Date: Mon, 07 Mar 2022 14:43:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Adrian Taylor <adet...@chromium.org>
    Gerrit-MessageType: comment

    danakj (Gerrit)

    unread,
    Mar 7, 2022, 10:48:31 AM3/7/22
    to rust...@chromium.org, Adrian Taylor, Chromium LUCI CQ, chromium...@chromium.org, Łukasz Anforowicz

    Patch set 12:Commit-Queue +2

    View Change

      To view, visit change 3503829. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: If2b369dc3b3bb219d42f2c3d6c8ffbd73bb64fbb
      Gerrit-Change-Number: 3503829
      Gerrit-PatchSet: 12
      Gerrit-Owner: danakj <dan...@chromium.org>
      Gerrit-Reviewer: Adrian Taylor <adet...@chromium.org>
      Gerrit-Reviewer: danakj <dan...@chromium.org>
      Gerrit-CC: Łukasz Anforowicz <luk...@chromium.org>
      Gerrit-Comment-Date: Mon, 07 Mar 2022 15:48:21 +0000

      Chromium LUCI CQ (Gerrit)

      unread,
      Mar 7, 2022, 12:41:09 PM3/7/22
      to danakj, rust...@chromium.org, Adrian Taylor, chromium...@chromium.org, Łukasz Anforowicz

      Chromium LUCI CQ submitted this change.

      View Change



      10 is the latest approved patch-set.
      The change was submitted with unreviewed changes in the following files:

      ```
      The name of the file: build/rust/rust_target.gni
      Insertions: 11, Deletions: 2.

      The diff is too large to show. Please review the diff.
      ```

      Approvals: Adrian Taylor: Looks good to me danakj: Commit
      Reorganize and simplify mixed_target and rust_target interactions.

      Previously mixed_target would cause rust_target to cleverly spawn extra
      targets within itself, in order for mixed_target to depend on a hidden
      target, and for Rust code to depend on a separate inner but public
      target (known as foo_rs for a mixed-target foo).

      As well, mixed_target would generate the Cxx bindings from the Rust
      code and include it into the C++ target as source files, then get
      rust_target to avoid generating Cxx bindings of its own.

      These complexities are reduced now:
      - C++ and Rust targets can each depend on a mixed target. This is
      done through improving use of public_deps so that both C++ and
      Rust dependents can see the pieces that they need to see through
      a mixed_target.
      - The Rust unittests within also depend on the mixed target.
      - The rust_target is the only place that generates C++ headers
      via Cxx.
      - Reduce the number of groups indirecting between the mixed target
      and the rlib to just one (in order to forward to the correct
      toolchain and/or insert dependencies for use of the target from
      C++.
      - Consistently forward testonly and visibility when a template
      generates more than 1 target by caching them into _testonly and
      _visibility, since forward_variables_from() can only forward a
      given variable once.
      - Always put generated C++ bindings into a static library, so that if
      multiple C++ targets use a Rust library with C++ bindings, they don't
      each get a copy of the object files linked into them. In a mixed
      target, those headers can include things from the C++ part of the
      mixed target. And just like other such users of those headers, any
      public_deps need to be depended on for the Cxx-generated headers.

      R=adet...@chromium.org

      Bug: 1296156
      Change-Id: If2b369dc3b3bb219d42f2c3d6c8ffbd73bb64fbb
      Cq-Include-Trybots: luci.chromium.try:linux-rust-x64-rel,android-rust-arm-rel
      Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3503829
      Reviewed-by: Adrian Taylor <adet...@chromium.org>
      Commit-Queue: danakj <dan...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#978327}
      ---
      M build/rust/cargo_crate.gni
      M build/rust/mixed_target.gni
      M build/rust/rust_cxx.gni
      M build/rust/rust_executable.gni
      M build/rust/rust_shared_library.gni
      M build/rust/rust_static_library.gni
      M build/rust/rust_target.gni
      M build/rust/tests/test_cpp_including_rust/BUILD.gn
      M build/rust/tests/test_mixed_shared_library/BUILD.gn
      M build/rust/tests/test_mixed_static_library/BUILD.gn
      M build/rust/tests/test_rust_exe/BUILD.gn
      M build/rust/tests/test_rust_multiple_dep_versions_exe/v1/src/lib.rs
      M build/rust/tests/test_rust_multiple_dep_versions_exe/v2/src/lib.rs
      M build/rust/tests/test_rust_unittests/BUILD.gn
      M build/rust/tests/test_serde_jsonrc/BUILD.gn
      15 files changed, 300 insertions(+), 324 deletions(-)


      To view, visit change 3503829. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: If2b369dc3b3bb219d42f2c3d6c8ffbd73bb64fbb
      Gerrit-Change-Number: 3503829
      Gerrit-PatchSet: 14
      Gerrit-Owner: danakj <dan...@chromium.org>
      Gerrit-Reviewer: Adrian Taylor <adet...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: danakj <dan...@chromium.org>
      Gerrit-CC: Łukasz Anforowicz <luk...@chromium.org>
      Gerrit-MessageType: merged
      Reply all
      Reply to author
      Forward
      0 new messages