swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.65k stars 1.31k forks source link

NFC: Assert that we don't add llbuild commands with the same name twice #7698

Closed kateinoigakukun closed 1 week ago

kateinoigakukun commented 1 week ago

Add debug assertion to avoid llbuild command name conflicts.

Depends on https://github.com/apple/swift-package-manager/pull/7695

Motivation:

One of the reasons we couldn't reveal https://github.com/apple/swift-package-manager/pull/7695 issue for long time (at least past 2 releases) is that we overlooked name conflicts on addWriteLinkFileListCommand.

Looking into the manifest builder, some of the commands also forgot to assert name conflicts, so it was error-prone.

Modifications:

Add a convenience method to perform assertions consistently

Result:

NFC for release build. Just add debug assertions

kateinoigakukun commented 1 week ago

@swift-ci test

kateinoigakukun commented 1 week ago

@swift-ci test

rauhul commented 1 week ago

Out of curiosity does this catch any current bugs?

kateinoigakukun commented 1 week ago

Fortunately, the current SwiftPM test suites didn't detect any bugs 😺

kateinoigakukun commented 1 week ago

@swift-ci test Windows