builder: Finish up the dependency management functions
This commit is contained in:
parent
19d19a0c12
commit
e0e0a1dea1
19
builder
19
builder
|
@ -38,7 +38,6 @@
|
|||
#
|
||||
# $ VERBOSE=ON ./builder build/
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -47,11 +46,13 @@ set -e
|
|||
|
||||
command=$1
|
||||
VERSION="0.7.0"
|
||||
|
||||
ME=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)
|
||||
|
||||
source "$ME/config"
|
||||
|
||||
LLVM_VERSION="11"
|
||||
|
||||
# Serene subprojects. We use this array to run common tasks on all the projects
|
||||
# like running the test cases
|
||||
PROJECTS=(libserene serenec serene-repl serene-tblgen)
|
||||
|
||||
CC=$(which clang)
|
||||
CXX=$(which clang++)
|
||||
|
@ -71,7 +72,7 @@ export LDFLAGS="-fuse-ld=lld"
|
|||
# root of the source tree
|
||||
ROOT_DIR=$(pwd)
|
||||
BUILD_DIR=$ROOT_DIR/build
|
||||
ME=$(cd "$(dirname "$0")/." >/dev/null 2>&1 ; pwd -P)
|
||||
|
||||
|
||||
CMAKEARGS_DEBUG=("-DCMAKE_BUILD_TYPE=Debug")
|
||||
CMAKEARGS=("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
|
@ -83,6 +84,9 @@ source "$ME/scripts/utils.sh"
|
|||
# shellcheck source=./scripts/devfs.sh
|
||||
source "$ME/scripts/devfs.sh"
|
||||
|
||||
# shellcheck source=./scripts/deps.sh
|
||||
source "$ME/scripts/deps.sh"
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Helper functions
|
||||
|
@ -122,6 +126,11 @@ function build-gen() {
|
|||
# -----------------------------------------------------------------------------
|
||||
# Subcomaands
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
function deps() { ## Manage the dependencies
|
||||
manage_dependencies "$@"
|
||||
}
|
||||
|
||||
function compile() { ## Compiles the project using the generated build scripts
|
||||
pushed_build
|
||||
cmake --build .
|
||||
|
|
6
config
6
config
|
@ -44,6 +44,10 @@ DEV_HEROES="https://beta.devheroes.codes"
|
|||
BUILD_DIR_NAME="build"
|
||||
DEPS_BUILD_DIR_NAME=".env"
|
||||
|
||||
# Serene subprojects. We use this array to run common tasks on all the projects
|
||||
# like running the test cases
|
||||
PROJECTS=(libserene serenec serene-repl serene-tblgen)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# INTERNAL VARS
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -77,6 +81,8 @@ ZSTD_CLI="zstd --ultra -22 -T$(nproc)"
|
|||
export ME
|
||||
export TARGET_ARCHS
|
||||
export DEV_HEROES
|
||||
export PROJECTS
|
||||
export DEPS_BUILD_DIR_NAME
|
||||
|
||||
export BUILD_DIR
|
||||
export LLVM_DIR_NAME
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
# -----------------------------------------------------------------------------
|
||||
# This file contains some functions to build, pack and distribute the
|
||||
# dependencies
|
||||
#
|
||||
# IMPORTANT: ENV Vars comes from the `config` file
|
||||
|
||||
source ./utils.sh
|
||||
# shellcheck source=./deps.sh
|
||||
source ./scripts/utils.sh
|
||||
|
||||
function build_toolchain() { ## Build LLVM and the toolchain
|
||||
local version
|
||||
|
@ -88,6 +91,7 @@ function push_toolchain() { ## Push the toolchain to the package repository
|
|||
info "Pushing the toolchain version '$version'..."
|
||||
_push "$DEPS_BUILD_DIR"
|
||||
http "$LLVM_DIR_NAME" "$version"
|
||||
echo ""
|
||||
info "Done"
|
||||
_pop
|
||||
}
|
||||
|
@ -164,6 +168,70 @@ function push_bdwgc() { ## Push the BDWGC package to the package repository
|
|||
info "Pushing the BDWGC package version '$version'..."
|
||||
_push "$DEPS_BUILD_DIR"
|
||||
http "$BDWGC_DIR_NAME" "$version"
|
||||
echo ""
|
||||
info "Done"
|
||||
_pop
|
||||
}
|
||||
|
||||
function manage_dependencies() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The action is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
"build")
|
||||
build_dep "${@:2}"
|
||||
;;
|
||||
"package")
|
||||
package_dep "${@:2}"
|
||||
;;
|
||||
"push")
|
||||
push_dep "${@:2}"
|
||||
;;
|
||||
"pull")
|
||||
pull_dep "${@:2}"
|
||||
;;
|
||||
*)
|
||||
error "Don't know about '$1' action"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
function build_dep() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The dependency name is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_"$1" "${@:2}"
|
||||
}
|
||||
|
||||
function package_dep() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The dependency name is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
package_"$1" "${@:2}"
|
||||
}
|
||||
|
||||
function push_dep() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The dependency name is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
push_"$1" "${@:2}"
|
||||
}
|
||||
|
||||
function pull_dep() {
|
||||
if [ ! "$1" ]; then
|
||||
error "The dependency name is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pull_"$1" "${@:2}"
|
||||
}
|
||||
|
|
|
@ -69,3 +69,23 @@ function get_version() {
|
|||
git describe
|
||||
_pop
|
||||
}
|
||||
|
||||
function http() {
|
||||
if [[ -z "$DEV_HEROES_TOKEN" ]]; then
|
||||
error '"$DEV_HEROES_TOKEN" is not set.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local pkg_name
|
||||
local version
|
||||
|
||||
pkg_name="$1"
|
||||
version="$2"
|
||||
|
||||
curl "$DEV_HEROES/api/packages/serene/generic/$pkg_name/$version/$pkg_name.$version.zstd" \
|
||||
--upload-file "$pkg_name.$version.zstd" \
|
||||
--progress-bar \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: token $DEV_HEROES_TOKEN" \
|
||||
-H "Content-Type: application/json"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue