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
55 changes: 55 additions & 0 deletions .github/workflows/stdout_renderer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Stdout Renderer

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
# Disable on Linux for now
# stdout_renderer_linux:
# name: Run stdout renderer on Linux
# runs-on: ubuntu-22.04
# container: swift:6.1.0-jammy
# env:
# OPENSWIFTUI_WERROR: 0
# OPENSWIFTUI_SWIFT_LOG: 1
# OPENSWIFTUI_SWIFT_CRYPTO: 1
# steps:
# - uses: actions/checkout@v4
# - name: Toolchain fix patch
# run: |
# # Fix swift-corelibs-foundation#5211
# .github/scripts/fix-toolchain.sh
# - name: Run stdout renderer example
# run: Renderer/Stdout/run-example.sh

stdout_renderer_macos:
name: Run stdout renderer on macOS
strategy:
fail-fast: false
matrix:
os: [macos-15]
xcode-version: ["16.4"]
release: [2024]
runs-on:
- self-hosted
- ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
OPENSWIFTUI_USE_LOCAL_DEPS: 1
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
uses: OpenSwiftUIProject/setup-xcode@v2
with:
xcode-version: ${{ matrix.xcode-version }}
- name: Set up build environment
run: Scripts/CI/darwin_setup_build.sh
shell: bash
- name: Run stdout renderer example
run: Renderer/Stdout/run-example.sh
24 changes: 24 additions & 0 deletions Renderer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Renderers

This directory contains renderer-specific examples and helper packages that are
kept outside the main OpenSwiftUI package manifest.

## Stdout

`Stdout/` contains a small executable package that launches an OpenSwiftUI app
with the stdout renderer enabled. It is useful for checking display-list output
without adding demo targets to the main package.

Run it from this repository:

```sh
cd Renderer/Stdout
./run-example.sh
```

On macOS, use the Stdout Tuist project for Xcode runs.

```sh
cd Renderer/Stdout
./open-xcode.sh
```
11 changes: 11 additions & 0 deletions Renderer/Stdout/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.build
.swiftpm
.xcodebuild
Derived
Package.resolved
xcodebuild.log
*.xcodeproj
*.xcworkspace
Tuist/.build
Tuist/.swiftpm
Tuist/Dependencies
15 changes: 15 additions & 0 deletions Renderer/Stdout/ExampleApp/ExampleApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@_spi(StdoutRenderer) import OpenSwiftUI

@main
struct ExampleApp: App {
static var rendererConfiguration: _RendererConfiguration? { .stdout() }

var body: some Scene {
WindowGroup {
VStack(spacing: 10.0) {
Color.red
Color.blue
}
}
}
}
23 changes: 23 additions & 0 deletions Renderer/Stdout/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// swift-tools-version: 6.1

import PackageDescription

let package = Package(
name: "StdoutRenderer",
platforms: [.macOS(.v15)],
products: [
.executable(name: "ExampleApp", targets: ["ExampleApp"]),
],
dependencies: [
.package(path: "../.."),
],
targets: [
.executableTarget(
name: "ExampleApp",
dependencies: [
.product(name: "OpenSwiftUI", package: "OpenSwiftUI"),
],
path: "ExampleApp"
),
]
)
113 changes: 113 additions & 0 deletions Renderer/Stdout/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import ProjectDescription

let appName = "StdoutRendererDemo"

let debugBuildSettings: SettingsDictionary = [
"ALWAYS_SEARCH_USER_PATHS": "NO",
"GCC_OPTIMIZATION_LEVEL": "0",
"ONLY_ACTIVE_ARCH": "YES",
"SWIFT_COMPILATION_MODE": "singlefile",
"SWIFT_OPTIMIZATION_LEVEL": "-Onone",
]

let releaseBuildSettings: SettingsDictionary = [
"SWIFT_COMPILATION_MODE": "wholemodule",
"SWIFT_OPTIMIZATION_LEVEL": "-O",
]

