Skip to content

Commit

Permalink
Merge branch 'master' into feat/core/9467-devolve-norm-to-js3-epic-ldml
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored Jun 7, 2024
2 parents f156a72 + 614f957 commit 51172c3
Show file tree
Hide file tree
Showing 44 changed files with 1,644 additions and 140 deletions.
36 changes: 13 additions & 23 deletions .github/workflows/api-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
id: environment_step
run: |
cat artifacts/env >> $GITHUB_OUTPUT
cat artifacts/env
- name: Set pending status on PR builds
id: set_status
Expand Down Expand Up @@ -68,22 +67,14 @@ 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 "VERSION=${{ steps.environment_step.outputs.VERSION }}"
echo "PRERELEASE_TAG=${{ steps.environment_step.outputs.PRERELEASE_TAG }}"
echo "GIT_SHA=${{ steps.environment_step.outputs.GIT_SHA }}"
echo "GIT_BASE=${{ steps.environment_step.outputs.GIT_BASE }}"
ls -al ${GITHUB_WORKSPACE}
ls -al ${GITHUB_WORKSPACE}/artifacts
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")
echo "BIN_PACKAGE=${BIN_PACKAGE}"
ls -al ${BIN_PACKAGE}
cd ${{ github.workspace }}/keyman/linux
./scripts/deb-packaging.sh \
--gha \
--bin-pkg "${BIN_PACKAGE}" \
--bin-pkg "${GITHUB_WORKSPACE}/artifacts/${BIN_PACKAGE}" \
--git-sha "${{ steps.environment_step.outputs.GIT_SHA }}" \
--git-base "${{ steps.environment_step.outputs.GIT_BASE }}" \
verify # 2>> $GITHUB_STEP_SUMMARY
verify 2>> $GITHUB_STEP_SUMMARY
- name: Archive .symbols file
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
Expand All @@ -99,23 +90,22 @@ jobs:
if: ${{ always() && needs.api_verification.outputs.IS_TEST_BUILD == 'true' }}
steps:
- name: Set success
# TEMP commented until things are working!
# if: needs.api_verification.result == 'success'
if: needs.api_verification.result == 'success'
run: |
echo "RESULT=success" >> $GITHUB_ENV
echo "MSG=Package build succeeded" >> $GITHUB_ENV
# - name: Set cancelled
# if: needs.api_verification.result == 'cancelled'
# run: |
# echo "RESULT=error" >> $GITHUB_ENV
# echo "MSG=Package build cancelled" >> $GITHUB_ENV
- name: Set cancelled
if: needs.api_verification.result == 'cancelled'
run: |
echo "RESULT=error" >> $GITHUB_ENV
echo "MSG=Package build cancelled" >> $GITHUB_ENV
# - name: Set failure
# if: needs.api_verification.result == 'failure'
# run: |
# echo "RESULT=failure" >> $GITHUB_ENV
# echo "MSG=Package build failed" >> $GITHUB_ENV
- name: Set failure
if: needs.api_verification.result == 'failure'
run: |
echo "RESULT=failure" >> $GITHUB_ENV
echo "MSG=Package build failed" >> $GITHUB_ENV
- name: Set final status
run: |
Expand Down
20 changes: 20 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Keyman Version History

## 18.0.50 alpha 2024-06-06

* chore(common): adds retry mechanism for build script npm ci calls (#11451)
* fix(web): get row-height for flick constraints after performing layout (#11691)
* chore(ios): enable webview debugging (#11229)
* fix(android): handle `IllegalArgumentException` when initializing `CloudDownloadMgr`, add logging to check for unhandled side-effects (#11626)
* chore: replace git dep on restructure with 3.0.1 in npm (#11657)
* chore: move xml2js into the repo to eliminate npm git dependency (#11660)
* chore(common): move CLDR import copy into build step for common/web/types (#11690)
* fix(developer): handle editor initializing after debugger when setting execution point (#11587)
* fix(developer): treat js files with unrecognized encodings as non-keyboard files (#11698)
* fix(developer): disable example edit controls if no examples in Package Editor (#11701)

## 18.0.49 alpha 2024-06-05

* fix(web): revert #11598 to eliminate use of `finalInput` which caused crash after moving caret (#11685)
* fix(common): correctly display result of multiple option parameters in builder (#11679)
* fix(linux): specify path with package name (#11694)
* fix(linux): remove debug output and re-enable failures (#11695)

## 18.0.48 alpha 2024-06-04

* fix(linux): add debug output (#11668)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.49
18.0.51
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private synchronized static void createInstance()
{
if(instance!=null)
return;
KMLog.LogBreadcrumb("CloudDownloadMgr", "CloudDownloadMgr.createInstance() - first call", true);
instance = new CloudDownloadMgr();
}

Expand All @@ -60,6 +61,7 @@ public synchronized void initialize(Context aContext)
if(isInitialized)
return;
try {
KMLog.LogBreadcrumb("CloudDownloadMgr", "attempting CloudDownloadMgr.initialize()", true);
// Runtime-registered boradcasts receivers must specify export behavior to indicate whether
// or not the receiver should be exported to all other apps on the device
// https://developer.android.com/about/versions/14/behavior-changes-14#runtime-receivers-exported
Expand All @@ -69,11 +71,12 @@ public synchronized void initialize(Context aContext)
} else {
aContext.registerReceiver(completeListener, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
} catch (IllegalStateException e) {
} catch (IllegalArgumentException e) {
String message = "initialize error: ";
KMLog.LogException(TAG, message, e);
}
isInitialized = true;
KMLog.LogBreadcrumb("CloudDownloadMgr", ".initialize() call complete", false);
}

/**
Expand All @@ -82,11 +85,15 @@ public synchronized void initialize(Context aContext)
*/
public synchronized void shutdown(Context aContext)
{
if(!isInitialized)
if(!isInitialized) {
return;
}

KMLog.LogBreadcrumb("CloudDownloadMgr", "CloudDownloadMgr.shutdown()", true);

try {
aContext.unregisterReceiver(completeListener);
} catch (IllegalStateException e) {
} catch (IllegalArgumentException e) {
String message = "shutdown error: ";
KMLog.LogException(TAG, message, e);
}
Expand Down Expand Up @@ -206,8 +213,10 @@ public <ModelType,ResultType> void executeAsDownload(Context aContext, String aD
CloudApiTypes.CloudApiParam... params)
{
if(!isInitialized) {
Log.w(TAG, "Downloadmanager not initialized. Initializing CloudDownloadMgr.");
Log.w(TAG, "DownloadManager not initialized. Initializing CloudDownloadMgr.");
initialize(aContext);
} else {
KMLog.LogBreadcrumb("CloudDownloadMgr", "CloudDownloadMgr.executeAsDownload() called; already initialized", true);
}

synchronized (downloadSetByDownloadIdentifier) {
Expand All @@ -218,7 +227,7 @@ public <ModelType,ResultType> void executeAsDownload(Context aContext, String aD

DownloadManager downloadManager = (DownloadManager) aContext.getSystemService(Context.DOWNLOAD_SERVICE);
if(downloadManager==null)
throw new IllegalStateException("Downloadmanager is not available");
throw new IllegalStateException("DownloadManager is not available");

aCallback.initializeContext(aContext);

Expand Down
43 changes: 43 additions & 0 deletions android/KMEA/app/src/main/java/com/keyman/engine/util/KMLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.keyman.engine.util.DependencyUtil;
import com.keyman.engine.util.DependencyUtil.LibraryType;

import io.sentry.Breadcrumb;
import io.sentry.Sentry;
import io.sentry.SentryLevel;

Expand All @@ -34,6 +35,48 @@ public static void LogInfo(String tag, String msg) {
}
}

/**
* Utility to log info and add as a Sentry breadcrumb, rather than
* as an independent message
* @param tag String of the caller
* @param msg String of the info message
*/
public static void LogBreadcrumb(String tag, String msg, boolean addStackTrace) {
if (msg == null || msg.isEmpty()) {
return;
}

Log.i(tag, msg);

if (!DependencyUtil.libraryExists(LibraryType.SENTRY) || !Sentry.isEnabled()) {
return;
}

Breadcrumb crumb = new Breadcrumb();
crumb.setMessage(msg);
crumb.setLevel(SentryLevel.INFO);

if(addStackTrace) {
StackTraceElement[] rawTrace = Thread.currentThread().getStackTrace();

// The call that gets us the stack-trace above... shows up in the
// stack trace, so we'll skip the first few (redundant) entries.
int skipCount = 3;

// Sentry does limit the size of messages... so let's just
// keep 10 entries and call it a day.
int limit = Math.min(rawTrace.length, 10 + skipCount);
if(rawTrace.length > skipCount) {
String[] trace = new String[limit - skipCount];
for (int i = skipCount; i < limit; i++) {
trace[i-skipCount] = rawTrace[i].toString();
}
crumb.setData("stacktrace", trace);
}
}
Sentry.addBreadcrumb(crumb);
}

/**
* Utility to log error and send to Sentry
* @param tag String of the caller
Expand Down
12 changes: 1 addition & 11 deletions common/web/lm-worker/src/main/model-compositor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,11 @@ export default class ModelCompositor {
// Worth considering: extend Traversal to allow direct prediction lookups?
// let traversal = match.finalTraversal;

// Find a proper Transform ID to map the correction to.
// Without it, we can't apply the suggestion.
let finalInput: Transform;
if(match.inputSequence.length > 0) {
// common case: from the same keystroke `inputTransform`, with matching `.id`.
finalInput = match.inputSequence[match.inputSequence.length - 1].sample;
} else {
finalInput = inputTransform; // A fallback measure. Greatly matters for empty contexts.
}

// Replace the existing context with the correction.
let correctionTransform: Transform = {
insert: correction, // insert correction string
deleteLeft: deleteLeft,
id: finalInput.id // The correction should always be based on the most recent external transform/transcription ID.
id: inputTransform.id // The correction should always be based on the most recent external transform/transcription ID.
}

let rootCost = match.totalCost;
Expand Down
8 changes: 6 additions & 2 deletions common/web/types/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ function copy_cldr_imports() {

function do_configure() {
compile_schemas
copy_cldr_imports
verify_npm_setup
}

function do_build() {
copy_cldr_imports
tsc --build
}

function do_test() {
eslint .
tsc --build test
Expand All @@ -103,6 +107,6 @@ function do_test() {

builder_run_action clean rm -rf ./build/ ./tsconfig.tsbuildinfo
builder_run_action configure do_configure
builder_run_action build tsc --build
builder_run_action build do_build
builder_run_action test do_test
builder_run_action publish builder_publish_npm
6 changes: 4 additions & 2 deletions common/web/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
"dependencies": {
"@keymanapp/ldml-keyboard-constants": "*",
"@keymanapp/keyman-version": "*",
"restructure": "git+https://github.com/keymanapp/dependency-restructure.git#7a188a1e26f8f36a175d95b67ffece8702363dfc",
"restructure": "3.0.1",
"semver": "^7.5.2",
"xml2js": "git+https://github.com/keymanapp/dependency-node-xml2js#535fe732dc408d697e0f847c944cc45f0baf0829"
"sax": ">=0.6.0",
"xmlbuilder": "~11.0.0"
},
"devDependencies": {
"@types/chai": "^4.1.7",
Expand Down Expand Up @@ -70,6 +71,7 @@
],
"exclude-after-remap": true,
"exclude": [
"src/deps/",
"src/kmx/kmx-plus-builder/",
"src/kmx/kmx-plus.ts",
"src/kmx/kmx-builder.ts",
Expand Down
19 changes: 19 additions & 0 deletions common/web/types/src/deps/xml2js/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright 2010, 2011, 2012, 2013. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
Loading

0 comments on commit 51172c3

Please sign in to comment.