Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: swift build -c release --product AstrolabeRuntime

ios-simulator:
name: iOS Simulator tests
name: iOS Simulator and framework tests
runs-on: macos-15
timeout-minutes: 30

Expand All @@ -56,5 +56,10 @@ jobs:
- name: Show Xcode version
run: xcodebuild -version

- name: Run iOS Simulator tests
- name: Run iOS Simulator and framework tests
run: scripts/run-ios-simulator-tests.sh

- name: Verify Release automatic runtime framework
run: |
ASTROLABE_ARTIFACT_CONFIGURATION=Release \
scripts/verify-auto-start-artifact.sh
12 changes: 11 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ let package = Package(
products: [
.library(
name: "AstrolabeRuntime",
targets: ["AstrolabeRuntime"]
type: .dynamic,
targets: [
"AstrolabeRuntime",
"AstrolabeRuntimeBootstrap"
]
)
],
dependencies: [
Expand All @@ -25,6 +29,11 @@ let package = Package(
name: "AstrolabeRuntimeObjC",
publicHeadersPath: "include"
),
.target(
name: "AstrolabeRuntimeBootstrap",
dependencies: ["AstrolabeRuntime"],
publicHeadersPath: "include"
),
.target(
name: "AstrolabeRuntimeCore",
dependencies: [
Expand Down Expand Up @@ -82,6 +91,7 @@ let package = Package(
name: "AstrolabeRuntimeTests",
dependencies: [
"AstrolabeRuntime",
"AstrolabeRuntimeCore",
.product(
name: "AstrolabeProtocol",
package: "astrolabe-protocol"
Expand Down
78 changes: 29 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
English | [简体中文](README.zh-CN.md)

Astrolabe Runtime for iOS exposes UIKit and Core Animation inspection data to
the Astrolabe Host during development. Runtime activation is compiled out of
Release builds.
the Astrolabe Host during development. Linking the dynamic framework is the
complete integration: the Runtime starts automatically when an eligible
application process loads it.

Current package release: `2.0.0`.
Current package release: `2.1.0`.

## Requirements

Expand All @@ -22,49 +23,24 @@ Add the following package in Xcode:
https://github.com/regulusleow/astrolabe-runtime-ios
```

Link the `AstrolabeRuntime` product to the application target.
Link and embed the `AstrolabeRuntime` product only in application targets that
are allowed to expose runtime inspection data, such as Debug and internal Beta
targets. Existing integrations upgraded from the former static product must
verify that the framework is configured as `Embed & Sign`.

## Integration

Start and stop the Runtime from the active scene lifecycle.
No source integration is required. Do not import the module or add
`AppDelegate` or `SceneDelegate` lifecycle calls. The dynamic framework
installs its process-level lifecycle observer when it is loaded, starts after
application launch, and keeps the same Runtime instance across foreground and
background transitions.

Objective-C:

```objc
@import AstrolabeRuntime;

- (void)sceneDidBecomeActive:(UIScene *)scene {
#if DEBUG
[ASTRuntime start];
#endif
}

- (void)sceneDidEnterBackground:(UIScene *)scene {
#if DEBUG
[ASTRuntime stop];
#endif
}
```

Swift:

```swift
func sceneDidBecomeActive(_ scene: UIScene) {
#if DEBUG
ASTRuntime.start()
#endif
}

func sceneDidEnterBackground(_ scene: UIScene) {
#if DEBUG
ASTRuntime.stop()
#endif
}
```

Use `startWithCompletion:` when Objective-C code needs to handle startup
failures. `UIKitRuntimeLifecycle` is available for custom port selection,
request limits, or inspection authorization.
The Runtime does not inspect `DEBUG` or application configuration names.
Linking and embedding the product enables it in any build configuration.
Release and App Store targets must therefore remove `AstrolabeRuntime` from
their dependency graph and final application bundle. Treat a final artifact
scan as a required release gate.

## Capabilities

Expand All @@ -84,10 +60,11 @@ discarded when the Runtime stops or the App process exits.

| Target | Responsibility |
| --- | --- |
| `AstrolabeRuntimeCore` | Protocol server, routing, sessions, transport, node registry, and platform-independent patch coordination used by the iOS SDK. |
| `AstrolabeRuntimeUIKit` | UIKit and Core Animation collection, attribute mapping, Auto Layout, accessibility, and allowlisted mutations. |
| `AstrolabeRuntime` | Public `ASTRuntime` facade, SDK metadata, lifecycle, and dependency composition. |
| `AstrolabeRuntimeObjC` | Minimal Objective-C Runtime metadata adapter. |
| `AstrolabeRuntimeCore` | Protocol server, routing, sessions, transport, node registry, and platform-independent patch coordination. |
| `AstrolabeRuntimeUIKit` | UIKit and Core Animation collection, attributes, layout, accessibility, and allowlisted mutations. |
| `AstrolabeRuntime` | Automatic installer, process lifecycle coordination, SDK metadata, and dependency composition. |
| `AstrolabeRuntimeBootstrap` | Objective-C dynamic-framework load hook with no public lifecycle API. |
| `AstrolabeRuntimeObjC` | Objective-C Runtime metadata adapter used by UIKit collection. |

The package implements the platform-neutral Wire Protocol from
`astrolabe-protocol`. iOS-specific collection, mapping, lifecycle, and port
Expand All @@ -102,6 +79,7 @@ npm ci
npm test
swift test --parallel
swift build -c release --product AstrolabeRuntime
scripts/verify-auto-start-artifact.sh
```

Run UIKit and integration tests in an iOS Simulator:
Expand All @@ -115,9 +93,11 @@ xcodebuild \

## Security

The Runtime listens only on a loopback TCP endpoint and is unavailable in
Release builds. USB transport also relies on host-device pairing enforced by
usbmux. Do not distribute Debug builds containing sensitive runtime data.
The Runtime listens only on a loopback TCP endpoint. USB transport also relies
on host-device pairing enforced by usbmux. The Runtime has no internal build
configuration gate: if its framework is present in a Release build, it will
start automatically. Do not distribute builds containing the Runtime or
sensitive runtime data.

Temporary mutation is restricted to the Runtime-owned patch catalog. Arbitrary
selectors, method invocation, and business actions are not exposed.
Expand Down
67 changes: 21 additions & 46 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
[English](README.md) | 简体中文

Astrolabe Runtime for iOS 在开发期间向 Astrolabe Host 暴露 UIKit 和 Core Animation
检查数据。Release 构建不会编译 Runtime 激活逻辑。
检查数据。链接 dynamic Framework 即完成全部接入;符合条件的 App 进程加载 Framework
后,Runtime 会自动启动。

当前 Package 版本:`2.0.0`。
当前 Package 版本:`2.1.0`。

## 环境要求

Expand All @@ -21,48 +22,19 @@ Astrolabe Runtime for iOS 在开发期间向 Astrolabe Host 暴露 UIKit 和 Cor
https://github.com/regulusleow/astrolabe-runtime-ios
```

将 `AstrolabeRuntime` Product 链接到 App Target。
只在允许暴露运行时检查数据的 App Target 中链接并嵌入 `AstrolabeRuntime` Product,例如
Debug 和内部 Beta Target。从旧静态 Product 升级的既有工程需要确认 Framework 已配置为
`Embed & Sign`。

## 接入

在当前 Scene 生命周期中启动和停止 Runtime。
不需要添加任何业务代码。无需导入 Runtime module,也无需在 `AppDelegate` 或
`SceneDelegate` 中调用生命周期 API。dynamic Framework 加载后会安装进程级生命周期观察者,
在 App 启动后开启 Runtime,并在前后台切换期间保持同一个 Runtime 实例。

Objective-C:

```objc
@import AstrolabeRuntime;

- (void)sceneDidBecomeActive:(UIScene *)scene {
#if DEBUG
[ASTRuntime start];
#endif
}

- (void)sceneDidEnterBackground:(UIScene *)scene {
#if DEBUG
[ASTRuntime stop];
#endif
}
```

Swift:

```swift
func sceneDidBecomeActive(_ scene: UIScene) {
#if DEBUG
ASTRuntime.start()
#endif
}

func sceneDidEnterBackground(_ scene: UIScene) {
#if DEBUG
ASTRuntime.stop()
#endif
}
```

Objective-C 代码需要处理启动失败时,可以使用 `startWithCompletion:`。需要自定义端口、请求限制或
检查授权时,可以使用 `UIKitRuntimeLifecycle`。
Runtime 不判断 `DEBUG`,也不识别业务工程的构建配置名称。只要链接并嵌入该 Product,任何构建配置
都会启用 Runtime。因此 Release 和 App Store Target 必须从依赖图和最终 App Bundle 中彻底移除
`AstrolabeRuntime`,并将最终制品扫描作为发布门禁。

## 能力

Expand All @@ -81,10 +53,11 @@ Runtime 停止或 App 进程退出时失效。

| Target | 职责 |
| --- | --- |
| `AstrolabeRuntimeCore` | iOS SDK 使用的协议服务、路由、Session、Transport、节点注册表和平台无关补丁协调。 |
| `AstrolabeRuntimeUIKit` | UIKit 和 Core Animation 采集、属性映射、Auto Layout、无障碍信息及白名单内的修改操作。 |
| `AstrolabeRuntime` | 公共 `ASTRuntime` 外观接口、SDK 元数据、生命周期和依赖组装。 |
| `AstrolabeRuntimeObjC` | 最小化的 Objective-C Runtime 元数据适配器。 |
| `AstrolabeRuntimeCore` | 协议服务、路由、Session、Transport、节点注册表和平台无关补丁协调。 |
| `AstrolabeRuntimeUIKit` | UIKit 和 Core Animation 采集、属性、布局、无障碍信息及白名单内的修改操作。 |
| `AstrolabeRuntime` | 自动安装器、进程生命周期协调、SDK 元数据和依赖组装。 |
| `AstrolabeRuntimeBootstrap` | 不暴露公共生命周期 API 的 Objective-C dynamic Framework 加载入口。 |
| `AstrolabeRuntimeObjC` | UIKit 采集使用的 Objective-C Runtime 元数据适配器。 |

该 Package 实现 `astrolabe-protocol` 定义的平台无关 Wire Protocol。iOS 特有的数据采集、映射、
生命周期和端口选择保留在本仓库中。
Expand All @@ -98,6 +71,7 @@ npm ci
npm test
swift test --parallel
swift build -c release --product AstrolabeRuntime
scripts/verify-auto-start-artifact.sh
```

在 iOS 模拟器中运行 UIKit 和集成测试:
Expand All @@ -111,8 +85,9 @@ xcodebuild \

## 安全性

Runtime 仅监听 Loopback TCP Endpoint,并且在 Release 构建中不可用。USB Transport 同样依赖
usbmux 强制执行的主机与设备配对机制。请勿分发包含敏感运行时数据的 Debug 构建。
Runtime 仅监听 Loopback TCP Endpoint。USB Transport 同样依赖 usbmux 强制执行的主机与设备
配对机制。Runtime 内部没有构建配置门禁;如果 Framework 进入 Release 构建,它也会自动启动。
请勿分发包含 Runtime 或敏感运行时数据的构建。

临时修改仅限 Runtime 自身维护的补丁能力清单中声明的属性。Runtime 不会暴露任意 Selector、方法调用或业务操作。

Expand Down
Loading