This repository has been archived by the owner on Oct 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsymlink_artifacts.sh
executable file
·53 lines (42 loc) · 1.77 KB
/
symlink_artifacts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
oasis_core_root_path=$1
oasis_core_src_path=$2
runtime_root_path=$3
runtime_src_path=$4
set -euo pipefail
# Sanity check the source paths.
if [ ! -d "${oasis_core_src_path}" ]; then
echo "ERROR: Invalid arguments specified."
echo " Invoke as: make symlink-artifacts OASIS_CORE_SRC_PATH=path/to/oasis-core"
exit 1
fi
# Symlink an artifact from the source directory to the root directory.
symlink_artifact() {
local src_path=$1
local binary_path=$2
local root_path=$3
local skip_sanity_check=${4:-"0"}
local artifact_src_path="$(realpath -m "${src_path}/${binary_path}")"
local artifact_dst_path="${root_path}/${binary_path}"
# Sanity check the source artifact.
if [[ "${skip_sanity_check}" != "1" && ! -f "${artifact_src_path}" ]]; then
echo "ERROR: Artifact '${binary_path}' does not exist in specified path ${src_path}."
echo " Maybe you need to run: make -C \"${src_path}\""
exit 1
fi
mkdir -p "$(dirname "${artifact_dst_path}")"
ln -sf "${artifact_src_path}" "${artifact_dst_path}"
}
# Symlink all Oasis Core build artifacts.
symlink_artifact ${oasis_core_src_path} go/oasis-node/oasis-node ${oasis_core_root_path}
symlink_artifact ${oasis_core_src_path} go/oasis-net-runner/oasis-net-runner ${oasis_core_root_path}
# For Rust, symlink against the CARGO_TARGET_DIR instead of OASIS_CORE_SRC_PATH, if set.
set +u
if [ -n "${CARGO_TARGET_DIR}" ]; then
oasis_core_src_path=$(dirname ${CARGO_TARGET_DIR})
runtime_src_path=$(dirname ${CARGO_TARGET_DIR})
fi
set -u
symlink_artifact $oasis_core_src_path target/default/debug/oasis-core-runtime-loader $oasis_core_root_path
# Symlink the runtime artifacts.
symlink_artifact $runtime_src_path target/debug/oasis-ethwasi-runtime $runtime_root_path 1