Closed adincebic closed 4 months ago
Is it possible to add a test case as well for this, would catch regressions in the future
Is it possible to add a test case as well for this, would catch regressions in the future
@luispadron No reason not to, just need to learn how to write tests in Starlark :)
Is it possible to add a test case as well for this, would catch regressions in the future
@luispadron I added the test though it is not that comprehensive. Maybe a better integration test would be to add example project with SwiftUI preview macro and build that on CI down the road. Does this small test suffice for now?
Is this fixed in 15.4?
@keith tested in the reproducer @adincebic provided but looks like its still broken unless we disable_sandbox:
<unknown>:0: warning: compiler plugin not loaded: '/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/swift-plugin-server; failed to initialize
app/source/ContentView.swift:15:1: error: external macro implementation type 'PreviewsMacros.SwiftUIView' could not be found for macro 'Preview(_:body:)'
#Preview {
^
SwiftUI.Preview:2:41: note: 'Preview(_:body:)' declared here
@freestanding(declaration) public macro Preview(_ name: String? = nil, body: @escaping @MainActor () -> any View) = #externalMacro(module: "PreviewsMacros", type: "SwiftUIView")
We use -load-plugin-library instead of executable, it works well, without the sandboxing issue
This should solve https://github.com/bazelbuild/rules_swift/issues/1202 and #1204
I am not sure whether this flag is required on Linux too.