tayloraswift / godot-swift

swift language support for the godot game engine
116 stars 5 forks source link

Update to swift-5.6 #7

Closed Kyle-Ye closed 1 year ago

Kyle-Ye commented 2 years ago
截屏2022-03-21 00 26 01

For many times, I got error here. Do you think we can have a better solution for this usage? Also currently implementation does not support godot-swift to be a local dependency. https://github.com/kelvin13/godot-swift/blob/8ed90d1956ccb8a4104a802683bb15bba63a0a7b/sources/godot-nativescript-generator/gyb.swift#L109-L120

Also if I change to something like this let directory:AbsolutePath = .init(NSTempotaryFolder()).appending(component: ".gyb").appending(components: name.dropLast()) (The test branch on my fork). I'll get another strange error message.

截屏2022-03-21 00 34 10

@kelvin13

tayloraswift commented 2 years ago

i’m not sure why this is failing, it probably has to do with the plugin being written for a very old version of SPM. i’d have to look into this in more detail

Kyle-Ye commented 2 years ago

i’m not sure why this is failing, it probably has to do with the plugin being written for a very old version of SPM. i’d have to look into this in more detail

The plugin and path issue has been fixed. Now I was blocked by the permission issue. I do not have the read access to the example Package.swift file even I run this in terminal with --disable-sandbox

➜  godot-swift-example swift build --disable-sandbox
[1/1] Planning buildCompiling plugin GodotNativeScript...
Building for debugging...
GodotNativeScriptGenerator/Synthesizer.swift:356: Fatal error: could not parse manifest at '/Users/kyleye/Github/godot/godot-swift-example' 
invalidManifestFormat("sandbox-exec: sandbox_apply: Operation not permitted", diagnosticFile: nil)
[0/3] Generating classes.swift'
tayloraswift commented 2 years ago

the plugin builds the target twice, it actually kicks off a nested build from inside the primary build. so make sure you’re propogating the --disable-sandbox to the child build as well

Kyle-Ye commented 2 years ago

the plugin builds the target twice, it actually kicks off a nested build from inside the primary build. so make sure you’re propogating the --disable-sandbox to the child build as well

How can I propagate the —-disable-sandbox to the child build?

tayloraswift commented 2 years ago

add it to the build arguments here: https://github.com/kelvin13/godot-swift/blob/8ed90d1956ccb8a4104a802683bb15bba63a0a7b/sources/godot-nativescript-generator/synthesizer.swift#L123

Kyle-Ye commented 2 years ago

add it to the build arguments here:

https://github.com/kelvin13/godot-swift/blob/8ed90d1956ccb8a4104a802683bb15bba63a0a7b/sources/godot-nativescript-generator/synthesizer.swift#L123

Seems to be resolved at first. But encounter a compile bug at the end.

