File tree 3 files changed +15
-4
lines changed
3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,18 @@ function package() {
20
20
rm " $file .zip" > 2& > /dev/null || true
21
21
# note: would use printf "@ $(basename $file)\n@=bootstrap" | zipnote -w "$file.zip"
22
22
# if not for https://bugs.launchpad.net/ubuntu/+source/zip/+bug/519611
23
- mv " $file " bootstrap
23
+ if [ " $file " != ./bootstrap ] && [ " $file " != bootstrap ]; then
24
+ mv " ${file} " bootstrap
25
+ fi
24
26
zip " $file .zip" bootstrap
25
27
rm bootstrap
26
28
}
27
29
28
30
cd " $CARGO_TARGET_DIR " /release
29
31
(
32
+ export -f package
30
33
if [ -z " $BIN " ]; then
31
- find -maxdepth 1 -executable -type f -exec package {} \;
34
+ find -maxdepth 1 -executable -type f -exec bash -c ' package "$0" ' {} \;
32
35
else
33
36
package " $BIN "
34
37
fi
Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ version = "0.1.0"
4
4
authors = [" softprops <d.tangren@gmail.com>" ]
5
5
edition = " 2018"
6
6
7
+ # users don't have to do this
8
+ # but when they do, the builder packaging still work
9
+ [[bin ]]
10
+ name = " bootstrap"
11
+ path = " src/main.rs"
12
+
7
13
[dependencies ]
8
14
lambda_runtime = " 0.1"
9
15
serde_json = " 1.0"
Original file line number Diff line number Diff line change @@ -46,17 +46,19 @@ DIST=$(cd $HERE/..; echo $PWD)
46
46
47
47
cd ${HERE} /test-func
48
48
49
+ # test packaing with a single binary
49
50
function package_bin() {
50
51
rm target/lambda/release/ > /dev/null 2>&1
51
52
docker run --rm \
52
- -e BIN=test-func \
53
+ -e BIN=" $1 " \
53
54
-v ${PWD} :/code \
54
55
-v ${HOME} /.cargo/registry:/root/.cargo/registry \
55
56
-v ${HOME} /.cargo/git:/root/.cargo/git \
56
57
softprops/lambda-rust && \
57
58
ls target/lambda/release/test-func.zip > /dev/null 2>&1
58
59
}
59
60
61
+ # test packaging all binaries
60
62
function package_all() {
61
63
rm target/lambda/release/ > /dev/null 2>&1
62
64
docker run --rm \
@@ -68,7 +70,7 @@ function package_all() {
68
70
}
69
71
70
72
# package tests
71
- assert_success " it packages single bin" package_bin
73
+ assert_success " it packages single bin" package_bin bootstrap
72
74
73
75
assert_success " it packages all bins" package_all
74
76
You can’t perform that action at this time.
0 commit comments