diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-09 23:58:47 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-09 23:59:18 +0800 |
| commit | 75f7578d784a4e209da4b29a80d27940197d8945 (patch) | |
| tree | 5086f022beb3e56321940fc7d80e150b518e8ea3 /Pre-Build.sh | |
| parent | 6dedba9e3cedf6463f25460eba84111d6a0bd0dd (diff) | |
Rename build scripts to Pre-Build
Diffstat (limited to 'Pre-Build.sh')
| -rw-r--r-- | Pre-Build.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Pre-Build.sh b/Pre-Build.sh new file mode 100644 index 0000000..61545b7 --- /dev/null +++ b/Pre-Build.sh @@ -0,0 +1,53 @@ +# Get the absolute path of the directory where the current script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +# Switch to the script's directory, exit if it fails +cd "$SCRIPT_DIR" || exit 1 + +# Define the target path for the CLI tool +cliPath=".Temp/Debug/JustEnoughVCS" + +# Check if the CLI already exists at the target path +if [ ! -f "$cliPath" ]; then + # Check if the CommandLine directory exists in the parent directory + if [ -d "./../CommandLine/" ]; then + # Check if a built CLI executable already exists + if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then + # Create the target directory (if it doesn't exist) + mkdir -p "$(dirname "$cliPath")" + # Copy the CLI executable to the target path + cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath" + # Add execute permission + chmod +x "$cliPath" + echo "CLI copied to $cliPath" + else + # Check if a deployment script exists + if [ -f "./../CommandLine/deploy.sh" ]; then + echo "Building CLI from deploy.sh..." + # Enter the CommandLine directory and execute the deployment script + (cd "./../CommandLine" && ./deploy.sh) + # Check if the CLI executable was generated after deployment + if [ -f "./../CommandLine/.temp/deploy/bin/jv" ]; then + # Create the target directory (if it doesn't exist) + mkdir -p "$(dirname "$cliPath")" + # Copy the newly built CLI executable + cp "./../CommandLine/.temp/deploy/bin/jv" "$cliPath" + # Add execute permission + chmod +x "$cliPath" + echo "CLI built and copied to $cliPath" + else + # CLI executable still not found after deployment, error and exit + echo "Error: ./../CommandLine/.temp/deploy/bin/jv Not Found after deployment!" + exit 1 + fi + else + # Deployment script not found, error and exit + echo "Error: ./../CommandLine/deploy.sh Not Found!" + exit 1 + fi + fi + else + # CommandLine directory not found, error and exit + echo "Error: ./../CommandLine/ Not Found!" + exit 1 + fi +fi |
