-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Compile all of the plugins at the start of a build with swiftbuild #9190
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
Open
cmcgee1024
wants to merge
2
commits into
swiftlang:main
Choose a base branch
from
cmcgee1024:precompile_plugins
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.
+177
−63
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6831,10 +6831,6 @@ struct PackageCommandTests { | |
} | ||
|
||
@Test( | ||
.issue( | ||
"https://github.com/swiftlang/swift-package-manager/issues/8977", | ||
relationship: .defect | ||
), | ||
.requiresSwiftConcurrencySupport, | ||
.IssueWindowsLongPath, | ||
.tags( | ||
|
@@ -6961,28 +6957,31 @@ struct PackageCommandTests { | |
ProcessInfo.hostOperatingSystem == .windows && data.buildSystem == .swiftbuild | ||
} | ||
|
||
try await withKnownIssue { | ||
// Check that building just one of them just compiles that plugin and doesn't build anything else. | ||
do { | ||
let (stdout, stderr) = try await executeSwiftBuild( | ||
packageDir, | ||
configuration: data.config, | ||
extraArgs: ["--target", "MyCommandPlugin"], | ||
buildSystem: data.buildSystem, | ||
) | ||
if data.buildSystem == .native { | ||
#expect(!stdout.contains("Compiling plugin MyBuildToolPlugin"), "stderr: \(stderr)") | ||
#expect(stdout.contains("Compiling plugin MyCommandPlugin"), "stderr: \(stderr)") | ||
} | ||
#expect(!stdout.contains("Building for \(data.config.buildFor)..."), "stderr: \(stderr)") | ||
// Check that building just one of them just compiles that plugin and doesn't build anything else. | ||
do { | ||
let (stdout, stderr) = try await executeSwiftBuild( | ||
packageDir, | ||
configuration: data.config, | ||
extraArgs: ["--target", "MyCommandPlugin"], | ||
buildSystem: data.buildSystem, | ||
) | ||
if data.buildSystem == .native { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: instead of an switch data.buildSystem {
case .native:
#expect(!stdout.contains("Compiling plugin MyBuildToolPlugin"), "stderr: \(stderr)")
#expect(stdout.contains("Compiling plugin MyCommandPlugin"), "stderr: \(stderr)")
case .swiftbuild:
// nothing specific
break
case .xcode:
Issue.record("Test expected have not been considered")
} |
||
#expect(!stdout.contains("Compiling plugin MyBuildToolPlugin"), "stderr: \(stderr)") | ||
#expect(stdout.contains("Compiling plugin MyCommandPlugin"), "stderr: \(stderr)") | ||
} | ||
} when: { | ||
data.buildSystem == .swiftbuild | ||
#expect(!stdout.contains("Building for \(data.config.buildFor)..."), "stderr: \(stderr)") | ||
} | ||
} | ||
} | ||
|
||
private static func commandPluginCompilationErrorImplementation( | ||
@Test( | ||
.requiresSwiftConcurrencySupport, | ||
.tags( | ||
.Feature.Command.Package.CommandPlugin, | ||
), | ||
arguments: getBuildData(for: SupportedBuildSystemOnAllPlatforms), | ||
) | ||
func commandPluginCompilationErrorImplementation( | ||
data: BuildData, | ||
) async throws { | ||
try await fixture(name: "Miscellaneous/Plugins/CommandPluginCompilationError") { packageDir in | ||
|
@@ -7017,44 +7016,6 @@ struct PackageCommandTests { | |
} | ||
} | ||
|
||
@Test( | ||
.requiresSwiftConcurrencySupport, | ||
.tags( | ||
.Feature.Command.Package.CommandPlugin, | ||
), | ||
// arguments: getBuildData(for: SupportedBuildSystemOnAllPlatforms), | ||
arguments: getBuildData(for: [.native]), | ||
) | ||
func commandPluginCompilationError( | ||
data: BuildData, | ||
) async throws { | ||
try await Self.commandPluginCompilationErrorImplementation(data: data) | ||
} | ||
|
||
@Test( | ||
.disabled("the swift-build process currently has a fatal error"), | ||
.issue( | ||
"https://github.com/swiftlang/swift-package-manager/issues/8977", | ||
relationship: .defect | ||
), | ||
.SWBINTTODO("Building sample package causes a backtrace on linux"), | ||
.requireSwift6_2, | ||
.requiresSwiftConcurrencySupport, | ||
.tags( | ||
.Feature.Command.Package.CommandPlugin, | ||
), | ||
// arguments: getBuildData(for: SupportedBuildSystemOnAllPlatforms), | ||
arguments: getBuildData(for: [.swiftbuild]), | ||
) | ||
func commandPluginCompilationErrorSwiftBuild( | ||
data: BuildData, | ||
) async throws { | ||
// Once this is fix, merge data iunto commandPluginCompilationError | ||
await withKnownIssue { | ||
try await Self.commandPluginCompilationErrorImplementation(data: data) | ||
} | ||
} | ||
|
||
@Test( | ||
.requiresSwiftConcurrencySupport, | ||
.tags( | ||
|
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.
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.
nit: classes should be
final
by default if you're not using inheritanceThere 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.
This class is declared within the scope of this function, so I think that would limit the ability for anything external to extend it. Is it still worth declaring it final in this case?
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.
The next question then is, why is this a class and not a value type if the lifetime is so short.