let appSettings: SettingsDictionary = [
"CODE_SIGN_STYLE": "Automatic",
"DEVELOPMENT_TEAM": "",
"ENABLE_HARDENED_RUNTIME": "YES",
"FRAMEWORK_SEARCH_PATHS": [
"$(inherited)",
"$(BUILD_DIR)/Debug$(EFFECTIVE_PLATFORM_NAME)",
"$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)",
],
"GENERATE_INFOPLIST_FILE": "YES",
"LD_RUNPATH_SEARCH_PATHS": [
"$(inherited)",
"@executable_path/../Frameworks",
],
"LIBRARY_SEARCH_PATHS": [
"$(inherited)",
"$(BUILD_DIR)/Debug$(EFFECTIVE_PLATFORM_NAME)",
"$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)",
],
"PRODUCT_BUNDLE_IDENTIFIER": "org.OpenSwiftUIProject.OpenSwiftUI.StdoutRendererDemo",
"SWIFT_VERSION": "5.0",
]

let privateFrameworkDependencies: [TargetDependency] = [
.external(name: "AttributeGraph"),
.external(name: "RenderBox"),
.external(name: "CoreUI"),
.external(name: "CoreSVG"),
.external(name: "SFSymbols"),
]

let target = Target.target(
name: appName,
destinations: [.mac],
product: .app,
bundleId: "org.OpenSwiftUIProject.OpenSwiftUI.StdoutRendererDemo",
deploymentTargets: .macOS("15.0"),
infoPlist: .extendingDefault(with: [:]),
sources: [
"ExampleApp/**/*.swift",
],
dependencies: [
.external(name: "OpenSwiftUI"),
] + privateFrameworkDependencies,
settings: .settings(
base: appSettings,
configurations: [
.debug(name: "Debug", settings: debugBuildSettings),
.release(name: "Release", settings: releaseBuildSettings),
],
defaultSettings: .none
)
)

let scheme = Scheme.scheme(
name: appName,
shared: true,
buildAction: .buildAction(targets: [.target(appName)]),
runAction: .runAction(
configuration: "Debug",
executable: .executable(.target(appName))
),
archiveAction: .archiveAction(configuration: "Release"),
profileAction: .profileAction(
configuration: "Release",
executable: .executable(.target(appName))
),
analyzeAction: .analyzeAction(configuration: "Debug")
)

let project = Project(
name: "StdoutRenderer",
options: .options(
automaticSchemesOptions: .disabled,
developmentRegion: "en"
),
settings: .settings(
configurations: [
.debug(name: "Debug", settings: debugBuildSettings),
.release(name: "Release", settings: releaseBuildSettings),
],
defaultSettings: .none,
defaultConfiguration: "Debug"
),
targets: [
target,
],
schemes: [
scheme,
],
additionalFiles: [
"README.md",
"Package.swift",
"run-example.sh",
]
)
39 changes: 39 additions & 0 deletions Renderer/Stdout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Stdout Renderer

This directory contains a minimal OpenSwiftUI app with the stdout renderer
enabled. The Swift package depends on the local OpenSwiftUI checkout at `../..`.

## CLI

```sh
./run-example.sh
```

The script selects AttributeGraph on macOS and Compute on other platforms,
then runs `swift run ExampleApp`.

## macOS Xcode

Use the Tuist project when running the demo from Xcode on macOS:

```sh
./open-xcode.sh
```

The script runs `tuist install`, generates the workspace without opening during
generation, then opens `StdoutRenderer.xcworkspace`. If `mise` is available, the

@augmentcode augmentcode Bot Jun 7, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renderer/Stdout/README.md:24-25 The README says open-xcode.sh uses mise to pick a repo-pinned Tuist version, but the script currently calls tuist directly. This looks like a doc/code mismatch that could confuse users trying to reproduce the intended workflow.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

script uses the repository-pinned Tuist version.

The Tuist project uses local OpenSwiftUI, OpenAttributeGraph, OpenRenderBox,
and DarwinPrivateFrameworks dependencies so Xcode does not need to open the
Swift package directly. Its package settings mirror the generated Example
project's local OpenSwiftUI product destinations, keeping AttributeGraph
enabled on macOS while preserving valid generated target platforms.

The example configures the app renderer with:

