Skip to content

Commit c457219

Browse files
committed
Rename features to not have a prefix of the crate name
1 parent 38e8a86 commit c457219

File tree

127 files changed

+8699
-8738
lines changed

Some content is hidden

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

127 files changed

+8699
-8738
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ jobs:
497497
run: >-
498498
cargo test $ARGS $PUBLIC_CRATES -ptests -pobjc2-foundation
499499
--features=unstable-static-sel,unstable-static-class,unstable-static-nsstring
500-
--features=Foundation_NSString
500+
--features=NSString
501501
502502
test-ios:
503503
# if: ${{ env.FULL }}

crates/header-translator/src/bin/check_framework_features.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ struct CargoToml {
1212
features: BTreeMap<String, Vec<String>>,
1313
}
1414

15-
const POPULAR_FOUNDATION_FEATURES: &[&str] = &[
16-
"Foundation_NSString",
17-
"Foundation_NSArray",
18-
"Foundation_NSDictionary",
19-
"Foundation_NSSet",
20-
"Foundation_NSEnumerator",
21-
"Foundation_NSError",
22-
"Foundation_NSException",
23-
"Foundation_NSValue",
24-
"Foundation_NSThread",
15+
const POPULAR_FEATURES: &[&str] = &[
16+
"NSString",
17+
"NSArray",
18+
"NSDictionary",
19+
"NSSet",
20+
"NSEnumerator",
21+
"NSError",
22+
"NSException",
23+
"NSValue",
24+
"NSThread",
2525
];
2626

2727
fn get_pairs<'a>(items: &'a [&'a str]) -> impl Iterator<Item = (&'a str, &'a str)> + 'a {
@@ -86,7 +86,7 @@ fn main() -> Result<(), Box<dyn Error>> {
8686
.join("objc2-foundation")
8787
.join("Cargo.toml"),
8888
)?;
89-
let feature_sets = get_pairs(POPULAR_FOUNDATION_FEATURES)
89+
let feature_sets = get_pairs(POPULAR_FEATURES)
9090
.map(|(feature1, feature2)| vec![feature1, feature2])
9191
.chain(features.iter().map(|feature| vec![&**feature]));
9292
test_feature_sets(

crates/header-translator/src/id.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,7 @@ impl Location {
9696
Some(Feature::Dependency("block2".to_string()))
9797
} else if self.library == emission_location.library {
9898
if let Some(file_name) = &self.file_name {
99-
Some(Feature::Feature(format!(
100-
"{}_{}",
101-
self.library,
102-
clean_name(file_name)
103-
)))
99+
Some(Feature::Feature(clean_name(file_name)))
104100
} else {
105101
error!("tried to get feature name of location with an unknown file name");
106102
Some(Feature::Feature(format!("{}_Unknown", self.library)))

crates/header-translator/src/library.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,8 @@ see that for related crates.", self.data.krate, self.link_name)?;
245245

246246
// Own features
247247
for (file_name, file) in &self.files {
248-
let feature_name = format!("{}_{}", self.link_name, clean_name(file_name));
249248
generated_features.insert(
250-
feature_name.clone(),
249+
clean_name(file_name),
251250
file.required_features(config).into_iter().collect(),
252251
);
253252
}
@@ -340,7 +339,7 @@ see that for related crates.", self.data.krate, self.link_name)?;
340339

341340
for name in self.files.keys() {
342341
let name = clean_name(name);
343-
write!(f, "#[cfg(feature = \"{}_{}\")]", self.link_name, name)?;
342+
write!(f, "#[cfg(feature = \"{name}\")]")?;
344343
writeln!(f, "#[path = \"{name}.rs\"]")?;
345344
writeln!(f, "mod __{name};")?;
346345
}

crates/objc2/src/topics/about_generated/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6363
[dependencies]
6464
# Removed `Foundation_NSMutableArray`, it is included via. `NSArray`.
6565
# Added `NSObject` as the `NSCopying` protocol comes from there.
66-
objc2-foundation = { version = "0.2", features = ["Foundation_NSNotification", "Foundation_NSString", "Foundation_NSThread", "Foundation_NSObject", "Foundation_NSArray"] }
66+
objc2-foundation = { version = "0.2", features = ["NSNotification", "NSString", "NSThread", "NSObject", "NSArray"] }
6767
# Added `NSResponder` as it's required by `NSApplication`.
6868
# Added `NSRunningApplication` as a lot of application constants come from here.
69-
objc2-app-kit = { version = "0.2", features = ["AppKit_NSResponder", "AppKit_NSApplication", "AppKit_NSRunningApplication"] }
69+
objc2-app-kit = { version = "0.2", features = ["NSResponder", "NSApplication", "NSRunningApplication"] }
7070
```
7171
* Marked `NSView::isFlipped`, `NSView::convertRect_toView`,
7272
`NSWindow::convertRectToScreen` and `NSWindow::convertPointFromScreen` as

crates/objc2/src/topics/about_generated/cargo_features.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ was declared inside of that header is locked behind that Cargo feature.
1616

1717
As an example, let's use `MetalKit`. This framework has four public C headers,
1818
`MTKDefines.h`, `MTKModel.h`, `MTKTextureLoader.h` and `MTKView.h`. This in
19-
turn means we get four Cargo features in `objc2-metal-kit`,
20-
`MetalKit_MTKDefines`, `MetalKit_MTKModel`, `MetalKit_MTKTextureLoader` and
21-
`MetalKit_MTKView`, that enables the functionality exposed by each of those
22-
headers, as well as any required dependency features (e.g. `MTKModel.h` uses
23-
`MTLDevice`, so `objc2-metal/Metal_MTLDevice` is enabled for you).
19+
turn means we get four Cargo features in `objc2-metal-kit`, `MTKDefines`,
20+
`MTKModel`, `MTKTextureLoader` and `MTKView`, that enables the functionality
21+
exposed by each of those headers, as well as any required dependency features
22+
(e.g. `MTKModel.h` uses `MTLDevice`, so `objc2-metal/MTLDevice` is enabled for
23+
you).
2424

2525

2626
## Dependency features

crates/test-assembly/crates/test_declare_class/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ gnustep-1-9 = ["gnustep-1-8", "objc2?/gnustep-1-9", "objc2-foundation?/gnustep-1
2222
gnustep-2-0 = ["gnustep-1-9", "objc2?/gnustep-2-0", "objc2-foundation?/gnustep-2-0"]
2323
gnustep-2-1 = ["gnustep-2-0", "objc2?/gnustep-2-1", "objc2-foundation?/gnustep-2-1"]
2424

25-
all = ["objc2-foundation?/block2", "objc2-foundation?/Foundation_NSObject", "objc2-foundation?/Foundation_NSZone"]
25+
all = ["objc2-foundation?/block2", "objc2-foundation?/NSObject", "objc2-foundation?/NSZone"]
2626

2727
# Hack to prevent the feature flag from being enabled in the entire project
2828
assembly-features = ["all", "objc2?/unstable-static-sel-inlined", "objc2?/unstable-static-class-inlined"]

crates/test-assembly/crates/test_fast_enumeration/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ gnustep-1-9 = ["gnustep-1-8", "objc2-foundation/gnustep-1-9"]
2323
gnustep-2-0 = ["gnustep-1-9", "objc2-foundation/gnustep-2-0"]
2424
gnustep-2-1 = ["gnustep-2-0", "objc2-foundation/gnustep-2-1"]
2525

26-
all = ["objc2-foundation/block2", "objc2-foundation/Foundation_NSEnumerator", "objc2-foundation/Foundation_NSArray"]
26+
all = ["objc2-foundation/block2", "objc2-foundation/NSEnumerator", "objc2-foundation/NSArray"]
2727

2828
# Hack
2929
assembly-features = ["all"] # "objc2/unstable-static-sel-inlined"

crates/test-assembly/crates/test_ns_string/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ gnustep-1-9 = ["gnustep-1-8", "objc2-foundation/gnustep-1-9"]
2222
gnustep-2-0 = ["gnustep-1-9", "objc2-foundation/gnustep-2-0"]
2323
gnustep-2-1 = ["gnustep-2-0", "objc2-foundation/gnustep-2-1"]
2424

25-
all = ["objc2-foundation/block2", "objc2-foundation/Foundation_NSString"]
25+
all = ["objc2-foundation/block2", "objc2-foundation/NSString"]
2626

2727
# Hack
2828
assembly-features = ["all", "objc2-foundation/unstable-static-nsstring"]

crates/test-fuzz/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ gnustep-2-0 = ["gnustep-1-9", "objc2-foundation/gnustep-2-0"]
2727
gnustep-2-1 = ["gnustep-2-0", "objc2-foundation/gnustep-2-1"]
2828

2929
# The features required for fuzzing all targets (used by CI)
30-
fuzz-all = ["objc2-foundation/Foundation_NSString"]
30+
fuzz-all = ["objc2-foundation/NSString"]
3131

3232
[[bin]]
3333
name = "class"
@@ -52,4 +52,4 @@ name = "nsstring"
5252
path = "fuzz_targets/nsstring.rs"
5353
test = false
5454
doc = false
55-
required-features = ["objc2-foundation/Foundation_NSString"]
55+
required-features = ["objc2-foundation/NSString"]

crates/test-ui/Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ default = [
1717
"apple",
1818
"std",
1919
"objc2-foundation/block2",
20-
"objc2-foundation/Foundation_NSObjCRuntime",
21-
"objc2-foundation/Foundation_NSString",
22-
"objc2-foundation/Foundation_NSNotification",
23-
"objc2-foundation/Foundation_NSThread",
24-
"objc2-foundation/Foundation_NSError",
25-
"objc2-foundation/Foundation_NSArray",
26-
"objc2-foundation/Foundation_NSValue",
27-
"objc2-foundation/Foundation_NSSet",
28-
"objc2-foundation/Foundation_NSObject",
29-
"objc2-foundation/Foundation_NSURLSession",
30-
"objc2-foundation/Foundation_NSEnumerator",
31-
"objc2-foundation/Foundation_NSDictionary",
20+
"objc2-foundation/NSObjCRuntime",
21+
"objc2-foundation/NSString",
22+
"objc2-foundation/NSNotification",
23+
"objc2-foundation/NSThread",
24+
"objc2-foundation/NSError",
25+
"objc2-foundation/NSArray",
26+
"objc2-foundation/NSValue",
27+
"objc2-foundation/NSSet",
28+
"objc2-foundation/NSObject",
29+
"objc2-foundation/NSURLSession",
30+
"objc2-foundation/NSEnumerator",
31+
"objc2-foundation/NSDictionary",
3232
"objc2/unstable-msg-send-always-comma",
3333
]
3434
std = ["block2/std", "objc2/std", "objc2-foundation/std"]

crates/test-ui/ui/implement_protocol_missing_super.stderr

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tests/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ exception = ["objc2/exception", "all"]
1919
catch-all = ["objc2/catch-all", "exception"]
2020
# TODO: Fix this
2121
all = [
22-
"objc2-foundation/Foundation_NSException",
23-
"objc2-foundation/Foundation_NSArray",
24-
"objc2-foundation/Foundation_NSString",
25-
"objc2-foundation/Foundation_NSSet",
26-
"objc2-foundation/Foundation_NSDictionary",
27-
"objc2-foundation/Foundation_NSValue",
28-
"objc2-foundation/Foundation_NSObject",
22+
"objc2-foundation/NSException",
23+
"objc2-foundation/NSArray",
24+
"objc2-foundation/NSString",
25+
"objc2-foundation/NSSet",
26+
"objc2-foundation/NSDictionary",
27+
"objc2-foundation/NSValue",
28+
"objc2-foundation/NSObject",
2929
]
3030

3131
apple = ["block2/apple", "objc2/apple", "objc2-foundation/apple"]

framework-crates/objc2-accessibility/Cargo.toml

Lines changed: 32 additions & 32 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1", "objc2
2121
name = "delegate"
2222
required-features = [
2323
"apple",
24-
"objc2-foundation/Foundation_NSNotification",
25-
"objc2-foundation/Foundation_NSString",
26-
"objc2-foundation/Foundation_NSObject",
27-
"objc2-foundation/Foundation_NSThread",
28-
"AppKit_NSResponder",
29-
"AppKit_NSApplication",
30-
"AppKit_NSRunningApplication",
24+
"objc2-foundation/NSNotification",
25+
"objc2-foundation/NSString",
26+
"objc2-foundation/NSObject",
27+
"objc2-foundation/NSThread",
28+
"NSResponder",
29+
"NSApplication",
30+
"NSRunningApplication",
3131
]
3232

3333
[[example]]
3434
name = "nspasteboard"
3535
required-features = [
3636
"apple",
37-
"objc2-foundation/Foundation_NSArray",
38-
"objc2-foundation/Foundation_NSString",
39-
"objc2-foundation/Foundation_NSObject",
40-
"AppKit_NSPasteboard",
37+
"objc2-foundation/NSArray",
38+
"objc2-foundation/NSString",
39+
"objc2-foundation/NSObject",
40+
"NSPasteboard",
4141
]

0 commit comments

Comments
 (0)