-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean up Generator top-level and use ArgumentParser #617
base: main
Are you sure you want to change the base?
Conversation
This simplifies checking whether a Godot type is a struct.
Error in Windows CI: "error: property wrappers are not yet supported in top-level code"
Windows CI error: error: cannot convert value of type 'WritableKeyPath<_, _>' to expected argument type '(JGodotBuiltinClass) -> JGodotBuiltinClass'
e567058
to
7823a01
Compare
14acea2
to
0634ee6
Compare
Whilst you're at it, can I suggest moving the Generator source code into See also #620. |
I am not ready to move the Generator to a new location, but happy to review this version. |
I reviewed, applied and tested up to:
Will continue later. |
Generally, one of the problems with these cleanup patches is that I have a fork of SwiftGodot with various in-progress patches that I need for Godot on iPad, and these become very time consuming and cumbersome to merge. I think that directionally this is a good set of changes, but I can not land right now, so I will have to do it in steps. |
return lambdaFull | ||
} | ||
|
||
private func generateSignals (_ p: Printer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this is out of date now with the generic signal implementation.
This PR makes several changes to the
Generator
command.The
Generator
command now uses theArgumentParser
module and anAsyncParsableCommand
conformance to parse the command line and run async code. This cleans up command line parsing, improves the help message, and makes it much easier to add more command line options in the future. It also eliminates the hack of using aDispatchSemaphore
to synchronously wait for aTask
to finish.This PR introduces a new
GeneratorCommand
type which conforms toAsyncParsableCommand
. The@main
annotation makesGeneratorCommand
the entry point for the program. I renamedmain.swift
toGenerator.swift
because we can't have amain.swift
if we use the@main
annotation.This PR also introduces a new
Generator
type, which holds every formerly-global variable that was declared inmain.swift
. All of these variables are now constant (let
) instead of mutable (var
).I moved many formerly global functions into extensions of
Generator
so they can continue accessing these variables easily.I changed many of the helper functions to
private
. I found some functions that were defined in one file but only used in a different file, and moved their definitions into the file where they are used (and made themprivate
orfileprivate
).I removed a few completely unused functions and variables.
This PR eliminates the fatal compile-time errors that prevented
Generator
from compiling at all with strict concurrency checking enabled. There are still several concurrency warnings, but it builds and runs successfully.I made the changes as a series of simple, somewhat trivial commits. The
Generator
program builds and produces unchanged output after each individual commit in this PR. I'm happy to squash the commits if you prefer, but I thought it would be easier to review as separate commits.