Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Convert the iOS example to a Cargo example target (#65658)

Anthony Eid21001b273f93
diff --git a/Cargo.lock b/Cargo.lock
index b6c76d52ac6..9fd1488d9a3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7505,6 +7505,7 @@ dependencies = [
"futures 0.3.34",
"gpui",
"gpui_apple",
+ "gpui_platform",
"log",
"objc2 0.6.3",
"objc2-core-foundation",
@@ -7517,15 +7518,6 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "gpui_ios_example"
-version = "0.1.0"
-dependencies = [
- "gpui",
- "gpui_ios",
- "gpui_platform",
-]
-
[[package]]
name = "gpui_linux"
version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index 4ec681efe43..3be8c8ae849 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -95,7 +95,6 @@ members = [
"crates/gpui",
"crates/gpui_apple",
"crates/gpui_ios",
- "crates/gpui_ios/examples/ios",
"crates/gpui_linux",
"crates/gpui_macos",
"crates/gpui_macros",
diff --git a/crates/gpui_ios/Cargo.toml b/crates/gpui_ios/Cargo.toml
index eecaf13ccac..4fc8d6cab22 100644
--- a/crates/gpui_ios/Cargo.toml
+++ b/crates/gpui_ios/Cargo.toml
@@ -13,6 +13,12 @@ path = "src/gpui_ios.rs"
crate-type = ["staticlib", "rlib"]
doctest = false
+[[example]]
+name = "ios"
+path = "examples/ios.rs"
+test = false
+bench = false
+
[[test]]
name = "text_input"
path = "tests/text_input.rs"
@@ -25,6 +31,7 @@ runtime_shaders = ["gpui_apple/runtime_shaders"]
gpui.workspace = true
[target.'cfg(target_os = "ios")'.dev-dependencies]
+gpui_platform.workspace = true
objc2-ui-kit = { workspace = true, features = ["UIConversationContext"] }
slotmap.workspace = true
diff --git a/crates/gpui_ios/examples/ios/src/gpui_ios_example.rs b/crates/gpui_ios/examples/ios.rs
similarity index 100%
rename from crates/gpui_ios/examples/ios/src/gpui_ios_example.rs
rename to crates/gpui_ios/examples/ios.rs
diff --git a/crates/gpui_ios/examples/ios/Cargo.toml b/crates/gpui_ios/examples/ios/Cargo.toml
deleted file mode 100644
index 41e1b7ca03e..00000000000
--- a/crates/gpui_ios/examples/ios/Cargo.toml
+++ /dev/null
@@ -1,20 +0,0 @@
-[package]
-name = "gpui_ios_example"
-version = "0.1.0"
-edition.workspace = true
-publish = false
-license = "Apache-2.0"
-
-[lints]
-workspace = true
-
-[[bin]]
-name = "gpui_ios_example"
-path = "src/gpui_ios_example.rs"
-test = false
-bench = false
-
-[target.'cfg(target_os = "ios")'.dependencies]
-gpui.workspace = true
-gpui_ios.workspace = true
-gpui_platform.workspace = true
diff --git a/crates/gpui_ios/examples/ios/LICENSE-APACHE b/crates/gpui_ios/examples/ios/LICENSE-APACHE
deleted file mode 120000
index 15824831a24..00000000000
--- a/crates/gpui_ios/examples/ios/LICENSE-APACHE
+++ /dev/null
@@ -1 +0,0 @@
-../../../../LICENSE-APACHE
\ No newline at end of file
diff --git a/crates/gpui_ios/examples/ios/build-simulator.sh b/crates/gpui_ios/examples/ios/build-simulator.sh
index 390955f54dc..4c1ea18b419 100755
--- a/crates/gpui_ios/examples/ios/build-simulator.sh
+++ b/crates/gpui_ios/examples/ios/build-simulator.sh
@@ -17,7 +17,7 @@ trap 'rm -f "$build_output"' EXIT
# Corgi does not currently support iOS targets. Extra arguments are passed to Cargo.
IPHONEOS_DEPLOYMENT_TARGET=15.0 \
- cargo build -p gpui_ios_example --target aarch64-apple-ios-sim \
+ cargo build -p gpui_ios --example ios --target aarch64-apple-ios-sim \
--message-format=json-render-diagnostics "$@" > "$build_output"
executable="$(python3 - "$build_output" <<'PY'
@@ -29,11 +29,12 @@ with open(sys.argv[1]) as output:
event["executable"]
for event in map(json.loads, output)
if event.get("reason") == "compiler-artifact"
- and event.get("target", {}).get("name") == "gpui_ios_example"
+ and event.get("target", {}).get("name") == "ios"
+ and "example" in event.get("target", {}).get("kind", [])
and event.get("executable")
]
if len(executables) != 1:
- sys.exit("Expected one gpui_ios_example executable in Cargo's build output")
+ sys.exit("Expected one ios example executable in Cargo's build output")
print(executables[0])
PY
)"