Add optional deploy of custom programs (#2817)
* Add optional deploy of custom programs * Review comments
This commit is contained in:
parent
0317583489
commit
760a82cb08
10
net/net.sh
10
net/net.sh
|
@ -36,6 +36,7 @@ Operate a configured testnet
|
||||||
(ignored if -s or -S is specified)
|
(ignored if -s or -S is specified)
|
||||||
-r - Reuse existing node/ledger configuration from a
|
-r - Reuse existing node/ledger configuration from a
|
||||||
previous |start| (ie, don't run ./multinode-demo/setup.sh).
|
previous |start| (ie, don't run ./multinode-demo/setup.sh).
|
||||||
|
-D /path/to/programs - Deploy custom programs from this location
|
||||||
|
|
||||||
sanity/start/update-specific options:
|
sanity/start/update-specific options:
|
||||||
-o noLedgerVerify - Skip ledger verification
|
-o noLedgerVerify - Skip ledger verification
|
||||||
|
@ -62,12 +63,13 @@ sanityExtraArgs=
|
||||||
cargoFeatures=
|
cargoFeatures=
|
||||||
skipSetup=false
|
skipSetup=false
|
||||||
updateNodes=false
|
updateNodes=false
|
||||||
|
customPrograms=
|
||||||
|
|
||||||
command=$1
|
command=$1
|
||||||
[[ -n $command ]] || usage
|
[[ -n $command ]] || usage
|
||||||
shift
|
shift
|
||||||
|
|
||||||
while getopts "h?S:s:T:t:o:f:r" opt; do
|
while getopts "h?S:s:T:t:o:f:r:D:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h | \?)
|
h | \?)
|
||||||
usage
|
usage
|
||||||
|
@ -110,6 +112,9 @@ while getopts "h?S:s:T:t:o:f:r" opt; do
|
||||||
r)
|
r)
|
||||||
skipSetup=true
|
skipSetup=true
|
||||||
;;
|
;;
|
||||||
|
D)
|
||||||
|
customPrograms=$OPTARG
|
||||||
|
;;
|
||||||
o)
|
o)
|
||||||
case $OPTARG in
|
case $OPTARG in
|
||||||
noLedgerVerify|noValidatorSanity|rejectExtraNodes)
|
noLedgerVerify|noValidatorSanity|rejectExtraNodes)
|
||||||
|
@ -149,6 +154,9 @@ build() {
|
||||||
$MAYBE_DOCKER bash -c "
|
$MAYBE_DOCKER bash -c "
|
||||||
set -ex
|
set -ex
|
||||||
scripts/cargo-install-all.sh farf \"$cargoFeatures\"
|
scripts/cargo-install-all.sh farf \"$cargoFeatures\"
|
||||||
|
if [[ -n $customPrograms ]]; then
|
||||||
|
scripts/cargo-install-custom-programs.sh farf $customPrograms
|
||||||
|
fi
|
||||||
"
|
"
|
||||||
)
|
)
|
||||||
echo "Build took $SECONDS seconds"
|
echo "Build took $SECONDS seconds"
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# This script will install all cargo workspace libraries found in
|
||||||
|
# `programDir` as native programs.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Directory to install libraries into
|
||||||
|
installDir="$(mkdir -p "$1"; cd "$1"; pwd)"
|
||||||
|
|
||||||
|
# Where to find custom programs
|
||||||
|
programDir="$2"
|
||||||
|
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
cd "$programDir"
|
||||||
|
cargo build --all --release
|
||||||
|
)
|
||||||
|
|
||||||
|
for dir in "$programDir"/*; do
|
||||||
|
for program in $programDir/target/release/deps/lib"$(basename "$dir")".{so,dylib,dll}; do
|
||||||
|
if [[ -f $program ]]; then
|
||||||
|
(
|
||||||
|
set -x
|
||||||
|
mkdir -p "$installDir/bin/deps"
|
||||||
|
rm -f "$installDir/bin/deps/$(basename "$program")"
|
||||||
|
cp -v "$program" "$installDir"/bin/deps
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
Loading…
Reference in New Issue