Device interoperability layer for Windows and MacOS
Find a file
2023-04-19 11:25:31 -07:00
.circleci chore(deps): pin windows orb to 5.0.0 2023-04-07 19:43:13 +00:00
.github Update CONTRIBUTING.md 2020-06-09 17:03:32 -04:00
.husky chore: add husky hook for commitlint 2023-04-05 13:31:37 -07:00
Assets fix: generate icons directly from SVGs for better quality 2023-02-02 13:42:43 -08:00
Documentation update architecture to avoid stdio with MAUI 2023-01-13 08:21:35 -08:00
fastlane ci: use fastlane match 2023-01-13 08:21:38 -08:00
Scratch Link Safari Helper fix: generate icons directly from SVGs for better quality 2023-02-02 13:42:43 -08:00
scratch-link make ScratchLinkApp to take the place of MAUI app 2023-01-13 08:21:36 -08:00
scratch-link-common refactor(macbt): add more logging to MacBT discovery 2023-04-06 13:26:01 -07:00
scratch-link-mac refactor(macbt): add more logging to MacBT discovery 2023-04-06 13:26:01 -07:00
scratch-link-win fix(Win): fix larger icon sizes being ignored sometimes 2023-04-19 11:25:31 -07:00
scratch-link-win-msix chore(deps): keep Windows SDK dependencies in sync 2023-04-14 08:47:55 -07:00
SharedProps chore(deps): update dependency microsoft.windowsappsdk to v1.3.230331000 2023-04-16 00:16:36 +00:00
.editorconfig style: on second thought, let's not use utf-8-bom 2023-04-06 09:34:01 -07:00
.gitattributes fix: generate icons directly from SVGs for better quality 2023-02-02 13:42:43 -08:00
.gitignore fix(windows): fix *.msixupload generation 2023-02-23 14:23:35 -08:00
.markdownlintrc Add .markdownlintrc, fix markdownlint complaints 2018-10-02 15:49:14 -07:00
.nvmrc chore(deps): update node.js to v18.16.0 2023-04-16 05:04:37 +00:00
CHANGELOG.md chore(release): 2.0.0-develop.8 [skip ci] 2023-04-17 09:28:09 +00:00
commitlint.config.js chore: add commitlint 2023-04-05 13:31:31 -07:00
global.d.ts refactor: move JS out of playground.html 2023-01-13 08:21:38 -08:00
LICENSE Update LICENSE 2019-03-06 12:56:04 -05:00
Makefile fix(Win): fix larger icon sizes being ignored sometimes 2023-04-19 11:25:31 -07:00
package-lock.json chore(deps): update commitlint monorepo to v17.6.1 2023-04-17 14:32:56 +00:00
package.json chore(deps): update commitlint monorepo to v17.6.1 2023-04-17 14:32:56 +00:00
playground.html test: add stress test to playground 2023-01-13 08:21:38 -08:00
playground.js test: add stress test to playground 2023-01-13 08:21:38 -08:00
README.md Merge branch 'develop' into scratch-link-2.0-windows 2023-04-06 09:21:59 -07:00
release.config.js Merge pull request #12 from LLK/semantic-release 2023-04-05 19:30:10 -07:00
renovate.json5 chore(deps): customize Renovate config 2023-04-07 12:22:37 -07:00
scratch-link.sln feat(Win): add proper Windows icon for app and tray 2023-04-19 10:36:15 -07:00
stylecop.json add StyleCop.Analyzers 2023-01-13 08:21:35 -08:00
svg-convert.sh fix(Win): fix larger icon sizes being ignored sometimes 2023-04-19 11:25:31 -07:00
TRADEMARK Update TRADEMARK 2019-03-06 12:56:27 -05:00

Scratch Link 2.0

Scratch Link is a helper application which allows Scratch 3.0 to communicate with hardware peripherals. Scratch Link replaces the Scratch Device Manager and Scratch Device Plug-in.

System Requirements:

