mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-15 19:39:42 +00:00
Merge branch 'upstream' into concedo_experimental
# Conflicts: # .github/workflows/build.yml # README.md # common/common.cpp # examples/embedding/embedding.cpp # examples/json_schema_to_grammar.py # examples/llama.android/llama/src/main/cpp/llama-android.cpp # examples/llama.swiftui/README.md # examples/llama.swiftui/llama.swiftui.xcodeproj/project.pbxproj # examples/lookahead/lookahead.cpp # examples/parallel/parallel.cpp # examples/passkey/passkey.cpp # ggml/CMakeLists.txt # ggml/src/CMakeLists.txt # ggml/src/ggml-cpu/CMakeLists.txt # requirements.txt # requirements/requirements-all.txt # scripts/fetch_server_test_models.py # tests/test-chat.cpp # tests/test-json-schema-to-grammar.cpp
This commit is contained in:
commit
ec43d2b147
52 changed files with 5600 additions and 946 deletions
5
scripts/apple/validate-apps.sh
Executable file
5
scripts/apple/validate-apps.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
./scripts/apple/validate-ios.sh
|
||||
./scripts/apple/validate-macos.sh
|
||||
./scripts/apple/validate-visionos.sh
|
||||
./scripts/apple/validate-tvos.sh
|
820
scripts/apple/validate-ios.sh
Executable file
820
scripts/apple/validate-ios.sh
Executable file
|
@ -0,0 +1,820 @@
|
|||
#!/bin/bash
|
||||
# validate-ios.sh - Validate iOS Application with embedded llama.xcframework using SwiftUI
|
||||
|
||||
# Authentication options (optional) (can be set via environment variables)
|
||||
# To use: export APPLE_ID=your.email@example.com
|
||||
# export APPLE_PASSWORD=your-app-specific-password
|
||||
# ./validate-ios.sh
|
||||
APPLE_ID=${APPLE_ID:-""}
|
||||
APPLE_PASSWORD=${APPLE_PASSWORD:-""}
|
||||
|
||||
# Ensure the script exits on error
|
||||
set -e
|
||||
|
||||
# Function to print usage instructions
|
||||
print_usage() {
|
||||
echo "Usage: ./validate-ios.sh [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --help Show this help message"
|
||||
echo " --apple-id EMAIL Apple ID email for validation"
|
||||
echo " --apple-password PWD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Environment variables:"
|
||||
echo " APPLE_ID Apple ID email for validation"
|
||||
echo " APPLE_PASSWORD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Notes:"
|
||||
echo " - Command line options take precedence over environment variables"
|
||||
echo " - Authentication is optional. If not provided, alternative validation will be performed"
|
||||
echo " - For APPLE_PASSWORD, use an app-specific password generated at https://appleid.apple.com/account/manage"
|
||||
}
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--help)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
--apple-id)
|
||||
APPLE_ID="$2"
|
||||
shift 2
|
||||
;;
|
||||
--apple-password)
|
||||
APPLE_PASSWORD="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Function to clean up in case of error
|
||||
cleanup() {
|
||||
# Don't clean up temp files on error to help with debugging
|
||||
echo "===== iOS Validation Process Failed ====="
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set up trap to call cleanup function on error
|
||||
trap cleanup ERR
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
|
||||
BUILD_DIR="${ROOT_DIR}/validation-builds/ios"
|
||||
|
||||
# Configuration
|
||||
APP_NAME="iOSLlamaTest"
|
||||
BUNDLE_ID="org.ggml.iOSLlamaTest"
|
||||
XCFRAMEWORK_PATH="${ROOT_DIR}/build-apple/llama.xcframework"
|
||||
TEMP_DIR="${BUILD_DIR}/temp"
|
||||
ARCHIVE_PATH="${BUILD_DIR}/${APP_NAME}.xcarchive"
|
||||
IPA_PATH="${BUILD_DIR}/${APP_NAME}.ipa"
|
||||
VALIDATION_DIR="${BUILD_DIR}/validation"
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
mkdir -p "${TEMP_DIR}"
|
||||
mkdir -p "${VALIDATION_DIR}"
|
||||
|
||||
echo "===== iOS Validation Process Started ====="
|
||||
|
||||
# 1. Create a simple test app project
|
||||
echo "Creating test iOS app project..."
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Info.plist" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${BUNDLE_ID}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchScreen</key>
|
||||
<dict/>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Create SwiftUI app files
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources"
|
||||
|
||||
# Create App.swift
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/App.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
@main
|
||||
struct LlamaTestApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create ContentView.swift
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/ContentView.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
struct ContentView: View {
|
||||
// Test that we can initialize a llama context params struct
|
||||
let params = llama_context_default_params()
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 20) {
|
||||
Text("Llama Framework Test")
|
||||
.font(.largeTitle)
|
||||
.padding()
|
||||
|
||||
Text("llama_context_default_params() created successfully")
|
||||
.font(.headline)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding()
|
||||
|
||||
// Display some param values to confirm the framework is working
|
||||
Text("n_ctx: \(params.n_ctx)")
|
||||
.font(.body)
|
||||
|
||||
Text("n_batch: \(params.n_batch)")
|
||||
.font(.body)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create project.pbxproj, fixing the framework search paths issues
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
11111111111111111111111 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22222222222222222222222; };
|
||||
33333333333333333333333 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44444444444444444444444; };
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
88888888888888888888888 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
99999999999999999999999 /* ${APP_NAME}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "${APP_NAME}.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22222222222222222222222 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
|
||||
44444444444444444444444 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
66666666666666666666666 /* llama.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = llama.xcframework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the project file with fixed framework search paths
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
99999999999999999999999 /* ${APP_NAME}.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EOF
|
||||
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
66666666666666666666666 /* llama.xcframework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EEEEEEEEEEEEEEEEEEEEEEEE = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* iOSLlamaTest */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */,
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* iOSLlamaTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1111111111111111111111AA /* Sources */,
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */,
|
||||
);
|
||||
path = "iOSLlamaTest";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1111111111111111111111AA /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22222222222222222222222 /* App.swift */,
|
||||
44444444444444444444444 /* ContentView.swift */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin PBXNativeTarget section */
|
||||
3333333333333333333333AA /* ${APP_NAME} */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */;
|
||||
buildPhases = (
|
||||
5555555555555555555555AA /* Sources */,
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */,
|
||||
6666666666666666666666AA /* Resources */,
|
||||
88888888888888888888888 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "${APP_NAME}";
|
||||
productName = "${APP_NAME}";
|
||||
productReference = 99999999999999999999999 /* ${APP_NAME}.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
7777777777777777777777AA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1240;
|
||||
LastUpgradeCheck = 1240;
|
||||
TargetAttributes = {
|
||||
3333333333333333333333AA = {
|
||||
CreatedOnToolsVersion = 12.4;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */;
|
||||
compatibilityVersion = "Xcode 12.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = EEEEEEEEEEEEEEEEEEEEEEEE;
|
||||
productRefGroup = CCCCCCCCCCCCCCCCCCCCCCCC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3333333333333333333333AA /* ${APP_NAME} */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the file with correct FRAMEWORK_SEARCH_PATHS
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
6666666666666666666666AA /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
5555555555555555555555AA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33333333333333333333333 /* ContentView.swift in Sources */,
|
||||
11111111111111111111111 /* App.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
9999999999999999999999AA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)";
|
||||
INFOPLIST_FILE = "iOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.iOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
INFOPLIST_FILE = "iOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.iOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
EOF
|
||||
|
||||
# Finish the project.pbxproj file
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin XCConfigurationList section */
|
||||
8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9999999999999999999999AA /* Debug */,
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 7777777777777777777777AA /* Project object */;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 2. Copy XCFramework to test project
|
||||
echo "Copying XCFramework to test project..."
|
||||
cp -R "${XCFRAMEWORK_PATH}" "${TEMP_DIR}/${APP_NAME}/"
|
||||
|
||||
# 3. Build and archive the app
|
||||
echo "Building and archiving test app..."
|
||||
cd "${TEMP_DIR}/${APP_NAME}"
|
||||
|
||||
# Create a simple xcscheme file to avoid xcodebuild scheme issues
|
||||
mkdir -p "${APP_NAME}.xcodeproj/xcshareddata/xcschemes"
|
||||
cat > "${APP_NAME}.xcodeproj/xcshareddata/xcschemes/${APP_NAME}.xcscheme" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1240"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
EOF
|
||||
|
||||
# Now use xcodebuild with an explicitly defined product name
|
||||
xcodebuild -project "${APP_NAME}.xcodeproj" -scheme "${APP_NAME}" -sdk iphoneos -configuration Release archive -archivePath "${ARCHIVE_PATH}" CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO PRODUCT_NAME="${APP_NAME}" SWIFT_OPTIMIZATION_LEVEL="-Onone" -quiet
|
||||
|
||||
# 4. Create IPA from archive
|
||||
echo "Creating IPA from archive..."
|
||||
mkdir -p "${TEMP_DIR}/Payload"
|
||||
cp -R "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" "${TEMP_DIR}/Payload/"
|
||||
|
||||
# Check and log app structure before zipping
|
||||
echo "App structure:"
|
||||
ls -la "${TEMP_DIR}/Payload/${APP_NAME}.app/"
|
||||
echo "Frameworks:"
|
||||
ls -la "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/" 2>/dev/null || echo "No Frameworks directory found"
|
||||
|
||||
cd "${TEMP_DIR}"
|
||||
zip -r "${IPA_PATH}" Payload
|
||||
|
||||
# Check embedded provisioning profile
|
||||
echo "Checking provisioning profile (if any)..."
|
||||
PROVISIONING_PROFILE=$(find "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" -name "embedded.mobileprovision" 2>/dev/null)
|
||||
if [ -n "$PROVISIONING_PROFILE" ]; then
|
||||
echo "Found embedded provisioning profile:"
|
||||
security cms -D -i "$PROVISIONING_PROFILE" || echo "Unable to decode provisioning profile"
|
||||
else
|
||||
echo "No embedded provisioning profile found (expected for ad-hoc builds)"
|
||||
fi
|
||||
|
||||
# 5. Validate the IPA
|
||||
echo "Validating IPA..."
|
||||
VALIDATION_OUTPUT="${VALIDATION_DIR}/validation_output.txt"
|
||||
|
||||
# Check if authentication credentials are provided
|
||||
AUTH_ARGS=""
|
||||
if [ -n "$APPLE_ID" ] && [ -n "$APPLE_PASSWORD" ]; then
|
||||
echo "Using Apple ID authentication for validation..."
|
||||
AUTH_ARGS="--username \"$APPLE_ID\" --password \"$APPLE_PASSWORD\""
|
||||
else
|
||||
echo "No authentication credentials provided. Will perform basic validation."
|
||||
echo "To use your personal developer account, you can run the script with:"
|
||||
echo " APPLE_ID='your.email@example.com' APPLE_PASSWORD='your-app-specific-password' ./validate-ios.sh"
|
||||
echo "Note: You need to create an app-specific password at https://appleid.apple.com/account/manage"
|
||||
fi
|
||||
|
||||
# Run validation with detailed output
|
||||
echo "Running validation with altool..."
|
||||
if [ -n "$AUTH_ARGS" ]; then
|
||||
# Use eval to properly handle the quoted arguments
|
||||
eval "xcrun altool --validate-app -f \"${IPA_PATH}\" --type ios --output-format xml $AUTH_ARGS" 2>&1 | tee "${VALIDATION_OUTPUT}"
|
||||
else
|
||||
xcrun altool --validate-app -f "${IPA_PATH}" --type ios --output-format xml 2>&1 | tee "${VALIDATION_OUTPUT}"
|
||||
fi
|
||||
VALIDATION_RESULT=$?
|
||||
|
||||
# Final validation result
|
||||
FINAL_VALIDATION_RESULT=0
|
||||
|
||||
# Check if validation failed because the app isn't in App Store Connect
|
||||
if grep -q "No suitable application records were found" "${VALIDATION_OUTPUT}"; then
|
||||
echo "⚠️ App Store Connect Warning: The app bundle identifier is not found in App Store Connect"
|
||||
echo "This is expected for apps that haven't been registered in App Store Connect yet."
|
||||
echo "This doesn't indicate a problem with the build or framework."
|
||||
|
||||
# Perform alternative validation
|
||||
echo "Performing alternative validation checks..."
|
||||
|
||||
# Check if IPA was created successfully
|
||||
if [ -f "${IPA_PATH}" ] && [ -s "${IPA_PATH}" ]; then
|
||||
echo "✅ IPA file created successfully"
|
||||
else
|
||||
echo "❌ IPA file not created or empty"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if app binary exists and is executable
|
||||
if [ -f "${TEMP_DIR}/Payload/${APP_NAME}.app/${APP_NAME}" ] && [ -x "${TEMP_DIR}/Payload/${APP_NAME}.app/${APP_NAME}" ]; then
|
||||
echo "✅ App binary exists and is executable"
|
||||
else
|
||||
echo "❌ App binary missing or not executable"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework was properly embedded
|
||||
if [ -d "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework" ]; then
|
||||
echo "✅ llama.framework properly embedded"
|
||||
else
|
||||
echo "❌ llama.framework not properly embedded"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework binary exists
|
||||
if [ -f "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework/llama" ]; then
|
||||
echo "✅ Framework binary exists"
|
||||
|
||||
# Further validate framework by checking architecture
|
||||
ARCHS=$(lipo -info "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework/llama" 2>/dev/null | grep -o "arm64\\|armv7\\|x86_64" | tr '\n' ' ')
|
||||
if [ -n "$ARCHS" ]; then
|
||||
echo "✅ Framework architecture(s): $ARCHS"
|
||||
else
|
||||
echo "⚠️ Could not determine framework architecture"
|
||||
fi
|
||||
else
|
||||
echo "❌ Framework binary missing"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
echo "✅ Alternative validation PASSED: App built successfully with embedded framework"
|
||||
else
|
||||
echo "❌ Alternative validation FAILED: Issues found with the app or framework"
|
||||
fi
|
||||
elif grep -q "You must specify authentication credentials" "${VALIDATION_OUTPUT}" && [ -z "$AUTH_ARGS" ]; then
|
||||
echo "✅ iOS Validation PASSED: IPA successfully validated"
|
||||
echo "Results saved to ${VALIDATION_OUTPUT}"
|
||||
else
|
||||
echo "❌ iOS Validation FAILED: IPA validation found issues"
|
||||
echo "See validation output at ${VALIDATION_OUTPUT}"
|
||||
echo ""
|
||||
echo "==== VALIDATION ERRORS ===="
|
||||
|
||||
# Try to extract specific errors from the output
|
||||
if grep -q "Error" "${VALIDATION_OUTPUT}"; then
|
||||
grep -A 5 "Error" "${VALIDATION_OUTPUT}"
|
||||
else
|
||||
# If no specific error found, show the whole log
|
||||
cat "${VALIDATION_OUTPUT}"
|
||||
fi
|
||||
|
||||
# Additional debugging: check IPA contents
|
||||
echo ""
|
||||
echo "==== IPA CONTENTS ===="
|
||||
mkdir -p "${TEMP_DIR}/ipa_contents"
|
||||
unzip -q "${IPA_PATH}" -d "${TEMP_DIR}/ipa_contents"
|
||||
ls -la "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app/"
|
||||
|
||||
# Check for code signing issues
|
||||
echo ""
|
||||
echo "==== CODE SIGNING INFO ===="
|
||||
codesign -vv -d "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app" 2>&1 || echo "Code signing verification failed"
|
||||
|
||||
# Check embedded frameworks
|
||||
echo ""
|
||||
echo "==== FRAMEWORK INFO ===="
|
||||
ls -la "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app/Frameworks/" 2>/dev/null || echo "No Frameworks directory found"
|
||||
fi
|
||||
|
||||
# Don't clean up on error to allow inspection
|
||||
if [ $FINAL_VALIDATION_RESULT -ne 0 ]; then
|
||||
echo ""
|
||||
echo "Temporary files kept for inspection at: ${TEMP_DIR}"
|
||||
echo "===== iOS Validation Process Failed ====="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up temporary files but keep build artifacts
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
echo "Cleaning up temporary files..."
|
||||
#rm -rf "${TEMP_DIR}"
|
||||
fi
|
||||
|
||||
echo "===== iOS Validation Process Completed ====="
|
||||
exit $FINAL_VALIDATION_RESULT
|
781
scripts/apple/validate-macos.sh
Executable file
781
scripts/apple/validate-macos.sh
Executable file
|
@ -0,0 +1,781 @@
|
|||
#!/bin/bash
|
||||
# validate-macos.sh - Validate macOS Application with embedded llama.xcframework using SwiftUI
|
||||
|
||||
# Authentication options (optional) (can be set via environment variables)
|
||||
# To use: export APPLE_ID=your.email@example.com
|
||||
# export APPLE_PASSWORD=your-app-specific-password
|
||||
# ./validate-macos.sh
|
||||
APPLE_ID=${APPLE_ID:-""}
|
||||
APPLE_PASSWORD=${APPLE_PASSWORD:-""}
|
||||
|
||||
# Ensure the script exits on error
|
||||
set -e
|
||||
|
||||
# Function to print usage instructions
|
||||
print_usage() {
|
||||
echo "Usage: ./validate-macos.sh [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --help Show this help message"
|
||||
echo " --apple-id EMAIL Apple ID email for validation"
|
||||
echo " --apple-password PWD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Environment variables:"
|
||||
echo " APPLE_ID Apple ID email for validation"
|
||||
echo " APPLE_PASSWORD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Notes:"
|
||||
echo " - Command line options take precedence over environment variables"
|
||||
echo " - Authentication is optional. If not provided, alternative validation will be performed"
|
||||
echo " - For APPLE_PASSWORD, use an app-specific password generated at https://appleid.apple.com/account/manage"
|
||||
}
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--help)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
--apple-id)
|
||||
APPLE_ID="$2"
|
||||
shift 2
|
||||
;;
|
||||
--apple-password)
|
||||
APPLE_PASSWORD="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Function to clean up in case of error
|
||||
cleanup() {
|
||||
# Don't clean up temp files on error to help with debugging
|
||||
echo "===== macOS Validation Process Failed ====="
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set up trap to call cleanup function on error
|
||||
trap cleanup ERR
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
|
||||
BUILD_DIR="${ROOT_DIR}/validation-builds/ios"
|
||||
|
||||
# Configuration
|
||||
APP_NAME="MacOSLlamaTest"
|
||||
BUNDLE_ID="org.ggml.MacOSLlamaTest"
|
||||
XCFRAMEWORK_PATH="${ROOT_DIR}/build-apple/llama.xcframework"
|
||||
TEMP_DIR="${BUILD_DIR}/temp"
|
||||
ARCHIVE_PATH="${BUILD_DIR}/${APP_NAME}.xcarchive"
|
||||
APP_PATH="${BUILD_DIR}/${APP_NAME}.app"
|
||||
ZIP_PATH="${BUILD_DIR}/${APP_NAME}.zip"
|
||||
VALIDATION_DIR="${BUILD_DIR}/validation"
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
mkdir -p "${TEMP_DIR}"
|
||||
mkdir -p "${VALIDATION_DIR}"
|
||||
|
||||
echo "===== macOS Validation Process Started ====="
|
||||
|
||||
# 1. Create a simple test app project
|
||||
echo "Creating test macOS app project..."
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Info.plist" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${BUNDLE_ID}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>12.0</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2025 GGML. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Create SwiftUI app files
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources"
|
||||
|
||||
# Create App.swift
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/App.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
@main
|
||||
struct LlamaTestApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create ContentView.swift with macOS specific elements
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/ContentView.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
struct ContentView: View {
|
||||
// Test that we can initialize a llama context params struct
|
||||
let params = llama_context_default_params()
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 20) {
|
||||
Text("Llama Framework Test on macOS")
|
||||
.font(.largeTitle)
|
||||
.padding()
|
||||
|
||||
Text("llama_context_default_params() created successfully")
|
||||
.font(.headline)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding()
|
||||
|
||||
// Display some param values to confirm the framework is working
|
||||
Text("n_ctx: \(params.n_ctx)")
|
||||
.font(.body)
|
||||
|
||||
Text("n_batch: \(params.n_batch)")
|
||||
.font(.body)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
.frame(width: 600, height: 400)
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create project.pbxproj, fixing the framework search paths issues
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
11111111111111111111111 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22222222222222222222222; };
|
||||
33333333333333333333333 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44444444444444444444444; };
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
88888888888888888888888 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
99999999999999999999999 /* ${APP_NAME}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "${APP_NAME}.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22222222222222222222222 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
|
||||
44444444444444444444444 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
66666666666666666666666 /* llama.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = llama.xcframework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the project file with fixed framework search paths
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
99999999999999999999999 /* ${APP_NAME}.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EOF
|
||||
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
66666666666666666666666 /* llama.xcframework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EEEEEEEEEEEEEEEEEEEEEEEE = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* MacOSLlamaTest */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */,
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* MacOSLlamaTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1111111111111111111111AA /* Sources */,
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */,
|
||||
);
|
||||
path = "MacOSLlamaTest";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1111111111111111111111AA /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22222222222222222222222 /* App.swift */,
|
||||
44444444444444444444444 /* ContentView.swift */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin PBXNativeTarget section */
|
||||
3333333333333333333333AA /* ${APP_NAME} */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */;
|
||||
buildPhases = (
|
||||
5555555555555555555555AA /* Sources */,
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */,
|
||||
6666666666666666666666AA /* Resources */,
|
||||
88888888888888888888888 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "${APP_NAME}";
|
||||
productName = "${APP_NAME}";
|
||||
productReference = 99999999999999999999999 /* ${APP_NAME}.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
7777777777777777777777AA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1240;
|
||||
LastUpgradeCheck = 1240;
|
||||
TargetAttributes = {
|
||||
3333333333333333333333AA = {
|
||||
CreatedOnToolsVersion = 12.4;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */;
|
||||
compatibilityVersion = "Xcode 12.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = EEEEEEEEEEEEEEEEEEEEEEEE;
|
||||
productRefGroup = CCCCCCCCCCCCCCCCCCCCCCCC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3333333333333333333333AA /* ${APP_NAME} */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the file with correct FRAMEWORK_SEARCH_PATHS and macOS settings
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
6666666666666666666666AA /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
5555555555555555555555AA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33333333333333333333333 /* ContentView.swift in Sources */,
|
||||
11111111111111111111111 /* App.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
9999999999999999999999AA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)";
|
||||
INFOPLIST_FILE = "MacOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.MacOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
INFOPLIST_FILE = "MacOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.MacOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
EOF
|
||||
|
||||
# Finish the project.pbxproj file
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin XCConfigurationList section */
|
||||
8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9999999999999999999999AA /* Debug */,
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 7777777777777777777777AA /* Project object */;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 2. Copy XCFramework to test project
|
||||
echo "Copying XCFramework to test project..."
|
||||
cp -R "${XCFRAMEWORK_PATH}" "${TEMP_DIR}/${APP_NAME}/"
|
||||
|
||||
# 3. Build and archive the app
|
||||
echo "Building and archiving test app..."
|
||||
cd "${TEMP_DIR}/${APP_NAME}"
|
||||
|
||||
# Create a simple xcscheme file to avoid xcodebuild scheme issues
|
||||
mkdir -p "${APP_NAME}.xcodeproj/xcshareddata/xcschemes"
|
||||
cat > "${APP_NAME}.xcodeproj/xcshareddata/xcschemes/${APP_NAME}.xcscheme" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1240"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
EOF
|
||||
|
||||
# Now use xcodebuild with an explicitly defined product name for macOS
|
||||
xcodebuild -project "${APP_NAME}.xcodeproj" -scheme "${APP_NAME}" -sdk macosx -configuration Release archive -archivePath "${ARCHIVE_PATH}" CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO PRODUCT_NAME="${APP_NAME}" SWIFT_OPTIMIZATION_LEVEL="-Onone" -quiet
|
||||
|
||||
# 4. Create a package for distribution
|
||||
echo "Creating distributable package from archive..."
|
||||
cp -R "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" "${APP_PATH}"
|
||||
|
||||
# Check and log app structure
|
||||
echo "App structure:"
|
||||
ls -la "${APP_PATH}"
|
||||
echo "Frameworks:"
|
||||
ls -la "${APP_PATH}/Contents/Frameworks/" 2>/dev/null || echo "No Frameworks directory found"
|
||||
|
||||
# Create a zip file for potential distribution
|
||||
cd "${BUILD_DIR}"
|
||||
zip -r "${ZIP_PATH}" "${APP_NAME}.app"
|
||||
|
||||
# Check embedded provisioning profile
|
||||
echo "Checking provisioning profile (if any)..."
|
||||
PROVISIONING_PROFILE=$(find "${APP_PATH}/Contents" -name "embedded.provisionprofile" 2>/dev/null)
|
||||
if [ -n "$PROVISIONING_PROFILE" ]; then
|
||||
echo "Found embedded provisioning profile:"
|
||||
security cms -D -i "$PROVISIONING_PROFILE" || echo "Unable to decode provisioning profile"
|
||||
else
|
||||
echo "No embedded provisioning profile found (expected for ad-hoc builds)"
|
||||
fi
|
||||
|
||||
# 5. Validate the app
|
||||
echo "Validating macOS app..."
|
||||
VALIDATION_OUTPUT="${VALIDATION_DIR}/validation_output.txt"
|
||||
|
||||
# Check if authentication credentials are provided
|
||||
AUTH_ARGS=""
|
||||
if [ -n "$APPLE_ID" ] && [ -n "$APPLE_PASSWORD" ]; then
|
||||
echo "Using Apple ID authentication for validation..."
|
||||
AUTH_ARGS="--username \"$APPLE_ID\" --password \"$APPLE_PASSWORD\""
|
||||
else
|
||||
echo "No authentication credentials provided. Will perform basic validation."
|
||||
echo "To use your personal developer account, you can run the script with:"
|
||||
echo " APPLE_ID='your.email@example.com' APPLE_PASSWORD='your-app-specific-password' ./validate-macos.sh"
|
||||
echo "Note: You need to create an app-specific password at https://appleid.apple.com/account/manage"
|
||||
fi
|
||||
|
||||
# For macOS we need to use notarytool or alternative checks because altool doesn't support macOS apps in the same way
|
||||
echo "Note: For macOS, formal notarization process would require Apple Developer credentials."
|
||||
echo "Performing alternative validation checks..."
|
||||
|
||||
# Final validation result
|
||||
FINAL_VALIDATION_RESULT=0
|
||||
|
||||
# Check if app was created successfully
|
||||
if [ -d "${APP_PATH}" ] && [ -s "${APP_PATH}/Contents/MacOS/${APP_NAME}" ]; then
|
||||
echo "✅ App package created successfully"
|
||||
else
|
||||
echo "❌ App package not created or binary missing"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if app binary exists and is executable
|
||||
if [ -f "${APP_PATH}/Contents/MacOS/${APP_NAME}" ] && [ -x "${APP_PATH}/Contents/MacOS/${APP_NAME}" ]; then
|
||||
echo "✅ App binary exists and is executable"
|
||||
else
|
||||
echo "❌ App binary missing or not executable"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework was properly embedded
|
||||
if [ -d "${APP_PATH}/Contents/Frameworks/llama.framework" ]; then
|
||||
echo "✅ llama.framework properly embedded"
|
||||
else
|
||||
echo "❌ llama.framework not properly embedded"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework binary exists
|
||||
if [ -f "${APP_PATH}/Contents/Frameworks/llama.framework/Versions/A/llama" ]; then
|
||||
echo "✅ Framework binary exists"
|
||||
|
||||
# Further validate framework by checking architecture
|
||||
ARCHS=$(lipo -info "${APP_PATH}/Contents/Frameworks/llama.framework/Versions/A/llama" 2>/dev/null | grep -o "arm64\\|x86_64" | tr '\n' ' ')
|
||||
if [ -n "$ARCHS" ]; then
|
||||
echo "✅ Framework architecture(s): $ARCHS"
|
||||
else
|
||||
echo "⚠️ Could not determine framework architecture"
|
||||
fi
|
||||
else
|
||||
echo "❌ Framework binary missing"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check code signing
|
||||
echo ""
|
||||
echo "==== CODE SIGNING INFO ===="
|
||||
codesign -vv -d "${APP_PATH}" 2>&1 || echo "Code signing verification not available (expected for ad-hoc builds)"
|
||||
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
if [ -n "$AUTH_ARGS" ]; then
|
||||
echo ""
|
||||
echo "To notarize this app with Apple (requires Apple Developer account):"
|
||||
echo "xcrun notarytool submit \"${ZIP_PATH}\" --apple-id \"your-apple-id\" --password \"your-app-specific-password\" --team-id \"your-team-id\" --wait"
|
||||
echo ""
|
||||
fi
|
||||
echo "✅ Validation PASSED: macOS app built successfully with embedded framework"
|
||||
else
|
||||
echo "❌ Validation FAILED: Issues found with the app or framework"
|
||||
fi
|
||||
|
||||
# Don't clean up on error to allow inspection
|
||||
if [ $FINAL_VALIDATION_RESULT -ne 0 ]; then
|
||||
echo ""
|
||||
echo "Temporary files kept for inspection at: ${TEMP_DIR}"
|
||||
echo "===== macOS Validation Process Failed ====="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up temporary files but keep build artifacts
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
echo "Cleaning up temporary files..."
|
||||
#rm -rf "${TEMP_DIR}"
|
||||
fi
|
||||
|
||||
echo "===== macOS Validation Process Completed ====="
|
||||
echo "App package available at: ${APP_PATH}"
|
||||
echo "Zipped app available at: ${ZIP_PATH}"
|
||||
exit $FINAL_VALIDATION_RESULT
|
813
scripts/apple/validate-tvos.sh
Executable file
813
scripts/apple/validate-tvos.sh
Executable file
|
@ -0,0 +1,813 @@
|
|||
#!/bin/bash
|
||||
# validate-tvos.sh - Validate tvOS Application with embedded llama.xcframework using SwiftUI
|
||||
|
||||
# Authentication options (optional) (can be set via environment variables)
|
||||
# To use: export APPLE_ID=your.email@example.com
|
||||
# export APPLE_PASSWORD=your-app-specific-password
|
||||
# ./validate-tvos.sh
|
||||
APPLE_ID=${APPLE_ID:-""}
|
||||
APPLE_PASSWORD=${APPLE_PASSWORD:-""}
|
||||
|
||||
# Ensure the script exits on error
|
||||
set -e
|
||||
|
||||
# Function to print usage instructions
|
||||
print_usage() {
|
||||
echo "Usage: ./validate-tvos.sh [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --help Show this help message"
|
||||
echo " --apple-id EMAIL Apple ID email for validation"
|
||||
echo " --apple-password PWD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Environment variables:"
|
||||
echo " APPLE_ID Apple ID email for validation"
|
||||
echo " APPLE_PASSWORD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Notes:"
|
||||
echo " - Command line options take precedence over environment variables"
|
||||
echo " - Authentication is optional. If not provided, alternative validation will be performed"
|
||||
echo " - For APPLE_PASSWORD, use an app-specific password generated at https://appleid.apple.com/account/manage"
|
||||
}
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--help)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
--apple-id)
|
||||
APPLE_ID="$2"
|
||||
shift 2
|
||||
;;
|
||||
--apple-password)
|
||||
APPLE_PASSWORD="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Function to clean up in case of error
|
||||
cleanup() {
|
||||
# Don't clean up temp files on error to help with debugging
|
||||
echo "===== tvOS Validation Process Failed ====="
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set up trap to call cleanup function on error
|
||||
trap cleanup ERR
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
|
||||
BUILD_DIR="${ROOT_DIR}/validation-builds/ios"
|
||||
|
||||
# Configuration
|
||||
APP_NAME="TVOSLlamaTest"
|
||||
BUNDLE_ID="org.ggml.TVOSLlamaTest"
|
||||
XCFRAMEWORK_PATH="${ROOT_DIR}/build-apple/llama.xcframework"
|
||||
TEMP_DIR="${BUILD_DIR}/temp"
|
||||
ARCHIVE_PATH="${BUILD_DIR}/${APP_NAME}.xcarchive"
|
||||
IPA_PATH="${BUILD_DIR}/${APP_NAME}.ipa"
|
||||
VALIDATION_DIR="${BUILD_DIR}/validation"
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
mkdir -p "${TEMP_DIR}"
|
||||
mkdir -p "${VALIDATION_DIR}"
|
||||
|
||||
echo "===== tvOS Validation Process Started ====="
|
||||
|
||||
# 1. Create a simple test app project
|
||||
echo "Creating test tvOS app project..."
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Info.plist" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${BUNDLE_ID}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Create SwiftUI app files
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources"
|
||||
|
||||
# Create App.swift
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/App.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
@main
|
||||
struct LlamaTestApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create ContentView.swift with tvOS specific elements
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/ContentView.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
struct ContentView: View {
|
||||
// Test that we can initialize a llama context params struct
|
||||
let params = llama_context_default_params()
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 40) {
|
||||
Text("Llama Framework Test on tvOS")
|
||||
.font(.largeTitle)
|
||||
.padding()
|
||||
|
||||
Text("llama_context_default_params() created successfully")
|
||||
.font(.headline)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding()
|
||||
|
||||
// Display some param values to confirm the framework is working
|
||||
Text("n_ctx: \(params.n_ctx)")
|
||||
.font(.title2)
|
||||
|
||||
Text("n_batch: \(params.n_batch)")
|
||||
.font(.title2)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(50)
|
||||
// Larger size suitable for TV display
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create project.pbxproj, fixing the framework search paths issues
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
11111111111111111111111 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22222222222222222222222; };
|
||||
33333333333333333333333 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44444444444444444444444; };
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
88888888888888888888888 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
99999999999999999999999 /* ${APP_NAME}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "${APP_NAME}.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22222222222222222222222 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
|
||||
44444444444444444444444 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
66666666666666666666666 /* llama.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = llama.xcframework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the project file with fixed framework search paths
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
99999999999999999999999 /* ${APP_NAME}.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EOF
|
||||
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
66666666666666666666666 /* llama.xcframework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EEEEEEEEEEEEEEEEEEEEEEEE = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* TVOSLlamaTest */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */,
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* TVOSLlamaTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1111111111111111111111AA /* Sources */,
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */,
|
||||
);
|
||||
path = "TVOSLlamaTest";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1111111111111111111111AA /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22222222222222222222222 /* App.swift */,
|
||||
44444444444444444444444 /* ContentView.swift */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin PBXNativeTarget section */
|
||||
3333333333333333333333AA /* ${APP_NAME} */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */;
|
||||
buildPhases = (
|
||||
5555555555555555555555AA /* Sources */,
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */,
|
||||
6666666666666666666666AA /* Resources */,
|
||||
88888888888888888888888 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "${APP_NAME}";
|
||||
productName = "${APP_NAME}";
|
||||
productReference = 99999999999999999999999 /* ${APP_NAME}.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
7777777777777777777777AA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1240;
|
||||
LastUpgradeCheck = 1240;
|
||||
TargetAttributes = {
|
||||
3333333333333333333333AA = {
|
||||
CreatedOnToolsVersion = 12.4;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */;
|
||||
compatibilityVersion = "Xcode 12.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = EEEEEEEEEEEEEEEEEEEEEEEE;
|
||||
productRefGroup = CCCCCCCCCCCCCCCCCCCCCCCC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3333333333333333333333AA /* ${APP_NAME} */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the file with correct FRAMEWORK_SEARCH_PATHS and tvOS settings
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
6666666666666666666666AA /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
5555555555555555555555AA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33333333333333333333333 /* ContentView.swift in Sources */,
|
||||
11111111111111111111111 /* App.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
9999999999999999999999AA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = appletvos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)";
|
||||
INFOPLIST_FILE = "TVOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.TVOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
INFOPLIST_FILE = "TVOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.TVOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = 3;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
EOF
|
||||
|
||||
# Finish the project.pbxproj file
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin XCConfigurationList section */
|
||||
8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9999999999999999999999AA /* Debug */,
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 7777777777777777777777AA /* Project object */;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 2. Copy XCFramework to test project
|
||||
echo "Copying XCFramework to test project..."
|
||||
cp -R "${XCFRAMEWORK_PATH}" "${TEMP_DIR}/${APP_NAME}/"
|
||||
|
||||
# 3. Build and archive the app
|
||||
echo "Building and archiving test app..."
|
||||
cd "${TEMP_DIR}/${APP_NAME}"
|
||||
|
||||
# Create a simple xcscheme file to avoid xcodebuild scheme issues
|
||||
mkdir -p "${APP_NAME}.xcodeproj/xcshareddata/xcschemes"
|
||||
cat > "${APP_NAME}.xcodeproj/xcshareddata/xcschemes/${APP_NAME}.xcscheme" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1240"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
EOF
|
||||
|
||||
# Now use xcodebuild with an explicitly defined product name for tvOS
|
||||
xcodebuild -project "${APP_NAME}.xcodeproj" -scheme "${APP_NAME}" -sdk appletvos -configuration Release archive -archivePath "${ARCHIVE_PATH}" CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO PRODUCT_NAME="${APP_NAME}" SWIFT_OPTIMIZATION_LEVEL="-Onone" -quiet
|
||||
|
||||
# 4. Create IPA from archive
|
||||
echo "Creating IPA from archive..."
|
||||
mkdir -p "${TEMP_DIR}/Payload"
|
||||
cp -R "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" "${TEMP_DIR}/Payload/"
|
||||
|
||||
# Check and log app structure before zipping
|
||||
echo "App structure:"
|
||||
ls -la "${TEMP_DIR}/Payload/${APP_NAME}.app/"
|
||||
echo "Frameworks:"
|
||||
ls -la "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/" 2>/dev/null || echo "No Frameworks directory found"
|
||||
|
||||
cd "${TEMP_DIR}"
|
||||
zip -r "${IPA_PATH}" Payload
|
||||
|
||||
# Check embedded provisioning profile
|
||||
echo "Checking provisioning profile (if any)..."
|
||||
PROVISIONING_PROFILE=$(find "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" -name "embedded.mobileprovision" 2>/dev/null)
|
||||
if [ -n "$PROVISIONING_PROFILE" ]; then
|
||||
echo "Found embedded provisioning profile:"
|
||||
security cms -D -i "$PROVISIONING_PROFILE" || echo "Unable to decode provisioning profile"
|
||||
else
|
||||
echo "No embedded provisioning profile found (expected for ad-hoc builds)"
|
||||
fi
|
||||
|
||||
# 5. Validate the IPA
|
||||
echo "Validating IPA..."
|
||||
VALIDATION_OUTPUT="${VALIDATION_DIR}/validation_output.txt"
|
||||
|
||||
# Check if authentication credentials are provided
|
||||
AUTH_ARGS=""
|
||||
if [ -n "$APPLE_ID" ] && [ -n "$APPLE_PASSWORD" ]; then
|
||||
echo "Using Apple ID authentication for validation..."
|
||||
AUTH_ARGS="--username \"$APPLE_ID\" --password \"$APPLE_PASSWORD\""
|
||||
else
|
||||
echo "No authentication credentials provided. Will perform basic validation."
|
||||
echo "To use your personal developer account, you can run the script with:"
|
||||
echo " APPLE_ID='your.email@example.com' APPLE_PASSWORD='your-app-specific-password' ./validate-tvos.sh"
|
||||
echo "Note: You need to create an app-specific password at https://appleid.apple.com/account/manage"
|
||||
fi
|
||||
|
||||
# Run validation with detailed output
|
||||
echo "Running validation with altool..."
|
||||
if [ -n "$AUTH_ARGS" ]; then
|
||||
# Use eval to properly handle the quoted arguments
|
||||
eval "xcrun altool --validate-app -f \"${IPA_PATH}\" --type tvos --output-format xml $AUTH_ARGS" 2>&1 | tee "${VALIDATION_OUTPUT}"
|
||||
else
|
||||
xcrun altool --validate-app -f "${IPA_PATH}" --type tvos --output-format xml 2>&1 | tee "${VALIDATION_OUTPUT}"
|
||||
fi
|
||||
VALIDATION_RESULT=$?
|
||||
|
||||
# Final validation result
|
||||
FINAL_VALIDATION_RESULT=0
|
||||
|
||||
# Check if validation failed because the app isn't in App Store Connect
|
||||
if grep -q "No suitable application records were found" "${VALIDATION_OUTPUT}"; then
|
||||
echo "⚠️ App Store Connect Warning: The app bundle identifier is not found in App Store Connect"
|
||||
echo "This is expected for apps that haven't been registered in App Store Connect yet."
|
||||
echo "This doesn't indicate a problem with the build or framework."
|
||||
|
||||
# Perform alternative validation
|
||||
echo "Performing alternative validation checks..."
|
||||
|
||||
# Check if IPA was created successfully
|
||||
if [ -f "${IPA_PATH}" ] && [ -s "${IPA_PATH}" ]; then
|
||||
echo "✅ IPA file created successfully"
|
||||
else
|
||||
echo "❌ IPA file not created or empty"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if app binary exists and is executable
|
||||
if [ -f "${TEMP_DIR}/Payload/${APP_NAME}.app/${APP_NAME}" ] && [ -x "${TEMP_DIR}/Payload/${APP_NAME}.app/${APP_NAME}" ]; then
|
||||
echo "✅ App binary exists and is executable"
|
||||
else
|
||||
echo "❌ App binary missing or not executable"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework was properly embedded
|
||||
if [ -d "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework" ]; then
|
||||
echo "✅ llama.framework properly embedded"
|
||||
else
|
||||
echo "❌ llama.framework not properly embedded"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework binary exists
|
||||
if [ -f "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework/llama" ]; then
|
||||
echo "✅ Framework binary exists"
|
||||
|
||||
# Further validate framework by checking architecture
|
||||
ARCHS=$(lipo -info "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework/llama" 2>/dev/null | grep -o "arm64\\|x86_64" | tr '\n' ' ')
|
||||
if [ -n "$ARCHS" ]; then
|
||||
echo "✅ Framework architecture(s): $ARCHS"
|
||||
else
|
||||
echo "⚠️ Could not determine framework architecture"
|
||||
fi
|
||||
else
|
||||
echo "❌ Framework binary missing"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
echo "✅ Alternative validation PASSED: App built successfully with embedded framework"
|
||||
else
|
||||
echo "❌ Alternative validation FAILED: Issues found with the app or framework"
|
||||
fi
|
||||
elif grep -q "You must specify authentication credentials" "${VALIDATION_OUTPUT}" && [ -z "$AUTH_ARGS" ]; then
|
||||
echo "✅ tvOS Validation PASSED: IPA successfully validated"
|
||||
echo "Results saved to ${VALIDATION_OUTPUT}"
|
||||
else
|
||||
echo "❌ tvOS Validation FAILED: IPA validation found issues"
|
||||
echo "See validation output at ${VALIDATION_OUTPUT}"
|
||||
echo ""
|
||||
echo "==== VALIDATION ERRORS ===="
|
||||
|
||||
# Try to extract specific errors from the output
|
||||
if grep -q "Error" "${VALIDATION_OUTPUT}"; then
|
||||
grep -A 5 "Error" "${VALIDATION_OUTPUT}"
|
||||
else
|
||||
# If no specific error found, show the whole log
|
||||
cat "${VALIDATION_OUTPUT}"
|
||||
fi
|
||||
|
||||
# Additional debugging: check IPA contents
|
||||
echo ""
|
||||
echo "==== IPA CONTENTS ===="
|
||||
mkdir -p "${TEMP_DIR}/ipa_contents"
|
||||
unzip -q "${IPA_PATH}" -d "${TEMP_DIR}/ipa_contents"
|
||||
ls -la "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app/"
|
||||
|
||||
# Check for code signing issues
|
||||
echo ""
|
||||
echo "==== CODE SIGNING INFO ===="
|
||||
codesign -vv -d "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app" 2>&1 || echo "Code signing verification failed"
|
||||
|
||||
# Check embedded frameworks
|
||||
echo ""
|
||||
echo "==== FRAMEWORK INFO ===="
|
||||
ls -la "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app/Frameworks/" 2>/dev/null || echo "No Frameworks directory found"
|
||||
fi
|
||||
|
||||
# Don't clean up on error to allow inspection
|
||||
if [ $FINAL_VALIDATION_RESULT -ne 0 ]; then
|
||||
echo ""
|
||||
echo "Temporary files kept for inspection at: ${TEMP_DIR}"
|
||||
echo "===== tvOS Validation Process Failed ====="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up temporary files but keep build artifacts
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
echo "Cleaning up temporary files..."
|
||||
#rm -rf "${TEMP_DIR}"
|
||||
fi
|
||||
|
||||
echo "===== tvOS Validation Process Completed ====="
|
||||
exit $FINAL_VALIDATION_RESULT
|
811
scripts/apple/validate-visionos.sh
Executable file
811
scripts/apple/validate-visionos.sh
Executable file
|
@ -0,0 +1,811 @@
|
|||
#!/bin/bash
|
||||
# validate-visionos.sh - Validate visionOS Application with embedded llama.xcframework using SwiftUI
|
||||
|
||||
# Authentication options (optional) (can be set via environment variables)
|
||||
# To use: export APPLE_ID=your.email@example.com
|
||||
# export APPLE_PASSWORD=your-app-specific-password
|
||||
# ./validate-visionos.sh
|
||||
APPLE_ID=${APPLE_ID:-""}
|
||||
APPLE_PASSWORD=${APPLE_PASSWORD:-""}
|
||||
|
||||
# Ensure the script exits on error
|
||||
set -e
|
||||
|
||||
# Function to print usage instructions
|
||||
print_usage() {
|
||||
echo "Usage: ./validate-visionos.sh [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --help Show this help message"
|
||||
echo " --apple-id EMAIL Apple ID email for validation"
|
||||
echo " --apple-password PWD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Environment variables:"
|
||||
echo " APPLE_ID Apple ID email for validation"
|
||||
echo " APPLE_PASSWORD App-specific password for Apple ID"
|
||||
echo ""
|
||||
echo "Notes:"
|
||||
echo " - Command line options take precedence over environment variables"
|
||||
echo " - Authentication is optional. If not provided, alternative validation will be performed"
|
||||
echo " - For APPLE_PASSWORD, use an app-specific password generated at https://appleid.apple.com/account/manage"
|
||||
}
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--help)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
--apple-id)
|
||||
APPLE_ID="$2"
|
||||
shift 2
|
||||
;;
|
||||
--apple-password)
|
||||
APPLE_PASSWORD="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Function to clean up in case of error
|
||||
cleanup() {
|
||||
# Don't clean up temp files on error to help with debugging
|
||||
echo "===== visionOS Validation Process Failed ====="
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Set up trap to call cleanup function on error
|
||||
trap cleanup ERR
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
|
||||
BUILD_DIR="${ROOT_DIR}/validation-builds/visionos"
|
||||
|
||||
# Configuration
|
||||
APP_NAME="VisionOSLlamaTest"
|
||||
BUNDLE_ID="org.ggml.VisionOSLlamaTest"
|
||||
XCFRAMEWORK_PATH="${ROOT_DIR}/build-apple/llama.xcframework"
|
||||
TEMP_DIR="${BUILD_DIR}/temp"
|
||||
ARCHIVE_PATH="${BUILD_DIR}/${APP_NAME}.xcarchive"
|
||||
IPA_PATH="${BUILD_DIR}/${APP_NAME}.ipa"
|
||||
VALIDATION_DIR="${BUILD_DIR}/validation"
|
||||
|
||||
# Create necessary directories
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
mkdir -p "${TEMP_DIR}"
|
||||
mkdir -p "${VALIDATION_DIR}"
|
||||
|
||||
echo "===== visionOS Validation Process Started ====="
|
||||
|
||||
# 1. Create a simple test app project
|
||||
echo "Creating test visionOS app project..."
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Info.plist" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${BUNDLE_ID}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${APP_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Create SwiftUI app files
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources"
|
||||
|
||||
# Create App.swift
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/App.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
@main
|
||||
struct LlamaTestApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create ContentView.swift with visionOS specific elements
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}/Sources/ContentView.swift" << EOF
|
||||
import SwiftUI
|
||||
import llama
|
||||
|
||||
struct ContentView: View {
|
||||
// Test that we can initialize a llama context params struct
|
||||
let params = llama_context_default_params()
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 20) {
|
||||
Text("Llama Framework Test on visionOS")
|
||||
.font(.largeTitle)
|
||||
.padding()
|
||||
|
||||
Text("llama_context_default_params() created successfully")
|
||||
.font(.headline)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding()
|
||||
|
||||
// Display some param values to confirm the framework is working
|
||||
Text("n_ctx: \(params.n_ctx)")
|
||||
.font(.body)
|
||||
|
||||
Text("n_batch: \(params.n_batch)")
|
||||
.font(.body)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
.frame(width: 500, height: 400)
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create project.pbxproj, fixing the framework search paths issues
|
||||
mkdir -p "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj"
|
||||
cat > "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
11111111111111111111111 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22222222222222222222222; };
|
||||
33333333333333333333333 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44444444444444444444444; };
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66666666666666666666666; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
88888888888888888888888 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
77777777777777777777777 /* llama.xcframework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
99999999999999999999999 /* ${APP_NAME}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "${APP_NAME}.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
22222222222222222222222 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
|
||||
44444444444444444444444 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
66666666666666666666666 /* llama.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = llama.xcframework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the project file with fixed framework search paths
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
55555555555555555555555 /* llama.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
99999999999999999999999 /* ${APP_NAME}.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EOF
|
||||
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
66666666666666666666666 /* llama.xcframework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
EEEEEEEEEEEEEEEEEEEEEEEE = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* VisionOSLlamaTest */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCCC /* Products */,
|
||||
DDDDDDDDDDDDDDDDDDDDDDDD /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FFFFFFFFFFFFFFFFFFFFFFFF /* VisionOSLlamaTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1111111111111111111111AA /* Sources */,
|
||||
AAAAAAAAAAAAAAAAAAAAAAA /* Info.plist */,
|
||||
);
|
||||
path = "VisionOSLlamaTest";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1111111111111111111111AA /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
22222222222222222222222 /* App.swift */,
|
||||
44444444444444444444444 /* ContentView.swift */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
EOF
|
||||
|
||||
# Continue with the project.pbxproj file, using the APP_NAME variable appropriately
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin PBXNativeTarget section */
|
||||
3333333333333333333333AA /* ${APP_NAME} */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */;
|
||||
buildPhases = (
|
||||
5555555555555555555555AA /* Sources */,
|
||||
BBBBBBBBBBBBBBBBBBBBBBBB /* Frameworks */,
|
||||
6666666666666666666666AA /* Resources */,
|
||||
88888888888888888888888 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "${APP_NAME}";
|
||||
productName = "${APP_NAME}";
|
||||
productReference = 99999999999999999999999 /* ${APP_NAME}.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
7777777777777777777777AA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1510;
|
||||
LastUpgradeCheck = 1510;
|
||||
TargetAttributes = {
|
||||
3333333333333333333333AA = {
|
||||
CreatedOnToolsVersion = 15.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */;
|
||||
compatibilityVersion = "Xcode 15.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = EEEEEEEEEEEEEEEEEEEEEEEE;
|
||||
productRefGroup = CCCCCCCCCCCCCCCCCCCCCCCC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3333333333333333333333AA /* ${APP_NAME} */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
EOF
|
||||
|
||||
# Add the rest of the file with correct FRAMEWORK_SEARCH_PATHS
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << 'EOF'
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
6666666666666666666666AA /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
5555555555555555555555AA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
33333333333333333333333 /* ContentView.swift in Sources */,
|
||||
11111111111111111111111 /* App.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
9999999999999999999999AA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = xros;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
XROS_DEPLOYMENT_TARGET = 1.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = xros;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
XROS_DEPLOYMENT_TARGET = 1.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)";
|
||||
INFOPLIST_FILE = "VisionOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.VisionOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SUPPORTED_PLATFORMS = "xros xrsimulator";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,7";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
INFOPLIST_FILE = "VisionOSLlamaTest/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.ggml.VisionOSLlamaTest";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SUPPORTED_PLATFORMS = "xros xrsimulator";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,7";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
EOF
|
||||
|
||||
# Finish the project.pbxproj file
|
||||
cat >> "${TEMP_DIR}/${APP_NAME}/${APP_NAME}.xcodeproj/project.pbxproj" << EOF
|
||||
/* Begin XCConfigurationList section */
|
||||
8888888888888888888888AA /* Build configuration list for PBXProject "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9999999999999999999999AA /* Debug */,
|
||||
AAAAAAAAAAAAAAAAAAAAABBB /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
4444444444444444444444AA /* Build configuration list for PBXNativeTarget "${APP_NAME}" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BBBBBBBBBBBBBBBBBBBBBBCCC /* Debug */,
|
||||
CCCCCCCCCCCCCCCCCCCCCCDDD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 7777777777777777777777AA /* Project object */;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 2. Copy XCFramework to test project
|
||||
echo "Copying XCFramework to test project..."
|
||||
cp -R "${XCFRAMEWORK_PATH}" "${TEMP_DIR}/${APP_NAME}/"
|
||||
|
||||
# 3. Build and archive the app
|
||||
echo "Building and archiving test app..."
|
||||
cd "${TEMP_DIR}/${APP_NAME}"
|
||||
|
||||
# Create a simple xcscheme file to avoid xcodebuild scheme issues
|
||||
mkdir -p "${APP_NAME}.xcodeproj/xcshareddata/xcschemes"
|
||||
cat > "${APP_NAME}.xcodeproj/xcshareddata/xcschemes/${APP_NAME}.xcscheme" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1510"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3333333333333333333333AA"
|
||||
BuildableName = "${APP_NAME}.app"
|
||||
BlueprintName = "${APP_NAME}"
|
||||
ReferencedContainer = "container:${APP_NAME}.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
EOF
|
||||
|
||||
# Now use xcodebuild with an explicitly defined product name for visionOS
|
||||
xcodebuild -project "${APP_NAME}.xcodeproj" -scheme "${APP_NAME}" -sdk xros -configuration Release archive -archivePath "${ARCHIVE_PATH}" CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO PRODUCT_NAME="${APP_NAME}" SWIFT_OPTIMIZATION_LEVEL="-Onone" -quiet
|
||||
|
||||
# 4. Create IPA from archive
|
||||
echo "Creating IPA from archive..."
|
||||
mkdir -p "${TEMP_DIR}/Payload"
|
||||
cp -R "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" "${TEMP_DIR}/Payload/"
|
||||
|
||||
# Check and log app structure before zipping
|
||||
echo "App structure:"
|
||||
ls -la "${TEMP_DIR}/Payload/${APP_NAME}.app/"
|
||||
echo "Frameworks:"
|
||||
ls -la "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/" 2>/dev/null || echo "No Frameworks directory found"
|
||||
|
||||
cd "${TEMP_DIR}"
|
||||
zip -r "${IPA_PATH}" Payload
|
||||
|
||||
# Check embedded provisioning profile
|
||||
echo "Checking provisioning profile (if any)..."
|
||||
PROVISIONING_PROFILE=$(find "${ARCHIVE_PATH}/Products/Applications/${APP_NAME}.app" -name "embedded.mobileprovision" 2>/dev/null)
|
||||
if [ -n "$PROVISIONING_PROFILE" ]; then
|
||||
echo "Found embedded provisioning profile:"
|
||||
security cms -D -i "$PROVISIONING_PROFILE" || echo "Unable to decode provisioning profile"
|
||||
else
|
||||
echo "No embedded provisioning profile found (expected for ad-hoc builds)"
|
||||
fi
|
||||
|
||||
# 5. Validate the IPA
|
||||
echo "Validating IPA..."
|
||||
VALIDATION_OUTPUT="${VALIDATION_DIR}/validation_output.txt"
|
||||
|
||||
# Check if authentication credentials are provided
|
||||
AUTH_ARGS=""
|
||||
if [ -n "$APPLE_ID" ] && [ -n "$APPLE_PASSWORD" ]; then
|
||||
echo "Using Apple ID authentication for validation..."
|
||||
AUTH_ARGS="--username \"$APPLE_ID\" --password \"$APPLE_PASSWORD\""
|
||||
else
|
||||
echo "No authentication credentials provided. Will perform basic validation."
|
||||
echo "To use your personal developer account, you can run the script with:"
|
||||
echo " APPLE_ID='your.email@example.com' APPLE_PASSWORD='your-app-specific-password' ./validate-visionos.sh"
|
||||
echo "Note: You need to create an app-specific password at https://appleid.apple.com/account/manage"
|
||||
fi
|
||||
|
||||
# Run validation with detailed output
|
||||
echo "Running validation with altool..."
|
||||
if [ -n "$AUTH_ARGS" ]; then
|
||||
# Use eval to properly handle the quoted arguments
|
||||
eval "xcrun altool --validate-app -f \"${IPA_PATH}\" --type visionos --output-format xml $AUTH_ARGS" 2>&1 | tee "${VALIDATION_OUTPUT}"
|
||||
else
|
||||
xcrun altool --validate-app -f "${IPA_PATH}" --type visionos --output-format xml 2>&1 | tee "${VALIDATION_OUTPUT}"
|
||||
fi
|
||||
VALIDATION_RESULT=$?
|
||||
|
||||
# Final validation result
|
||||
FINAL_VALIDATION_RESULT=0
|
||||
|
||||
# Check if validation failed because the app isn't in App Store Connect
|
||||
if grep -q "No suitable application records were found" "${VALIDATION_OUTPUT}"; then
|
||||
echo "⚠️ App Store Connect Warning: The app bundle identifier is not found in App Store Connect"
|
||||
echo "This is expected for apps that haven't been registered in App Store Connect yet."
|
||||
echo "This doesn't indicate a problem with the build or framework."
|
||||
|
||||
# Perform alternative validation
|
||||
echo "Performing alternative validation checks..."
|
||||
|
||||
# Check if IPA was created successfully
|
||||
if [ -f "${IPA_PATH}" ] && [ -s "${IPA_PATH}" ]; then
|
||||
echo "✅ IPA file created successfully"
|
||||
else
|
||||
echo "❌ IPA file not created or empty"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if app binary exists and is executable
|
||||
if [ -f "${TEMP_DIR}/Payload/${APP_NAME}.app/${APP_NAME}" ] && [ -x "${TEMP_DIR}/Payload/${APP_NAME}.app/${APP_NAME}" ]; then
|
||||
echo "✅ App binary exists and is executable"
|
||||
else
|
||||
echo "❌ App binary missing or not executable"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework was properly embedded
|
||||
if [ -d "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework" ]; then
|
||||
echo "✅ llama.framework properly embedded"
|
||||
else
|
||||
echo "❌ llama.framework not properly embedded"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
# Check if framework binary exists
|
||||
if [ -f "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework/llama" ]; then
|
||||
echo "✅ Framework binary exists"
|
||||
|
||||
# Further validate framework by checking architecture
|
||||
ARCHS=$(lipo -info "${TEMP_DIR}/Payload/${APP_NAME}.app/Frameworks/llama.framework/llama" 2>/dev/null | grep -o "arm64\\|x86_64" | tr '\n' ' ')
|
||||
if [ -n "$ARCHS" ]; then
|
||||
echo "✅ Framework architecture(s): $ARCHS"
|
||||
else
|
||||
echo "⚠️ Could not determine framework architecture"
|
||||
fi
|
||||
else
|
||||
echo "❌ Framework binary missing"
|
||||
FINAL_VALIDATION_RESULT=1
|
||||
fi
|
||||
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
echo "✅ Alternative validation PASSED: App built successfully with embedded framework"
|
||||
else
|
||||
echo "❌ Alternative validation FAILED: Issues found with the app or framework"
|
||||
fi
|
||||
elif grep -q "You must specify authentication credentials" "${VALIDATION_OUTPUT}" && [ -z "$AUTH_ARGS" ]; then
|
||||
echo "✅ visionOS Validation PASSED: IPA successfully validated"
|
||||
echo "Results saved to ${VALIDATION_OUTPUT}"
|
||||
else
|
||||
echo "❌ visionOS Validation FAILED: IPA validation found issues"
|
||||
echo "See validation output at ${VALIDATION_OUTPUT}"
|
||||
echo ""
|
||||
echo "==== VALIDATION ERRORS ===="
|
||||
|
||||
# Try to extract specific errors from the output
|
||||
if grep -q "Error" "${VALIDATION_OUTPUT}"; then
|
||||
grep -A 5 "Error" "${VALIDATION_OUTPUT}"
|
||||
else
|
||||
# If no specific error found, show the whole log
|
||||
cat "${VALIDATION_OUTPUT}"
|
||||
fi
|
||||
|
||||
# Additional debugging: check IPA contents
|
||||
echo ""
|
||||
echo "==== IPA CONTENTS ===="
|
||||
mkdir -p "${TEMP_DIR}/ipa_contents"
|
||||
unzip -q "${IPA_PATH}" -d "${TEMP_DIR}/ipa_contents"
|
||||
ls -la "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app/"
|
||||
|
||||
# Check for code signing issues
|
||||
echo ""
|
||||
echo "==== CODE SIGNING INFO ===="
|
||||
codesign -vv -d "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app" 2>&1 || echo "Code signing verification failed"
|
||||
|
||||
# Check embedded frameworks
|
||||
echo ""
|
||||
echo "==== FRAMEWORK INFO ===="
|
||||
ls -la "${TEMP_DIR}/ipa_contents/Payload/${APP_NAME}.app/Frameworks/" 2>/dev/null || echo "No Frameworks directory found"
|
||||
fi
|
||||
|
||||
# Don't clean up on error to allow inspection
|
||||
if [ $FINAL_VALIDATION_RESULT -ne 0 ]; then
|
||||
echo ""
|
||||
echo "Temporary files kept for inspection at: ${TEMP_DIR}"
|
||||
echo "===== visionOS Validation Process Failed ====="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up temporary files but keep build artifacts
|
||||
if [ $FINAL_VALIDATION_RESULT -eq 0 ]; then
|
||||
echo "Cleaning up temporary files..."
|
||||
#rm -rf "${TEMP_DIR}"
|
||||
fi
|
||||
|
||||
echo "===== visionOS Validation Process Completed ====="
|
||||
exit $FINAL_VALIDATION_RESULT
|
368
scripts/tool_bench.py
Executable file
368
scripts/tool_bench.py
Executable file
|
@ -0,0 +1,368 @@
|
|||
#!/usr/bin/env uv run
|
||||
'''
|
||||
Simplistic tool call benchmarks for llama-server and ollama.
|
||||
|
||||
Essentially runs the tests at server/examples/server/tests/unit/test_tool_call.py N times, at different temperatures and on different backends (current llama-server, baseline llama-server and ollama),
|
||||
and plots the results of multiple runs (from same .jsonl file or multiple ones) as a success rate heatmap.
|
||||
|
||||
Simple usage example:
|
||||
|
||||
cmake -B build -DLLAMA_CURL=1 && cmake --build build --config Release -j -t llama-server
|
||||
|
||||
export LLAMA_SERVER_BIN_PATH=$PWD/build/bin/llama-server
|
||||
export LLAMA_CACHE=${LLAMA_CACHE:-$HOME/Library/Caches/llama.cpp}
|
||||
|
||||
./scripts/tool_bench.py run --n 30 --temp -1 --temp 0 --temp 1 --model "Qwen 2.5 1.5B Q4_K_M" --output qwen1.5b.jsonl --hf bartowski/Qwen2.5-1.5B-Instruct-GGUF --ollama qwen2.5:1.5b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run --n 30 --temp -1 --temp 0 --temp 1 --model "Qwen 2.5 Coder 7B Q4_K_M" --output qwenc7b.jsonl --hf bartowski/Qwen2.5-Coder-7B-Instruct-GGUF --ollama qwen2.5-coder:7b
|
||||
|
||||
./scripts/tool_bench.py plot *.jsonl # Opens window w/ heatmap
|
||||
./scripts/tool_bench.py plot qwen*.jsonl --output qwen.png # Saves heatmap to qwen.png
|
||||
|
||||
(please see ./scripts/tool_bench.sh for a more complete example)
|
||||
'''
|
||||
# /// script
|
||||
# requires-python = ">=3.10"
|
||||
# dependencies = [
|
||||
# "pytest",
|
||||
# "pandas",
|
||||
# "matplotlib",
|
||||
# "seaborn",
|
||||
# "requests",
|
||||
# "wget",
|
||||
# "typer",
|
||||
# ]
|
||||
# ///
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
import re
|
||||
from statistics import mean, median
|
||||
from typing import Annotated, Dict, List, Optional, Tuple
|
||||
import atexit
|
||||
import json
|
||||
import logging
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import seaborn as sns
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import typer
|
||||
|
||||
sys.path.insert(0, Path(__file__).parent.parent.as_posix())
|
||||
if True:
|
||||
from examples.server.tests.utils import ServerProcess
|
||||
from examples.server.tests.unit.test_tool_call import TIMEOUT_SERVER_START, do_test_calc_result, do_test_hello_world, do_test_weather
|
||||
|
||||
|
||||
@contextmanager
|
||||
def scoped_server(sp: ServerProcess):
|
||||
def stop():
|
||||
nonlocal sp
|
||||
if sp is not None:
|
||||
sp.stop()
|
||||
sp = None # type: ignore
|
||||
atexit.register(stop)
|
||||
yield sp
|
||||
stop()
|
||||
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
@app.command()
|
||||
def plot(files: List[Path], output: Optional[Path] = None, test_regex: Optional[str] = None, server_regex: Optional[str] = None):
|
||||
|
||||
lines: List[Dict] = []
|
||||
for file in files:
|
||||
if not file.exists():
|
||||
logger.error(f"File not found: {file}")
|
||||
continue
|
||||
|
||||
try:
|
||||
with file.open() as f:
|
||||
raw_data = f.read()
|
||||
logger.info(f"Reading {file} ({len(raw_data)} bytes)")
|
||||
|
||||
for line_num, line in enumerate(raw_data.split('\n'), 1):
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
try:
|
||||
record = json.loads(line)
|
||||
lines.append(record)
|
||||
except json.JSONDecodeError as e:
|
||||
logger.warning(f"Invalid JSON at {file}:{line_num} - {e}")
|
||||
except Exception as e:
|
||||
logger.error(f"Error processing {file}: {e}")
|
||||
|
||||
if not lines:
|
||||
raise Exception("No valid data was loaded")
|
||||
|
||||
data_dict: Dict[Tuple, float] = {}
|
||||
models: List[str] = []
|
||||
temps = set()
|
||||
tests = set()
|
||||
server_names = set()
|
||||
total_counts = set()
|
||||
for rec in lines:
|
||||
try:
|
||||
model = rec["model"]
|
||||
temp = rec["temp"]
|
||||
server_name = rec["server_name"]
|
||||
test = rec["test"]
|
||||
success = rec["success_ratio"]
|
||||
success_count = rec["success_count"]
|
||||
failure_count = rec["failure_count"]
|
||||
total_count = success_count + failure_count
|
||||
total_counts.add(total_count)
|
||||
|
||||
if test_regex and not re.search(test_regex, test):
|
||||
continue
|
||||
|
||||
if server_regex and not re.search(server_regex, server_name):
|
||||
continue
|
||||
|
||||
data_dict[(model, temp, server_name, test)] = success
|
||||
|
||||
if model not in models:
|
||||
models.append(model)
|
||||
temps.add(temp)
|
||||
tests.add(test)
|
||||
server_names.add(server_name)
|
||||
|
||||
except KeyError as e:
|
||||
logger.warning(f"Missing required field in record: {e}")
|
||||
|
||||
if len(total_counts) > 1:
|
||||
logger.warning(f"Total counts are not consistent: {total_counts}")
|
||||
|
||||
# Sort the collected values
|
||||
temps = list(sorted(temps, key=lambda x: x if x is not None else -1))
|
||||
tests = list(sorted(tests))
|
||||
server_names = list(sorted(server_names))
|
||||
|
||||
logger.info(f"Processed {len(lines)} lines")
|
||||
logger.info(f"Found {len(data_dict)} valid data points")
|
||||
logger.info(f"Models: {models}")
|
||||
logger.info(f"Temperatures: {temps}")
|
||||
logger.info(f"Tests: {tests}")
|
||||
logger.info(f"Servers: {server_names}")
|
||||
|
||||
matrix: list[list[float]] = []
|
||||
index: list[str] = []
|
||||
|
||||
all_cols = [
|
||||
(server_name, test)
|
||||
for server_name in server_names
|
||||
for test in tests
|
||||
]
|
||||
for model in models:
|
||||
for temp in temps:
|
||||
index.append(f"{model} @ {temp}")
|
||||
row_vals = [
|
||||
data_dict.get((model, temp, server_name, test), np.nan)
|
||||
for server_name, test in all_cols
|
||||
]
|
||||
matrix.append(row_vals)
|
||||
|
||||
columns: list[str] = [f"{server_name}\n{test}" for server_name, test in all_cols]
|
||||
|
||||
df = pd.DataFrame(matrix, index=np.array(index), columns=np.array(columns))
|
||||
|
||||
plt.figure(figsize=(12, 6))
|
||||
|
||||
sns.heatmap(
|
||||
df, annot=True, cmap="RdYlGn", vmin=0.0, vmax=1.0, cbar=True, fmt=".2f", center=0.5, square=True, linewidths=0.5,
|
||||
cbar_kws={"label": "Success Ratio"},
|
||||
)
|
||||
|
||||
plt.title(f"Tool Call Bench (n = {str(min(total_counts)) if len(total_counts) == 1 else f'{min(total_counts)}-{max(total_counts)}'})\nSuccess Ratios by Server & Test", pad=20)
|
||||
plt.xlabel("Server & Test", labelpad=10)
|
||||
plt.ylabel("Model @ Temperature", labelpad=10)
|
||||
|
||||
plt.xticks(rotation=45, ha='right')
|
||||
plt.yticks(rotation=0)
|
||||
|
||||
plt.tight_layout()
|
||||
|
||||
if output:
|
||||
plt.savefig(output, dpi=300, bbox_inches='tight')
|
||||
logger.info(f"Plot saved to {output}")
|
||||
else:
|
||||
plt.show()
|
||||
|
||||
|
||||
@app.command()
|
||||
def run(
|
||||
output: Annotated[Path, typer.Option(help="Output JSON file")],
|
||||
model: Annotated[Optional[str], typer.Option(help="Name of the model to test (server agnostic)")] = None,
|
||||
hf: Annotated[Optional[str], typer.Option(help="GGUF huggingface model repo id (+ optional quant) to test w/ llama-server")] = None,
|
||||
chat_template: Annotated[Optional[str], typer.Option(help="Chat template override for llama-server")] = None,
|
||||
ollama: Annotated[Optional[str], typer.Option(help="Ollama model tag to test")] = None,
|
||||
llama_baseline: Annotated[Optional[str], typer.Option(help="llama-server baseline binary path to use as baseline")] = None,
|
||||
n: Annotated[int, typer.Option(help="Number of times to run each test")] = 10,
|
||||
temp: Annotated[Optional[List[float]], typer.Option(help="Set of temperatures to test")] = None,
|
||||
top_p: Annotated[Optional[float], typer.Option(help="top_p")] = None,
|
||||
top_k: Annotated[Optional[int], typer.Option(help="top_k")] = None,
|
||||
ctk: Annotated[Optional[str], typer.Option(help="ctk")] = None,
|
||||
ctv: Annotated[Optional[str], typer.Option(help="ctv")] = None,
|
||||
fa: Annotated[Optional[bool], typer.Option(help="fa")] = None,
|
||||
seed: Annotated[Optional[int], typer.Option(help="Random seed")] = None,
|
||||
port: Annotated[int, typer.Option(help="llama-server port")] = 8084,
|
||||
force: Annotated[bool, typer.Option(help="Force overwrite of output file")] = False,
|
||||
append: Annotated[bool, typer.Option(help="Append to output file")] = False,
|
||||
|
||||
test_hello_world: Annotated[bool, typer.Option(help="Whether to run the hello world test")] = True,
|
||||
test_weather: Annotated[bool, typer.Option(help="Whether to run the weather test")] = True,
|
||||
test_calc_result: Annotated[bool, typer.Option(help="Whether to run the calc result test")] = False,
|
||||
):
|
||||
# Check only one of output and append
|
||||
|
||||
n_predict = 512 # High because of DeepSeek R1
|
||||
# n_ctx = 8192
|
||||
n_ctx = 2048
|
||||
|
||||
assert force or append or not output.exists(), f"Output file already exists: {output}; use --force to overwrite"
|
||||
|
||||
with output.open('a' if append else 'w') as output_file:
|
||||
|
||||
def run(server: ServerProcess, *, server_name: str, model_id: str, temp: Optional[float] = None, output_kwargs={}, request_kwargs={}):
|
||||
request_kwargs = {**request_kwargs}
|
||||
if temp is not None:
|
||||
request_kwargs['temperature'] = temp
|
||||
if top_p is not None:
|
||||
request_kwargs['top_p'] = top_p
|
||||
if top_k is not None:
|
||||
request_kwargs['top_k'] = top_k
|
||||
if seed is not None:
|
||||
request_kwargs['seed'] = seed
|
||||
|
||||
request_kwargs['cache_prompt'] = False
|
||||
|
||||
tests = {}
|
||||
if test_hello_world:
|
||||
tests["hello world"] = lambda server: do_test_hello_world(server, **request_kwargs)
|
||||
if test_weather:
|
||||
tests["weather"] = lambda server: do_test_weather(server, **request_kwargs)
|
||||
if test_calc_result:
|
||||
tests["calc result"] = lambda server: do_test_calc_result(server, None, 512, **request_kwargs)
|
||||
|
||||
for test_name, test in tests.items():
|
||||
success_count = 0
|
||||
failure_count = 0
|
||||
failures = []
|
||||
success_times = []
|
||||
failure_times = []
|
||||
logger.info(f"Running {test_name} ({server_name}, {model}): ")
|
||||
for i in range(n):
|
||||
start_time = time.time()
|
||||
|
||||
def elapsed():
|
||||
return time.time() - start_time
|
||||
|
||||
try:
|
||||
test(server)
|
||||
success_times.append(elapsed())
|
||||
success_count += 1
|
||||
logger.info('success')
|
||||
except Exception as e:
|
||||
logger.error(f'failure: {e}')
|
||||
failure_count += 1
|
||||
failure_times.append(elapsed())
|
||||
failures.append(str(e))
|
||||
# import traceback
|
||||
# traceback.print_exc()
|
||||
output_file.write(json.dumps({**output_kwargs, **dict(
|
||||
model=model,
|
||||
server_name=server_name,
|
||||
model_id=model_id,
|
||||
test=test_name,
|
||||
temp=t,
|
||||
top_p=top_p,
|
||||
top_k=top_k,
|
||||
ctk=ctk,
|
||||
ctv=ctv,
|
||||
seed=seed,
|
||||
success_ratio=float(success_count) / n,
|
||||
avg_time=mean(success_times + failure_times),
|
||||
median_time=median(success_times + failure_times),
|
||||
success_count=success_count,
|
||||
success_times=success_times,
|
||||
failure_count=failure_count,
|
||||
failure_times=failure_times,
|
||||
failures=list(set(failures)),
|
||||
)}) + '\n')
|
||||
output_file.flush()
|
||||
|
||||
for t in [None] if temp is None else [t if t >= 0 else None for t in temp]:
|
||||
if hf is not None:
|
||||
|
||||
servers: list[Tuple[str, Optional[str]]] = [('llama-server', None)]
|
||||
if llama_baseline is not None:
|
||||
servers.append(('llama-server (baseline)', llama_baseline))
|
||||
|
||||
for server_name, server_path in servers:
|
||||
server = ServerProcess()
|
||||
server.n_ctx = n_ctx
|
||||
server.n_slots = 1
|
||||
server.jinja = True
|
||||
server.ctk = ctk
|
||||
server.ctv = ctv
|
||||
server.fa = fa
|
||||
server.n_predict = n_predict
|
||||
server.model_hf_repo = hf
|
||||
server.model_hf_file = None
|
||||
server.chat_template = chat_template
|
||||
server.server_path = server_path
|
||||
if port is not None:
|
||||
server.server_port = port
|
||||
# server.debug = True
|
||||
|
||||
with scoped_server(server):
|
||||
server.start(timeout_seconds=TIMEOUT_SERVER_START)
|
||||
for ignore_chat_grammar in [False]:
|
||||
run(
|
||||
server,
|
||||
server_name=server_name,
|
||||
model_id=hf,
|
||||
temp=t,
|
||||
output_kwargs=dict(
|
||||
chat_template=chat_template,
|
||||
),
|
||||
request_kwargs=dict(
|
||||
ignore_chat_grammar=ignore_chat_grammar,
|
||||
),
|
||||
)
|
||||
|
||||
if ollama is not None:
|
||||
server = ServerProcess()
|
||||
server.server_port = 11434
|
||||
server.server_host = "localhost"
|
||||
subprocess.check_call(["ollama", "pull", ollama])
|
||||
|
||||
with scoped_server(server):
|
||||
run(
|
||||
server,
|
||||
server_name="ollama",
|
||||
model_id=ollama,
|
||||
temp=t,
|
||||
output_kwargs=dict(
|
||||
chat_template=None,
|
||||
),
|
||||
request_kwargs=dict(
|
||||
model=ollama,
|
||||
max_tokens=n_predict,
|
||||
num_ctx = n_ctx,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app()
|
66
scripts/tool_bench.sh
Executable file
66
scripts/tool_bench.sh
Executable file
|
@ -0,0 +1,66 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
cmake --build build -j
|
||||
|
||||
export LLAMA_CACHE=${LLAMA_CACHE:-$HOME/Library/Caches/llama.cpp}
|
||||
export LLAMA_SERVER_BIN_PATH=$PWD/build/bin/llama-server
|
||||
|
||||
if [ ! -x "$LLAMA_SERVER_BIN_PATH" ]; then
|
||||
echo "Could not find llama-server binary at $LLAMA_SERVER_BIN_PATH"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d "$LLAMA_CACHE" ]; then
|
||||
echo "Could not find llama cache at $LLAMA_CACHE, please set LLAMA_CACHE explicitly."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export ARGS=(
|
||||
--llama-baseline="$(which llama-server)"
|
||||
--n 30
|
||||
--temp -1 # Leaves temperature parameter unset (use the server's default, e.g. 0.6 for ollama)
|
||||
--temp 0
|
||||
--temp 0.5
|
||||
--temp 0.75
|
||||
--temp 1
|
||||
--temp 1.5
|
||||
--temp 2
|
||||
--temp 5
|
||||
"$@"
|
||||
)
|
||||
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 Coder 0.5B Q4_K_M" --output ../qwenc0.5b.jsonl --hf bartowski/Qwen2.5-Coder-0.5B-Instruct-GGUF:Q4_K_M --ollama qwen2.5-coder:0.5b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 Coder 1.5B Q4_K_M" --output ../qwenc1.5b.jsonl --hf bartowski/Qwen2.5-Coder-1.5B-Instruct-GGUF:Q4_K_M --ollama qwen2.5-coder:1.5b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 Coder 3B Q4_K_M" --output ../qwenc3b.jsonl --hf bartowski/Qwen2.5-Coder-3B-Instruct-GGUF:Q4_K_M --ollama qwen2.5-coder:3b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 Coder 7B Q4_K_M" --output ../qwenc7b.jsonl --hf bartowski/Qwen2.5-Coder-7B-Instruct-GGUF:Q4_K_M --ollama qwen2.5-coder:7b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 Coder 32B Q4_K_M" --output ../qwenc32b.jsonl --hf bartowski/Qwen2.5-Coder-32B-Instruct-GGUF:Q4_K_M --ollama qwen2.5-coder:32B-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 1.5B Q4_K_M" --output ../qwen1.5b.jsonl --hf bartowski/Qwen2.5-1.5B-Instruct-GGUF:Q4_K_M --ollama qwen2.5:1.5b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 3B Q4_K_M" --output ../qwen3b.jsonl --hf bartowski/Qwen2.5-3B-Instruct-GGUF:Q4_K_M --ollama qwen2.5:3b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Qwen 2.5 7B Q4_K_M" --output ../qwen7b.jsonl --hf bartowski/Qwen2.5-7B-Instruct-GGUF:Q4_K_M --ollama qwen2.5:7b-instruct-q4_K_M
|
||||
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Llama 3.2 Instruct 1B Q4_K_M" --output ../llama1b.jsonl --hf bartowski/Llama-3.2-1B-Instruct-GGUF:Q4_K_M --ollama llama3.2:1b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Llama 3.2 Instruct 3B Q4_K_M" --output ../llama3b.jsonl --hf bartowski/Llama-3.2-3B-Instruct-GGUF:Q4_K_M --ollama llama3.2:3b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Llama 3.1 Instruct 8B Q4_K_M" --output ../llama8b.jsonl --hf bartowski/Meta-Llama-3.1-8B-Instruct-GGUF:Q4_K_M --ollama llama3.1:8b-instruct-q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Llama 3.3 70B Q4_K_M" --output ../llama70b.jsonl --hf bartowski/Llama-3.3-70B-Instruct-GGUF:Q4_K_M
|
||||
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Mistral Nemo Q4_K_M" --output ../nemo.jsonl --hf bartowski/Mistral-Nemo-Instruct-2407-GGUF:Q4_K_M --ollama mistral-nemo:12b-instruct-2407-q4_K_M
|
||||
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Hermes 3 Llama 3.1 8B Q4_K_M" --output ../hermes3.jsonl --hf bartowski/Hermes-3-Llama-3.1-8B-GGUF:Q4_K_M --ollama hermes3:8b-llama3.1-q4_K_M --chat-template-file <( python scripts/get_chat_template.py NousResearch/Hermes-3-Llama-3.1-8B tool_use )
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Hermes 2 Pro Llama 3 8B Q4_K_M" --output ../hermes2.jsonl --hf bartowski/Hermes-2-Pro-Llama-3-8B-GGUF:Q4_K_M --ollama hermes2:8b-llama3-q4_K_M --chat-template-file <( python scripts/get_chat_template.py NousResearch/Hermes-2-Pro-Llama-3-8B tool_use )
|
||||
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Functionary Small V3.2 Q4_K_M" --output ../funct3.2.jsonl --hf bartowski/functionary-small-v3.2-GGUF:Q4_K_M
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "FireFunction V2 IQ1_M" --output ../firef2.jsonl --hf bartowski/firefunction-v2-GGUF:IQ1_M --chat-template-file <( python scripts/get_chat_template.py fireworks-ai/llama-3-firefunction-v2 tool_use )
|
||||
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Command R7B 12-2024 Q6_K_L" --output ../c4ai.jsonl --hf bartowski/c4ai-command-r7b-12-2024-GGUF:Q6_K_L --chat-template-file <( python scripts/get_chat_template.py CohereForAI/c4ai-command-r7b-12-2024 tool_use )
|
||||
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Gemma 2 2B Q8_0" --output ../gemma2.jsonl --hf bartowski/gemma-2-2b-it-GGUF:Q8_0
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Phi 4 Instruct Q4_K_M" --output ../phi4.jsonl --hf bartowski/phi-4-GGUF:Q4_K_M # --ollama phi4
|
||||
./scripts/tool_bench.py run ${ARGS[@]} --model "Phi 3.5 Mini Instruct Q4_K_M" --output ../phi3.5.jsonl --hf bartowski/Phi-3.5-mini-instruct-GGUF:Q4_K_M # --ollama phi3.5:3.8b-mini-instruct-q4_K_M
|
||||
|
||||
# ./scripts/tool_bench.py run ${ARGS[@]} --model "DeepSeek R1 Distill Qwen 7B Q6_K_L" --output ../dsqw7.jsonl --hf bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF:Q6_K_L --chat-template-file <( python scripts/get_chat_template.py NousResearch/DeepSeek-R1-Distill-Qwen-7B tool_use )
|
||||
# ./scripts/tool_bench.py run ${ARGS[@]} --model "DeepSeek R1 Distill Qwen 32B Q4_K_M" --output ../dsqw32.jsonl --hf bartowski/DeepSeek-R1-Distill-Qwen-32B-GGUF:Q4_K_M --chat-template-file <( python scripts/get_chat_template.py NousResearch/DeepSeek-R1-Distill-Qwen-32B tool_use )
|
||||
|
||||
|
||||
for f in ../*.jsonl; do
|
||||
./scripts/tool_bench.py plot "$f" --output ${f%.jsonl}.png || true
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue