From 8b21a12208cd943b35fcd33f4bb9e354ab3ed460 Mon Sep 17 00:00:00 2001 From: softprops Date: Tue, 26 May 2020 04:10:30 -0400 Subject: [PATCH 01/19] feat: support rust via cargo --- .appveyor.yml | 15 + Makefile | 5 +- README.md | 1 + aws_lambda_builders/workflows/__init__.py | 1 + .../workflows/rust_cargo/DESIGN.md | 45 + .../workflows/rust_cargo/__init__.py | 5 + .../workflows/rust_cargo/actions.py | 216 +++++ .../workflows/rust_cargo/workflow.py | 37 + .../workflows/rust_cargo/test_rust_actions.py | 28 + .../workflows/rust_cargo/test_rust_cargo.py | 46 + .../rust_cargo/testdata/hello/.gitignore | 1 + .../rust_cargo/testdata/hello/Cargo.lock | 859 ++++++++++++++++++ .../rust_cargo/testdata/hello/Cargo.toml | 9 + .../rust_cargo/testdata/hello/src/main.rs | 10 + tests/unit/workflows/rust_cargo/__init__.py | 0 .../unit/workflows/rust_cargo/test_actions.py | 168 ++++ .../workflows/rust_cargo/test_workflow.py | 26 + 17 files changed, 1471 insertions(+), 1 deletion(-) create mode 100644 aws_lambda_builders/workflows/rust_cargo/DESIGN.md create mode 100644 aws_lambda_builders/workflows/rust_cargo/__init__.py create mode 100644 aws_lambda_builders/workflows/rust_cargo/actions.py create mode 100644 aws_lambda_builders/workflows/rust_cargo/workflow.py create mode 100644 tests/functional/workflows/rust_cargo/test_rust_actions.py create mode 100644 tests/integration/workflows/rust_cargo/test_rust_cargo.py create mode 100644 tests/integration/workflows/rust_cargo/testdata/hello/.gitignore create mode 100644 tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock create mode 100644 tests/integration/workflows/rust_cargo/testdata/hello/Cargo.toml create mode 100644 tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs create mode 100644 tests/unit/workflows/rust_cargo/__init__.py create mode 100644 tests/unit/workflows/rust_cargo/test_actions.py create mode 100644 tests/unit/workflows/rust_cargo/test_workflow.py diff --git a/.appveyor.yml b/.appveyor.yml index 5e1b18f48..d8f23e8e8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -73,6 +73,15 @@ for: # setup make - "choco install make" + # setup rust + - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe + - rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain stable + - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin + - set RUST_BACKTRACE=1 + - rustup target add x86_64-unknown-linux-musl --toolchain stable + - rustc -V + - cargo -V + # Echo final Path - "echo %PATH%" @@ -103,6 +112,12 @@ for: - sh: "sudo unzip -d /opt/gradle /tmp/gradle-*.zip" - sh: "PATH=/opt/gradle/gradle-5.5/bin:$PATH" + # Install rust + - sh: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" + - sh: "PATH=${HOME}/.cargo/bin:$PATH" + - sh: "rustc -V" + - sh: "cargo -V" + # Install black - sh: "wget -O /tmp/black https://github.com/python/black/releases/download/19.10b0/black" - sh: "chmod +x /tmp/black" diff --git a/Makefile b/Makefile index 883aba1b1..cdd4e1897 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,13 @@ init: LAMBDA_BUILDERS_DEV=1 pip install -e '.[dev]' test: - # Run unit tests + # Run unit and functional tests # Fail if coverage falls below 94% LAMBDA_BUILDERS_DEV=1 pytest --cov aws_lambda_builders --cov-report term-missing --cov-fail-under 94 tests/unit tests/functional +unit-test: + LAMBDA_BUILDERS_DEV=1 pytest tests/unit + func-test: LAMBDA_BUILDERS_DEV=1 pytest tests/functional diff --git a/README.md b/README.md index bf1e12779..530969dbb 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Lambda Builders currently contains the following workflows * Ruby with Bundler * Go with Dep * Go with Mod +* Rust with Cargo Lambda Builders is the brains behind the `sam build` command from [AWS SAM CLI](https://github.com/awslabs/aws-sam-cli) diff --git a/aws_lambda_builders/workflows/__init__.py b/aws_lambda_builders/workflows/__init__.py index fd9c9c141..16c7c4db8 100644 --- a/aws_lambda_builders/workflows/__init__.py +++ b/aws_lambda_builders/workflows/__init__.py @@ -11,3 +11,4 @@ import aws_lambda_builders.workflows.java_maven import aws_lambda_builders.workflows.dotnet_clipackage import aws_lambda_builders.workflows.custom_make +import aws_lambda_builders.workflows.rust_cargo diff --git a/aws_lambda_builders/workflows/rust_cargo/DESIGN.md b/aws_lambda_builders/workflows/rust_cargo/DESIGN.md new file mode 100644 index 000000000..5f483cab1 --- /dev/null +++ b/aws_lambda_builders/workflows/rust_cargo/DESIGN.md @@ -0,0 +1,45 @@ +# Rust Cargo Builder + +## Scope + +This package enables the creation of a Lambda deployment package for Rust projects managed using the [cargo](https://doc.rust-lang.org/cargo/) build tool targeting Lambda's "provided" runtime. Rust support for the provided runtime is bundled as a compilation dependency of these projects, provided by the [lambda](https://github.com/awslabs/aws-lambda-rust-runtime) crate. + +## Implementation + +The general algorithm for preparing a rust executable for use on AWS Lambda +is as follows. + +### Build + +It builds a binary in the standard cargo target directory. + +## Copy and Rename executable + +It then copies the executable to the target directory renaming the executable to "bootstrap" to honor the provided runtime's [expectation on executable names](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html). + +## Challenges + +### Cross compilation + +Cargo builds binaries targeting host platforms. When the host platform is not the same as the target platform it leverages a parameterized notion of a named target, typically installed and managed by [rustup](https://github.com/rust-lang/rustup). In the case of `sam` we default this target to to `x86_64-unknown-linux-musl` when the host is not linux based. + +Users can simply run `rustup target add x86_64-unknown-linux-musl` if needed. It's also possible for sam to detect this when needed and do that for users by parsing the output of `rustup target list --installed` + +The challenge is not installing the cargo target. The challenge is ensuring external linker dependencies of that target are present at build time. Setting this up varies from platform to platform. And example for osx can be found [here](https://www.andrew-thorburn.com/cross-compiling-a-simple-rust-web-app/). This may warrant requiring a building inside a docker container that is linux based. + +Related to the above, Windows support is currently untested. + +## Notes + +Like the go builders, the workflow argument `options.artifact_executable_name` +interface is used to provide a handler name that resolves to an executable. This +enables sam support for cargo workspaces allowing for one rust project to have multiple lambdas. Cargo workspaces have a notion of a `package` and `bin`. A `package` can have +multiple bins but typically `packages` have a 1-to-1 relationship with a default `bin`: `main.rs`. + +The following table defines handler name to package/bin semantics. + +| Handler name | Package | Bin | +|--------------|---------|-----| +| foo | foo | foo | +| foo.foo | foo | foo | +| foo.bar | foo | bar | \ No newline at end of file diff --git a/aws_lambda_builders/workflows/rust_cargo/__init__.py b/aws_lambda_builders/workflows/rust_cargo/__init__.py new file mode 100644 index 000000000..ea66c4f5f --- /dev/null +++ b/aws_lambda_builders/workflows/rust_cargo/__init__.py @@ -0,0 +1,5 @@ +""" +Builds Rust Lambda functions using Cargo +""" + +from .workflow import RustCargoWorkflow diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py new file mode 100644 index 000000000..e6237bdd5 --- /dev/null +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -0,0 +1,216 @@ +""" +Rust Cargo build actions +""" + +import os +import subprocess +import shutil +import json + +from aws_lambda_builders.workflow import BuildMode +from aws_lambda_builders.actions import ActionFailedError, BaseAction, Purpose + + +class BuilderError(Exception): + MESSAGE = "Builder Failed: {message}" + + def __init__(self, **kwargs): + Exception.__init__(self, self.MESSAGE.format(**kwargs)) + + +class OSUtils(object): + """ + Wrapper around file system functions, to make it easy to + unit test actions in memory + """ + + def popen(self, command, stdout=None, stderr=None, env=None, cwd=None): + return subprocess.Popen(command, stdout=stdout, stderr=stderr, env=env, cwd=cwd) + + def copyfile(self, source, destination): + shutil.copyfile(source, destination) + + def makedirs(self, path): + if not os.path.exists(path): + os.makedirs(path) + + +def parse_handler(handler): + """ + Parse package and binary from handler name + + If the handler contains a period, assume `package.bin_name` + otherwise assume common case where bin_name is the same as the package + """ + spec = handler.split(".", 1) + if len(spec) == 1: + return (spec[0], spec[0]) + else: + return (spec[0], spec[1]) + + +class BuildAction(BaseAction): + NAME = "CargoBuild" + DESCRIPTION = "Building the project using Cargo" + PURPOSE = Purpose.COMPILE_SOURCE + + def __init__(self, source_dir, handler, binaries, platform, mode, osutils=OSUtils()): + """ + Build the a rust executable + + :type source_dir: str + :param source_dir: + Path to a folder containing the source code + + :type handler: str + :param handler: + Handler name in `package.bin_name` or `bin_name` format + + :type binaries: dict + :param binaries: + Resolved path dependencies + + :type platform: string + :param platform: + Platform builder is being run on + + :type mode: str + :param mode: + Mode the build should produce + + :type osutils: object + :param osutils: + Optional, External IO utils + """ + self.source_dir = source_dir + self.handler = handler + self.mode = mode + self.binaries = binaries + self.platform = platform + self.osutils = osutils + + def cargo_metadata(self): + p = self.osutils.popen( + ["cargo", "metadata", "--no-deps", "--format-version=1"], + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + env=os.environ.copy(), + cwd=self.source_dir, + ) + out, err = p.communicate() + if p.returncode != 0: + raise BuilderError(message=err.decode("utf8").strip()) + return json.loads(out) + + def build_command(self, package): + cmd = [self.binaries["cargo"].binary_path, "build", "-p", package] + if self.mode != BuildMode.DEBUG: + cmd.append("--release") + if self.platform.lower() != "linux": + cmd.extend(["--target", "x86_64-unknown-linux-musl"]) + return cmd + + def resolve_binary(self, cargo_meta): + """ + Interrogate cargo metadata to resolve a handler function + + :type cargo_meta: dict + :param cargo_meta: + Build metadata emitted by cargo + """ + (package, binary) = parse_handler(self.handler) + exists = any( + map( + lambda p: p["name"] == package + and any(map(lambda t: any(map(lambda k: k == "bin", t["kind"])) and t["name"] == binary, p["targets"])), + cargo_meta["packages"], + ) + ) + if not exists: + raise BuilderError(message="Cargo project does not contain a {handler} binary".format(handler=self.handler)) + + return (package, binary) + + def build_env(self): + env = os.environ.copy() + if self.platform.lower() == "darwin": + # on osx we assume a musl cross compilation + # linker installed via `brew install filosottile/musl-cross/musl-cross` + # This requires the follow env vars when invoking cargo build + env.update( + { + "RUSTFLAGS": "{rust_flags} -Clinker=x86_64-linux-musl-gcc".format( + rust_flags=env.get("RUSTFLAGS", "") + ), + "TARGET_CC": "x86_64-linux-musl-gcc", + "CC_x86_64_unknown_linux_musl": "x86_64-linux-musl-gcc", + } + ) + return env + + def execute(self): + (package, _) = self.resolve_binary(self.cargo_metadata()) + p = self.osutils.popen( + self.build_command(package), + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + env=self.build_env(), + cwd=self.source_dir, + ) + out, err = p.communicate() + if p.returncode != 0: + raise BuilderError(message=err.decode("utf8").strip()) + return out.decode("utf8").strip() + + +class CopyAndRenameAction(BaseAction): + NAME = "CopyAndRename" + DESCRIPTION = "Copy executable renaming if needed" + PURPOSE = Purpose.COPY_SOURCE + + def __init__(self, source_dir, handler, artifacts_dir, platform, mode, osutils=OSUtils()): + """ + Copy and rename rust executable + + :type source_dir: str + :param source_dir: + Path to a folder containing the source code + + :type handler: str + :param handler: + Handler name in `package.bin_name` or `bin_name` format + + :type artifacts_dir: str + :param binaries: + Path to a folder containing the deployable artifacts + + :type platform: string + :param platform: + Platform builder is being run on + + :type mode: str + :param mode: + Mode the build should produce + + :type osutils: object + :param osutils: + Optional, External IO utils + """ + self.source_dir = source_dir + self.handler = handler + self.artifacts_dir = artifacts_dir + self.platform = platform + self.mode = mode + self.osutils = osutils + + def binary_path(self): + (_, binary) = parse_handler(self.handler) + profile = "debug" if self.mode == BuildMode.DEBUG else "release" + target = os.path.join(self.source_dir, "target") + if self.platform.lower() != "linux": + target = os.path.join(target, "x86_64-unknown-linux-musl") + return os.path.join(target, profile, binary) + + def execute(self): + self.osutils.makedirs(self.artifacts_dir) + self.osutils.copyfile(self.binary_path(), os.path.join(self.artifacts_dir, "bootstrap")) diff --git a/aws_lambda_builders/workflows/rust_cargo/workflow.py b/aws_lambda_builders/workflows/rust_cargo/workflow.py new file mode 100644 index 000000000..84eab16d9 --- /dev/null +++ b/aws_lambda_builders/workflows/rust_cargo/workflow.py @@ -0,0 +1,37 @@ +""" +Rust Cargo Workflow +""" +import platform +from aws_lambda_builders.path_resolver import PathResolver +from aws_lambda_builders.workflow import BaseWorkflow, Capability +from .actions import BuildAction, CopyAndRenameAction + + +class RustCargoWorkflow(BaseWorkflow): + + NAME = "RustCargoBuilder" + + CAPABILITY = Capability(language="rust", dependency_manager="cargo", application_framework=None) + + SUPPORTED_MANIFESTS = ["Cargo.toml"] + + def __init__(self, source_dir, artifacts_dir, scratch_dir, manifest_path, runtime=None, mode=None, **kwargs): + super(RustCargoWorkflow, self).__init__( + source_dir, artifacts_dir, scratch_dir, manifest_path, runtime=runtime, **kwargs + ) + + # we utilize the handler identifier to + # select the binary to build + options = kwargs.get("options") or {} + handler = options.get("artifact_executable_name", None) + system_platform = platform.system().lower() + self.actions = [ + BuildAction(source_dir, handler, self.binaries, system_platform, mode), + CopyAndRenameAction(source_dir, handler, artifacts_dir, system_platform, mode), + ] + + def get_resolvers(self): + """ + specialized path resolver that just returns the list of executable for the runtime on the path. + """ + return [PathResolver(runtime=self.runtime, binary="cargo")] diff --git a/tests/functional/workflows/rust_cargo/test_rust_actions.py b/tests/functional/workflows/rust_cargo/test_rust_actions.py new file mode 100644 index 000000000..ecf7579e4 --- /dev/null +++ b/tests/functional/workflows/rust_cargo/test_rust_actions.py @@ -0,0 +1,28 @@ +import os +import shutil +import sys +import tempfile +import subprocess + +from unittest import TestCase + +from aws_lambda_builders.workflows.rust_cargo.actions import OSUtils + + +class TestOSUtils(TestCase): + + def test_popen_runs_a_process_and_returns_outcome(self): + cwd_py = os.path.join(os.path.dirname(__file__), "..", "..", "testdata", "cwd.py") + p = OSUtils().popen([sys.executable, cwd_py], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + self.assertEqual(p.returncode, 0) + self.assertEqual(out.decode("utf8").strip(), os.getcwd()) + + def test_popen_can_accept_cwd(self): + testdata_dir = os.path.join(os.path.dirname(__file__), "..", "..", "testdata") + p = OSUtils().popen( + [sys.executable, "cwd.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=testdata_dir + ) + out, err = p.communicate() + self.assertEqual(p.returncode, 0) + self.assertEqual(out.decode("utf8").strip(), os.path.abspath(testdata_dir)) diff --git a/tests/integration/workflows/rust_cargo/test_rust_cargo.py b/tests/integration/workflows/rust_cargo/test_rust_cargo.py new file mode 100644 index 000000000..59bb2fbed --- /dev/null +++ b/tests/integration/workflows/rust_cargo/test_rust_cargo.py @@ -0,0 +1,46 @@ +import os +import shutil +import tempfile + +from unittest import TestCase + +from aws_lambda_builders.builder import LambdaBuilder +from aws_lambda_builders.exceptions import WorkflowFailedError + + +class TestRustCargo(TestCase): + """ + Verifies that rust workflow works by building a Lambda using cargo + """ + + TEST_DATA_FOLDER = os.path.join(os.path.dirname(__file__), "testdata") + + def setUp(self): + self.artifacts_dir = tempfile.mkdtemp() + self.scratch_dir = tempfile.mkdtemp() + self.runtime = "provided" + # this inherently tests that rust was was wired up though + # the registry, a runtime error would be raised here if not + self.builder = LambdaBuilder(language="rust", dependency_manager="cargo", application_framework=None) + + def tearDown(self): + shutil.rmtree(self.artifacts_dir) + shutil.rmtree(self.scratch_dir) + + def test_builds_hello_project(self): + pass + source_dir = os.path.join(self.TEST_DATA_FOLDER, "hello") + + self.builder.build( + source_dir, + self.artifacts_dir, + self.scratch_dir, + os.path.join(source_dir, "Cargo.toml"), + runtime=self.runtime, + options={"artifact_executable_name": "hello"}, + ) + + expected_files = {"bootstrap"} + output_files = set(os.listdir(self.artifacts_dir)) + + self.assertEquals(expected_files, output_files) diff --git a/tests/integration/workflows/rust_cargo/testdata/hello/.gitignore b/tests/integration/workflows/rust_cargo/testdata/hello/.gitignore new file mode 100644 index 000000000..1de565933 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/hello/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock new file mode 100644 index 000000000..ddf47c644 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock @@ -0,0 +1,859 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "anyhow" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" + +[[package]] +name = "arc-swap" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" + +[[package]] +name = "autocfg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bytes" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" + +[[package]] +name = "futures-executor" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" + +[[package]] +name = "futures-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.13", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" + +[[package]] +name = "futures-task" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "genawaiter" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86bd0361bcbde39b13475e6e36cb24c329964aa2611be285289d1e4b751c1a0" +dependencies = [ + "futures-core", + "genawaiter-macro", + "genawaiter-proc-macro", + "proc-macro-hack", +] + +[[package]] +name = "genawaiter-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b32dfe1fdfc0bbde1f22a5da25355514b5e450c33a6af6770884c8750aedfbc" + +[[package]] +name = "genawaiter-proc-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784f84eebc366e15251c4a8c3acee82a6a6f427949776ecb88377362a9621738" +dependencies = [ + "proc-macro-error", + "proc-macro-hack", + "proc-macro2 1.0.13", + "quote", + "syn", +] + +[[package]] +name = "h2" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "log", + "slab", + "tokio", + "tokio-util", +] + +[[package]] +name = "hello" +version = "0.1.0" +dependencies = [ + "lambda", + "serde_json", + "tokio", +] + +[[package]] +name = "hermit-abi" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" +dependencies = [ + "libc", +] + +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "hyper" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "log", + "net2", + "pin-project", + "time", + "tokio", + "tower-service", + "want", +] + +[[package]] +name = "indexmap" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +dependencies = [ + "autocfg", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "itoa" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "lambda" +version = "0.1.0" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +dependencies = [ + "anyhow", + "bytes", + "futures", + "genawaiter", + "http", + "hyper", + "lambda-attributes", + "serde", + "serde_json", + "tokio", + "tower-service", + "tracing", + "tracing-error", + "tracing-futures", +] + +[[package]] +name = "lambda-attributes" +version = "0.1.0" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +dependencies = [ + "proc-macro2 0.4.30", + "quote", + "syn", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" + +[[package]] +name = "mio" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +dependencies = [ + "cfg-if", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.1", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +dependencies = [ + "log", + "mio", + "miow 0.3.3", + "winapi 0.3.8", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "miow" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" +dependencies = [ + "socket2", + "winapi 0.3.8", +] + +[[package]] +name = "net2" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +dependencies = [ + "cfg-if", + "libc", + "winapi 0.3.8", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" + +[[package]] +name = "pin-project" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb" +dependencies = [ + "proc-macro2 1.0.13", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro-error" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2 1.0.13", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +dependencies = [ + "proc-macro2 1.0.13", + "quote", + "syn", + "syn-mid", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" + +[[package]] +name = "proc-macro-nested" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639" +dependencies = [ + "unicode-xid 0.2.0", +] + +[[package]] +name = "quote" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +dependencies = [ + "proc-macro2 1.0.13", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" + +[[package]] +name = "ryu" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" + +[[package]] +name = "serde" +version = "1.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" +dependencies = [ + "proc-macro2 1.0.13", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +dependencies = [ + "arc-swap", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "socket2" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.8", +] + +[[package]] +name = "syn" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1425de3c33b0941002740a420b1a906a350b88d08b82b2c8a01035a3f9447bac" +dependencies = [ + "proc-macro2 1.0.13", + "quote", + "unicode-xid 0.2.0", +] + +[[package]] +name = "syn-mid" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" +dependencies = [ + "proc-macro2 1.0.13", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi 0.3.8", +] + +[[package]] +name = "tokio" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-named-pipes", + "mio-uds", + "num_cpus", + "pin-project-lite", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.8", +] + +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.13", + "quote", + "syn", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "tracing" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7c6b59d116d218cb2d990eb06b77b64043e0268ef7323aae63d8b30ae462923" +dependencies = [ + "cfg-if", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +dependencies = [ + "proc-macro2 1.0.13", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-error" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4d7c0b83d4a500748fa5879461652b361edf5c9d51ede2a2ac03875ca185e24" +dependencies = [ + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-futures" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d53c40489aa69c9aed21ff483f26886ca8403df33bdc2d2f87c60c1617826d2" +dependencies = [ + "sharded-slab", + "tracing-core", +] + +[[package]] +name = "try-lock" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" + +[[package]] +name = "version_check" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] diff --git a/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.toml b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.toml new file mode 100644 index 000000000..386660039 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hello" +version = "0.1.0" +edition = "2018" + +[dependencies] +lambda = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" } +serde_json = "1.0" +tokio = { version = "0.2", features = ["macros"] } \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs b/tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs new file mode 100644 index 000000000..35482f3ad --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs @@ -0,0 +1,10 @@ +use lambda::lambda; +use serde_json::Value; + +type Error = Box; + +#[lambda] +#[tokio::main] +async fn main(event: Value) -> Result { + Ok(event) +} \ No newline at end of file diff --git a/tests/unit/workflows/rust_cargo/__init__.py b/tests/unit/workflows/rust_cargo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py new file mode 100644 index 000000000..4352ef942 --- /dev/null +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -0,0 +1,168 @@ +from unittest import TestCase +from mock import patch +import json + +from aws_lambda_builders.binary_path import BinaryPath +from aws_lambda_builders.workflow import BuildMode +from aws_lambda_builders.actions import ActionFailedError +from aws_lambda_builders.workflows.rust_cargo.actions import ( + parse_handler, + BuildAction, + CopyAndRenameAction, + BuilderError, +) + + +class FakePopen: + def __init__(self, out=b"out", err=b"err", retcode=0): + self.out = out + self.err = err + self.returncode = retcode + + def communicate(self): + return self.out, self.err + + +class TestBuildAction(TestCase): + def test_linux_release_build_cargo_command(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.RELEASE) + self.assertEqual(action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo", "--release"]) + + def test_nonlinux_release_build_cargo_command(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE) + self.assertEqual( + action.build_command("foo"), + ["path/to/cargo", "build", "-p", "foo", "--release", "--target", "x86_64-unknown-linux-musl"], + ) + + def test_linux_debug_build_cargo_command(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.DEBUG) + self.assertEqual(action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo"]) + + def test_nonlinux_debug_build_cargo_command(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.DEBUG) + self.assertEqual( + action.build_command("foo"), + ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl"], + ) + + def test_parse_handler_simple(self): + self.assertEqual(parse_handler("foo"), ("foo", "foo")) + + def test_parse_handler_structured(self): + self.assertEqual(parse_handler("foo.bar"), ("foo", "bar")) + + def test_resolve_returns_bin_handler_exists(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo.bar", {"cargo": cargo}, "darwin", BuildMode.DEBUG) + self.assertEqual( + action.resolve_binary({"packages": [{"name": "foo", "targets": [{"kind": ["bin"], "name": "bar"}]}]}), + ("foo", "bar"), + ) + + def test_resolve_returns_raise_build_error_if_handler_doesnt_exist(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo.bar", {"cargo": cargo}, "darwin", BuildMode.DEBUG) + with self.assertRaises(BuilderError) as err_assert: + action.resolve_binary({"packages": [{"name": "foo", "targets": [{"kind": ["bin"], "name": "baz"}]}]}) + self.assertEquals( + err_assert.exception.args[0], "Builder Failed: Cargo project does not contain a foo.bar binary" + ) + + def test_build_env_on_darwin(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE) + env = action.build_env() + self.assertDictContainsSubset( + { + "RUSTFLAGS": " -Clinker=x86_64-linux-musl-gcc", + "TARGET_CC": "x86_64-linux-musl-gcc", + "CC_x86_64_unknown_linux_musl": "x86_64-linux-musl-gcc", + }, + env, + ) + + def test_build_env_on_linux(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.RELEASE) + env = action.build_env() + self.assertIsNone(env.get("RUSTFLAGS")) + self.assertIsNone(env.get("TARGET_CC")) + self.assertIsNone(env.get("CC_x86_64_unknown_linux_musl")) + + @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") + def test_execute_happy_path(self, OSUtilsMock): + osutils = OSUtilsMock.return_value + popen1 = FakePopen( + out=json.dumps({"packages": [{"name": "foo", "targets": [{"kind": ["bin"], "name": "foo"}]}]}) + ) + popen2 = FakePopen() + osutils.popen.side_effect = [popen1, popen2] + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE, osutils=osutils) + action.execute() + + @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") + def test_execute_cargo_meta_fail(self, OSUtilsMock): + osutils = OSUtilsMock.return_value + popen1 = FakePopen( + retcode=1, + err=b"meta failed" + ) + popen2 = FakePopen() + osutils.popen.side_effect = [popen1, popen2] + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE, osutils=osutils) + with self.assertRaises(BuilderError) as err_assert: + action.execute() + self.assertEquals( + err_assert.exception.args[0], "Builder Failed: meta failed" + ) + + @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") + def test_execute_cargo_build_fail(self, OSUtilsMock): + osutils = OSUtilsMock.return_value + popen1 = FakePopen( + out=json.dumps({"packages": [{"name": "foo", "targets": [{"kind": ["bin"], "name": "foo"}]}]}) + ) + popen2 = FakePopen( + retcode=1, + err=b"build failed" + ) + osutils.popen.side_effect = [popen1, popen2] + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE, osutils=osutils) + with self.assertRaises(BuilderError) as err_assert: + action.execute() + self.assertEquals( + err_assert.exception.args[0], "Builder Failed: build failed" + ) + +class TestCopyAndRenameAction(TestCase): + def test_debug_copy_path(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.DEBUG) + self.assertEqual(action.binary_path(), "source_dir/target/debug/foo") + + def test_release_copy_path(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.RELEASE) + self.assertEqual(action.binary_path(), "source_dir/target/release/foo") + + def test_nonlinux_copy_path(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = CopyAndRenameAction("source_dir", "foo", "output_dir", "darwin", BuildMode.RELEASE) + self.assertEqual(action.binary_path(), "source_dir/target/x86_64-unknown-linux-musl/release/foo") + + @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") + def test_execute(self, OSUtilsMock): + osutils = OSUtilsMock.return_value + osutils.copyfile.return_value = "" + osutils.makedirs.return_value = "" + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = CopyAndRenameAction("source_dir", "foo", "output_dir", "darwin", BuildMode.RELEASE, osutils=osutils) + action.execute() diff --git a/tests/unit/workflows/rust_cargo/test_workflow.py b/tests/unit/workflows/rust_cargo/test_workflow.py new file mode 100644 index 000000000..3630176bd --- /dev/null +++ b/tests/unit/workflows/rust_cargo/test_workflow.py @@ -0,0 +1,26 @@ +from unittest import TestCase + +from aws_lambda_builders.path_resolver import PathResolver +from aws_lambda_builders.workflows.rust_cargo.workflow import RustCargoWorkflow +from aws_lambda_builders.workflows.rust_cargo.actions import BuildAction, CopyAndRenameAction + + +class TestRustCargoWorkflow(TestCase): + """ + Validate workflow wiring + """ + + def test_workflow_sets_up_builder_actions(self): + workflow = RustCargoWorkflow("source", "artifacts", "scratch_dir", "manifest", runtime="provided") + self.assertEqual(len(workflow.actions), 2) + self.assertIsInstance(workflow.actions[0], BuildAction) + self.assertIsInstance(workflow.actions[1], CopyAndRenameAction) + + def test_workflow_configures_path_resolver_for_cargo(self): + workflow = RustCargoWorkflow("source", "artifacts", "scratch_dir", "manifest", runtime="provided") + resolvers = workflow.get_resolvers() + self.assertEqual(len(resolvers), 1) + resolver = resolvers[0] + self.assertIsInstance(resolver, PathResolver) + self.assertEqual(resolver.binary, "cargo") + self.assertEqual(resolver.runtime, "provided") From 8bd50e0d40e9ea3bfa5b68d5af97de734b71f5ed Mon Sep 17 00:00:00 2001 From: softprops Date: Tue, 26 May 2020 04:17:21 -0400 Subject: [PATCH 02/19] make black reformat --- .../workflows/rust_cargo/test_rust_actions.py | 1 - .../unit/workflows/rust_cargo/test_actions.py | 19 +++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/tests/functional/workflows/rust_cargo/test_rust_actions.py b/tests/functional/workflows/rust_cargo/test_rust_actions.py index ecf7579e4..3e3dca2bf 100644 --- a/tests/functional/workflows/rust_cargo/test_rust_actions.py +++ b/tests/functional/workflows/rust_cargo/test_rust_actions.py @@ -10,7 +10,6 @@ class TestOSUtils(TestCase): - def test_popen_runs_a_process_and_returns_outcome(self): cwd_py = os.path.join(os.path.dirname(__file__), "..", "..", "testdata", "cwd.py") p = OSUtils().popen([sys.executable, cwd_py], stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py index 4352ef942..c3116ea7b 100644 --- a/tests/unit/workflows/rust_cargo/test_actions.py +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -109,19 +109,14 @@ def test_execute_happy_path(self, OSUtilsMock): @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") def test_execute_cargo_meta_fail(self, OSUtilsMock): osutils = OSUtilsMock.return_value - popen1 = FakePopen( - retcode=1, - err=b"meta failed" - ) + popen1 = FakePopen(retcode=1, err=b"meta failed") popen2 = FakePopen() osutils.popen.side_effect = [popen1, popen2] cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE, osutils=osutils) with self.assertRaises(BuilderError) as err_assert: action.execute() - self.assertEquals( - err_assert.exception.args[0], "Builder Failed: meta failed" - ) + self.assertEquals(err_assert.exception.args[0], "Builder Failed: meta failed") @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") def test_execute_cargo_build_fail(self, OSUtilsMock): @@ -129,18 +124,14 @@ def test_execute_cargo_build_fail(self, OSUtilsMock): popen1 = FakePopen( out=json.dumps({"packages": [{"name": "foo", "targets": [{"kind": ["bin"], "name": "foo"}]}]}) ) - popen2 = FakePopen( - retcode=1, - err=b"build failed" - ) + popen2 = FakePopen(retcode=1, err=b"build failed") osutils.popen.side_effect = [popen1, popen2] cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE, osutils=osutils) with self.assertRaises(BuilderError) as err_assert: action.execute() - self.assertEquals( - err_assert.exception.args[0], "Builder Failed: build failed" - ) + self.assertEquals(err_assert.exception.args[0], "Builder Failed: build failed") + class TestCopyAndRenameAction(TestCase): def test_debug_copy_path(self): From deeceede0884d6de82604b79ef67fb1737ca1769 Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 17:17:15 -0400 Subject: [PATCH 03/19] install minimal rustup profile without interactions --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index d8f23e8e8..a7b0edf20 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -113,7 +113,7 @@ for: - sh: "PATH=/opt/gradle/gradle-5.5/bin:$PATH" # Install rust - - sh: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" + - sh: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal" - sh: "PATH=${HOME}/.cargo/bin:$PATH" - sh: "rustc -V" - sh: "cargo -V" From 5092dc1d7ecbcc64d86390a840c7008df3ab487b Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 18:01:24 -0400 Subject: [PATCH 04/19] use os.path.join in path assertion tests to address windows paths --- tests/unit/workflows/rust_cargo/test_actions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py index c3116ea7b..8b6c4c76b 100644 --- a/tests/unit/workflows/rust_cargo/test_actions.py +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -1,6 +1,7 @@ from unittest import TestCase from mock import patch import json +import os from aws_lambda_builders.binary_path import BinaryPath from aws_lambda_builders.workflow import BuildMode @@ -137,17 +138,19 @@ class TestCopyAndRenameAction(TestCase): def test_debug_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.DEBUG) - self.assertEqual(action.binary_path(), "source_dir/target/debug/foo") + self.assertEqual(action.binary_path(), os.path.join("source_dir", "target", "debug", "foo")) def test_release_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.RELEASE) - self.assertEqual(action.binary_path(), "source_dir/target/release/foo") + self.assertEqual(action.binary_path(), os.path.join("source_dir", "target", "release", "foo")) def test_nonlinux_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "darwin", BuildMode.RELEASE) - self.assertEqual(action.binary_path(), "source_dir/target/x86_64-unknown-linux-musl/release/foo") + self.assertEqual( + action.binary_path(), os.path.join("source_dir", "target", "x86_64-unknown-linux-musl", "release", "foo") + ) @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") def test_execute(self, OSUtilsMock): From da8cc79512ec0d9fa2b6025959bb691c0864ed56 Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 20:55:16 -0400 Subject: [PATCH 05/19] address pylint ci errors --- aws_lambda_builders/workflows/rust_cargo/actions.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py index e6237bdd5..baa5ed46f 100644 --- a/aws_lambda_builders/workflows/rust_cargo/actions.py +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -120,11 +120,14 @@ def resolve_binary(self, cargo_meta): """ (package, binary) = parse_handler(self.handler) exists = any( - map( - lambda p: p["name"] == package - and any(map(lambda t: any(map(lambda k: k == "bin", t["kind"])) and t["name"] == binary, p["targets"])), - cargo_meta["packages"], - ) + [ + kind == "bin" + for kind in target["kind"] + for target in pkg["targets"] + if target["name"] == binary + for pkg in cargo_meta["packages"] + if pkg["name"] == package + ] ) if not exists: raise BuilderError(message="Cargo project does not contain a {handler} binary".format(handler=self.handler)) From e2901c17776a4e47c6d57e20a5fcb6dcfe0a914c Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 21:36:23 -0400 Subject: [PATCH 06/19] fix reformatted list comprehensions --- aws_lambda_builders/workflows/rust_cargo/actions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py index baa5ed46f..aa6501e3e 100644 --- a/aws_lambda_builders/workflows/rust_cargo/actions.py +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -122,11 +122,11 @@ def resolve_binary(self, cargo_meta): exists = any( [ kind == "bin" - for kind in target["kind"] - for target in pkg["targets"] - if target["name"] == binary for pkg in cargo_meta["packages"] if pkg["name"] == package + for target in pkg["targets"] + if target["name"] == binary + for kind in target["kind"] ] ) if not exists: From 0da7e1bfc23dbbcddc2a94ad77ee31e4721bdd61 Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 21:58:28 -0400 Subject: [PATCH 07/19] try passing rust-lld linker on windows --- aws_lambda_builders/workflows/rust_cargo/actions.py | 13 +++++++++++++ tests/unit/workflows/rust_cargo/test_actions.py | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py index aa6501e3e..759166063 100644 --- a/aws_lambda_builders/workflows/rust_cargo/actions.py +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -149,6 +149,19 @@ def build_env(self): "CC_x86_64_unknown_linux_musl": "x86_64-linux-musl-gcc", } ) + if self.platform.lower() == "windows": + # on windows we assume a musl cross compilation + # linker is available via rusts embedded llvm linker "rust-lld" + # but cc is used as the default + # source: https://github.com/KodrAus/rust-cross-compile + # This requires the follow env vars when invoking cargo build + env.update( + { + "RUSTFLAGS": "{rust_flags} -Clinker=rust-lld".format(rust_flags=env.get("RUSTFLAGS", "")), + "TARGET_CC": "rust-lld", + "CC_x86_64_unknown_linux_musl": "rust-lld", + } + ) return env def execute(self): diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py index 8b6c4c76b..403044282 100644 --- a/tests/unit/workflows/rust_cargo/test_actions.py +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -87,6 +87,15 @@ def test_build_env_on_darwin(self): env, ) + def test_build_env_on_windows(self): + cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") + action = BuildAction("source_dir", "foo", {"cargo": cargo}, "windows", BuildMode.RELEASE) + env = action.build_env() + self.assertDictContainsSubset( + {"RUSTFLAGS": " -Clinker=rust-lld", "TARGET_CC": "rust-lld", "CC_x86_64_unknown_linux_musl": "rust-lld",}, + env, + ) + def test_build_env_on_linux(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.RELEASE) From 45dc201a57bb461c261d140a384bdc2e14fba4e5 Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 22:33:53 -0400 Subject: [PATCH 08/19] update rust cargo design doc. windows support was added and tested --- aws_lambda_builders/workflows/rust_cargo/DESIGN.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/aws_lambda_builders/workflows/rust_cargo/DESIGN.md b/aws_lambda_builders/workflows/rust_cargo/DESIGN.md index 5f483cab1..1540c15cf 100644 --- a/aws_lambda_builders/workflows/rust_cargo/DESIGN.md +++ b/aws_lambda_builders/workflows/rust_cargo/DESIGN.md @@ -13,7 +13,7 @@ is as follows. It builds a binary in the standard cargo target directory. -## Copy and Rename executable +### Copy and Rename executable It then copies the executable to the target directory renaming the executable to "bootstrap" to honor the provided runtime's [expectation on executable names](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html). @@ -23,12 +23,11 @@ It then copies the executable to the target directory renaming the executable to Cargo builds binaries targeting host platforms. When the host platform is not the same as the target platform it leverages a parameterized notion of a named target, typically installed and managed by [rustup](https://github.com/rust-lang/rustup). In the case of `sam` we default this target to to `x86_64-unknown-linux-musl` when the host is not linux based. -Users can simply run `rustup target add x86_64-unknown-linux-musl` if needed. It's also possible for sam to detect this when needed and do that for users by parsing the output of `rustup target list --installed` +Users can simply run `rustup target add x86_64-unknown-linux-musl` if needed. It's also possible for sam to detect this when needed and do that for users by parsing the output of `rustup target list --installed` but it would be unusual for sam to +install toolchain components on a users behalf. The challenge is not installing the cargo target. The challenge is ensuring external linker dependencies of that target are present at build time. Setting this up varies from platform to platform. And example for osx can be found [here](https://www.andrew-thorburn.com/cross-compiling-a-simple-rust-web-app/). This may warrant requiring a building inside a docker container that is linux based. -Related to the above, Windows support is currently untested. - ## Notes Like the go builders, the workflow argument `options.artifact_executable_name` From 9aa694b39db5193c036d6160ce814007a1984422 Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 23:07:43 -0400 Subject: [PATCH 09/19] add test for cargo workspaces project --- .../workflows/rust_cargo/test_rust_cargo.py | 18 + .../rust_cargo/testdata/workspaces/.gitignore | 1 + .../rust_cargo/testdata/workspaces/Cargo.lock | 868 ++++++++++++++++++ .../rust_cargo/testdata/workspaces/Cargo.toml | 2 + .../testdata/workspaces/bar/Cargo.toml | 9 + .../testdata/workspaces/bar/src/main.rs | 10 + .../testdata/workspaces/foo/Cargo.toml | 9 + .../testdata/workspaces/foo/src/main.rs | 10 + 8 files changed, 927 insertions(+) create mode 100644 tests/integration/workflows/rust_cargo/testdata/workspaces/.gitignore create mode 100644 tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock create mode 100644 tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.toml create mode 100644 tests/integration/workflows/rust_cargo/testdata/workspaces/bar/Cargo.toml create mode 100644 tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs create mode 100644 tests/integration/workflows/rust_cargo/testdata/workspaces/foo/Cargo.toml create mode 100644 tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs diff --git a/tests/integration/workflows/rust_cargo/test_rust_cargo.py b/tests/integration/workflows/rust_cargo/test_rust_cargo.py index 59bb2fbed..1394acbe8 100644 --- a/tests/integration/workflows/rust_cargo/test_rust_cargo.py +++ b/tests/integration/workflows/rust_cargo/test_rust_cargo.py @@ -44,3 +44,21 @@ def test_builds_hello_project(self): output_files = set(os.listdir(self.artifacts_dir)) self.assertEquals(expected_files, output_files) + + def test_builds_workspaces_project(self): + pass + source_dir = os.path.join(self.TEST_DATA_FOLDER, "workspaces") + + self.builder.build( + source_dir, + self.artifacts_dir, + self.scratch_dir, + os.path.join(source_dir, "Cargo.toml"), + runtime=self.runtime, + options={"artifact_executable_name": "foo"}, + ) + + expected_files = {"bootstrap"} + output_files = set(os.listdir(self.artifacts_dir)) + + self.assertEquals(expected_files, output_files) \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/.gitignore b/tests/integration/workflows/rust_cargo/testdata/workspaces/.gitignore new file mode 100644 index 000000000..1de565933 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock new file mode 100644 index 000000000..0ffdbc1be --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock @@ -0,0 +1,868 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "anyhow" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" + +[[package]] +name = "arc-swap" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" + +[[package]] +name = "autocfg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" + +[[package]] +name = "bar" +version = "0.1.0" +dependencies = [ + "lambda", + "serde_json", + "tokio", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bytes" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foo" +version = "0.1.0" +dependencies = [ + "lambda", + "serde_json", + "tokio", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" + +[[package]] +name = "futures-executor" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" + +[[package]] +name = "futures-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.17", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" + +[[package]] +name = "futures-task" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "genawaiter" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86bd0361bcbde39b13475e6e36cb24c329964aa2611be285289d1e4b751c1a0" +dependencies = [ + "futures-core", + "genawaiter-macro", + "genawaiter-proc-macro", + "proc-macro-hack", +] + +[[package]] +name = "genawaiter-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b32dfe1fdfc0bbde1f22a5da25355514b5e450c33a6af6770884c8750aedfbc" + +[[package]] +name = "genawaiter-proc-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784f84eebc366e15251c4a8c3acee82a6a6f427949776ecb88377362a9621738" +dependencies = [ + "proc-macro-error", + "proc-macro-hack", + "proc-macro2 1.0.17", + "quote", + "syn", +] + +[[package]] +name = "h2" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "log", + "slab", + "tokio", + "tokio-util", +] + +[[package]] +name = "hermit-abi" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" +dependencies = [ + "libc", +] + +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "hyper" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "log", + "net2", + "pin-project", + "time", + "tokio", + "tower-service", + "want", +] + +[[package]] +name = "indexmap" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +dependencies = [ + "autocfg", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "itoa" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "lambda" +version = "0.1.0" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +dependencies = [ + "anyhow", + "bytes", + "futures", + "genawaiter", + "http", + "hyper", + "lambda-attributes", + "serde", + "serde_json", + "tokio", + "tower-service", + "tracing", + "tracing-error", + "tracing-futures", +] + +[[package]] +name = "lambda-attributes" +version = "0.1.0" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +dependencies = [ + "proc-macro2 0.4.30", + "quote", + "syn", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" + +[[package]] +name = "mio" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +dependencies = [ + "cfg-if", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.1", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +dependencies = [ + "log", + "mio", + "miow 0.3.4", + "winapi 0.3.8", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "miow" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22dfdd1d51b2639a5abd17ed07005c3af05fb7a2a3b1a1d0d7af1000a520c1c7" +dependencies = [ + "socket2", + "winapi 0.3.8", +] + +[[package]] +name = "net2" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +dependencies = [ + "cfg-if", + "libc", + "winapi 0.3.8", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" + +[[package]] +name = "pin-project" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40" +dependencies = [ + "proc-macro2 1.0.17", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro-error" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2 1.0.17", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +dependencies = [ + "proc-macro2 1.0.17", + "quote", + "syn", + "syn-mid", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" + +[[package]] +name = "proc-macro-nested" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101" +dependencies = [ + "unicode-xid 0.2.0", +] + +[[package]] +name = "quote" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +dependencies = [ + "proc-macro2 1.0.17", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" + +[[package]] +name = "ryu" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" + +[[package]] +name = "serde" +version = "1.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" +dependencies = [ + "proc-macro2 1.0.17", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +dependencies = [ + "arc-swap", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "socket2" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.8", +] + +[[package]] +name = "syn" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de" +dependencies = [ + "proc-macro2 1.0.17", + "quote", + "unicode-xid 0.2.0", +] + +[[package]] +name = "syn-mid" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" +dependencies = [ + "proc-macro2 1.0.17", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi 0.3.8", +] + +[[package]] +name = "tokio" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-named-pipes", + "mio-uds", + "num_cpus", + "pin-project-lite", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.8", +] + +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.17", + "quote", + "syn", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "tracing" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7c6b59d116d218cb2d990eb06b77b64043e0268ef7323aae63d8b30ae462923" +dependencies = [ + "cfg-if", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +dependencies = [ + "proc-macro2 1.0.17", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-error" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4d7c0b83d4a500748fa5879461652b361edf5c9d51ede2a2ac03875ca185e24" +dependencies = [ + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-futures" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d53c40489aa69c9aed21ff483f26886ca8403df33bdc2d2f87c60c1617826d2" +dependencies = [ + "sharded-slab", + "tracing-core", +] + +[[package]] +name = "try-lock" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" + +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.toml b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.toml new file mode 100644 index 000000000..7492eaa8e --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.toml @@ -0,0 +1,2 @@ +[workspace] +members = ["foo", "bar"] \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/Cargo.toml b/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/Cargo.toml new file mode 100644 index 000000000..b2b080721 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "bar" +version = "0.1.0" +edition = "2018" + +[dependencies] +lambda = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" } +serde_json = "1.0" +tokio = { version = "0.2", features = ["macros"] } \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs b/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs new file mode 100644 index 000000000..b5fce7570 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs @@ -0,0 +1,10 @@ +use lambda::lambda; +use serde_json::Value; + +type Error = Box; + +#[lambda] +#[tokio::main] +async fn main(_: Value) -> Result { + Ok("bar".into()) +} \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/Cargo.toml b/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/Cargo.toml new file mode 100644 index 000000000..6d8c16a17 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "foo" +version = "0.1.0" +edition = "2018" + +[dependencies] +lambda = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" } +serde_json = "1.0" +tokio = { version = "0.2", features = ["macros"] } \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs b/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs new file mode 100644 index 000000000..4d853dc67 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs @@ -0,0 +1,10 @@ +use lambda::lambda; +use serde_json::Value; + +type Error = Box; + +#[lambda] +#[tokio::main] +async fn main(_: Value) -> Result { + Ok("foo".into()) +} \ No newline at end of file From 734d65876949cf1c39dcdcdfc5de870c281bf11c Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 27 May 2020 23:22:08 -0400 Subject: [PATCH 10/19] reformat test sources --- tests/integration/workflows/rust_cargo/test_rust_cargo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/workflows/rust_cargo/test_rust_cargo.py b/tests/integration/workflows/rust_cargo/test_rust_cargo.py index 1394acbe8..c477a65d3 100644 --- a/tests/integration/workflows/rust_cargo/test_rust_cargo.py +++ b/tests/integration/workflows/rust_cargo/test_rust_cargo.py @@ -61,4 +61,4 @@ def test_builds_workspaces_project(self): expected_files = {"bootstrap"} output_files = set(os.listdir(self.artifacts_dir)) - self.assertEquals(expected_files, output_files) \ No newline at end of file + self.assertEquals(expected_files, output_files) From 9d43a747119f73fdd9664da4ac3fb6e69c4ec979 Mon Sep 17 00:00:00 2001 From: softprops Date: Mon, 1 Jun 2020 19:05:09 -0400 Subject: [PATCH 11/19] build with musl on linux because glibc may differ on lambda --- aws_lambda_builders/workflows/rust_cargo/actions.py | 4 +--- tests/unit/workflows/rust_cargo/test_actions.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py index 759166063..3902d7010 100644 --- a/aws_lambda_builders/workflows/rust_cargo/actions.py +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -103,11 +103,9 @@ def cargo_metadata(self): return json.loads(out) def build_command(self, package): - cmd = [self.binaries["cargo"].binary_path, "build", "-p", package] + cmd = [self.binaries["cargo"].binary_path, "build", "-p", package, "--target", "x86_64-unknown-linux-musl"] if self.mode != BuildMode.DEBUG: cmd.append("--release") - if self.platform.lower() != "linux": - cmd.extend(["--target", "x86_64-unknown-linux-musl"]) return cmd def resolve_binary(self, cargo_meta): diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py index 403044282..3ca0d509f 100644 --- a/tests/unit/workflows/rust_cargo/test_actions.py +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -28,20 +28,26 @@ class TestBuildAction(TestCase): def test_linux_release_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.RELEASE) - self.assertEqual(action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo", "--release"]) + self.assertEqual( + action.build_command("foo"), + ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl", "--release"], + ) def test_nonlinux_release_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE) self.assertEqual( action.build_command("foo"), - ["path/to/cargo", "build", "-p", "foo", "--release", "--target", "x86_64-unknown-linux-musl"], + ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl", "--release"], ) def test_linux_debug_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.DEBUG) - self.assertEqual(action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo"]) + self.assertEqual( + action.build_command("foo"), + ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl"], + ) def test_nonlinux_debug_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") From 27d49bd94427115bdd915ed36cef0aa34a4910ab Mon Sep 17 00:00:00 2001 From: softprops Date: Mon, 1 Jun 2020 20:53:54 -0400 Subject: [PATCH 12/19] add musl tools to ubuntu ci build --- .appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index a7b0edf20..88beb2b69 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -115,6 +115,8 @@ for: # Install rust - sh: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal" - sh: "PATH=${HOME}/.cargo/bin:$PATH" + - sh: "rustup target add x86_64-unknown-linux-musl --toolchain stable" + - sh: "sudo apt-get install musl-tools" - sh: "rustc -V" - sh: "cargo -V" From 0d1c9fb315e4d668cdb5391d53b4f440362797ae Mon Sep 17 00:00:00 2001 From: softprops Date: Mon, 1 Jun 2020 21:48:56 -0400 Subject: [PATCH 13/19] fix apt-get command --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 88beb2b69..fe2951c9b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -116,7 +116,7 @@ for: - sh: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal" - sh: "PATH=${HOME}/.cargo/bin:$PATH" - sh: "rustup target add x86_64-unknown-linux-musl --toolchain stable" - - sh: "sudo apt-get install musl-tools" + - sh: "sudo apt-get install -y musl-tools" - sh: "rustc -V" - sh: "cargo -V" From 85cdb7cb838072130f56aef80924feeb75500371 Mon Sep 17 00:00:00 2001 From: softprops Date: Mon, 1 Jun 2020 23:05:51 -0400 Subject: [PATCH 14/19] update linux copy and bin paths --- aws_lambda_builders/workflows/rust_cargo/actions.py | 4 +--- tests/unit/workflows/rust_cargo/test_actions.py | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py index 3902d7010..c2730abeb 100644 --- a/aws_lambda_builders/workflows/rust_cargo/actions.py +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -220,9 +220,7 @@ def __init__(self, source_dir, handler, artifacts_dir, platform, mode, osutils=O def binary_path(self): (_, binary) = parse_handler(self.handler) profile = "debug" if self.mode == BuildMode.DEBUG else "release" - target = os.path.join(self.source_dir, "target") - if self.platform.lower() != "linux": - target = os.path.join(target, "x86_64-unknown-linux-musl") + target = os.path.join(self.source_dir, "target", "x86_64-unknown-linux-musl") return os.path.join(target, profile, binary) def execute(self): diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py index 3ca0d509f..2a0851fce 100644 --- a/tests/unit/workflows/rust_cargo/test_actions.py +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -153,12 +153,16 @@ class TestCopyAndRenameAction(TestCase): def test_debug_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.DEBUG) - self.assertEqual(action.binary_path(), os.path.join("source_dir", "target", "debug", "foo")) + self.assertEqual( + action.binary_path(), os.path.join("source_dir", "target", "x86_64-unknown-linux-musl", "debug", "foo") + ) def test_release_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.RELEASE) - self.assertEqual(action.binary_path(), os.path.join("source_dir", "target", "release", "foo")) + self.assertEqual( + action.binary_path(), os.path.join("source_dir", "target", "x86_64-unknown-linux-musl", "release", "foo") + ) def test_nonlinux_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") From 65bf74e01abda74ee39f5f9ee830ff2899ed82c8 Mon Sep 17 00:00:00 2001 From: softprops Date: Fri, 26 Jun 2020 12:34:40 -0400 Subject: [PATCH 15/19] update make test again, use the version appveyor is complaining about --- tests/integration/workflows/custom_make/test_custom_make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/workflows/custom_make/test_custom_make.py b/tests/integration/workflows/custom_make/test_custom_make.py index e0417fe04..508c66827 100644 --- a/tests/integration/workflows/custom_make/test_custom_make.py +++ b/tests/integration/workflows/custom_make/test_custom_make.py @@ -46,7 +46,7 @@ def test_must_build_python_project_through_makefile(self): "idna", "urllib3-1.25.9.dist-info", "chardet-3.0.4.dist-info", - "certifi-2020.4.5.2.dist-info", + "certifi-2020.6.20.dist-info", "certifi", "idna-2.9.dist-info", "requests", From bb938dbfeb77dbfa51f483ea7e39ccea20357030 Mon Sep 17 00:00:00 2001 From: softprops Date: Tue, 30 Jun 2020 20:22:25 -0400 Subject: [PATCH 16/19] update integration tests for rust cargo with latest aws rust runtime interfaces --- .../rust_cargo/testdata/hello/Cargo.lock | 220 +++++++++++------- .../rust_cargo/testdata/hello/src/main.rs | 4 +- .../rust_cargo/testdata/workspaces/Cargo.lock | 208 +++++++++++------ .../testdata/workspaces/bar/src/main.rs | 4 +- .../testdata/workspaces/foo/src/main.rs | 4 +- 5 files changed, 276 insertions(+), 164 deletions(-) diff --git a/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock index ddf47c644..433293b24 100644 --- a/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock +++ b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock @@ -1,16 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "anyhow" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" - [[package]] name = "arc-swap" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" [[package]] name = "autocfg" @@ -26,9 +20,18 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bytes" -version = "0.5.4" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" +dependencies = [ + "loom", +] + +[[package]] +name = "cc" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "77c1f1d60091c1b73e2b1f4560ab419204b178e625fa945ded7b660becd2bd46" [[package]] name = "cfg-if" @@ -113,7 +116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -179,11 +182,24 @@ checksum = "784f84eebc366e15251c4a8c3acee82a6a6f427949776ecb88377362a9621738" dependencies = [ "proc-macro-error", "proc-macro-hack", - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", ] +[[package]] +name = "generator" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" +dependencies = [ + "cc", + "libc", + "log", + "rustc_version", + "winapi 0.3.9", +] + [[package]] name = "h2" version = "0.2.5" @@ -214,9 +230,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" +checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" dependencies = [ "libc", ] @@ -250,9 +266,9 @@ checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] name = "hyper" -version = "0.13.5" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" +checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" dependencies = [ "bytes", "futures-channel", @@ -264,8 +280,8 @@ dependencies = [ "httparse", "itoa", "log", - "net2", "pin-project", + "socket2", "time", "tokio", "tower-service", @@ -274,9 +290,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" dependencies = [ "autocfg", ] @@ -292,9 +308,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "kernel32-sys" @@ -309,9 +325,8 @@ dependencies = [ [[package]] name = "lambda" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" dependencies = [ - "anyhow", "bytes", "futures", "genawaiter", @@ -330,7 +345,7 @@ dependencies = [ [[package]] name = "lambda-attributes" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" dependencies = [ "proc-macro2 0.4.30", "quote", @@ -345,9 +360,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.70" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" [[package]] name = "log" @@ -358,6 +373,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "loom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", +] + [[package]] name = "memchr" version = "2.3.3" @@ -385,14 +411,14 @@ dependencies = [ [[package]] name = "mio-named-pipes" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ "log", "mio", - "miow 0.3.3", - "winapi 0.3.8", + "miow 0.3.5", + "winapi 0.3.9", ] [[package]] @@ -420,12 +446,12 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" dependencies = [ "socket2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -436,7 +462,7 @@ checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -457,29 +483,29 @@ checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" [[package]] name = "pin-project" -version = "0.4.16" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d480cb4e89522ccda96d0eed9af94180b7a5f93fb28f66e1fd7d68431663d1" +checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.16" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82996f11efccb19b685b14b5df818de31c1edcee3daa256ab5775dd98e72feb" +checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", ] [[package]] name = "pin-project-lite" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" [[package]] name = "pin-utils" @@ -494,7 +520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", "version_check", @@ -506,7 +532,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", "syn-mid", @@ -515,15 +541,15 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" +checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" [[package]] name = "proc-macro-nested" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" @@ -536,20 +562,20 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.13" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53f5ffe53a6b28e37c9c1ce74893477864d64f74778a93a4beb43c8fa167f639" +checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" dependencies = [ - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] name = "quote" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", ] [[package]] @@ -558,37 +584,67 @@ version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + [[package]] name = "ryu" -version = "1.0.4" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "scoped-tls" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.110" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" +checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.110" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" +checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", ] [[package]] name = "serde_json" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" dependencies = [ "itoa", "ryu", @@ -629,18 +685,18 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "syn" -version = "1.0.22" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1425de3c33b0941002740a420b1a906a350b88d08b82b2c8a01035a3f9447bac" +checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] @@ -649,7 +705,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -661,7 +717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -685,7 +741,7 @@ dependencies = [ "signal-hook-registry", "slab", "tokio-macros", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -694,7 +750,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -721,9 +777,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7c6b59d116d218cb2d990eb06b77b64043e0268ef7323aae63d8b30ae462923" +checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" dependencies = [ "cfg-if", "tracing-attributes", @@ -736,7 +792,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" dependencies = [ - "proc-macro2 1.0.13", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -772,9 +828,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d53c40489aa69c9aed21ff483f26886ca8403df33bdc2d2f87c60c1617826d2" +checksum = "04a11b459109e38ff6e1b580bafef4142a11d44889f5d07424cbce2fd2a2a119" dependencies = [ "sharded-slab", "tracing-core", @@ -794,15 +850,15 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "version_check" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "want" @@ -822,9 +878,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", diff --git a/tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs b/tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs index 35482f3ad..6a2b68ab6 100644 --- a/tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs +++ b/tests/integration/workflows/rust_cargo/testdata/hello/src/main.rs @@ -1,10 +1,10 @@ -use lambda::lambda; +use lambda::{lambda, Context}; use serde_json::Value; type Error = Box; #[lambda] #[tokio::main] -async fn main(event: Value) -> Result { +async fn main(event: Value, _: Context) -> Result { Ok(event) } \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock index 0ffdbc1be..66216e3ca 100644 --- a/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock @@ -1,16 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "anyhow" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bb70cc08ec97ca5450e6eba421deeea5f172c0fc61f78b5357b2a8e8be195f" - [[package]] name = "arc-swap" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" [[package]] name = "autocfg" @@ -35,9 +29,18 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bytes" -version = "0.5.4" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" +dependencies = [ + "loom", +] + +[[package]] +name = "cc" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +checksum = "77c1f1d60091c1b73e2b1f4560ab419204b178e625fa945ded7b660becd2bd46" [[package]] name = "cfg-if" @@ -131,7 +134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -197,11 +200,24 @@ checksum = "784f84eebc366e15251c4a8c3acee82a6a6f427949776ecb88377362a9621738" dependencies = [ "proc-macro-error", "proc-macro-hack", - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", ] +[[package]] +name = "generator" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" +dependencies = [ + "cc", + "libc", + "log", + "rustc_version", + "winapi 0.3.9", +] + [[package]] name = "h2" version = "0.2.5" @@ -223,9 +239,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" +checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" dependencies = [ "libc", ] @@ -259,9 +275,9 @@ checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] name = "hyper" -version = "0.13.5" +version = "0.13.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" +checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" dependencies = [ "bytes", "futures-channel", @@ -273,8 +289,8 @@ dependencies = [ "httparse", "itoa", "log", - "net2", "pin-project", + "socket2", "time", "tokio", "tower-service", @@ -283,9 +299,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" dependencies = [ "autocfg", ] @@ -301,9 +317,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "kernel32-sys" @@ -318,9 +334,8 @@ dependencies = [ [[package]] name = "lambda" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" dependencies = [ - "anyhow", "bytes", "futures", "genawaiter", @@ -339,7 +354,7 @@ dependencies = [ [[package]] name = "lambda-attributes" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#91d2a60d4a0d040332521576f9ac349add3db128" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" dependencies = [ "proc-macro2 0.4.30", "quote", @@ -367,6 +382,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "loom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", +] + [[package]] name = "memchr" version = "2.3.3" @@ -394,14 +420,14 @@ dependencies = [ [[package]] name = "mio-named-pipes" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ "log", "mio", - "miow 0.3.4", - "winapi 0.3.8", + "miow 0.3.5", + "winapi 0.3.9", ] [[package]] @@ -429,12 +455,12 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22dfdd1d51b2639a5abd17ed07005c3af05fb7a2a3b1a1d0d7af1000a520c1c7" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" dependencies = [ "socket2", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -445,7 +471,7 @@ checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -466,29 +492,29 @@ checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" [[package]] name = "pin-project" -version = "0.4.17" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc93aeee735e60ecb40cf740eb319ff23eab1c5748abfdb5c180e4ce49f7791" +checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.17" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e58db2081ba5b4c93bd6be09c40fd36cb9193a8336c384f3b40012e531aa7e40" +checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", ] [[package]] name = "pin-project-lite" -version = "0.1.5" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7505eeebd78492e0f6108f7171c4948dbb120ee8119d9d77d0afa5469bef67f" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" [[package]] name = "pin-utils" @@ -503,7 +529,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", "version_check", @@ -515,7 +541,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", "syn-mid", @@ -530,9 +556,9 @@ checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" [[package]] name = "proc-macro-nested" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" @@ -545,20 +571,20 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101" +checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" dependencies = [ - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] name = "quote" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", ] [[package]] @@ -567,37 +593,67 @@ version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + [[package]] name = "ryu" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.110" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" +checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.110" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984" +checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", ] [[package]] name = "serde_json" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2" +checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" dependencies = [ "itoa", "ryu", @@ -638,18 +694,18 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] name = "syn" -version = "1.0.27" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de" +checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", - "unicode-xid 0.2.0", + "unicode-xid 0.2.1", ] [[package]] @@ -658,7 +714,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -670,7 +726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -694,7 +750,7 @@ dependencies = [ "signal-hook-registry", "slab", "tokio-macros", - "winapi 0.3.8", + "winapi 0.3.9", ] [[package]] @@ -703,7 +759,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -730,9 +786,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7c6b59d116d218cb2d990eb06b77b64043e0268ef7323aae63d8b30ae462923" +checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" dependencies = [ "cfg-if", "tracing-attributes", @@ -745,7 +801,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" dependencies = [ - "proc-macro2 1.0.17", + "proc-macro2 1.0.18", "quote", "syn", ] @@ -781,9 +837,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d53c40489aa69c9aed21ff483f26886ca8403df33bdc2d2f87c60c1617826d2" +checksum = "04a11b459109e38ff6e1b580bafef4142a11d44889f5d07424cbce2fd2a2a119" dependencies = [ "sharded-slab", "tracing-core", @@ -803,9 +859,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" [[package]] name = "unicode-xid" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "version_check" @@ -831,9 +887,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs b/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs index b5fce7570..7c92663d5 100644 --- a/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/bar/src/main.rs @@ -1,10 +1,10 @@ -use lambda::lambda; +use lambda::{lambda, Context}; use serde_json::Value; type Error = Box; #[lambda] #[tokio::main] -async fn main(_: Value) -> Result { +async fn main(_: Value, _: Context) -> Result { Ok("bar".into()) } \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs b/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs index 4d853dc67..460e07e63 100644 --- a/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/foo/src/main.rs @@ -1,10 +1,10 @@ -use lambda::lambda; +use lambda::{lambda, Context}; use serde_json::Value; type Error = Box; #[lambda] #[tokio::main] -async fn main(_: Value) -> Result { +async fn main(_: Value, _: Context) -> Result { Ok("foo".into()) } \ No newline at end of file From bc91737b42e3cc2fd73860ce3a4c45769ab3cdc7 Mon Sep 17 00:00:00 2001 From: softprops Date: Thu, 2 Jul 2020 00:44:15 -0400 Subject: [PATCH 17/19] align TestCustomMakeWorkflow integ test assumptions with appveyor reality --- tests/integration/workflows/custom_make/test_custom_make.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/workflows/custom_make/test_custom_make.py b/tests/integration/workflows/custom_make/test_custom_make.py index 508c66827..8b4e59fdd 100644 --- a/tests/integration/workflows/custom_make/test_custom_make.py +++ b/tests/integration/workflows/custom_make/test_custom_make.py @@ -46,9 +46,9 @@ def test_must_build_python_project_through_makefile(self): "idna", "urllib3-1.25.9.dist-info", "chardet-3.0.4.dist-info", - "certifi-2020.6.20.dist-info", + "certifi-2020.4.5.2.dist-info", "certifi", - "idna-2.9.dist-info", + "idna-2.10.dist-info", "requests", "requests-2.23.0.dist-info", } From 4afe4fdbea0af11d3b42370ce7576f940cfdc490 Mon Sep 17 00:00:00 2001 From: softprops Date: Fri, 10 Jul 2020 19:08:22 -0400 Subject: [PATCH 18/19] make x86_64-unknown-linux-musl a const for the rust cargo workflow --- .../workflows/rust_cargo/actions.py | 6 +++-- .../unit/workflows/rust_cargo/test_actions.py | 25 ++++++------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py index c2730abeb..fb9d25435 100644 --- a/aws_lambda_builders/workflows/rust_cargo/actions.py +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -10,6 +10,8 @@ from aws_lambda_builders.workflow import BuildMode from aws_lambda_builders.actions import ActionFailedError, BaseAction, Purpose +CARGO_TARGET = "x86_64-unknown-linux-musl" + class BuilderError(Exception): MESSAGE = "Builder Failed: {message}" @@ -103,7 +105,7 @@ def cargo_metadata(self): return json.loads(out) def build_command(self, package): - cmd = [self.binaries["cargo"].binary_path, "build", "-p", package, "--target", "x86_64-unknown-linux-musl"] + cmd = [self.binaries["cargo"].binary_path, "build", "-p", package, "--target", CARGO_TARGET] if self.mode != BuildMode.DEBUG: cmd.append("--release") return cmd @@ -220,7 +222,7 @@ def __init__(self, source_dir, handler, artifacts_dir, platform, mode, osutils=O def binary_path(self): (_, binary) = parse_handler(self.handler) profile = "debug" if self.mode == BuildMode.DEBUG else "release" - target = os.path.join(self.source_dir, "target", "x86_64-unknown-linux-musl") + target = os.path.join(self.source_dir, "target", CARGO_TARGET) return os.path.join(target, profile, binary) def execute(self): diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py index 2a0851fce..8cca4b692 100644 --- a/tests/unit/workflows/rust_cargo/test_actions.py +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -11,6 +11,7 @@ BuildAction, CopyAndRenameAction, BuilderError, + CARGO_TARGET, ) @@ -29,32 +30,28 @@ def test_linux_release_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.RELEASE) self.assertEqual( - action.build_command("foo"), - ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl", "--release"], + action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo", "--target", CARGO_TARGET, "--release"], ) def test_nonlinux_release_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE) self.assertEqual( - action.build_command("foo"), - ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl", "--release"], + action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo", "--target", CARGO_TARGET, "--release"], ) def test_linux_debug_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "linux", BuildMode.DEBUG) self.assertEqual( - action.build_command("foo"), - ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl"], + action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo", "--target", CARGO_TARGET], ) def test_nonlinux_debug_build_cargo_command(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.DEBUG) self.assertEqual( - action.build_command("foo"), - ["path/to/cargo", "build", "-p", "foo", "--target", "x86_64-unknown-linux-musl"], + action.build_command("foo"), ["path/to/cargo", "build", "-p", "foo", "--target", CARGO_TARGET], ) def test_parse_handler_simple(self): @@ -153,23 +150,17 @@ class TestCopyAndRenameAction(TestCase): def test_debug_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.DEBUG) - self.assertEqual( - action.binary_path(), os.path.join("source_dir", "target", "x86_64-unknown-linux-musl", "debug", "foo") - ) + self.assertEqual(action.binary_path(), os.path.join("source_dir", "target", CARGO_TARGET, "debug", "foo")) def test_release_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "linux", BuildMode.RELEASE) - self.assertEqual( - action.binary_path(), os.path.join("source_dir", "target", "x86_64-unknown-linux-musl", "release", "foo") - ) + self.assertEqual(action.binary_path(), os.path.join("source_dir", "target", CARGO_TARGET, "release", "foo")) def test_nonlinux_copy_path(self): cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = CopyAndRenameAction("source_dir", "foo", "output_dir", "darwin", BuildMode.RELEASE) - self.assertEqual( - action.binary_path(), os.path.join("source_dir", "target", "x86_64-unknown-linux-musl", "release", "foo") - ) + self.assertEqual(action.binary_path(), os.path.join("source_dir", "target", CARGO_TARGET, "release", "foo")) @patch("aws_lambda_builders.workflows.rust_cargo.actions.OSUtils") def test_execute(self, OSUtilsMock): From 903f7aaf356c39905a8d28624cbb51efe462e42f Mon Sep 17 00:00:00 2001 From: softprops Date: Wed, 15 Jul 2020 16:33:11 -0400 Subject: [PATCH 19/19] add integ test for failing cargo rust build --- .../workflows/rust_cargo/actions.py | 27 +- .../workflows/rust_cargo/test_rust_cargo.py | 17 +- .../rust_cargo/testdata/fail/.gitignore | 1 + .../rust_cargo/testdata/fail/Cargo.lock | 915 ++++++++++++++++++ .../rust_cargo/testdata/fail/Cargo.toml | 9 + .../rust_cargo/testdata/fail/src/main.rs | 11 + .../rust_cargo/testdata/hello/Cargo.lock | 40 +- .../rust_cargo/testdata/workspaces/Cargo.lock | 40 +- .../unit/workflows/rust_cargo/test_actions.py | 4 +- 9 files changed, 1008 insertions(+), 56 deletions(-) create mode 100644 tests/integration/workflows/rust_cargo/testdata/fail/.gitignore create mode 100644 tests/integration/workflows/rust_cargo/testdata/fail/Cargo.lock create mode 100644 tests/integration/workflows/rust_cargo/testdata/fail/Cargo.toml create mode 100644 tests/integration/workflows/rust_cargo/testdata/fail/src/main.rs diff --git a/aws_lambda_builders/workflows/rust_cargo/actions.py b/aws_lambda_builders/workflows/rust_cargo/actions.py index fb9d25435..6527ea614 100644 --- a/aws_lambda_builders/workflows/rust_cargo/actions.py +++ b/aws_lambda_builders/workflows/rust_cargo/actions.py @@ -165,18 +165,21 @@ def build_env(self): return env def execute(self): - (package, _) = self.resolve_binary(self.cargo_metadata()) - p = self.osutils.popen( - self.build_command(package), - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - env=self.build_env(), - cwd=self.source_dir, - ) - out, err = p.communicate() - if p.returncode != 0: - raise BuilderError(message=err.decode("utf8").strip()) - return out.decode("utf8").strip() + try: + (package, _) = self.resolve_binary(self.cargo_metadata()) + p = self.osutils.popen( + self.build_command(package), + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + env=self.build_env(), + cwd=self.source_dir, + ) + out, err = p.communicate() + if p.returncode != 0: + raise BuilderError(message=err.decode("utf8").strip()) + return out.decode("utf8").strip() + except Exception as ex: + raise ActionFailedError(str(ex)) class CopyAndRenameAction(BaseAction): diff --git a/tests/integration/workflows/rust_cargo/test_rust_cargo.py b/tests/integration/workflows/rust_cargo/test_rust_cargo.py index c477a65d3..0b4d7bbf4 100644 --- a/tests/integration/workflows/rust_cargo/test_rust_cargo.py +++ b/tests/integration/workflows/rust_cargo/test_rust_cargo.py @@ -27,8 +27,22 @@ def tearDown(self): shutil.rmtree(self.artifacts_dir) shutil.rmtree(self.scratch_dir) + def test_failed_build_project(self): + source_dir = os.path.join(self.TEST_DATA_FOLDER, "fail") + + with self.assertRaises(WorkflowFailedError) as raised: + self.builder.build( + source_dir, + self.artifacts_dir, + self.scratch_dir, + os.path.join(source_dir, "Cargo.toml"), + runtime=self.runtime, + options={"artifact_executable_name": "fail"}, + ) + self.maxDiff = None + self.assertTrue(raised.exception.args[0].startswith("RustCargoBuilder:CargoBuild - Builder Failed")) + def test_builds_hello_project(self): - pass source_dir = os.path.join(self.TEST_DATA_FOLDER, "hello") self.builder.build( @@ -46,7 +60,6 @@ def test_builds_hello_project(self): self.assertEquals(expected_files, output_files) def test_builds_workspaces_project(self): - pass source_dir = os.path.join(self.TEST_DATA_FOLDER, "workspaces") self.builder.build( diff --git a/tests/integration/workflows/rust_cargo/testdata/fail/.gitignore b/tests/integration/workflows/rust_cargo/testdata/fail/.gitignore new file mode 100644 index 000000000..1de565933 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/fail/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/fail/Cargo.lock b/tests/integration/workflows/rust_cargo/testdata/fail/Cargo.lock new file mode 100644 index 000000000..af0890308 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/fail/Cargo.lock @@ -0,0 +1,915 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "arc-swap" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" + +[[package]] +name = "autocfg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bytes" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" +dependencies = [ + "loom", +] + +[[package]] +name = "cc" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "fail" +version = "0.1.0" +dependencies = [ + "lambda", + "serde_json", + "tokio", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" + +[[package]] +name = "futures-executor" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" + +[[package]] +name = "futures-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.18", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" + +[[package]] +name = "futures-task" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "genawaiter" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86bd0361bcbde39b13475e6e36cb24c329964aa2611be285289d1e4b751c1a0" +dependencies = [ + "futures-core", + "genawaiter-macro", + "genawaiter-proc-macro", + "proc-macro-hack", +] + +[[package]] +name = "genawaiter-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b32dfe1fdfc0bbde1f22a5da25355514b5e450c33a6af6770884c8750aedfbc" + +[[package]] +name = "genawaiter-proc-macro" +version = "0.99.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784f84eebc366e15251c4a8c3acee82a6a6f427949776ecb88377362a9621738" +dependencies = [ + "proc-macro-error", + "proc-macro-hack", + "proc-macro2 1.0.18", + "quote", + "syn", +] + +[[package]] +name = "generator" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" +dependencies = [ + "cc", + "libc", + "log", + "rustc_version", + "winapi 0.3.9", +] + +[[package]] +name = "h2" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "log", + "slab", + "tokio", + "tokio-util", +] + +[[package]] +name = "hermit-abi" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" +dependencies = [ + "libc", +] + +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "hyper" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "log", + "pin-project", + "socket2", + "time", + "tokio", + "tower-service", + "want", +] + +[[package]] +name = "indexmap" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" +dependencies = [ + "autocfg", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "itoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "lambda" +version = "0.1.0" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#c8dbcd39e0b1cf9ecf395e2b2f9df6c6c0d97780" +dependencies = [ + "bytes", + "futures", + "genawaiter", + "http", + "hyper", + "lambda-attributes", + "serde", + "serde_json", + "tokio", + "tower-service", + "tracing", + "tracing-error", + "tracing-futures", +] + +[[package]] +name = "lambda-attributes" +version = "0.1.0" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#c8dbcd39e0b1cf9ecf395e2b2f9df6c6c0d97780" +dependencies = [ + "proc-macro2 0.4.30", + "quote", + "syn", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "loom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", +] + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" + +[[package]] +name = "mio" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +dependencies = [ + "cfg-if", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.1", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" +dependencies = [ + "log", + "mio", + "miow 0.3.5", + "winapi 0.3.9", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "miow" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +dependencies = [ + "socket2", + "winapi 0.3.9", +] + +[[package]] +name = "net2" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +dependencies = [ + "cfg-if", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" + +[[package]] +name = "pin-project" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" +dependencies = [ + "proc-macro2 1.0.18", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro-error" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18f33027081eba0a6d8aba6d1b1c3a3be58cbb12106341c2d5759fcd9b5277e7" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2 1.0.18", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a5b4b77fdb63c1eca72173d68d24501c54ab1269409f6b672c85deb18af69de" +dependencies = [ + "proc-macro2 1.0.18", + "quote", + "syn", + "syn-mid", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" + +[[package]] +name = "proc-macro-nested" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +dependencies = [ + "unicode-xid 0.2.1", +] + +[[package]] +name = "quote" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +dependencies = [ + "proc-macro2 1.0.18", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" +dependencies = [ + "proc-macro2 1.0.18", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +dependencies = [ + "arc-swap", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "socket2" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.9", +] + +[[package]] +name = "syn" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" +dependencies = [ + "proc-macro2 1.0.18", + "quote", + "unicode-xid 0.2.1", +] + +[[package]] +name = "syn-mid" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a" +dependencies = [ + "proc-macro2 1.0.18", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "tokio" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-named-pipes", + "mio-uds", + "num_cpus", + "pin-project-lite", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.18", + "quote", + "syn", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "tracing" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" +dependencies = [ + "cfg-if", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" +dependencies = [ + "proc-macro2 1.0.18", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-error" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4d7c0b83d4a500748fa5879461652b361edf5c9d51ede2a2ac03875ca185e24" +dependencies = [ + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-futures" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c72c8cf3ec4ed69fef614d011a5ae4274537a8a8c59133558029bd731eb71659" +dependencies = [ + "sharded-slab", + "tracing-core", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] diff --git a/tests/integration/workflows/rust_cargo/testdata/fail/Cargo.toml b/tests/integration/workflows/rust_cargo/testdata/fail/Cargo.toml new file mode 100644 index 000000000..87d0d725d --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/fail/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "fail" +version = "0.1.0" +edition = "2018" + +[dependencies] +lambda = { git = "https://github.com/awslabs/aws-lambda-rust-runtime" } +serde_json = "1.0" +tokio = { version = "0.2", features = ["macros"] } \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/fail/src/main.rs b/tests/integration/workflows/rust_cargo/testdata/fail/src/main.rs new file mode 100644 index 000000000..c3f724287 --- /dev/null +++ b/tests/integration/workflows/rust_cargo/testdata/fail/src/main.rs @@ -0,0 +1,11 @@ +use lambda::{lambda, Context}; +use serde_json::Value; + +// fails to compile because missing semi colon +type Error = Box + +#[lambda] +#[tokio::main] +async fn main(event: Value, _: Context) -> Result { + Ok(event) +} \ No newline at end of file diff --git a/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock index 433293b24..19d049867 100644 --- a/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock +++ b/tests/integration/workflows/rust_cargo/testdata/hello/Cargo.lock @@ -29,9 +29,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.56" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c1f1d60091c1b73e2b1f4560ab419204b178e625fa945ded7b660becd2bd46" +checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" [[package]] name = "cfg-if" @@ -230,9 +230,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ "libc", ] @@ -325,7 +325,7 @@ dependencies = [ [[package]] name = "lambda" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#c8dbcd39e0b1cf9ecf395e2b2f9df6c6c0d97780" dependencies = [ "bytes", "futures", @@ -345,7 +345,7 @@ dependencies = [ [[package]] name = "lambda-attributes" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#c8dbcd39e0b1cf9ecf395e2b2f9df6c6c0d97780" dependencies = [ "proc-macro2 0.4.30", "quote", @@ -360,9 +360,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" [[package]] name = "log" @@ -580,9 +580,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "rustc_version" @@ -777,9 +777,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" +checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" dependencies = [ "cfg-if", "tracing-attributes", @@ -788,9 +788,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" dependencies = [ "proc-macro2 1.0.18", "quote", @@ -799,9 +799,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" dependencies = [ "lazy_static", ] @@ -828,9 +828,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04a11b459109e38ff6e1b580bafef4142a11d44889f5d07424cbce2fd2a2a119" +checksum = "c72c8cf3ec4ed69fef614d011a5ae4274537a8a8c59133558029bd731eb71659" dependencies = [ "sharded-slab", "tracing-core", @@ -838,9 +838,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "unicode-xid" diff --git a/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock index 66216e3ca..b8a657345 100644 --- a/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock +++ b/tests/integration/workflows/rust_cargo/testdata/workspaces/Cargo.lock @@ -38,9 +38,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.56" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c1f1d60091c1b73e2b1f4560ab419204b178e625fa945ded7b660becd2bd46" +checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" [[package]] name = "cfg-if" @@ -239,9 +239,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ "libc", ] @@ -334,7 +334,7 @@ dependencies = [ [[package]] name = "lambda" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#c8dbcd39e0b1cf9ecf395e2b2f9df6c6c0d97780" dependencies = [ "bytes", "futures", @@ -354,7 +354,7 @@ dependencies = [ [[package]] name = "lambda-attributes" version = "0.1.0" -source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#ae3ce1d4aee593b9425a045cd19d2b967d5cf367" +source = "git+https://github.com/awslabs/aws-lambda-rust-runtime#c8dbcd39e0b1cf9ecf395e2b2f9df6c6c0d97780" dependencies = [ "proc-macro2 0.4.30", "quote", @@ -369,9 +369,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" [[package]] name = "log" @@ -589,9 +589,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "rustc_version" @@ -786,9 +786,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f" +checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" dependencies = [ "cfg-if", "tracing-attributes", @@ -797,9 +797,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c" +checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b" dependencies = [ "proc-macro2 1.0.18", "quote", @@ -808,9 +808,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" dependencies = [ "lazy_static", ] @@ -837,9 +837,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04a11b459109e38ff6e1b580bafef4142a11d44889f5d07424cbce2fd2a2a119" +checksum = "c72c8cf3ec4ed69fef614d011a5ae4274537a8a8c59133558029bd731eb71659" dependencies = [ "sharded-slab", "tracing-core", @@ -847,9 +847,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "unicode-xid" diff --git a/tests/unit/workflows/rust_cargo/test_actions.py b/tests/unit/workflows/rust_cargo/test_actions.py index 8cca4b692..1f30116d2 100644 --- a/tests/unit/workflows/rust_cargo/test_actions.py +++ b/tests/unit/workflows/rust_cargo/test_actions.py @@ -127,7 +127,7 @@ def test_execute_cargo_meta_fail(self, OSUtilsMock): osutils.popen.side_effect = [popen1, popen2] cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE, osutils=osutils) - with self.assertRaises(BuilderError) as err_assert: + with self.assertRaises(ActionFailedError) as err_assert: action.execute() self.assertEquals(err_assert.exception.args[0], "Builder Failed: meta failed") @@ -141,7 +141,7 @@ def test_execute_cargo_build_fail(self, OSUtilsMock): osutils.popen.side_effect = [popen1, popen2] cargo = BinaryPath(None, None, None, binary_path="path/to/cargo") action = BuildAction("source_dir", "foo", {"cargo": cargo}, "darwin", BuildMode.RELEASE, osutils=osutils) - with self.assertRaises(BuilderError) as err_assert: + with self.assertRaises(ActionFailedError) as err_assert: action.execute() self.assertEquals(err_assert.exception.args[0], "Builder Failed: build failed")