-
Notifications
You must be signed in to change notification settings - Fork 77
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
Open
mayoff
wants to merge
44
commits into
migueldeicaza:main
Choose a base branch
from
mayoff:generator-AsyncParsableCommand
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,812
−2,778
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'
mayoff
force-pushed
the
generator-AsyncParsableCommand
branch
from
November 25, 2024 07:03
e567058
to
7823a01
Compare
mayoff
force-pushed
the
generator-AsyncParsableCommand
branch
from
November 25, 2024 07:27
14acea2
to
0634ee6
Compare
Whilst you're at it, can I suggest moving the Generator source code into See also #620. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.