diff --git a/hack/build.sh b/hack/build.sh index 65a3bfd..9436b74 100755 --- a/hack/build.sh +++ b/hack/build.sh @@ -28,6 +28,8 @@ function build_platform() { if [ -z "$platform" ]; then vox_box::log::fatal "undefined platform to build" fi + + ignore_thirdparty_invalid_file poetry build diff --git a/hack/install.sh b/hack/install.sh index 3bf8b0b..30bef11 100755 --- a/hack/install.sh +++ b/hack/install.sh @@ -13,7 +13,8 @@ source "${ROOT_DIR}/hack/lib/init.sh" function download_deps() { git submodule update --init --recursive - rm -rf "${ROOT_DIR}/vox_box/third_party/CosyVoice/third_party/Matcha-TTS/data" + + ignore_thirdparty_invalid_file pip install poetry==1.8.3 pre-commit==4.0.1 poetry install diff --git a/hack/lib/util.sh b/hack/lib/util.sh index b71fef5..efcdd78 100644 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)" function vox_box::util::sed() { if ! sed -i "$@" >/dev/null 2>&1; then @@ -25,3 +26,13 @@ function vox_box::util::is_darwin() { function vox_box::util::is_linux() { [[ "$(vox_box::util::get_os_name)" == "linux" ]] } + +function ignore_thirdparty_invalid_file() { + local data_file_dir="${ROOT_DIR}/vox_box/third_party/CosyVoice/third_party/Matcha-TTS" + pushd "${data_file_dir}" > /dev/null || exit + { + git update-index --assume-unchanged "data" + rm -rf "data" + } + popd > /dev/null || exit +} diff --git a/hack/lib/windows/util.ps1 b/hack/lib/windows/util.ps1 new file mode 100644 index 0000000..91979d9 --- /dev/null +++ b/hack/lib/windows/util.ps1 @@ -0,0 +1,13 @@ +$ROOT_DIR = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent | Split-Path -Parent | Split-Path -Parent | Split-Path -Parent -Resolve + +function Ignore-Thirdparty-InvalidFile { + $dataFileDir = "$env:ROOT_DIR/vox_box/third_party/CosyVoice/third_party/Matcha-TTS" + Push-Location -Path $dataFileDir + try { + git update-index --assume-unchanged "data" + Remove-Item -Recurse -Force "data" + } + finally { + Pop-Location + } +} diff --git a/hack/windows/build.ps1 b/hack/windows/build.ps1 index c94a84b..5dfacfa 100644 --- a/hack/windows/build.ps1 +++ b/hack/windows/build.ps1 @@ -9,7 +9,8 @@ $ROOT_DIR = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent | Split- function Build { $distDir = Join-Path -Path $ROOT_DIR -ChildPath "dist" Remove-Item -Path $distDir -Recurse -Force -ErrorAction SilentlyContinue - + + Ignore-Thirdparty-InvalidFile poetry build if ($LASTEXITCODE -ne 0) { SpeechBox.Log.Fatal "failed to run poetry build." diff --git a/hack/windows/install.ps1 b/hack/windows/install.ps1 index 54f834e..b8ad29d 100644 --- a/hack/windows/install.ps1 +++ b/hack/windows/install.ps1 @@ -9,8 +9,9 @@ $ROOT_DIR = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent | Split- function Install-Dependency { git submodule update --init --recursive - Remove-Item -Recurse -Force "$ROOT_DIR/vox_box/third_party/CosyVoice/third_party/Matcha-TTS/data" + Ignore-Thirdparty-InvalidFile + pip install poetry==1.8.3 pre-commit==4.0.1 if ($LASTEXITCODE -ne 0) { SpeechBox.Log.Fatal "failed to install poetry."