Skip to content

[plugin] Move cross-compile backend factory to BuilderConfiguration; fix log handler deprecation warning#680

Merged
sebsto merged 2 commits into
mainfrom
refactor/config-makebackend
Jun 29, 2026
Merged

[plugin] Move cross-compile backend factory to BuilderConfiguration; fix log handler deprecation warning#680
sebsto merged 2 commits into
mainfrom
refactor/config-makebackend

Conversation

@sebsto

@sebsto sebsto commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Two small follow-ups on top of the build-backend refactor (#679).

1. Move the cross-compile backend factory onto BuilderConfiguration

The call site read circularly:

backend = try configuration.crossCompileMethod.makeBackend(configuration: configuration)

— reaching through the configuration to get the method, then handing the
configuration straight back. The factory needs three values that the
configuration already owns (crossCompileToolPath, baseDockerImage,
disableDockerImageUpdate) plus the method, so it belongs on the configuration.

  • CrossCompileMethod is now purely the parsed user choice (parse + cases +
    description); its makeBackend(...) is gone.
  • BuilderConfiguration gains makeCrossCompileBackend() -> any BuildBackend,
    which reads everything it needs from self.
  • The call site becomes backend = try configuration.makeCrossCompileBackend().

No behaviour change. Also adopts explicit any (any BuildBackend,
any ContainerCLI).

The backend-selection tests now drive through
BuilderConfiguration(...).makeCrossCompileBackend() (passing --cross-compile).
The old "unsupported methods throw" test on the factory was dropped: unsupported
methods (swift-static-sdk, custom-sdk) are now rejected earlier, at
BuilderConfiguration.init via CrossCompileMethod.parse, and that behaviour is
already covered by UnsupportedCrossCompileMethodsPropertyTests.

2. Fix a deprecation warning in the test log handler

swift-log 1.13 added a log(event:) requirement to LogHandler and deprecated the
old log(level:message:source:...) method. CollectEverythingLogHandler (test
helper) still implemented the deprecated method, so it fell back to the deprecated
default implementation of log(event:), producing a build warning. It now
implements log(event:) directly. (JSONLogHandler in the library already did.)

Verification

  • Clean build of products and tests: no compiler warnings originate from our
    sources (Sources/, Tests/); remaining output is only unrelated ld: macOS
    dylib-version notes and the pre-existing Docs.docc "unhandled file" note.
  • All tests pass: 140 AWSLambdaRuntimeTests, 83 AWSLambdaPluginHelperTests.
  • swift format lint --strict clean.

@sebsto sebsto self-assigned this Jun 29, 2026
@sebsto sebsto added the 🆕 semver/minor Adds new public API. label Jun 29, 2026
@sebsto sebsto merged commit d5a3bf0 into main Jun 29, 2026
103 of 104 checks passed
@sebsto sebsto deleted the refactor/config-makebackend branch June 29, 2026 11:20
@sebsto sebsto changed the title Move cross-compile backend factory to BuilderConfiguration; fix log handler deprecation warning [plugin] Move cross-compile backend factory to BuilderConfiguration; fix log handler deprecation warning Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant