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

[plugin] Provided Examples' Package.swift does not work with the archive plugin. #275

Closed
sebsto opened this issue Dec 13, 2022 · 2 comments

Comments

@sebsto
Copy link
Contributor

sebsto commented Dec 13, 2022

Expected behavior

Trying to use the archive plugin on examples is not working out of the box.

In the examples directory Package.swift must be modified as this (note the branch and not the version parameter.

    dependencies: [
        // this is the dependency on the swift-aws-lambda-runtime library
        // in real-world projects this would say
        .package(url: "https://github.com/swift-server/swift-aws-lambda-runtime.git", branch: "main")
        //.package(name: "swift-aws-lambda-runtime", path: "../.."),
    ],

Actual behavior

When in the Examples/Echo directory, the plugin fails with the error below.
This is because inside the docker container /workspace maps to Examples/Echo and the examples' Package.swift refer to the swift-runtime library as ../.. which does not exist in the docker container.

.package(name: "swift-aws-lambda-runtime", path: "../.."),
-------------------------------------------------------------------------
configuration
-------------------------------------------------------------------------
{
  outputDirectory: /Users/stormacq/Documents/amazon/code/lambda/swift/swift-aws-lambda-runtime/Examples/Echo/.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager
  products: ["MyLambda"]
  buildConfiguration: release
  baseDockerImage: swift:amazonlinux2
}
-------------------------------------------------------------------------
building "echo" in docker
-------------------------------------------------------------------------
updating "swift:amazonlinux2" docker image
  amazonlinux2: Pulling from library/swift
  Digest: sha256:0b645a7589aa5f1759f976c42a9ffba48fd930b27b3481b0ab32e271e701d444
  Status: Image is up to date for swift:amazonlinux2
  docker.io/library/swift:amazonlinux2
/usr/local/bin/docker run --rm -v /Users/stormacq/Documents/amazon/code/lambda/swift/swift-aws-lambda-runtime/Examples/Echo:/workspace -w /workspace swift:amazonlinux2 bash -cl swift build -c release --show-bin-path
  /workspace/.build/aarch64-unknown-linux-gnu/release
building "MyLambda"
/usr/local/bin/docker run --rm -v /Users/stormacq/Documents/amazon/code/lambda/swift/swift-aws-lambda-runtime/Examples/Echo:/workspace -w /workspace swift:amazonlinux2 bash -cl swift build -c release --product MyLambda --static-swift-stdlib
  error: the package manifest at '/Package.swift' cannot be accessed (/Package.swift doesn't exist in file system)
error: /usr/local/bin/docker run --rm -v /Users/stormacq/Documents/amazon/code/lambda/swift/swift-aws-lambda-runtime/Examples/Echo:/workspace -w /workspace swift:amazonlinux2 bash -cl swift build -c release --product MyLambda --static-swift-stdlib failed with code 1

Steps to reproduce

  1. git clone [email protected]:sebsto/swift-aws-lambda-runtime.git
  2. cd swift-aws-lambda-runtime/Examples/Echo
  3. swift package --disable-sandbox archive --verbose 1

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

n/a

SwiftAWSLambdaRuntime version/commit hash

https://github.com/swift-server/swift-aws-lambda-runtime/tree/dc64ce195b1c51356f6655935c3509e296c35696

Swift & OS version (output of swift --version && uname -a)

✗ swift --version && uname -a
swift-driver version: 1.62.15 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
Target: arm64-apple-macosx13.0
Darwin bcd07458a91c 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64
@sebsto sebsto changed the title Provided example's Package.swift does not work for archive plugin. [plugin] Provided example's Package.swift does not work for archive plugin. Dec 13, 2022
@sebsto sebsto changed the title [plugin] Provided example's Package.swift does not work for archive plugin. [plugin] Provided Examples' Package.swift does not work with the archive plugin. Dec 13, 2022
@sebsto
Copy link
Contributor Author

sebsto commented Jan 3, 2023

This PR proposes changes to make the archive plugin works with the examples.
#277

@tomerd
Copy link
Contributor

tomerd commented Jan 10, 2023

made this PR to document the 1.x API. once merged we can tag a 1.0.0-alpha.1

@sebsto sebsto closed this as completed May 13, 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

No branches or pull requests

2 participants