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

chore(developer): build.sh for developer #11421

Merged
merged 18 commits into from
May 23, 2024
Merged

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented May 11, 2024

Fixes #11317.

Now builds from a clean repo:

developer/src/build.sh configure build test publish
  • Splits kmbrowserhost into kmdbrowserhost for Developer; this means that Developer Browser Host now inherits the Developer settings rather than the Keyman for Windows settings, and simplifies distribution and management. The only difference between the two is in the startup code so this seems like a good split.

  • Cleanup of various build scripts and dependencies.

TODO:

User Testing

  • TEST_DEVELOPER: Please perform a basic regression test of Keyman Developer to ensure that all functions continue to operate as expected.

@keymanapp-test-bot keymanapp-test-bot bot added the user-test-missing User tests have not yet been defined for the PR label May 11, 2024
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented May 11, 2024

User Test Results

Test specification and instructions

  • TEST_DEVELOPER (PASSED): for all other use cases.

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot bot added this to the A18S2 milestone May 11, 2024
@mcdurdin mcdurdin changed the base branch from master to feat/common/11408-11394-builder-child-and-dependency-tweaks May 12, 2024 04:45
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed and removed user-test-missing User tests have not yet been defined for the PR labels May 13, 2024
@mcdurdin mcdurdin marked this pull request as ready for review May 13, 2024 08:21
Base automatically changed from feat/common/11408-11394-builder-child-and-dependency-tweaks to master May 13, 2024 08:24
Comment on lines 73 to +92
#
# builder_publish_to_pack and builder_publish_to_npm are similar:
# * builder_publish_to_npm publishes to the public registry
# * builder_publish_to_pack creates a local tarball which can be used to test
# If --npm-publish is set:
# * then builder_publish_npm publishes to the public registry
# * else builder_publish_npm creates a local tarball which can be used to test
#
# Usage:
# ```bash
# builder_publish_to_npm
# builder_publish_npm
# ```
#
function builder_publish_to_npm() {
_builder_publish_npm_package publish
}

function builder_publish_to_pack() {
_builder_publish_npm_package pack
function builder_publish_npm() {
if builder_has_option --npm-publish; then
# Require --dry-run if local or test to avoid accidentally clobbering npm packages
if [[ $VERSION_ENVIRONMENT =~ local|test ]] && ! builder_has_option --dry-run; then
builder_die "publish --npm-publish must use --dry-run flag for local or test builds"
fi
_builder_publish_npm_package publish
else
_builder_publish_npm_package pack
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this gets referenced by a lot of the child scripts, especially in the earlier files. Figured I'd highlight this as reference, as the merge of builder_publish_to_npm and builder_publish_to_pack is significant.

Also, I see that this conditions upon a non-implicit builder option - --dry-run; that's an interesting decision, but I can understand it. (non-implicit: --dry-run is not automatically available for all builder scripts, unlike --debug and --verbose.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hear you on this. tl;dir: I don't have a great answer. It's a bit repetitious for now but we can easily revisit in the future if we need to.

More details...

I could upgrade --dry-run to a global option but I'm hesitant because it won't work on most scripts, so that's confusing (and I don't think we want to start supporting --dry-run everywhere either -- busywork with little benefit). --debug and --verbose work nearly everywhere.

One option I considered is pulling this out to be an exported DRY_RUN variable. That could avoid us defining it on every script that does publishing.

FWIW, I do plan to using the option more later on for any other actions that send files to other systems (e.g. when we deploy to downloads, app store, play store, etc ad infinitum).

Copy link
Contributor

@jahorton jahorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot here, so here's a partial review: I've looked over all the common/ + common/windows file changes. Hopefully the feedback's useful, given my comparatively limited knowledge of Windows & Developer build structure.

COMMON_OUTLIB="$KEYMAN_ROOT/common/windows/lib"

if builder_is_debug_build || [[ $VERSION_ENVIRONMENT == local ]] || [[ ! -z ${TEAMCITY_PR_NUMBER+x} ]]; then
# We do a fast build for debug builds, local builds, test PR builds but not for master/beta/stable release builds
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between a "fast" build and one that isn't? I'm lacking context, since I'm not usually working with Windows or Developer source.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fast build in this context is currently only used when building installers -- reducing compression level which is really slow:

if [[ $GO_FAST == 1 ]]; then
# for debug builds, we turn off compression because it is so hideously slow
# for test builds, we also turn off compression
WIXLIGHTCOMPRESSION=-dcl:none
else
WIXLIGHTCOMPRESSION=-dcl:high
fi

if [[ $GO_FAST == 1 ]]; then
"$WZZIPPATH" a -mx1 "$@"
else
"$WZZIPPATH" a -mx9 "$@"
fi

"$DEVTOOLS" -ri
}

