Skip to content

Commit

Permalink
Merge pull request #12575 from keymanapp/chore/merge-master-into-dict…
Browse files Browse the repository at this point in the history
…-breaker

chore: merge master into dict-breaker 🔬
  • Loading branch information
mcdurdin authored Oct 25, 2024
2 parents 04cab9d + 0db0b26 commit c3f9917
Show file tree
Hide file tree
Showing 36 changed files with 569 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:

- name: "Verify API for libkeymancore*.so (${{ steps.environment_step.outputs.GIT_BRANCH }}, branch ${{ steps.environment_step.outputs.GIT_BASE_BRANCH }}, by ${{ steps.environment_step.outputs.GIT_USER }})"
run: |
echo "Verify API for libkeymancore*.so (${{ steps.environment_step.outputs.GIT_BRANCH }}, branch ${{ steps.environment_step.outputs.GIT_BASE_BRANCH }}, by ${{ steps.environment_step.outputs.GIT_USER }})" >> $GITHUB_STEP_SUMMARY
echo "Verify API for libkeymancore*.so (${{ steps.environment_step.outputs.GIT_BRANCH }}, branch ${{ steps.environment_step.outputs.GIT_BASE_BRANCH }}, by ${{ steps.environment_step.outputs.GIT_USER }}):" >> $GITHUB_STEP_SUMMARY
BIN_PACKAGE=$(ls "${GITHUB_WORKSPACE}/artifacts/" | grep "${PKG_NAME}[0-9]*_${{ steps.environment_step.outputs.VERSION }}-1${{ steps.environment_step.outputs.PRERELEASE_TAG }}+$(lsb_release -c -s)1_amd64.deb")
cd ${{ github.workspace }}/keyman/linux
Expand Down
22 changes: 22 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Keyman Version History

## 18.0.130 alpha 2024-10-24

* fix(android/engine): Increase robustness when checking package kmp.json languages (#12567)
* chore(ios): support xcode 16 build (#12570)

## 18.0.129 alpha 2024-10-21

* chore(mac): support Xcode 16 build (#12554)

## 18.0.128 alpha 2024-10-14

* docs(developer): add refs to Keyman MIME types (#12540)

## 18.0.127 alpha 2024-10-12

* fix(developer): use TextDecoder to convert Uint8Array to string (#12537)

## 18.0.126 alpha 2024-10-11

* test(common): add markdown link check test for product documentation (#12472)
* chore(linux): improve output if `dpkg-gensymbols` fails and run other tests (#12527)

## 18.0.125 alpha 2024-10-10

* chore(common): allow to run `build.sh` scripts in `bashdb` debugger (#12518)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.126
18.0.131
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public static JSONArray getLanguages() {
return new JSONArray();
}
File[] packages = resourceRoot.listFiles();
if (packages == null) {
return new JSONArray();
}
JSONArray languagesArray = new JSONArray();
JSONParser parser = new JSONParser();

Expand All @@ -60,6 +63,9 @@ public static JSONArray getLanguages() {
String kbdFilename = pkg.getName() + "/" + kbdID + ".js";

// Merge languages
if (!kmpKeyboardObj.has("languages")) {
continue;
}
JSONArray kmpLanguageArray = kmpKeyboardObj.getJSONArray("languages");
for (int j=0; j<kmpLanguageArray.length(); j++) {
JSONObject languageObj = kmpLanguageArray.getJSONObject(j);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@RunWith(RobolectricTestRunner.class)
public class JSONUtilsTest {
private static final File TEST_RESOURCE_ROOT = new File("test_resources", "packages");
private static final File TEST_INVALID_RESOURCE_ROOT = new File("test_resources", "invalid_packages");
private static final String TAG = "JSONUtilsTest";

@Before
Expand Down Expand Up @@ -52,6 +53,18 @@ public void test_getLanguages() {
}
}

/**
* Test parsing null_languages/kmp.json which has no languages
*/
@Test
public void test_invalid_getLanguages() {
JSONUtils.initialize(TEST_INVALID_RESOURCE_ROOT);
JSONArray result = JSONUtils.getLanguages();
final int EXPECTED_NUM_LANGUAGES = 0;

Assert.assertEquals(EXPECTED_NUM_LANGUAGES, result.length());
}

@Test
public void test_findID() {
JSONParser parser = new JSONParser();
Expand Down
127 changes: 127 additions & 0 deletions android/KMEA/test_resources/invalid_packages/null_languages/kmp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"system": {
"keymanDeveloperVersion": "11.0.1304.0",
"fileVersion": "7.0"
},
"options": {
"graphicFile": "splash.bmp"
},
"info": {
"name": {
"description": "Cameroon QWERTY"
},
"version": {
"description": "6.0.2"
},
"copyright": {
"description": "\u00A92018 SIL Cameroon"
},
"author": {
"description": "Matthew Lee",
"url": "mailto:[email protected]"
},
"website": {
"description": "LangTechCameroon.info",
"url": "LangTechCameroon.info"
}
},
"files": [
{
"name": "Cameroon.ico",
"description": "File Cameroon.ico"
},
{
"name": "sil_cameroon_qwerty.css",
"description": "File sil_cameroon_qwerty.css"
},
{
"name": "AndikaAfr-R.ttf",
"description": "Font Andika Afr"
},
{
"name": "sil_cameroon_qwerty.kvk",
"description": "File sil_cameroon_qwerty.kvk"
},
{
"name": "sil_cameroon_qwerty.kmx",
"description": "Keyboard Cameroon QWERTY"
},
{
"name": "splash.bmp",
"description": "File splash.bmp"
},
{
"name": "welcome.htm",
"description": "File welcome.htm"
},
{
"name": "e_chart.png",
"description": "File e_chart.png"
},
{
"name": "e_tableau.png",
"description": "File e_tableau.png"
},
{
"name": "helpIcon.png",
"description": "File helpIcon.png"
},
{
"name": "ic_launcher.png",
"description": "File ic_launcher.png"
},
{
"name": "icon.png",
"description": "File icon.png"
},
{
"name": "QwertyColor.png",
"description": "File QwertyColor.png"
},
{
"name": "sil-logo-blue.png",
"description": "File sil-logo-blue.png"
},
{
"name": "kb.css",
"description": "File kb.css"
},
{
"name": "sil_cameroon_qwerty.js",
"description": "File sil_cameroon_qwerty.js"
},
{
"name": "globe.png",
"description": "File globe.png"
},
{
"name": "longpress-qwerty.png",
"description": "File longpress-qwerty.png"
},
{
"name": "modkeys-en-q.png",
"description": "File modkeys-en-q.png"
},
{
"name": "modkeys-fr-q.png",
"description": "File modkeys-fr-q.png"
},
{
"name": "kmp.inf",
"description": "Package information"
},
{
"name": "kmp.json",
"description": "Package information (JSON)"
}
],
"keyboards": [
{
"name": "Cameroon QWERTY",
"id": "sil_cameroon_qwerty",
"version": "6.0.2",
"oskFont": "AndikaAfr-R.ttf",
"displayFont": "AndikaAfr-R.ttf"
}
]
}
7 changes: 6 additions & 1 deletion android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"

builder_describe \
"Build Keyman Engine for Android, Keyman for Android, and FirstVoices Android app." \
"@/resources/tools/check-markdown test:help" \
clean \
configure \
build \
Expand All @@ -23,6 +24,7 @@ builder_describe \
--upload-sentry+ \
":engine=KMEA Keyman Engine for Android" \
":app=KMAPro Keyman for Android" \
":help Online documentation" \
":sample1=Samples/KMSample1 Sample app: KMSample1" \
":sample2=Samples/KMSample2 Sample app: KMSample2" \
":keyboardharness=Tests/KeyboardHarness Test app: KeyboardHarness" \
Expand All @@ -42,4 +44,7 @@ if builder_start_action clean; then
builder_finish_action success clean
fi

builder_run_child_actions configure build test publish
builder_run_child_actions configure build test
builder_run_action test:help check-markdown "$KEYMAN_ROOT/android/docs/help"

builder_run_child_actions publish
2 changes: 2 additions & 0 deletions developer/docs/help/reference/file-types/kmp.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Details:
Developer will also include a [metadata](metadata) file in the
package. Lexical model packages contain one lexical model instead of
keyboards.
: .kmp file format has registered MIME type
[`application/vnd.keyman.kmp+zip`](https://www.iana.org/assignments/media-types/application/vnd.keyman.kmp+zip).

Distributed with keyboard:
: A Keyman keyboard Package file (.KMP) can include keyboard files
Expand Down
4 changes: 3 additions & 1 deletion developer/docs/help/reference/file-types/kmx.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: KMX files
---

Used by:
: <span class="application">Keyman Desktop</span>,
: Keyman Core in <span class="application">Keyman for Windows</span>,
<span class="application">Keyman for macOS</span>, and
<span class="application">Keyman for Linux</span>.

Expand All @@ -16,6 +16,8 @@ Details:
for the keyboard (.ICO/.BMP). Note that .KMX files are not used for
<span class="application">Keyman for Android</span> and
<span class="application">Keyman for iPhone and iPad</span>.
: .KMX file format has registered MIME type
[`application/vnd.keyman.kmx`](https://www.iana.org/assignments/media-types/application/vnd.keyman.kmx).

Distributed with keyboard:
: This is the keyboard file. It must be distributed with your package
Expand Down
3 changes: 3 additions & 0 deletions developer/src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"

builder_describe \
"Keyman Developer" \
"@/resources/tools/check-markdown test:help" \
clean \
configure \
build \
Expand All @@ -20,6 +21,7 @@ builder_describe \
"install Install built programs locally" \
":common Developer common files" \
":ext Third party components" \
":help Online documentation" \
":kmcmplib Compiler - .kmn compiler" \
":kmc-analyze Compiler - Analysis Tools" \
":kmc-keyboard-info Compiler - .keyboard_info Module" \
Expand Down Expand Up @@ -125,6 +127,7 @@ fi
#-------------------------------------------------------------------------------------------------------------------

builder_run_child_actions clean configure build test
builder_run_action test:help check-markdown "$KEYMAN_ROOT/developer/docs/help"

#-------------------------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class KPJFileReader {
let data: KPJFile;

data = new KeymanXMLReader('kpj')
.parse(file.toString());
.parse(new TextDecoder().decode(file));

data = this.boxArrays(data);
if(data.KeymanDeveloperProject?.Files?.File?.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class KVKSFileReader {

try {
source = new KeymanXMLReader('kvks')
.parse(file.toString()) as KVKSourceFile;
.parse(new TextDecoder().decode(file)) as KVKSourceFile;
} catch(e) {
if(file.byteLength > 4 && file.subarray(0,3).every((v,i) => v == KVK_HEADER_IDENTIFIER_BYTES[i])) {
throw new Error('File appears to be a binary .kvk file', {cause: e});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export class LDMLKeyboardXMLSourceFileReader {

loadTestDataUnboxed(file: Uint8Array): any {
const source = new KeymanXMLReader('keyboardTest3')
.parse(file.toString()) as any;
.parse(new TextDecoder().decode(file)) as any;
return source;
}

Expand Down
2 changes: 1 addition & 1 deletion developer/src/kmc-package/src/compiler/kmp-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export class KmpCompiler implements KeymanCompiler {

try {
a = new KeymanXMLReader('kps')
.parse(data.toString()) as KpsFile.KpsPackage;
.parse(data) as KpsFile.KpsPackage;
} catch(e) {
this.callbacks.reportMessage(PackageCompilerMessages.Error_InvalidPackageFile({e}));
}
Expand Down
2 changes: 1 addition & 1 deletion ios/Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "weichsel/ZIPFoundation" ~> 0.9
github "devicekit/DeviceKit" ~> 5.0
github "ashleymills/Reachability.swift"
github "getsentry/sentry-cocoa" ~> 8.7.0
github "getsentry/sentry-cocoa" ~> 8.38.0
8 changes: 4 additions & 4 deletions ios/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "ashleymills/Reachability.swift" "v5.1.0"
github "devicekit/DeviceKit" "5.1.0"
github "getsentry/sentry-cocoa" "8.15.2"
github "weichsel/ZIPFoundation" "0.9.17"
github "ashleymills/Reachability.swift" "v5.2.4"
github "devicekit/DeviceKit" "5.5.0"
github "getsentry/sentry-cocoa" "8.38.0"
github "weichsel/ZIPFoundation" "0.9.19"
11 changes: 5 additions & 6 deletions ios/build.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
#!/usr/bin/env bash

## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
. "${THIS_SCRIPT%/*}/../resources/build/builder.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE

# Include our resource functions; they're pretty useful!
. "$KEYMAN_ROOT/resources/shellHelperFunctions.sh"

# Please note that this build script (understandably) assumes that it is running on Mac OS X.
verify_on_mac

builder_describe "Builds Keyman Engine and the Keyman app for use on iOS devices - iPhone and iPad." \
"@/resources/tools/check-markdown test:help" \
"clean" \
"configure" \
"build" \
"test" \
":engine Builds KeymanEngine.xcframework, usable by our main app and by third-party apps" \
":app=keyman Builds the Keyman app for iOS platforms" \
":help Online documentation" \
":sample1=Samples/KMSample1 Builds the first KeymanEngine sample app" \
":sample2=Samples/KMSample2 Builds the second KeymanEngine sample app" \
":fv=../oem/firstvoices/ios Builds OEM FirstVoices for iOS platforms" \
"--sim-artifact+ Also outputs a simulator-friendly test artifact corresponding to the build"

builder_parse "$@"

builder_run_child_actions clean configure build
builder_run_child_actions clean configure build test
builder_run_action test:help check-markdown "$KEYMAN_ROOT/ios/docs/help"
Loading

0 comments on commit c3f9917

Please sign in to comment.