Build AI Studio 1.1 for macOS #1

Open
admin wants to merge 38 commits from admin/ai-studio-v1.1 AGit into main
8 changed files with 94 additions and 76 deletions
Showing only changes of commit 87cdc990c3 - Show all commits
+2 -2
View File
@@ -2,7 +2,7 @@
## Local package
Run `./Tests/test.sh`, then `./Sources/release.sh` from the project directory. The release script builds the arm64 Release configuration, checks the app's code signature, and creates `AIStudio-<version>-macOS-arm64.zip` in the temporary build directory’s `dist` folder with a SHA-256 checksum alongside it. Pass an output directory as the first argument to override `dist`. The default package is ad-hoc signed for local verification.
Run `./test.sh`, then `./release.sh` from the project directory. The release script builds the arm64 Release configuration, checks the app's code signature, and creates `AIStudio-<version>-macOS-arm64.zip` in the temporary build directory’s `dist` folder with a SHA-256 checksum alongside it. Pass an output directory as the first argument to override `dist`. The default package is ad-hoc signed for local verification.
The scripts keep build products, Swift package checkouts and test results under the OS temporary directory. Set `AISTUDIO_BUILD_ROOT` to reuse a specific temporary build directory across runs. Set `MARKETING_VERSION` and `CURRENT_PROJECT_VERSION` in the Xcode target before packaging a new version.
@@ -13,7 +13,7 @@ Install a Developer ID Application certificate and store credentials for Apple's
```sh
SIGN_IDENTITY='Developer ID Application: Example (TEAMID)' \
NOTARY_PROFILE='example-notary-profile' \
./Sources/release.sh
./release.sh
```
The script signs with the hardened runtime and a timestamp, submits to the notary service, staples and validates the ticket, and produces the final ZIP and checksum. Verify the files before distribution.
+2 -2
View File
@@ -22,7 +22,7 @@ The client supports Streamable HTTP with current stateless discovery and legacy
## Build and test
Use `./Scripts/build.sh Debug` or `./Scripts/build.sh Release`. Run `./Tests/test.sh` for XCTest, including the local MCP and Ollama management fixture. It requires Python 3 for the fixture and keeps its logs and results in the temporary build directory.
From the project root, run `./build.sh` to build and open AI Studio. It defaults to Debug. Use `./build.sh Release` for a Release build, or add `--no-launch` after the configuration to build without opening the app. Run `./test.sh` for XCTest, including the local MCP and Ollama management fixture. It requires Python 3 for the fixture and keeps its logs and results in the temporary build directory.
For opt-in live provider checks, use installed models or select a catalog download:
@@ -31,7 +31,7 @@ TEST_RUNNER_AISTUDIO_TEST_OLLAMA_URL=http://127.0.0.1:11434 \
TEST_RUNNER_AISTUDIO_TEST_OLLAMA_MODEL=your-installed-tag \
TEST_RUNNER_AISTUDIO_TEST_MLX_PATH=/path/to/local-model \
TEST_RUNNER_AISTUDIO_TEST_MODEL_DOWNLOAD=qwen3-0.6b-4bit \
./Tests/test.sh
./test.sh
```
See `Docs/RELEASE.md` for packaging, signing, and notarization.
+1 -12
View File
@@ -1,14 +1,3 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
configuration="${1:-Debug}"
case "$configuration" in
Debug|Release) ;;
*) echo "Usage: $0 [Debug|Release]" >&2; exit 2 ;;
esac
base="${AISTUDIO_BUILD_ROOT:-/private/tmp/AIStudio-build-$(id -u)}"
mkdir -p "$base"
xcodebuild CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= -project AIStudio.xcodeproj -scheme AIStudio -configuration "$configuration" \
-destination 'platform=macOS,arch=arm64' -derivedDataPath "$base/Derived" \
-clonedSourcePackagesDirPath "$base/Packages" -disablePackageRepositoryCache build
printf 'App: %s\n' "$base/Derived/Build/Products/$configuration/AIStudio.app"
exec "$(dirname "$0")/../build.sh" "$@"
+1 -31
View File
@@ -1,33 +1,3 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
if [[ -n "${NOTARY_PROFILE:-}" && -z "${SIGN_IDENTITY:-}" ]]; then
echo "Notarization requires SIGN_IDENTITY." >&2
exit 2
fi
export AISTUDIO_BUILD_ROOT="${AISTUDIO_BUILD_ROOT:-/private/tmp/AIStudio-build-$(id -u)}"
destination="${1:-$AISTUDIO_BUILD_ROOT/dist}"
./Scripts/build.sh Release
stage="$(mktemp -d "$AISTUDIO_BUILD_ROOT/release.XXXXXXXX")"
trap 'rm -rf -- "$stage"' EXIT
app="$stage/AIStudio.app"
ditto "$AISTUDIO_BUILD_ROOT/Derived/Build/Products/Release/AIStudio.app" "$app"
version="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$app/Contents/Info.plist")"
if [[ -n "${SIGN_IDENTITY:-}" ]]; then
codesign --force --timestamp --options runtime --sign "$SIGN_IDENTITY" "$app"
else
codesign --force --sign - "$app"
fi
codesign --verify --deep --strict "$app"
archive="AIStudio-$version-macOS-arm64.zip"
if [[ -n "${NOTARY_PROFILE:-}" ]]; then
ditto -c -k --keepParent "$app" "$stage/notarization.zip"
xcrun notarytool submit "$stage/notarization.zip" --keychain-profile "$NOTARY_PROFILE" --wait
xcrun stapler staple "$app"
xcrun stapler validate "$app"
fi
ditto -c -k --keepParent "$app" "$stage/$archive"
mkdir -p "$destination"
mv "$stage/$archive" "$destination/$archive"
(cd "$destination" && shasum -a 256 "$archive" > "$archive.sha256")
printf 'Release: %s\n' "$destination/$archive"
exec "$(dirname "$0")/../release.sh" "$@"
+1 -29
View File
@@ -1,31 +1,3 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")/.."
base="${AISTUDIO_BUILD_ROOT:-/private/tmp/AIStudio-build-$(id -u)}"
mkdir -p "$base"
results="$(mktemp -d "$base/test.XXXXXXXX")"
if [[ -z "${TEST_RUNNER_AISTUDIO_TEST_MCP_URLS:-}" || -z "${TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL:-}" ]]; then
python3 -u Tests/Fixtures/server.py >"$results/fixture.log" 2>&1 &
fixture_pid=$!
trap 'kill "$fixture_pid" 2>/dev/null || true' EXIT
port=""
for attempt in {1..50}; do
port="$(head -n 1 "$results/fixture.log")"
[[ "$port" =~ ^[0-9]+$ ]] && break
kill -0 "$fixture_pid" 2>/dev/null || break
sleep 0.1
done
if [[ ! "$port" =~ ^[0-9]+$ ]]; then
cat "$results/fixture.log" >&2
echo "Could not start the local test fixture." >&2
exit 1
fi
fixture="http://127.0.0.1:$port"
export TEST_RUNNER_AISTUDIO_TEST_MCP_URLS="${TEST_RUNNER_AISTUDIO_TEST_MCP_URLS:-$fixture/modern,$fixture/legacy}"
export TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL="${TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL:-$fixture/ollama}"
fi
xcodebuild CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= -project AIStudio.xcodeproj -scheme AIStudio -configuration Debug \
-destination 'platform=macOS,arch=arm64' -derivedDataPath "$base/Derived" \
-clonedSourcePackagesDirPath "$base/Packages" -disablePackageRepositoryCache \
-parallel-testing-enabled NO -resultBundlePath "$results/AIStudio.xcresult" test
exec "$(dirname "$0")/../test.sh" "$@"
Executable
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
configuration="${1:-Debug}"
launch="${2:-}"
if [[ "$#" -gt 2 || ( -n "$launch" && "$launch" != "--no-launch" ) ]]; then
echo "Usage: $0 [Debug|Release] [--no-launch]" >&2
exit 2
fi
case "$configuration" in
Debug|Release) ;;
*) echo "Usage: $0 [Debug|Release] [--no-launch]" >&2; exit 2 ;;
esac
base="${AISTUDIO_BUILD_ROOT:-/private/tmp/AIStudio-build-$(id -u)}"
mkdir -p "$base"
xcodebuild CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= -project AIStudio.xcodeproj -scheme AIStudio -configuration "$configuration" \
-destination 'platform=macOS,arch=arm64' -derivedDataPath "$base/Derived" \
-clonedSourcePackagesDirPath "$base/Packages" -disablePackageRepositoryCache build
app="$base/Derived/Build/Products/$configuration/AIStudio.app"
printf 'App: %s\n' "$app"
if [[ "$launch" != "--no-launch" ]]; then
open "$app"
fi
Executable
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
if [[ -n "${NOTARY_PROFILE:-}" && -z "${SIGN_IDENTITY:-}" ]]; then
echo "Notarization requires SIGN_IDENTITY." >&2
exit 2
fi
export AISTUDIO_BUILD_ROOT="${AISTUDIO_BUILD_ROOT:-/private/tmp/AIStudio-build-$(id -u)}"
destination="${1:-$AISTUDIO_BUILD_ROOT/dist}"
./build.sh Release --no-launch
stage="$(mktemp -d "$AISTUDIO_BUILD_ROOT/release.XXXXXXXX")"
trap 'rm -rf -- "$stage"' EXIT
app="$stage/AIStudio.app"
ditto "$AISTUDIO_BUILD_ROOT/Derived/Build/Products/Release/AIStudio.app" "$app"
version="$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$app/Contents/Info.plist")"
if [[ -n "${SIGN_IDENTITY:-}" ]]; then
codesign --force --timestamp --options runtime --sign "$SIGN_IDENTITY" "$app"
else
codesign --force --sign - "$app"
fi
codesign --verify --deep --strict "$app"
archive="AIStudio-$version-macOS-arm64.zip"
if [[ -n "${NOTARY_PROFILE:-}" ]]; then
ditto -c -k --keepParent "$app" "$stage/notarization.zip"
xcrun notarytool submit "$stage/notarization.zip" --keychain-profile "$NOTARY_PROFILE" --wait
xcrun stapler staple "$app"
xcrun stapler validate "$app"
fi
ditto -c -k --keepParent "$app" "$stage/$archive"
mkdir -p "$destination"
mv "$stage/$archive" "$destination/$archive"
(cd "$destination" && shasum -a 256 "$archive" > "$archive.sha256")
printf 'Release: %s\n' "$destination/$archive"
Executable
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
base="${AISTUDIO_BUILD_ROOT:-/private/tmp/AIStudio-build-$(id -u)}"
mkdir -p "$base"
results="$(mktemp -d "$base/test.XXXXXXXX")"
if [[ -z "${TEST_RUNNER_AISTUDIO_TEST_MCP_URLS:-}" || -z "${TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL:-}" ]]; then
python3 -u Tests/Fixtures/server.py >"$results/fixture.log" 2>&1 &
fixture_pid=$!
trap 'kill "$fixture_pid" 2>/dev/null || true' EXIT
port=""
for attempt in {1..50}; do
port="$(head -n 1 "$results/fixture.log")"
[[ "$port" =~ ^[0-9]+$ ]] && break
kill -0 "$fixture_pid" 2>/dev/null || break
sleep 0.1
done
if [[ ! "$port" =~ ^[0-9]+$ ]]; then
cat "$results/fixture.log" >&2
echo "Could not start the local test fixture." >&2
exit 1
fi
fixture="http://127.0.0.1:$port"
export TEST_RUNNER_AISTUDIO_TEST_MCP_URLS="${TEST_RUNNER_AISTUDIO_TEST_MCP_URLS:-$fixture/modern,$fixture/legacy}"
export TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL="${TEST_RUNNER_AISTUDIO_TEST_OLLAMA_FIXTURE_URL:-$fixture/ollama}"
fi
xcodebuild CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= -project AIStudio.xcodeproj -scheme AIStudio -configuration Debug \
-destination 'platform=macOS,arch=arm64' -derivedDataPath "$base/Derived" \
-clonedSourcePackagesDirPath "$base/Packages" -disablePackageRepositoryCache \
-parallel-testing-enabled NO -resultBundlePath "$results/AIStudio.xcresult" test