builder_run_action reset do_reset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reset? First time I've seen that as an action name in one of our scripts.

Lacking context here - what's the intended difference between reset and clean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reset just removes all the Keyman packages and paths from the Delphi IDE. It's kinda ugly, and it is legacy that we never really use. I copied it across but we could probably remove it altogether.

common/windows/delphi/ext/cef4delphi/build.sh Show resolved Hide resolved
common/windows/delphi/ext/dcpcrypt/build.sh Show resolved Hide resolved
common/windows/delphi/ext/sentry/build.sh Show resolved Hide resolved
common/windows/delphi/tools/Makefile Show resolved Hide resolved
Relates to #11317.

All projects now have a build.sh. Still need to work on inst/, remove
old Makefiles, and update CI.
This finishes the changes for all build infrastructure for Keyman
Developer to use build.sh.
Now builds from a clean repo:

  developer/src/build.sh configure build test publish

* Splits kmbrowserhost into kmdbrowserhost for Developer; this means
  that Developer Browser Host now inherits the Developer settings rather
  than the Keyman for Windows settings, and simplifies distribution and
  management. The only difference between the two is in the startup code
  so this seems like a good split.

* Cleanup of various build scripts and dependencies.
Use a new flag `--npm-publish` in conjunction with `publish` action,
so that the default will always be to `npm pack` if the new flag is not
specified. This flag is also guarded in the actual npm publish code to
ensure that it can only run in the appropriate CI alpha/beta/stable
environment, and not in local or test.

This then also removes the separate `pack` action.

Also removes legacy boilerplate from a number of build scripts.
Also some more script cleanup and ensure common/core packages are also
published.
A round of cleanup and consistency for Developer build scripts.
Additional shared script resources for Developer and Windows,
refactor of a code signing function, refactor of clean step in build.sh.
@mcdurdin mcdurdin force-pushed the chore/developer/11317-build.sh branch from 781d154 to 8b2070c Compare May 19, 2024 23:35
@mcdurdin mcdurdin changed the base branch from master to fix/common/builder-run-action-quotes May 19, 2024 23:35
Base automatically changed from fix/common/builder-run-action-quotes to master May 20, 2024 03:32
@dinakaranr
Copy link

Test Results

  • TEST_DEVELOPER (FAILED): I tested this issue with the attached "Keymandeveloper-18.0.39-alpha-test-11421" build on Windows 11 and 10 OS environment: Here is my observation.
    I have followed the acceptance scenario from the help file. I executed the below scenarios
    TEST_DEBUGGER_STARTS: passed
    TEST_DEBUGGER_SINGLE_STEP: passed
    TEST_DEBUGGER_PAUSE: passed
    TEST_DEBUGGER_CHANGES: failed
    TEST_DEBUGGER_PLATFORM: failed
    and got an error "Test_debugger_pause and Test_Debugger_platform"

Steps to reproduce:

  1. Installed the "keymandeveloper-18.0.39.exe" file.
  2. Double-click on the "Keyman Developer" icon. The developer tool appeared correctly.
  3. Open the Keyman keyboard project (*.kpj) file.
  4. Open any keyman keyboard (*.kmn) file. (e.g., Tamil 99 text)
  5. Navigate to the Debugger mode by pressing the F5 or (On build tab/Start Debugging).
  6. Navigate to the Layout tab. Click on an empty text box.
  7. Type a letter. Press the CTRL+Z key.
    Here, the error message box appears. I am not able to test the Keyman developer build. So, I failed this issue. Thanks.
    Please refer to the screenshot and video files

https://github.com/keymanapp/keyman/assets/19683059/11bc7a35-e403-4df5-a3e5-87be360211e1
Thanks.

@keymanapp-test-bot keymanapp-test-bot bot added user-test-failed and removed user-test-required User tests have not been completed labels May 20, 2024
@mcdurdin
Copy link
Member Author

Thank you @dinakaranr. The issue you experienced is being tracked at #11486. I think apart from that, the install went well, so we can go ahead with merge on this soon.

TEST_DEVELOPER PASSED for all other use cases.

@mcdurdin mcdurdin merged commit 1e66b6e into master May 23, 2024
23 of 25 checks passed
@mcdurdin mcdurdin deleted the chore/developer/11317-build.sh branch May 23, 2024 07:22
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 18.0.42-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

chore(developer): consolidate build.sh
5 participants