Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): changed build script prepRelease to fix sample builds 🏠 #10940

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint --config ../../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
11 changes: 7 additions & 4 deletions ios/samples/KMSample1/KMSample1/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ class ViewController: UIViewController, TextViewDelegate {
let keyboardID = FullKeyboardID(keyboardID: "ekwtamil99uni", languageID: "ta")

do {
let package = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL) as! KeyboardKeymanPackage
try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package)

_ = Manager.shared.setKeyboard(withFullID: keyboardID)
let resource = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL)
if let package = resource as? KeyboardKeymanPackage {
try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package)
_ = Manager.shared.setKeyboard(withFullID: keyboardID)
} else {
print("Error installing: \(keyboardID) is not a keyboard package")
}
} catch {
print("Error preloading: \(error)")
}
Expand Down
4 changes: 2 additions & 2 deletions ios/samples/KMSample2/KMSample2.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint --config ../../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
C0324B8B1F8726E500AF3785 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -382,7 +382,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint --config ../../.swiftlint.yml\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
11 changes: 7 additions & 4 deletions ios/samples/KMSample2/KMSample2/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ class ViewController: UIViewController, TextViewDelegate {
let keyboardID = FullKeyboardID(keyboardID: "ekwtamil99uni", languageID: "ta")

do {
let package = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL) as! KeyboardKeymanPackage
try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package)

_ = Manager.shared.setKeyboard(withFullID: keyboardID)
let resource = try ResourceFileManager.shared.prepareKMPInstall(from: kmpFileURL)
if let package = resource as? KeyboardKeymanPackage {
try ResourceFileManager.shared.install(resourceWithID: keyboardID, from: package)
_ = Manager.shared.setKeyboard(withFullID: keyboardID)
} else {
print("Error installing: \(keyboardID) is not a keyboard package")
}
} catch {
print("Error preloading: \(error)")
}
Expand Down
50 changes: 39 additions & 11 deletions ios/tools/prepRelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,55 @@ LC_ALL=UTF-8 sed -e "s/[$(printf $emoji)]//g" < "$CHANGELOG_PATH" > "$CHANGELOG_
mv -f "$CHANGELOG_PATH.1" "$CHANGELOG_PATH"
assertFileExists "${CHANGELOG_PATH}"

KMEI_DST_NAME="keyman-engine-ios-${BUILD_NUMBER}.zip"
KMEI_DST="${WORK_DIR}/${UPLOAD_DIR}/${KMEI_DST_NAME}"

#
# Keyman Engine
# Copy xcframeworks from Carthage to upload directory and add to zip
#

KMEI_DST_NAME="keyman-engine-ios-${BUILD_NUMBER}.zip"
KMEI_DST="${WORK_DIR}/${UPLOAD_DIR}/${KMEI_DST_NAME}"
CARTHAGE_DIR="Carthage"
KEYMAN_FRAMEWORKS="Carthage/Build/"
#KEYMAN_FRAMEWORK_BASE="Carthage"

KMEI_FRAMEWORK_BASE="build/Build/Products/Release/"
FRAMEWORK="KeymanEngine.xcframework"
cd "$UPLOAD_DIR"
mkdir -p "${CARTHAGE_DIR}"

cd "$WORK_DIR"
echo "Copying frameworks into ${CARTHAGE_DIR} and adding to zip file..."
cp -rf "${KEYMAN_FRAMEWORKS}" "${UPLOAD_DIR}/${CARTHAGE_DIR}"
zip -qrX "${KMEI_DST}" "${KEYMAN_FRAMEWORKS}"
cd "$UPLOAD_DIR"
rm -rf "${CARTHAGE_DIR}"
cd "$WORK_DIR"

#
# Samples - copy source to temporary folder
#

KEYMAN_SAMPLES="samples"
echo "Copying Keyman Engine samples into ${UPLOAD_DIR}/${KMEI_DST_NAME}..."
cd "$WORK_DIR"
cp -rf "${KEYMAN_SAMPLES}" "${UPLOAD_DIR}/samples"


#
# Copy Keyman Engine xcframework to the root of each sample project
#

KMEI_FRAMEWORK_BASE="build/Build/Products/Release/"
KEYMAN_ENGINE_FRAMEWORK="KeymanEngine.xcframework"

echo "engine dest: $KMEI_DST"

echo "Zipping ${UNI_FRAMEWORK} => ${UPLOAD_DIR}/${KMEI_DST}..."
cd "${KMEI_FRAMEWORK_BASE}"
zip -qrX ${KMEI_DST} ${FRAMEWORK}
cd $WORK_DIR
echo "Copying ${UNI_FRAMEWORK} => ${UPLOAD_DIR}/samples..."
cd "$WORK_DIR"
cp -rf "${KMEI_FRAMEWORK_BASE}/${KEYMAN_ENGINE_FRAMEWORK}" "${UPLOAD_DIR}/samples/KMSample1/"
cp -rf "${KMEI_FRAMEWORK_BASE}/${KEYMAN_ENGINE_FRAMEWORK}" "${UPLOAD_DIR}/samples/KMSample2/"

echo "Copying Keyman Engine samples into ${UPLOAD_DIR}/${KMEI_DST_NAME}..."
cp -rf "${KEYMAN_SAMPLES}" "${UPLOAD_DIR}/samples"
#
# Add samples directory to zip and remove temporary folder
#
cd "${UPLOAD_DIR}"
zip -qr "${KMEI_DST_NAME}" "samples"
rm -rf "samples"
Expand Down
Loading