keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
398 stars 112 forks source link

feat(core): dx: support 'arch' as synonym for current architecture #10302

Open srl295 opened 10 months ago

srl295 commented 10 months ago

core/build.sh supports :arch on Linux meaning "current architecture".

We should support this on mac and windows also. Something like this:

diff --git a/core/build.sh b/core/build.sh
index 08ba60bcb7..f7c55a6f8c 100755
--- a/core/build.sh
+++ b/core/build.sh
@@ -36,6 +36,7 @@ case $BUILDER_OS in
     archtargets+=(
       ":x86    32-bit Windows (x86) build"
       ":x64    64-bit Windows (x64) build"
+      ":arch   Windows current architecture"
     )
     ;;
   mac)
@@ -43,6 +44,7 @@ case $BUILDER_OS in
       ":mac           Mac all architectures fat library build"
       ":mac-x86_64    Mac Intel build"
       ":mac-arm64     Mac arm64 (M1) build"
+      ":arch          Mac current architecture"
     )
     ;;
   linux)

Then we could just run core/build.sh test:arch (which is the command I usually run) and it would work on linux/win/mac the same.

I'd be fine with it being a synonym, wouldn't need to generate core/build/arch on a mac for example.

For that matter, arch on linux would be better off creating core/build/linux-$(uname -m)/… which would be core/build/linux-x86_64/ for example. Then arch remains a pseudo-target on all 3 platforms, and whatever uname -m returns becomes the calculated "current architecture" for linux. (x86_64, aarch64, …)

Caveat I don't really understand how the architecture selection works within build.sh so I might be talking through my hat here!

Could also have :current instead as an alias, which would select :arch on linux.

srl295 commented 10 months ago

Workaround:

$ core/build.sh test:mac-$(uname -m)
mcdurdin commented 10 months ago

This is a good idea. Mac and Windows are complicated because they need multiple architectures. For Linux, we have just supported current-arch but that is a little bit limiting. Let's discuss in 18.0.