xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.25k stars 796 forks source link

xmake cannot build default SwiftUI template #4540

Open demhademha opened 11 months ago

demhademha commented 11 months ago

Xmake Version

xmake v2.8.5+20231107,

Operating System Version and Architecture

Darwin Arm64 MacOS 14.3 23D5033f(

Describe Bug

After creating "xmake.lua" for the default xcode SwiftUI template, xmake fails to build it. There are two issues: Apple now use a .entitlements file for code signatures (which xmake does not support) The other issue is with the Preview macro

Expected Behavior

xmake to be able to compile this project

Project Configuration

xmakeSwiftUI.zip

Additional Information and Error Logs

�[0m�[38;5;2;1m[ 14%]:�[0m �[2mcompiling.release xmakeSwiftUI/xmakeSwiftUIApp.swift�[0m /Applications/Xcode-15.1.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -c -target arm64-apple-macos14.2 -sdk /Applications/Xcode-15.1.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -framework AppKit -module-name xmakeSwiftUI xmakeSwiftUI/ContentView.swift -o build/.objs/xmakeSwiftUI/macosx/arm64/release/xmakeSwiftUI/xmakeSwiftUIApp.swift.o -primary-file xmakeSwiftUI/xmakeSwiftUIApp.swift �[0m�[38;5;2;1m[ 14%]:�[0m �[2mcompiling.release xmakeSwiftUI/ContentView.swift�[0m /Applications/Xcode-15.1.0-Release.Candidate.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -c -target arm64-apple-macos14.2 -sdk /Applications/Xcode-15.1.0-Release.Candidate.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -framework AppKit -module-name xmakeSwiftUI xmakeSwiftUI/xmakeSwiftUIApp.swift -o build/.objs/xmakeSwiftUI/macosx/arm64/release/xmakeSwiftUI/ContentView.swift.o -primary-file xmakeSwiftUI/ContentView.swift �[0m�[38;5;2;1m[ 14%]:�[0m �[2mcompiling.xcode.release xmakeSwiftUI/Assets.xcassets�[0m /Applications/Xcode-15.1.0-Release.Candidate.app/Contents/Developer/usr/bin/actool --warnings --notices --output-format human-readable-text --target-device mac --platform macosx --minimum-deployment-target 14.2 --app-icon AppIcon --enable-on-demand-resources NO --output-partial-info-plist build/.gens/xmakeSwiftUI/macosx/arm64/release/rules/xcode/xcassets/assetcatalog_generated_info.plist --development-region en --product-type com.apple.product-type.application --compile build/macosx/arm64/release/xmakeSwiftUI.app/Contents/Resources xmakeSwiftUI/Assets.xcassets �[0m�[38;5;2;1m[ 14%]:�[0m �[2mcompiling.xcode.release xmakeSwiftUI/Preview Content/Preview Assets.xcassets�[0m /Applications/Xcode-15.1.0-Release.Candidate.app/Contents/Developer/usr/bin/actool --warnings --notices --output-format human-readable-text --target-device mac --platform macosx --minimum-deployment-target 14.2 --app-icon AppIcon --enable-on-demand-resources NO --output-partial-info-plist build/.gens/xmakeSwiftUI/macosx/arm64/release/rules/xcode/xcassets/assetcatalog_generated_info.plist --development-region en --product-type com.apple.product-type.application --compile build/macosx/arm64/release/xmakeSwiftUI.app/Contents/Resources "xmakeSwiftUI/Preview Content/Preview Assets.xcassets" �[0m�[1;38;5;1;1merror: �[0m@programdir/core/main.lua:309: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:320: @programdir/modules/private/action/build/object.lua:91: @programdir/core/sandbox/modules/os.lua:273: xmakeSwiftUI/ContentView.swift:22: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: https://github.com/escaping @mainactor () -> View) = #externalMacro(module: "PreviewsMacros", type: "SwiftUIView") ^

stack traceback: [C]: in function 'error' [@programdir/core/base/os.lua:923]: [@programdir/core/sandbox/modules/os.lua:273]: in function 'runv' [@programdir/modules/core/tools/swift_frontend.lua:149]: [C]: in function 'xpcall' [@programdir/core/base/utils.lua:280]: [@programdir/core/tool/compiler.lua:278]: in function 'compile' [@programdir/modules/private/action/build/object.lua:91]: in function 'script' [@programdir/modules/private/action/build/object.lua:122]: in function 'build_object' [@programdir/modules/private/action/build/object.lua:147]: in function 'jobfunc' [@programdir/modules/async/runjobs.lua:237]: [C]: in function 'xpcall' [@programdir/core/base/utils.lua:280]: in function 'trycall' [@programdir/core/sandbox/modules/try.lua:117]: in function 'try' [@programdir/modules/async/runjobs.lua:220]: in function 'cotask' [@programdir/core/base/scheduler.lua:404]:

stack traceback: [C]: in function 'error' @programdir/core/base/os.lua:923: in function 'base/os.raiselevel' (...tail calls...) @programdir/core/main.lua:309: in upvalue 'cotask' @programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>�[0m

Issues-translate-bot commented 11 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: xmake cannot build default SwiftUI template

waruqi commented 11 months ago

Can you provide a swiftUI project with xcode.proj? I need analysis it's build commands.

demhademha commented 11 months ago

XmakeTest.zip

Issues-translate-bot commented 11 months ago

Bot detected the issue body's language is not English, translate it automatically.


XmakeTest.zip

demhademha commented 11 months ago

default xcode project attached

Issues-translate-bot commented 11 months ago

Bot detected the issue body's language is not English, translate it automatically.


default xcode project attached