Skip to content

Compile error on Windows #327

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

Closed
finestructure opened this issue May 29, 2024 · 1 comment · Fixed by #328
Closed

Compile error on Windows #327

finestructure opened this issue May 29, 2024 · 1 comment · Fixed by #328

Comments

@finestructure
Copy link
Contributor

finestructure commented May 29, 2024

Expected behavior

I'm trying to build a project on Windows that has (but doesn't use) this package as a transitive dependency. It leads to a failure early on during package resolution:

warning: 'spi-builder': dependency 'swift-crypto' is not used by any target
error: fatalError
C:\Users\sven_\Projects\spi-builder\.build\checkouts\swift-aws-lambda-runtime\Plugins\AWSLambdaPackager\Plugin.swift:195:25: error: type 'any Error' has no member 'unsupportedPlatform'
            throw Error.unsupportedPlatform("can't or don't know how to create a zip file on this platform")
                  ~~~~~ ^~~~~~~~~~~~~~~~~~~
C:\Users\sven_\Projects\spi-builder\.build\checkouts\swift-aws-lambda-runtime\Plugins\AWSLambdaPackager\Plugin.swift:201:28: error: cannot find 'arguments' in scope
                arguments: arguments,
                           ^~~~~~~~~
[1/1] Compiling plugin AWSLambdaPackager

The problem appears to be

            #if os(macOS) || os(Linux)
            let arguments = ["--junk-paths", "--symlinks", zipfilePath.string, relocatedArtifactPath.string, symbolicLinkPath.string]
            #else
            throw Error.unsupportedPlatform("can't or don't know how to create a zip file on this platform")
            #endif

in Plugin.swift.

The dependency is coming into my project via another project of ours that creates a lambda to upload data to S3. This project runs on Linux and is imported in order to share data structures & logic. I can probably work around this by creating yet another project that moves those types but it'd be rather awkward.

I wonder if the plugin could be simply disabled such that it won't bail out my build even when it's not being used?

Actual behavior

Don't abort the build unless the plugin is being actively used.

Steps to reproduce

Create a project that transitively imports swift-aws-lambda-runtime and doesn't use the plugin. The build will fail on Windows.

If possible, minimal yet complete reproducer code (or URL to code)

No response

What version of this project (swift-aws-lambda-runtime) are you using?

1.0.0-alpha.2

Swift version

5.10

Amazon Linux 2 docker image version

No response

@finestructure
Copy link
Contributor Author

I completely misread the error - it's a compile error, not a runtime error 🤦‍♂️

error: type 'any Error' has no member 'unsupportedPlatform

@finestructure finestructure changed the title Prevents build on Windows as a transitive dependency Compile error on Windows May 29, 2024
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 a pull request may close this issue.

1 participant