(sub-build) 1.  Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
(sub-build) 2.  Compiling with the current language version
(sub-build) 3.  While evaluating request TypeCheckSourceFileRequest(source_file "/Users/kyleye/Github/godot/godot-swift-example/.build/plugins/outputs/godot-swift-example/GodotExample/GodotNativeScript/.build/plugins/outputs/godot-swift-example/GodotExample/GodotNativeScript/common.swift")
e/.build/plugins/outputs/godot-swift-example/GodotExample/GodotNativeScript/.build/plugins/outputs/godot-swift-example/GodotExample/GodotNativeScript/common.swift:7921:1)
(sub-build) 5.  While evaluating request RequirementRequest(extension of VectorFiniteRangeExpression, 0, interface)
(sub-build) 6.  While evaluating request ResolveTypeRequest(while resolving type , SIMD2<T>, (null))
(sub-build) 7.  While building rewrite system for generic signature <τ_0_0 where τ_0_0 : VectorFiniteRangeExpression, τ_0_0.Storage == SIMD2<τ_0_0.T>, τ_0_0.T : FixedWidthInteger>
(sub-build) Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
(sub-build) 0  swift-frontend           0x0000000104e9ef88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
(sub-build) 1  swift-frontend           0x0000000104e9df9c llvm::sys::RunSignalHandlers() + 112
(sub-build) 2  swift-frontend           0x0000000104e9f618 SignalHandler(int) + 344
(sub-build) 3  libsystem_platform.dylib 0x000000018fa214c4 _sigtramp + 56
(sub-build) 4  libsystem_pthread.dylib  0x000000018fa09ee0 pthread_kill + 288
(sub-build) 5  libsystem_c.dylib        0x000000018f944340 abort + 168
(sub-build) 6  swift-frontend           0x00000001019ce158 swift::rewriting::RuleBuilder::~RuleBuilder() + 0
(sub-build) 7  swift-frontend           0x00000001019cd574 swift::rewriting::RequirementMachine::computeCompletion(swift::rewriting::RewriteSystem::ValidityPolicy) + 84
(sub-build) 8  swift-frontend           0x00000001019cd448 swift::rewriting::RequirementMachine::initWithGenericSignature(swift::CanGenericSignature) + 892
(sub-build) 9  swift-frontend           0x00000001019d449c swift::rewriting::RewriteContext::getRequirementMachine(swift::CanGenericSignature) + 240
(sub-build) 10 swift-frontend           0x00000001018f5e90 swift::GenericSignatureImpl::getLocalRequirements(swift::Type) const + 216
(sub-build) 11 swift-frontend           0x00000001018f3dc4 swift::GenericEnvironment::getOrCreateArchetypeFromInterfaceType(swift::Type) + 48
(sub-build) 12 swift-frontend           0x00000001018f45a8 swift::QueryInterfaceTypeSubstitutions::operator()(swift::SubstitutableType*) const + 464
(sub-build) 13 swift-frontend           0x0000000101a006c8 llvm::Optional<swift::Type> llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>::callback_fn<substType(swift::Type, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<swift::ProtocolConformanceRef (swift::CanType, swift::Type, swift::ProtocolDecl*)>, swift::SubstOptions)::$_26>(long, swift::TypeBase*) + 160
(sub-build) 14 swift-frontend           0x00000001019fa91c swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const + 84
(sub-build) 15 swift-frontend           0x00000001019f831c substType(swift::Type, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<swift::ProtocolConformanceRef (swift::CanType, swift::Type, swift::ProtocolDecl*)>, swift::SubstOptions) + 272
(sub-build) 16 swift-frontend           0x0000000101a00a80 llvm::Optional<swift::Type> llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>::callback_fn<substType(swift::Type, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<swift::ProtocolConformanceRef (swift::CanType, swift::Type, swift::ProtocolDecl*)>, swift::SubstOptions)::$_26>(long, swift::TypeBase*) + 1112
(sub-build) 17 swift-frontend           0x00000001019fa91c swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const + 84
(sub-build) 18 swift-frontend           0x00000001019f831c substType(swift::Type, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<swiftocolDecl*)>, swift::SubstOptions) + 272
(sub-build) 19 swift-frontend           0x00000001015cd6a4 swift::TypeResolution::applyUnboundGenericArguments(swift::GenericTypeDecl*, swift::Type, swift::SourceLoc, llvm::ArrayRef<swift::Type>) const + 2216
(sub-build) 20 swift-frontend           0x00000001015da6e4 applyGenericArguments(swift::Type, swift::TypeResolution, swift::GenericParamList*, swift::ComponentIdentTypeRepr*) + 1740
(sub-build) 21 swift-frontend           0x00000001015d873c resolveTypeDecl(swift::TypeDecl*, swift::DeclContext*, swift::TypeResolution, swift::GenericParamList*, swift::ComponentIdentTypeRepr*) + 196
(sub-build) 22 swift-frontend           0x00000001015d1510 (anonymous namespace)::TypeResolver::resolveIdentifierType(swift::IdentTypeRepr*, swift::TypeResolutionOptions) + 548
(sub-build) 23 swift-frontend           0x00000001015ce008 (anonymous namespace)::TypeResolver::resolveType(swift::TypeRepr*, swift::TypeResolutionOptions) + 228
(sub-build) 24 swift-frontend           0x00000001015cdd8c swift::ResolveTypeRequest::evaluate(swift::Evaluator&, swift::TypeResolution const*, swift::TypeRepr*, swift::GenericParamList*) const + 104
(sub-build) 25 swift-frontend           0x00000001015dcf2c llvm::Expected<swift::ResolveTypeRequest::OutputType> swift::Evaluator::getResultUncached<swift::ResolveTypeRequest>(swift::ResolveTypeRequest const&) + 484
(sub-build) 26 swift-frontend           0x00000001015cdc9c swift::TypeResolution::resolveType(swift::TypeRepr*, swift::GenericParamList*) const + 96
(sub-build) 27 swift-frontend           0x000000010154dc04 swift::RequirementRequest::evaluate(swift::Evaluator&, swift::WhereClauseOwner, unsigned int, swift::TypeResolutionStage) const + 528
(sub-build) 28 swift-frontend           0x0000000101a0daa0 llvm::Expected<swift::RequirementRequest::OutputType> swift::Evaluator::getResultUncached<swift::RequirementRequest>(swift::RequirementRequest const&) + 1044
(sub-build) 29 swift-frontend           0x0000000101a0b524 swift::WhereClauseOwner::visitRequirements(swift::TypeResolutionStage, llvm::function_ref<bool (swift::Requirement, swift::RequirementRepr*)>) const && + 936
(sub-build) 30 swift-frontend           0x000000010152df84 checkGenericParams(swift::GenericContext*) + 292
(sub-build) 31 swift-frontend           0x0000000101529350 swift::ASTVisitor<(anonymous namespace)::DeclChecker, void, void, void, void, void, void>::visit(swift::Decl*) + 15096
(sub-build) 32 swift-frontend           0x0000000101522a7c (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 400
(sub-build) 33 swift-frontend           0x00000001015228e0 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 204
(sub-build) 34 swift-frontend           0x00000001015de83c swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 540
(sub-build) 35 swift-frontend           0x00000001015e15e0 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 564
(sub-build) 36 swift-frontend           0x00000001015de5cc swift::performTypeChecking(swift::SourceFile&) + 120
(sub-build) 37 swift-frontend           0x00000001008b35d0 swift::CompilerInstance::performSema() + 256
(sub-build) 38 swift-frontend           0x0000000100740348 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4072
(sub-build) 39 swift-frontend           0x0000000100708130 swift::mainEntry(int, char const**) + 808
(sub-build) 40 dyld                     0x0000000107781088 start + 516

I'll confirm this later and make the PR ready for review.

Full log 👇 log.txt

tayloraswift commented 2 years ago

should file this as a swift bug. unfortunately they are in the middle of a migration from JIRA to GH issues…

Kyle-Ye commented 2 years ago

bugs.swift.org will be in read-only mode starting April 18th 2022

We can still report issue on it until April 18th.

nvanfleet commented 1 year ago

I try this but I get a build error command: swift build --product GodotNativeScriptGenerator -c debug

.../swift-tools-support-core/Sources/TSCUtility/FSWatch.swift:848:15: error: cannot assign value of type 'Thread' to type 'Thread?'
                self.thread = thread
                            ^

If I update to tools version 5.7

.../Sources/GodotNativeScriptGenerator/synthesizer.swift:327:32: error: type 'ManifestLoader' has no member 'loadRootManifest'
                ManifestLoader.loadRootManifest(at: path, 
                ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
.../Sources/GodotNativeScriptGenerator/synthesizer.swift:331:42: error: cannot infer contextual base in reference to member 'global'
                    on:                 .global(), 
Kyle-Ye commented 1 year ago

Close since no active developement for this library.

For anyone interested with Godot in Swift. Maybe you can refer to https://github.com/migueldeicaza/SwiftGodot