```swift
@_spi(StdoutRenderer) import OpenSwiftUI

static var rendererConfiguration: _RendererConfiguration? { .stdout() }
```
15 changes: 15 additions & 0 deletions Renderer/Stdout/Tuist.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import ProjectDescription

let tuist = Tuist(
project: .tuist(
generationOptions: .options(
defaultConfiguration: "Debug",
manifestEnvironment: [
"DARWINPRIVATEFRAMEWORKS_*",
"OPENATTRIBUTEGRAPH_*",
"OPENRENDERBOX_*",
"OPENSWIFTUI_*",
]
)
)
)
91 changes: 91 additions & 0 deletions Renderer/Stdout/Tuist/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// swift-tools-version: 6.1

import PackageDescription

let package = Package(
name: "StdoutRendererDependencies",
dependencies: [
.package(path: "../../.."),
.package(path: "../../../../OpenAttributeGraph"),
.package(path: "../../../../OpenRenderBox"),
.package(path: "../../../../DarwinPrivateFrameworks"),
.package(url: "https://github.com/OpenSwiftUIProject/SymbolLocator.git", from: "0.2.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-numerics", from: "1.0.3"),
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "601.0.0"),
]
)

#if TUIST
import ProjectDescription

let packageDestinations: Destinations = [.mac]

let packageProductTypes: [String: ProjectDescription.Product] = [
"OpenSwiftUI": .framework,
"OpenSwiftUICore": .staticFramework,
"OpenSwiftUI_SPI": .staticFramework,
"COpenSwiftUI": .staticFramework,
"OpenSwiftUIMacros": .macro,
"OpenSwiftUITestsSupport": .staticFramework,
"OpenSwiftUISymbolDualTestsSupport": .staticFramework,
"OpenAttributeGraphShims": .staticFramework,
"OpenCoreGraphicsShims": .staticFramework,
"OpenObservation": .staticFramework,
"OpenQuartzCoreShims": .staticFramework,
"OpenRenderBoxShims": .staticFramework,
"AttributeGraph": .framework,
"RenderBox": .framework,
"CoreUI": .framework,
"CoreSVG": .framework,
"SFSymbols": .framework,
"BacklightServices": .framework,
"SymbolLocator": .staticFramework,
]

let packageProductDestinations: [String: Destinations] = [
"OpenSwiftUI": packageDestinations,
"OpenSwiftUICore": packageDestinations,
"OpenSwiftUI_SPI": packageDestinations,
"OpenSwiftUIExtension": packageDestinations,
"OpenSwiftUIBridge": packageDestinations,
"OpenSwiftUITestsSupport": packageDestinations,
"OpenSwiftUISymbolDualTestsSupport": packageDestinations,
"OpenAttributeGraph": packageDestinations,
"OpenAttributeGraphShims": packageDestinations,
"OpenRenderBox": packageDestinations,
"OpenRenderBoxShims": packageDestinations,
"AttributeGraph": packageDestinations,
"RenderBox": packageDestinations,
"CoreUI": packageDestinations,
"CoreSVG": packageDestinations,
"SFSymbols": packageDestinations,
"SymbolLocator": packageDestinations,
]

let debugBuildSettings: SettingsDictionary = [
"ALWAYS_SEARCH_USER_PATHS": "NO",
"GCC_OPTIMIZATION_LEVEL": "0",
"ONLY_ACTIVE_ARCH": "YES",
"SWIFT_COMPILATION_MODE": "singlefile",
"SWIFT_OPTIMIZATION_LEVEL": "-Onone",
]

let releaseBuildSettings: SettingsDictionary = [
"SWIFT_COMPILATION_MODE": "wholemodule",
"SWIFT_OPTIMIZATION_LEVEL": "-O",
]

let packageSettings = PackageSettings(
productTypes: packageProductTypes,
productDestinations: packageProductDestinations,
baseSettings: .settings(
configurations: [
.debug(name: "Debug", settings: debugBuildSettings),
.release(name: "Release", settings: releaseBuildSettings),
],
defaultSettings: .none,
defaultConfiguration: "Debug"
)
)
#endif
Loading
Loading