Skip to content

Commit fc7cb2d

Browse files
committed
Use Cargo workspace dependencies
For library dependencies, not (yet) all framework dependencies.
1 parent b41dcfb commit fc7cb2d

File tree

185 files changed

+492
-487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+492
-487
lines changed

Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ categories = [
2626
"os::macos-apis",
2727
]
2828

29+
# Used in framework crates.
30+
[workspace.dependencies]
31+
dispatch2 = { path = "crates/dispatch2", version = "0.2.0", default-features = false }
32+
block2 = { path = "crates/block2", version = "0.6.0", default-features = false }
33+
objc2 = { path = "crates/objc2", version = "0.6.0", default-features = false }
34+
# Use a reasonably new version of libc.
35+
libc = { version = "0.2.80", default-features = false }
36+
# Use a version of bitflags that supports `impl`.
37+
bitflags = { version = "2.5.0", default-features = false }
38+
2939
[workspace.lints.rust]
3040
elided_lifetimes_in_paths = "warn"
3141
missing_copy_implementations = "warn"

crates/block2/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ unstable-private = []
5050
unstable-coerce-pointee = []
5151

5252
[dependencies]
53-
objc2 = { path = "../objc2", version = "0.6.0", default-features = false, features = ["std"] }
53+
objc2 = { workspace = true, features = ["std"] }
5454

