Skip to content
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

Commands: update ArgumentParser to 1.1.4 #5884

Merged
merged 13 commits into from
Jan 10, 2023
Merged

Conversation

MaxDesiatov
Copy link
Member

@MaxDesiatov MaxDesiatov commented Nov 7, 2022

Motivation:

Plenty of updates were added to ArgumentParser since 1.0.3. For example, @OptionGroup(_hiddenFromHelp: true) is now @OptionGroup(visibility: .hidden). Also, some of the placeholder help output is formatter in a nicer way, for swift package init in our case.

Modifications:

Updated uses of @OptionGroup(_hiddenFromHelp: true), updated a test that checks for swift package init help output.

Result:

We can utilize new features of ArgumentParser in some future PR if needed.

@MaxDesiatov

This comment was marked as outdated.

@MaxDesiatov MaxDesiatov self-assigned this Nov 7, 2022
@MaxDesiatov
Copy link
Member Author

@swift-ci please test with the following PRs
apple/swift#59009
apple/swift-driver#1218

@MaxDesiatov
Copy link
Member Author

@swift-ci please smoke test
apple/swift#59009
apple/swift-driver#1218

@tomerd
Copy link
Member

tomerd commented Nov 7, 2022

@tomerd
Copy link
Member

tomerd commented Nov 7, 2022

@MaxDesiatov there may be a few other spots to get this this in. @shahmishal has a list

@shahmishal
Copy link
Member

@MaxDesiatov
Copy link
Member Author

Not quite sure how to make CI pass here without merging the swift-driver change first? We have upToNextMinor version constraint everywhere, but SwiftPM depends on a swift-driver branch, not a specific version, and that branch doesn't have the version update yet.

@neonichu
Copy link
Member

neonichu commented Nov 7, 2022

Not quite sure how to make CI pass here without merging the swift-driver change first? We have upToNextMinor version constraint everywhere, but SwiftPM depends on a swift-driver branch, not a specific version, and that branch doesn't have the version update yet.

It's normal for the self-hosted jobs to fail for this type of change, but cross-repo testing should allow getting the smoke tests jobs to pass. Once they do, we have to merge all the linked PRs at once.

@neonichu
Copy link
Member

neonichu commented Nov 7, 2022

BTW, from the Linux smoke test failure I would gather that the update-checkout changes aren't sufficient, yet.

@MaxDesiatov
Copy link
Member Author

It's normal for the self-hosted jobs to fail for this type of change, but cross-repo testing should allow getting the smoke tests jobs to pass.

Hm, but self-hosted jobs are required to pass on this repo, and cross-repo testing doesn't allow changing the branch of swift-driver specified in this SwiftPM repo?

@MaxDesiatov
Copy link
Member Author

MaxDesiatov commented Nov 7, 2022

BTW, from the Linux smoke test failure I would gather that the update-checkout changes aren't sufficient, yet.

Maybe there's an issue with cross-repo testing? I see in the log it checks out main branch of swift instead of the PR branch for some reason ¯\_(ツ)_/¯

@MaxDesiatov

This comment was marked as duplicate.

@MaxDesiatov

This comment was marked as duplicate.

@MaxDesiatov

This comment was marked as duplicate.

@MaxDesiatov

This comment was marked as duplicate.

1 similar comment
@MaxDesiatov
Copy link
Member Author

@neonichu
Copy link
Member

neonichu commented Nov 7, 2022

Hm, but self-hosted jobs are required to pass on this repo, and cross-repo testing doesn't allow changing the branch of swift-driver specified in this SwiftPM repo?

Ah yah, I guess we recently made them required, so @tomerd will need to do a force merge once we have the smoke testing jobs passing.

@tomerd
Copy link
Member

tomerd commented Nov 7, 2022

yes, I can force merge once the only failures are the expected ones. we changed policy to do that since its more explicit and safe, as we had PRs merged with failures in self hosted which were not legitimate to merge with

@MaxDesiatov MaxDesiatov changed the title Commands: update ArgumentParser to 1.1.4 Commands: update ArgumentParser to 1.2.0 Nov 9, 2022
@MaxDesiatov
Copy link
Member Author

@MaxDesiatov
Copy link
Member Author

1 similar comment
@MaxDesiatov
Copy link
Member Author

@MaxDesiatov
Copy link
Member Author

@MaxDesiatov
Copy link
Member Author

Ah, smoke test checks are finally passing. @neonichu @tomerd it's ready for review now.

}
} catch {
throw error
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this whole block can be made more concise

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean collapsing catch and switch into a single block? I don't think there's a way for catch to match against enum cases, is there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe something like this? I also added an XCTFail for when it does not throw since that seems to be an error case? you could also use XCTAssertThrowsError for that.

do {
            let stdout = try execute(["-help"]).stdout
            XCTFail("expecting an error")
         } catch SwiftPMProductError.executionFailure(_, _, let stderr)  {
             XCTAssertMatch(stderr, .contains("Usage: swift package"))
         }

@MaxDesiatov
Copy link
Member Author

@swift-ci please smoke test

@MaxDesiatov
Copy link
Member Author

…xd/argument-parser-update

# Conflicts:
#	Sources/CoreCommands/Options.swift
@MaxDesiatov
Copy link
Member Author

…xd/argument-parser-update

# Conflicts:
#	Sources/CoreCommands/Options.swift
@MaxDesiatov
Copy link
Member Author

1 similar comment
@MaxDesiatov
Copy link
Member Author

@MaxDesiatov
Copy link
Member Author

@swift-ci please test Windows

@MaxDesiatov
Copy link
Member Author

…xd/argument-parser-update

# Conflicts:
#	Sources/CoreCommands/Options.swift
@MaxDesiatov
Copy link
Member Author

@MaxDesiatov
Copy link
Member Author

1 similar comment
@MaxDesiatov
Copy link
Member Author

@shahmishal shahmishal merged commit 1cf758c into main Jan 10, 2023
@MaxDesiatov MaxDesiatov deleted the maxd/argument-parser-update branch January 10, 2023 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants