mirror of
https://github.com/openharmony/third_party_rust_link-cplusplus.git
synced 2026-06-30 21:47:55 -04:00
link-cplusplus升级1.0.12
Signed-off-by: wangmeng <wangmeng259@huawei.com>
This commit is contained in:
@@ -3,6 +3,7 @@ name: CI
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
schedule: [cron: "40 1 * * *"]
|
||||
|
||||
permissions:
|
||||
@@ -12,21 +13,62 @@ env:
|
||||
RUSTFLAGS: -Dwarnings
|
||||
|
||||
jobs:
|
||||
pre_ci:
|
||||
uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
|
||||
|
||||
test:
|
||||
name: Rust ${{matrix.rust}} on ${{matrix.os}}
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ${{matrix.os}}-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
rust: [nightly, beta, stable, 1.34.0]
|
||||
rust: [nightly, beta, stable, 1.68.0]
|
||||
os: [ubuntu, macos, windows]
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{matrix.rust}}
|
||||
- name: Enable type layout randomization
|
||||
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
|
||||
if: matrix.rust == 'nightly'
|
||||
shell: bash
|
||||
- run: cargo test
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: matrix.os == 'ubuntu' && matrix.rust == 'nightly' && always()
|
||||
with:
|
||||
name: Cargo.lock
|
||||
path: Cargo.lock
|
||||
continue-on-error: true
|
||||
|
||||
minimal:
|
||||
name: Minimal versions
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- run: cargo generate-lockfile -Z minimal-versions
|
||||
- run: cargo check --locked
|
||||
|
||||
doc:
|
||||
name: Documentation
|
||||
needs: pre_ci
|
||||
if: needs.pre_ci.outputs.continue
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@nightly
|
||||
- uses: dtolnay/install@cargo-docs-rs
|
||||
- run: cargo docs-rs
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
@@ -34,7 +76,7 @@ jobs:
|
||||
if: github.event_name != 'pull_request'
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@clippy
|
||||
- run: cargo clippy -- -Dclippy::all -Dclippy::pedantic
|
||||
|
||||
@@ -44,6 +86,7 @@ jobs:
|
||||
if: github.event_name != 'pull_request'
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: dtolnay/install@cargo-outdated
|
||||
- run: cargo outdated --workspace --exit-code 1
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
/Cargo.lock
|
||||
/target
|
||||
/target/
|
||||
|
||||
@@ -21,7 +21,7 @@ ohos_cargo_crate("lib") {
|
||||
|
||||
sources = [ "src/lib.rs" ]
|
||||
edition = "2018"
|
||||
cargo_pkg_version = "1.0.8"
|
||||
cargo_pkg_version = "1.0.12"
|
||||
cargo_pkg_authors = "David Tolnay <dtolnay@gmail.com>"
|
||||
cargo_pkg_name = "link-cplusplus"
|
||||
cargo_pkg_description = "Link libstdc++ or libc++ automatically or manually"
|
||||
|
||||
+10
-4
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "link-cplusplus"
|
||||
version = "1.0.8"
|
||||
version = "1.0.12"
|
||||
authors = ["David Tolnay <dtolnay@gmail.com>"]
|
||||
categories = ["external-ffi-bindings", "development-tools::ffi", "compilers", "no-std"]
|
||||
categories = ["external-ffi-bindings", "development-tools::ffi", "compilers", "no-std", "no-std::no-alloc"]
|
||||
description = "Link libstdc++ or libc++ automatically or manually"
|
||||
documentation = "https://docs.rs/link-cplusplus"
|
||||
edition = "2018"
|
||||
@@ -10,10 +10,10 @@ keywords = ["linkage", "c++"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
links = "cplusplus"
|
||||
repository = "https://github.com/dtolnay/link-cplusplus"
|
||||
rust-version = "1.34"
|
||||
rust-version = "1.68"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
cc = "1"
|
||||
|
||||
[features]
|
||||
default = [] # automatic
|
||||
@@ -27,3 +27,9 @@ libcxx = ["libc++"]
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
rustdoc-args = [
|
||||
"--generate-link-to-definition",
|
||||
"--extern-html-root-url=core=https://doc.rust-lang.org",
|
||||
"--extern-html-root-url=alloc=https://doc.rust-lang.org",
|
||||
"--extern-html-root-url=std=https://doc.rust-lang.org",
|
||||
]
|
||||
|
||||
@@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"Name": "link-cplusplus",
|
||||
"License": "Apache License V2.0, MIT",
|
||||
"License File": "LICENSE-APACHE, LICENSE-MIT",
|
||||
"Version Number": "1.0.8",
|
||||
"Version Number": "1.0.12",
|
||||
"Owner": "fangting12@huawei.com",
|
||||
"Upstream URL": "https://github.com/dtolnay/link-cplusplus",
|
||||
"Description": "A Rust library that provides support for linking with C++ code."
|
||||
|
||||
@@ -29,18 +29,18 @@ Cargo.toml:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
link-cplusplus = "1.0"
|
||||
link-cplusplus = "1"
|
||||
```
|
||||
|
||||
An application that wants a particular one or the other linked should use:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
link-cplusplus = { version = "1.0", features = ["libstdc++"] }
|
||||
link-cplusplus = { version = "1", features = ["libstdc++"] }
|
||||
|
||||
# or
|
||||
|
||||
link-cplusplus = { version = "1.0", features = ["libc++"] }
|
||||
link-cplusplus = { version = "1", features = ["libc++"] }
|
||||
```
|
||||
|
||||
An application that wants to handle its own more complicated logic for link
|
||||
@@ -48,7 +48,7 @@ flags from its build script can make this crate do nothing by using:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
link-cplusplus = { version = "1.0", features = ["nothing"] }
|
||||
link-cplusplus = { version = "1", features = ["nothing"] }
|
||||
```
|
||||
|
||||
Lastly, make sure to add an explicit `extern crate` dependency to your crate
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
@@ -25,10 +24,13 @@ fn main() {
|
||||
(false, true) => println!("cargo:rustc-link-lib=c++"),
|
||||
(false, false) | (true, true) => {
|
||||
// The platform's default.
|
||||
let out_dir = env::var_os("OUT_DIR").expect("missing OUT_DIR");
|
||||
let path = PathBuf::from(out_dir).join("dummy.cc");
|
||||
fs::write(&path, "int rust_link_cplusplus;\n").unwrap();
|
||||
cc::Build::new().cpp(true).file(&path).compile("link-cplusplus");
|
||||
let manifest_dir =
|
||||
env::var_os("CARGO_MANIFEST_DIR").expect("missing CARGO_MANIFEST_DIR");
|
||||
let path = PathBuf::from(manifest_dir).join("src").join("dummy.cc");
|
||||
cc::Build::new()
|
||||
.cpp(true)
|
||||
.file(&path)
|
||||
.compile("link-cplusplus");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
|
||||
#endif
|
||||
|
||||
int rust_link_cplusplus;
|
||||
+4
-4
@@ -31,18 +31,18 @@
|
||||
//!
|
||||
//! ```toml
|
||||
//! [dependencies]
|
||||
//! link-cplusplus = "1.0"
|
||||
//! link-cplusplus = "1"
|
||||
//! ```
|
||||
//!
|
||||
//! An application that wants a particular one or the other linked should use:
|
||||
//!
|
||||
//! ```toml
|
||||
//! [dependencies]
|
||||
//! link-cplusplus = { version = "1.0", features = ["libstdc++"] }
|
||||
//! link-cplusplus = { version = "1", features = ["libstdc++"] }
|
||||
//!
|
||||
//! # or
|
||||
//!
|
||||
//! link-cplusplus = { version = "1.0", features = ["libc++"] }
|
||||
//! link-cplusplus = { version = "1", features = ["libc++"] }
|
||||
//! ```
|
||||
//!
|
||||
//! An application that wants to handle its own more complicated logic for link
|
||||
@@ -50,7 +50,7 @@
|
||||
//!
|
||||
//! ```toml
|
||||
//! [dependencies]
|
||||
//! link-cplusplus = { version = "1.0", features = ["nothing"] }
|
||||
//! link-cplusplus = { version = "1", features = ["nothing"] }
|
||||
//! ```
|
||||
//!
|
||||
//! Lastly, make sure to add an explicit `extern crate` dependency to your crate
|
||||
|
||||
Reference in New Issue
Block a user