5555
[dev-dependencies]
5656
objc2-foundation = { path = "../../framework-crates/objc2-foundation", default-features = false, features = [

crates/dispatch2/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ authors = ["Mads Marquart <[email protected]>", "Mary <[email protected]>"]
1717
workspace = true
1818

1919
[dependencies]
20-
bitflags = { version = "2.5.0", default-features = false, features = ["std"] }
21-
block2 = { path = "../block2", version = "0.6.0", default-features = false, optional = true, features = ["alloc"] }
22-
libc = { version = "0.2.80", default-features = false, optional = true }
23-
objc2 = { path = "../objc2", version = "0.6.0", default-features = false, optional = true, features = ["std"] }
20+
bitflags = { workspace = true, features = ["std"] }
21+
block2 = { workspace = true, optional = true, features = ["alloc"] }
22+
libc = { workspace = true, optional = true }
23+
objc2 = { workspace = true, optional = true, features = ["std"] }
2424

2525
[package.metadata.docs.rs]
2626
default-target = "aarch64-apple-darwin"

crates/header-translator/src/library.rs

+12-25
Original file line numberDiff line numberDiff line change
@@ -365,35 +365,22 @@ see that for related crates.", self.data.krate)?;
365365
for (krate, required_features) in self.dependencies(config) {
366366
let library = config.library_from_crate(krate);
367367
let required = self.data.required_crates.contains(krate);
368-
let path = match (library.is_library, self.data.is_library) {
369-
(true, true) => format!("../{krate}"),
370-
(true, false) => format!("../../crates/{krate}"),
371-
(false, true) => format!("../../framework-crates/{krate}"),
372-
(false, false) => format!("../{krate}"),
373-
};
374-
let mut table = match krate {
375-
"dispatch2" => InlineTable::from_iter([
376-
("path", Value::from(path)),
377-
("version", Value::from("0.2.0")),
378-
]),
379-
"objc2" => InlineTable::from_iter([
380-
("path", Value::from(path)),
381-
("version", Value::from("0.6.0")),
382-
]),
383-
"block2" => InlineTable::from_iter([
384-
("path", Value::from(path)),
385-
("version", Value::from("0.6.0")),
368+
let mut table = match (library.is_library, self.data.is_library) {
369+
(true, _) => InlineTable::from_iter([("workspace", Value::from(true))]),
370+
(false, true) => InlineTable::from_iter([
371+
(
372+
"path",
373+
Value::from(format!("../../framework-crates/{krate}")),
374+
),
375+
("version", Value::from(VERSION)),
376+
("default-features", Value::from(false)),
386377
]),
387-
// Use a reasonably new version of libc
388-
"libc" => InlineTable::from_iter([("version", Value::from("0.2.80"))]),
389-
// Use a version of bitflags that supports `impl`
390-
"bitflags" => InlineTable::from_iter([("version", Value::from("2.5.0"))]),
391-
_ => InlineTable::from_iter([
392-
("path", Value::from(path)),
378+
(false, false) => InlineTable::from_iter([
379+
("path", Value::from(format!("../{krate}"))),
393380
("version", Value::from(VERSION)),
381+
("default-features", Value::from(false)),
394382
]),
395383
};
396-
table.insert("default-features", Value::from(false));
397384
if !required {
398385
table.insert("optional", Value::from(true));
399386
}

crates/header-translator/src/main.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -809,22 +809,28 @@ fn update_test_metadata(workspace_dir: &Path, config: &Config) {
809809
(
810810
"block2",
811811
toml_edit::Value::InlineTable(toml_edit::InlineTable::from_iter([(
812-
"path",
813-
"../block2",
812+
"workspace",
813+
toml_edit::Value::from(true),
814814
)])),
815815
),
816816
(
817817
"objc2",
818818
toml_edit::Value::InlineTable(toml_edit::InlineTable::from_iter([
819-
("path", toml_edit::Value::from("../objc2")),
819+
("workspace", toml_edit::Value::from(true)),
820820
// FIXME: Make these not required for tests
821821
(
822822
"features",
823823
toml_edit::Value::Array(toml_edit::Array::from_iter(["relax-sign-encoding"])),
824824
),
825825
])),
826826
),
827-
("libc", "0.2.80".into()),
827+
(
828+
"libc",
829+
toml_edit::Value::InlineTable(toml_edit::InlineTable::from_iter([(
830+
"workspace",
831+
toml_edit::Value::from(true),
832+
)])),
833+
),
828834
]));
829835
let _ = cargo_toml.remove("target");
830836

crates/objc2/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ static_assertions = "1.1.0"
149149
backtrace = "0.3.74"
150150
memoffset = "0.9.0"
151151
block2 = { path = "../block2" }
152+
153+
# Intentionally does not use workspace deps, since we want to NOT put a version number in here for *Cargo reasons*
152154
objc2-core-foundation = { path = "../../framework-crates/objc2-core-foundation", default-features = false, features = [
153155
"CFCGTypes",
154156
] }

crates/test-frameworks/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@ objc2-phase = ["dep:objc2-phase"]
375375
objc2-carbon = ["dep:objc2-carbon"]
376376

377377
[dependencies]
378-
block2 = { path = "../block2" }
379-
objc2 = { path = "../objc2", features = ["relax-sign-encoding"] }
380-
libc = "0.2.80"
378+
block2 = { workspace = true }
379+
objc2 = { workspace = true, features = ["relax-sign-encoding"] }
380+
libc = { workspace = true }
381381
objc2-avf-audio = { path = "../../framework-crates/objc2-avf-audio", optional = true }
382382
objc2-av-foundation = { path = "../../framework-crates/objc2-av-foundation", optional = true }
383383
objc2-av-kit = { path = "../../framework-crates/objc2-av-kit", optional = true }

framework-crates/objc2-accessibility/Cargo.toml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-accessory-setup-kit/Cargo.toml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-accounts/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-ad-services/Cargo.toml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-ad-support/Cargo.toml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-app-clip/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-app-kit/Cargo.toml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-app-tracking-transparency/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-application-services/Cargo.toml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-ar-kit/Cargo.toml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-audio-toolbox/Cargo.toml

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-authentication-services/Cargo.toml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-automatic-assessment-configuration/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-automator/Cargo.toml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-av-foundation/Cargo.toml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-av-kit/Cargo.toml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-av-routing/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-avf-audio/Cargo.toml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework-crates/objc2-background-assets/Cargo.toml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)