chore: bump shadow-rs version to set the path to find the correct git repo (#4494)

This commit is contained in:
LFC
2024-08-05 10:24:12 +08:00
committed by GitHub
parent 3b701d8f5e
commit c4717abb68
4 changed files with 15 additions and 5 deletions

4
Cargo.lock generated
View File

@@ -10386,9 +10386,9 @@ dependencies = [
[[package]]
name = "shadow-rs"
version = "0.29.0"
version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a600f795d0894cda22235b44eea4b85c2a35b405f65523645ac8e35b306817a"
checksum = "66caf2de9b7e61293c00006cd2807d6c4e4b31018c5ea21d008f44f4852b93c3"
dependencies = [
"const_format",
"git2",

View File

@@ -159,6 +159,7 @@ schemars = "0.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["float_roundtrip"] }
serde_with = "3"
shadow-rs = "0.31"
smallvec = { version = "1", features = ["serde"] }
snafu = "0.8"
sysinfo = "0.30"

View File

@@ -14,8 +14,8 @@ codec = ["dep:serde", "dep:schemars"]
const_format = "0.2"
schemars = { workspace = true, optional = true }
serde = { workspace = true, optional = true }
shadow-rs = "0.29"
shadow-rs.workspace = true
[build-dependencies]
build-data = "0.2"
shadow-rs = "0.29"
shadow-rs.workspace = true

View File

@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::env;
use build_data::{format_timestamp, get_source_time};
fn main() -> shadow_rs::SdResult<()> {
@@ -25,5 +27,12 @@ fn main() -> shadow_rs::SdResult<()> {
}
);
build_data::set_BUILD_TIMESTAMP();
shadow_rs::new()
// The "CARGO_WORKSPACE_DIR" is set manually (not by Rust itself) in Cargo config file, to
// solve the problem where the "CARGO_MANIFEST_DIR" is not what we want when this repo is
// made as a submodule in another repo.
let src_path = env::var("CARGO_WORKSPACE_DIR").or_else(|_| env::var("CARGO_MANIFEST_DIR"))?;
let out_path = env::var("OUT_DIR")?;
let _ = shadow_rs::Shadow::build_with(src_path, out_path, Default::default())?;
Ok(())
}