-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprepare_all_apps.sh
executable file
·54 lines (39 loc) · 1.9 KB
/
prepare_all_apps.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
54
#!/bin/bash -ex
if [[ "$(uname -s)" == "Linux" ]]; then
export CARGO_EXTRA_ARGS="--target=x86_64-unknown-linux-musl"
export RUST_TARGET_DIR="target/x86_64-unknown-linux-musl/release"
elif [[ -n "$MACOS_ARM64_BUILD" ]]; then
export SDKROOT=$(xcrun -sdk macosx --show-sdk-path)
export MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)
export CARGO_EXTRA_ARGS="--target=aarch64-apple-darwin"
export RUST_TARGET_DIR="target/aarch64-apple-darwin/release"
else
export CARGO_EXTRA_ARGS=""
export RUST_TARGET_DIR="target/release"
fi
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPTS_DIR
if [ -z "$PREPARE_ALL_OUTPUT_DIR" ]; then
# rm -rf /tmp/bzl-gen-build
export PREPARE_ALL_OUTPUT_DIR="/tmp/bzl-gen-build"
fi
if [ ! -d "$PREPARE_ALL_OUTPUT_DIR" ]; then
mkdir -p $PREPARE_ALL_OUTPUT_DIR
fi
echo "running Scala and Python generator building"
OUTPUT_DIR=$PREPARE_ALL_OUTPUT_DIR language_generators/scala-defref-extractor/build_native.sh
cd crates
cargo build $CARGO_EXTRA_ARGS --release
rm -f $PREPARE_ALL_OUTPUT_DIR/system-driver-app || true
cp ${RUST_TARGET_DIR}/bzl_gen_build_driver $PREPARE_ALL_OUTPUT_DIR/system-driver-app
rm -f $PREPARE_ALL_OUTPUT_DIR/python-entity-extractor || true
cp ${RUST_TARGET_DIR}/bzl_gen_python_extractor $PREPARE_ALL_OUTPUT_DIR/python-entity-extractor
rm -f $PREPARE_ALL_OUTPUT_DIR/protos-entity-extractor || true
cp ${RUST_TARGET_DIR}/bzl_gen_protobuf_extractor $PREPARE_ALL_OUTPUT_DIR/protos-entity-extractor
rm -f $PREPARE_ALL_OUTPUT_DIR/jarscanner || true
cp ${RUST_TARGET_DIR}/bzl_gen_jarscanner $PREPARE_ALL_OUTPUT_DIR/jarscanner
echo "workspace(name = \"external_build_tooling_gen\")" > $PREPARE_ALL_OUTPUT_DIR/WORKSPACE
cat > $PREPARE_ALL_OUTPUT_DIR/BUILD.bazel <<EOF
exports_files(["WORKSPACE", "python-entity-extractor", "jarscanner"])
EOF
echo "wrote all outputs to $PREPARE_ALL_OUTPUT_DIR" 1>&2