Minimum
macOS 10.15 "Catalina"
Windows Windows 10 build 17763

The Windows version requires the Windows App Runtime version 1.2, and will install it automatically if possible.

Manual installation is available here (choose your platform):

To use Scratch Link with Scratch 3.0:

  1. Install and run Scratch Link
  2. Open Scratch 3.0
  3. Select the "Add Extension" button (looks like Scratch blocks with a + at the bottom of the block categories list)
  4. Select a compatible extension such as the micro:bit or LEGO EV3 extension.
  5. Follow the prompts to connect your peripheral.
  6. Build a project with the new extension blocks. Scratch Link will help Scratch communicate with your peripheral.

Development: Getting started

Documentation

The general network protocol and all supported hardware protocols are documented in Markdown files in the Documentation subdirectory. Please note that network protocol stability and compatibility are high priorities for this project. Changes to the protocol are unlikely to be accepted without very strong justification combined with thorough documentation.

Please use markdownlint to check documentation changes before submitting a pull request.

Version numbers

Scratch Link 2.0 uses semantic-release to control its version number. The develop branch is treated as a pre-release branch, and main is treated as a release branch. Each time a change is merged to either of those branches, semantic-release will calculate a new version number.

Apple requires that CFBundleShortVersionString is unique for published releases, and the (CFBundleShortVersionString,CFBundleVersion) tuple is unique for uploaded builds. The CFBundleShortVersionString is version calculated by semantic-release, and CFBundleVersion is calculated from the number of commits since the tag made by semantic-release. This information is available through git describe.

Secure WebSockets

Some previous versions of Scratch Link used Secure WebSockets (wss://) to communicate with Scratch. This is no longer the case: new versions of Scratch Link use regular WebSockets (ws://). It is no longer necessary to prepare an SSL certificate for Scratch Link.

This change caused an incompatibility with some browsers, including Safari. The macOS version of Scratch Link 2.0 includes a Safari extension to resolve this incompatibility.

Windows platforms and installer size

The PublishReadyToRun (R2R) setting enables ahead-of-time (AOT) compilation, as opposed to just-in-time (JIT) compilation. This can improve performance, especially at startup. The drawback is R2R binaries are larger because they contain both intermediate language (IL) code, which is still needed for some scenarios, and the native version of the same code.

Recent versions of .NET (5.0 and above) can build a "Framework-Dependent Application" or a "Self-Contained Application" depending on settings.

  • A self-contained application includes the .NET runtime framework. This includes a platform-specific (x86, x64, or ARM64) version of dotnet.exe to host the application.
    • Cannot be built for "AnyCPU" because it must include the native portion of the runtime.
    • The app can be "trimmed" to include only the portions of the framework needed by the application, but it'll still be larger than a framework-dependent application.
  • A framework-dependent application does not include the framework at all; it must be installed separately.
    • The generated MSIX will trigger automatic framework installation if necessary (requires Internet connection).
    • Can be built for "AnyCPU" since it doesn't include the native portion (or any other portion) of the runtime.
    • Can be built for a specific CPU if desired.
    • Debugging this requires setting <WindowsPackageType>None</WindowsPackageType> in the project file.

When packaging an application:

  • An MSIX file (*.msix) can contain exactly one platform (x86, x64, ARM64).
  • An MSIX Bundle (*.msixbundle) can contain more than one MSIX -- one for each platform, for example.

Ideally, it would be possible to package a single "AnyCPU" build of the app with stub MSIX files to install each platform-specific copy of the framework, resulting in a Bundle that's only a little larger than a single copy of the app. More investigation needed.

However, it is possible to build a platform-specific MSIX containing an AnyCPU build of the app. That's much smaller than a platform-specific build of the app, so even with 3 full copies of the AnyCPU app -- one each packaged for x86, x64, and ARM64 -- the resulting bundle is significantly smaller.

Disabling R2R and bundling AnyCPU builds of the app generated a bundle roughly 12% of the size of a bundle of self-contained apps for the same set of platforms.