Browse Source

refactor(tool): Use melos to query packages

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/917/head
jld3103 1 year ago
parent
commit
f32336c8ee
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 20
      tool/build-app.sh

20
tool/build-app.sh

@ -3,6 +3,18 @@ set -euxo pipefail
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
source tool/common.sh source tool/common.sh
function get_mount_paths_dir() {
dir="$1"
mapfile -t packages < <(melos list --parsable --relative --dir-exists="$dir")
echo "${packages[@]/%//$dir}"
}
function get_mount_paths_file() {
file="$1"
mapfile -t packages < <(melos list --parsable --relative --file-exists="$file")
echo "${packages[@]/%//$file}"
}
targets=("linux/arm64" "linux/amd64") targets=("linux/arm64" "linux/amd64")
target="$1" target="$1"
@ -29,8 +41,14 @@ if [[ "$target" == "linux/arm64" ]] || [[ "$target" == "linux/amd64" ]]; then
-f "tool/build/Dockerfile.$os" \ -f "tool/build/Dockerfile.$os" \
./tool/build ./tool/build
paths=(packages/app/{pubspec.lock,linux,build})
mapfile -O "${#paths[@]}" -t paths < <(get_mount_paths_dir "lib")
mapfile -O "${#paths[@]}" -t paths < <(get_mount_paths_dir "assets")
mapfile -O "${#paths[@]}" -t paths < <(get_mount_paths_file "pubspec.yaml")
mapfile -O "${#paths[@]}" -t paths < <(get_mount_paths_file "pubspec_overrides.yaml")
run_args=() run_args=()
for path in packages/{app,dynamite/dynamite_runtime,file_icons,neon_lints,nextcloud,sort_box}/{lib,pubspec.yaml} packages/neon/*/{assets,lib,pubspec.yaml,pubspec_overrides.yaml} packages/file_icons/fonts packages/nextcloud/pubspec_overrides.yaml packages/app/{pubspec_overrides.yaml,assets,build,linux}; do for path in ${paths[*]}; do
run_args+=(-v "$(pwd)/$path:/src/$path") run_args+=(-v "$(pwd)/$path:/src/$path")
done done
mkdir -p "packages/app/build" mkdir -p "packages/app/build"

Loading…
Cancel
Save