fastled 1.2.43__tar.gz → 1.2.44__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastled-1.2.44/.github/workflows/build_docker_image_template.yml +79 -0
- fastled-1.2.44/.github/workflows/build_multi_docker_image.yml +120 -0
- {fastled-1.2.43 → fastled-1.2.44}/Dockerfile +4 -2
- {fastled-1.2.43 → fastled-1.2.44}/PKG-INFO +1 -1
- {fastled-1.2.43 → fastled-1.2.44}/compiler/code_sync.py +14 -8
- {fastled-1.2.43 → fastled-1.2.44}/compiler/compile.py +76 -82
- fastled-1.2.44/compiler/compile_lock.py +3 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/init_runtime.py +18 -11
- {fastled-1.2.43 → fastled-1.2.44}/compiler/platformio.ini +3 -1
- {fastled-1.2.43 → fastled-1.2.44}/compiler/process-ino.py +39 -25
- {fastled-1.2.43 → fastled-1.2.44}/compiler/requirements.txt +4 -4
- {fastled-1.2.43 → fastled-1.2.44}/compiler/run.py +30 -15
- {fastled-1.2.43 → fastled-1.2.44}/compiler/sketch_hasher.py +8 -7
- {fastled-1.2.43 → fastled-1.2.44}/compiler/wasm_compiler_flags.py +34 -31
- {fastled-1.2.43 → fastled-1.2.44}/docker-compose.yml +1 -1
- fastled-1.2.44/lint +17 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/__init__.py +1 -1
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/app.py +3 -2
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/compile_server_impl.py +3 -3
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/settings.py +1 -1
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled.egg-info/PKG-INFO +1 -1
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled.egg-info/SOURCES.txt +2 -1
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_bad_ino.py +6 -1
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_build_examples.py +4 -1
- fastled-1.2.43/.github/workflows/build_multi_docker_image.yml +0 -174
- fastled-1.2.43/compiler/compile_lock.py +0 -3
- fastled-1.2.43/lint +0 -17
- {fastled-1.2.43 → fastled-1.2.44}/.aiderignore +0 -0
- {fastled-1.2.43/compiler → fastled-1.2.44}/.dockerignore +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.github/workflows/lint.yml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.github/workflows/test_win.yml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.gitignore +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.pylintrc +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.vscode/launch.json +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.vscode/settings.json +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/.vscode/tasks.json +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/LICENSE +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/MANIFEST.in +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/README.md +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/RELEASE.md +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/TODO.md +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/build_exe.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/build_site.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/clean +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/CMakeLists.txt +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/__init__.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/arduino-pre-process.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/build.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/build_archive.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/build_fast.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/entrypoint.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/extra/100dots.html +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/extra/demo_threejs.html +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/extra/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/final_prewarm.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/index.css +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/index.html +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/index.js +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/install-arduino-cli.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/modules/graphics_manager.js +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/modules/graphics_manager_threejs.js +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/modules/ui_manager.js +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/pre-process.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/prewarm.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/compiler/server.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/install +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/install_linux.sh +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/pyproject.toml +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/requirements.testing.txt +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/setup.cfg +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/setup.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/assets/example.txt +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/cli.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/client_server.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/compile_server.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/docker_manager.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/filewatcher.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/interactive_srcs.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/keyboard.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/live_client.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/open_browser.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/open_browser2.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/parse_args.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/paths.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/project_init.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/site/build.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/sketch.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/spinner.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/string_diff.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/test/examples.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/types.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/util.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled/web_compile.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/test +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/html/index.html +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_api.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_cli.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_compile_server.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_docker_linux_on_windows.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_embedded_data.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_examples.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_filechanger.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_http_server.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_ino/bad/bad.ino +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_project_init.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_server_and_client_seperatly.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/tests/test_webcompile.py +0 -0
- {fastled-1.2.43 → fastled-1.2.44}/upload_package.sh +0 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
name: Docker Build Template
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_call:
|
5
|
+
secrets:
|
6
|
+
env_vars:
|
7
|
+
required: true
|
8
|
+
inputs:
|
9
|
+
runs_on:
|
10
|
+
required: true
|
11
|
+
type: string
|
12
|
+
platform:
|
13
|
+
required: true
|
14
|
+
type: string
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
build:
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
runs-on: ${{ inputs.runs_on }}
|
21
|
+
env:
|
22
|
+
env_vars: ${{ secrets.env_vars }}
|
23
|
+
outputs:
|
24
|
+
docker_username: ${{ steps.check.outputs.docker_username }}
|
25
|
+
steps:
|
26
|
+
- name: Decode credentials as environment variables
|
27
|
+
id: check
|
28
|
+
run: |
|
29
|
+
for i in $env_vars; do
|
30
|
+
i=$(echo $i | sed 's/=.*//g')=$(echo ${i#*=} | base64 -di | base64 -di)
|
31
|
+
echo ::add-mask::${i#*=}
|
32
|
+
printf '%s\n' "$i" >> $GITHUB_ENV
|
33
|
+
done
|
34
|
+
|
35
|
+
|
36
|
+
- name: Prepare
|
37
|
+
run: |
|
38
|
+
platform=${{ inputs.platform }}
|
39
|
+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
40
|
+
- name: Docker meta
|
41
|
+
id: meta
|
42
|
+
uses: docker/metadata-action@v5
|
43
|
+
with:
|
44
|
+
images: ${{ env.docker_registry_image }}
|
45
|
+
tags: |
|
46
|
+
type=raw,value=latest,enable={{is_default_branch}}
|
47
|
+
|
48
|
+
- name: Set up Docker Buildx
|
49
|
+
uses: docker/setup-buildx-action@v3
|
50
|
+
- name: Login to Docker Hub
|
51
|
+
uses: docker/login-action@v3
|
52
|
+
with:
|
53
|
+
username: ${{ env.docker_username }}
|
54
|
+
password: ${{ env.docker_password }}
|
55
|
+
- name: Build and push by digest
|
56
|
+
id: build
|
57
|
+
uses: docker/build-push-action@v6
|
58
|
+
with:
|
59
|
+
platforms: ${{ inputs.platform }}
|
60
|
+
context: https://github.com/zackees/fastled-wasm.git
|
61
|
+
file: Dockerfile
|
62
|
+
labels: ${{ steps.meta.outputs.labels }}
|
63
|
+
outputs: type=image,name=${{ env.docker_registry_image }},push-by-digest=true,name-canonical=true,push=true
|
64
|
+
build-args: |
|
65
|
+
PLATFORM_TAG=${{ inputs.platform == 'linux/arm64' && '-arm64' || '' }}
|
66
|
+
cache-from: type=gha
|
67
|
+
cache-to: type=gha,mode=max,compression=zstd
|
68
|
+
- name: Export digest
|
69
|
+
run: |
|
70
|
+
mkdir -p /tmp/digests
|
71
|
+
digest="${{ steps.build.outputs.digest }}"
|
72
|
+
touch "/tmp/digests/${digest#sha256:}"
|
73
|
+
- name: Upload digest
|
74
|
+
uses: actions/upload-artifact@v4
|
75
|
+
with:
|
76
|
+
name: digests-${{ env.PLATFORM_PAIR }}
|
77
|
+
path: /tmp/digests/*
|
78
|
+
if-no-files-found: error
|
79
|
+
retention-days: 1
|
@@ -0,0 +1,120 @@
|
|
1
|
+
name: Build and Push Multi Docker Image
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main # Adjust this to your default branch
|
7
|
+
schedule:
|
8
|
+
- cron: '0 12 * * *' # Executes every day at 4:00 AM Pacific Time
|
9
|
+
|
10
|
+
env:
|
11
|
+
REGISTRY_IMAGE: niteris/fastled-wasm # Replace with your Docker Hub username and repository
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
check-if-changed:
|
15
|
+
runs-on: ubuntu-24.04
|
16
|
+
outputs:
|
17
|
+
should_run: ${{ steps.check.outputs.should_run }}
|
18
|
+
steps:
|
19
|
+
- name: Check workflow repo changes
|
20
|
+
uses: actions/checkout@v4
|
21
|
+
with:
|
22
|
+
fetch-depth: 2
|
23
|
+
|
24
|
+
- id: check
|
25
|
+
run: |
|
26
|
+
# Check if there are any changes in workflow repository
|
27
|
+
# At this point always run, this used to trigger on changes to fastled repo (mostly for the compiler stuff)
|
28
|
+
# but that has been moved to this repo.
|
29
|
+
echo "should_run=true" >> $GITHUB_OUTPUT
|
30
|
+
|
31
|
+
|
32
|
+
credentials:
|
33
|
+
needs: check-if-changed
|
34
|
+
if: needs.check-if-changed.outputs.should_run == 'true'
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
outputs:
|
37
|
+
docker_username: ${{ steps.credentials.outputs.docker_username }}
|
38
|
+
docker_password: ${{ steps.credentials.outputs.docker_password }}
|
39
|
+
registry_image: ${{ steps.credentials.outputs.registry_image }}
|
40
|
+
steps:
|
41
|
+
- name: Output encoded credentials
|
42
|
+
id: credentials
|
43
|
+
env:
|
44
|
+
docker_username: ${{ secrets.DOCKER_USERNAME }}
|
45
|
+
docker_password: ${{ secrets.DOCKER_PASSWORD }}
|
46
|
+
registry_image: ${{ env.REGISTRY_IMAGE }}
|
47
|
+
run: |
|
48
|
+
echo "docker_username=$(echo $docker_username | base64 -w0 | base64 -w0)" >> $GITHUB_OUTPUT
|
49
|
+
echo "docker_password=$(echo $docker_password | base64 -w0 | base64 -w0)" >> $GITHUB_OUTPUT
|
50
|
+
echo "registry_image=$(echo $registry_image | base64 -w0 | base64 -w0)" >> $GITHUB_OUTPUT
|
51
|
+
|
52
|
+
|
53
|
+
build-amd64:
|
54
|
+
needs: credentials
|
55
|
+
uses: ./.github/workflows/build_docker_image_template.yml
|
56
|
+
with:
|
57
|
+
runs_on: ubuntu-24.04
|
58
|
+
platform: linux/amd64
|
59
|
+
secrets:
|
60
|
+
env_vars: |
|
61
|
+
docker_username=${{ needs.credentials.outputs.docker_username }}
|
62
|
+
docker_password=${{ needs.credentials.outputs.docker_password }}
|
63
|
+
docker_registry_image=${{ needs.credentials.outputs.registry_image }}
|
64
|
+
|
65
|
+
build-arm:
|
66
|
+
needs: credentials
|
67
|
+
uses: ./.github/workflows/build_docker_image_template.yml
|
68
|
+
with:
|
69
|
+
runs_on: ubuntu-24.04-arm
|
70
|
+
platform: linux/arm64
|
71
|
+
secrets:
|
72
|
+
env_vars: |
|
73
|
+
docker_username=${{ needs.credentials.outputs.docker_username }}
|
74
|
+
docker_password=${{ needs.credentials.outputs.docker_password }}
|
75
|
+
docker_registry_image=${{ needs.credentials.outputs.registry_image }}
|
76
|
+
|
77
|
+
|
78
|
+
merge:
|
79
|
+
runs-on: ubuntu-24.04
|
80
|
+
needs:
|
81
|
+
- check-if-changed
|
82
|
+
- credentials
|
83
|
+
- build-amd64
|
84
|
+
- build-arm
|
85
|
+
if: needs.check-if-changed.outputs.should_run == 'true'
|
86
|
+
steps:
|
87
|
+
- name: Download digests
|
88
|
+
uses: actions/download-artifact@v4
|
89
|
+
with:
|
90
|
+
path: /tmp/digests
|
91
|
+
pattern: digests-*
|
92
|
+
merge-multiple: true
|
93
|
+
|
94
|
+
- name: Set up Docker Buildx
|
95
|
+
uses: docker/setup-buildx-action@v3
|
96
|
+
|
97
|
+
- name: Docker meta
|
98
|
+
id: meta
|
99
|
+
uses: docker/metadata-action@v5
|
100
|
+
with:
|
101
|
+
images: ${{ env.REGISTRY_IMAGE }}
|
102
|
+
tags: |
|
103
|
+
type=raw,value=latest,enable={{is_default_branch}}
|
104
|
+
|
105
|
+
- name: Login to Docker Hub
|
106
|
+
uses: docker/login-action@v3
|
107
|
+
with:
|
108
|
+
username: ${{ secrets.DOCKER_USERNAME }}
|
109
|
+
password: ${{ secrets.DOCKER_PASSWORD }}
|
110
|
+
|
111
|
+
- name: Create manifest list and push
|
112
|
+
working-directory: /tmp/digests
|
113
|
+
run: |
|
114
|
+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
115
|
+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
116
|
+
|
117
|
+
- name: Inspect image
|
118
|
+
run: |
|
119
|
+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
|
120
|
+
|
@@ -41,9 +41,11 @@
|
|
41
41
|
|
42
42
|
# This will be set to arm64 to support MacOS M1+ devices (and Linux-based arm64 devices)
|
43
43
|
ARG PLATFORM_TAG=""
|
44
|
+
# ARG EMSDK_VERSION_TAG="4.0.4"
|
45
|
+
ARG EMSDK_VERSION_TAG="3.1.70"
|
44
46
|
|
45
47
|
# Use only Emscripten base image
|
46
|
-
FROM emscripten/emsdk
|
48
|
+
FROM emscripten/emsdk:${EMSDK_VERSION_TAG}${PLATFORM_TAG}
|
47
49
|
|
48
50
|
|
49
51
|
ENV DEBIAN_FRONTEND=noninteractive
|
@@ -119,7 +121,7 @@ RUN echo 'export LANG=en_US.UTF-8' >> /etc/profile && \
|
|
119
121
|
#COPY compiler/install-arduino-cli.sh /install-arduino-cli.sh
|
120
122
|
#RUN chmod +x /install-arduino-cli.sh && /install-arduino-cli.sh || echo "Failed to install Arduino CLI"
|
121
123
|
|
122
|
-
RUN pip install uv==0.5
|
124
|
+
RUN pip install uv==0.6.5
|
123
125
|
|
124
126
|
# Get the compiler requirements and install them.
|
125
127
|
COPY compiler/requirements.txt /install/requirements.txt
|
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
import os
|
3
|
-
from pathlib import Path
|
4
|
-
from typing import Callable
|
5
1
|
import subprocess
|
6
2
|
import time
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import Callable
|
7
5
|
|
8
6
|
from compile_lock import COMPILE_LOCK
|
9
7
|
|
@@ -11,6 +9,7 @@ VOLUME_MAPPED_SRC = Path("/host/fastled/src")
|
|
11
9
|
RSYNC_DEST = Path("/js/fastled/src")
|
12
10
|
TIME_START = time.time()
|
13
11
|
|
12
|
+
|
14
13
|
def sync_src_to_target(
|
15
14
|
src: Path, dst: Path, callback: Callable[[], None] | None = None
|
16
15
|
) -> bool:
|
@@ -28,7 +27,15 @@ def sync_src_to_target(
|
|
28
27
|
with COMPILE_LOCK:
|
29
28
|
# Use rsync to copy files, preserving timestamps and deleting removed files
|
30
29
|
cp: subprocess.CompletedProcess = subprocess.run(
|
31
|
-
[
|
30
|
+
[
|
31
|
+
"rsync",
|
32
|
+
"-av",
|
33
|
+
"--info=NAME",
|
34
|
+
"--delete",
|
35
|
+
f"{src}/",
|
36
|
+
f"{dst}/",
|
37
|
+
exclude_hidden,
|
38
|
+
],
|
32
39
|
check=True,
|
33
40
|
text=True,
|
34
41
|
capture_output=True,
|
@@ -63,9 +70,8 @@ def sync_src_to_target(
|
|
63
70
|
return False
|
64
71
|
|
65
72
|
|
66
|
-
|
67
73
|
def sync_source_directory_if_volume_is_mapped(
|
68
|
-
callback: Callable[[], None] | None = None
|
74
|
+
callback: Callable[[], None] | None = None,
|
69
75
|
) -> bool:
|
70
76
|
"""Sync the volume mapped source directory to the FastLED source directory."""
|
71
77
|
if not VOLUME_MAPPED_SRC.exists():
|
@@ -73,4 +79,4 @@ def sync_source_directory_if_volume_is_mapped(
|
|
73
79
|
print("Skipping rsync, as fastled src volume not mapped")
|
74
80
|
return False
|
75
81
|
print("Syncing source directories because host is mapped in")
|
76
|
-
return sync_src_to_target(VOLUME_MAPPED_SRC, RSYNC_DEST, callback=callback)
|
82
|
+
return sync_src_to_target(VOLUME_MAPPED_SRC, RSYNC_DEST, callback=callback)
|
@@ -54,39 +54,36 @@ class SyntaxCheckResult:
|
|
54
54
|
_CHECK_SYNTAX = False
|
55
55
|
_COMPILER_PATH = "em++"
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
# FASTLED_SRC_PLATFORMS =
|
57
|
+
_JS_DIR = Path("/js")
|
58
|
+
_FASTLED_DIR = _JS_DIR / "fastled"
|
59
|
+
_FASTLED_SRC = _FASTLED_DIR / "src"
|
60
|
+
# FASTLED_SRC_PLATFORMS = _FASTLED_SRC / "platforms"
|
61
61
|
# FASTLED_SRC_PLATFORMS_WASM = FASTLED_SRC_PLATFORMS / "wasm"
|
62
|
-
#
|
63
|
-
|
62
|
+
# _FASTLED_SRC_PLATFORMS_WASM_COMPILER = FASTLED_SRC_PLATFORMS_WASM / "compiler"
|
63
|
+
_FASTLED_SRC_PLATFORMS_WASM_COMPILER = _JS_DIR / "compiler"
|
64
64
|
|
65
65
|
|
66
|
-
|
66
|
+
_JS_SRC = _JS_DIR / "src"
|
67
67
|
|
68
|
-
|
69
|
-
# FASTLED_SRC_DIR =
|
68
|
+
_FASTLED_DIR = _JS_DIR / "fastled"
|
69
|
+
# FASTLED_SRC_DIR = _FASTLED_DIR / "src"
|
70
70
|
# FASTLED_PLATFORMS_DIR = FASTLED_SRC_DIR / "platforms"
|
71
71
|
# FASTLED_WASM_DIR = FASTLED_PLATFORMS_DIR / "wasm"
|
72
|
-
|
73
|
-
|
72
|
+
_FASTLED_COMPILER_DIR = _JS_DIR / "compiler"
|
73
|
+
_FASTLED_MODULES_DIR = _FASTLED_COMPILER_DIR / "modules"
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
INDEX_JS_SRC = FASTLED_COMPILER_DIR / "index.js"
|
80
|
-
|
81
|
-
|
82
|
-
WASM_COMPILER_SETTTINGS = JS_DIR / "wasm_compiler_flags.py"
|
83
|
-
OUTPUT_FILES = ["fastled.js", "fastled.wasm"]
|
84
|
-
HEADERS_TO_INSERT = ["#include <Arduino.h>", '#include "platforms/wasm/js.h"']
|
85
|
-
FILE_EXTENSIONS = [".ino", ".h", ".hpp", ".cpp"]
|
86
|
-
MAX_COMPILE_ATTEMPTS = 1 # Occasionally the compiler fails for unknown reasons, but disabled because it increases the build time on failure.
|
87
|
-
FASTLED_OUTPUT_DIR_NAME = "fastled_js"
|
75
|
+
_PIO_BUILD_DIR = _JS_DIR / ".pio/build"
|
76
|
+
_INDEX_HTML_SRC = _FASTLED_COMPILER_DIR / "index.html"
|
77
|
+
_INDEX_CSS_SRC = _FASTLED_COMPILER_DIR / "index.css"
|
78
|
+
_INDEX_JS_SRC = _FASTLED_COMPILER_DIR / "index.js"
|
88
79
|
|
89
80
|
|
81
|
+
_WASM_COMPILER_SETTTINGS = _JS_DIR / "wasm_compiler_flags.py"
|
82
|
+
_OUTPUT_FILES = ["fastled.js", "fastled.wasm"]
|
83
|
+
_HEADERS_TO_INSERT = ["#include <Arduino.h>", '#include "platforms/wasm/js.h"']
|
84
|
+
_FILE_EXTENSIONS = [".ino", ".h", ".hpp", ".cpp"]
|
85
|
+
_MAX_COMPILE_ATTEMPTS = 1 # Occasionally the compiler fails for unknown reasons, but disabled because it increases the build time on failure.
|
86
|
+
_FASTLED_OUTPUT_DIR_NAME = "fastled_js"
|
90
87
|
|
91
88
|
|
92
89
|
def copy_files(src_dir: Path, js_src: Path) -> None:
|
@@ -101,7 +98,7 @@ def copy_files(src_dir: Path, js_src: Path) -> None:
|
|
101
98
|
|
102
99
|
|
103
100
|
def compile(
|
104
|
-
|
101
|
+
_JS_DIR: Path, build_mode: BuildMode, auto_clean: bool, no_platformio: bool
|
105
102
|
) -> int:
|
106
103
|
print("Starting compilation process...")
|
107
104
|
max_attempts = 1
|
@@ -124,7 +121,7 @@ def compile(
|
|
124
121
|
def _open_process(cmd_list: list[str] = cmd_list) -> subprocess.Popen:
|
125
122
|
out = subprocess.Popen(
|
126
123
|
cmd_list,
|
127
|
-
cwd=
|
124
|
+
cwd=_JS_DIR,
|
128
125
|
stdout=subprocess.PIPE,
|
129
126
|
stderr=subprocess.STDOUT,
|
130
127
|
universal_newlines=True,
|
@@ -165,7 +162,7 @@ def insert_header(file: Path) -> None:
|
|
165
162
|
content = f.read()
|
166
163
|
|
167
164
|
# Remove existing includes
|
168
|
-
for header in
|
165
|
+
for header in _HEADERS_TO_INSERT:
|
169
166
|
content = re.sub(
|
170
167
|
rf"^.*{re.escape(header)}.*\n", "", content, flags=re.MULTILINE
|
171
168
|
)
|
@@ -175,7 +172,7 @@ def insert_header(file: Path) -> None:
|
|
175
172
|
content = re.sub(arduino_pattern, "", content, flags=re.MULTILINE)
|
176
173
|
|
177
174
|
# Add new headers at the beginning
|
178
|
-
content = "\n".join(
|
175
|
+
content = "\n".join(_HEADERS_TO_INSERT) + "\n" + content
|
179
176
|
|
180
177
|
with open(file, "w") as f:
|
181
178
|
f.write(content)
|
@@ -220,7 +217,7 @@ def insert_headers(
|
|
220
217
|
def process_ino_files(src_dir: Path) -> None:
|
221
218
|
transform_to_cpp(src_dir)
|
222
219
|
exclusion_folders: List[Path] = []
|
223
|
-
insert_headers(src_dir, exclusion_folders,
|
220
|
+
insert_headers(src_dir, exclusion_folders, _FILE_EXTENSIONS)
|
224
221
|
print("Transform to cpp and insert header operations completed.")
|
225
222
|
|
226
223
|
|
@@ -250,6 +247,8 @@ def check_syntax_with_gcc(file_path, gcc_path="gcc"):
|
|
250
247
|
"/js/fastled/src/", # Add /js/fastled/src/ to the include path
|
251
248
|
"-I",
|
252
249
|
"/emsdk/upstream/emscripten/system/include",
|
250
|
+
"-I",
|
251
|
+
"/js/fastled/src/platforms/wasm/compiler", # Arduino.h and Arduino.cpp
|
253
252
|
file_path,
|
254
253
|
]
|
255
254
|
cmd_str = subprocess.list2cmdline(cmd_list)
|
@@ -421,10 +420,10 @@ def find_project_dir(mapped_dir: Path) -> Path:
|
|
421
420
|
|
422
421
|
|
423
422
|
def process_compile(
|
424
|
-
|
423
|
+
_JS_DIR: Path, build_mode: BuildMode, auto_clean: bool, no_platformio: bool
|
425
424
|
) -> None:
|
426
425
|
print("Starting compilation...")
|
427
|
-
rtn = compile(
|
426
|
+
rtn = compile(_JS_DIR, build_mode, auto_clean, no_platformio=no_platformio)
|
428
427
|
print(f"Compilation return code: {rtn}")
|
429
428
|
if rtn != 0:
|
430
429
|
print("Compilation failed.")
|
@@ -450,32 +449,29 @@ def hash_file(file_path: Path) -> str:
|
|
450
449
|
|
451
450
|
def main() -> int:
|
452
451
|
|
453
|
-
|
454
|
-
|
455
|
-
# assert JS_DIR.exists()
|
452
|
+
# assert _JS_DIR.exists()
|
456
453
|
# assert ARDUINO_H_SRC.exists()
|
457
|
-
# assert
|
458
|
-
# assert
|
459
|
-
# assert
|
460
|
-
# assert
|
461
|
-
# assert
|
462
|
-
# assert
|
454
|
+
# assert _INDEX_HTML_SRC.exists()
|
455
|
+
# assert _INDEX_CSS_SRC.exists(), f"Index CSS not found at {_INDEX_CSS_SRC}"
|
456
|
+
# assert _INDEX_JS_SRC.exists()
|
457
|
+
# assert _WASM_COMPILER_SETTTINGS.exists()
|
458
|
+
# assert _FASTLED_SRC_PLATFORMS_WASM_COMPILER.exists()
|
459
|
+
# assert _JS_DIR.exists(), f"_JS_DIR does not exist: {_JS_DIR}"
|
463
460
|
# assert ARDUINO_H_SRC.exists(), f"ARDUINO_H_SRC does not exist: {ARDUINO_H_SRC}"
|
464
|
-
# assert
|
465
|
-
# assert
|
466
|
-
# assert
|
461
|
+
# assert _INDEX_HTML_SRC.exists(), f"_INDEX_HTML_SRC does not exist: {_INDEX_HTML_SRC}"
|
462
|
+
# assert _INDEX_CSS_SRC.exists(), f"_INDEX_CSS_SRC does not exist: {_INDEX_CSS_SRC}"
|
463
|
+
# assert _INDEX_JS_SRC.exists(), f"_INDEX_JS_SRC does not exist: {_INDEX_JS_SRC}"
|
467
464
|
# assert (
|
468
|
-
#
|
469
|
-
# ), f"
|
465
|
+
# _WASM_COMPILER_SETTTINGS.exists()
|
466
|
+
# ), f"_WASM_COMPILER_SETTTINGS does not exist: {_WASM_COMPILER_SETTTINGS}"
|
470
467
|
|
471
468
|
check_paths: list[Path] = [
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
FASTLED_SRC_PLATFORMS_WASM_COMPILER,
|
469
|
+
_JS_DIR,
|
470
|
+
_INDEX_HTML_SRC,
|
471
|
+
_INDEX_CSS_SRC,
|
472
|
+
_INDEX_JS_SRC,
|
473
|
+
_WASM_COMPILER_SETTTINGS,
|
474
|
+
_FASTLED_SRC_PLATFORMS_WASM_COMPILER,
|
479
475
|
]
|
480
476
|
|
481
477
|
missing_paths = [p for p in check_paths if not p.exists()]
|
@@ -497,9 +493,9 @@ def main() -> int:
|
|
497
493
|
os.environ["EMPROFILE"] = "2"
|
498
494
|
|
499
495
|
try:
|
500
|
-
if
|
501
|
-
shutil.rmtree(
|
502
|
-
|
496
|
+
if _JS_SRC.exists():
|
497
|
+
shutil.rmtree(_JS_SRC)
|
498
|
+
_JS_SRC.mkdir(parents=True, exist_ok=True)
|
503
499
|
src_dir = find_project_dir(args.mapped_dir)
|
504
500
|
|
505
501
|
any_only_flags = args.only_copy or args.only_insert_header or args.only_compile
|
@@ -509,14 +505,12 @@ def main() -> int:
|
|
509
505
|
do_compile = not any_only_flags or args.only_compile
|
510
506
|
|
511
507
|
if do_copy:
|
512
|
-
copy_files(src_dir,
|
513
|
-
print("Copying Arduino.h to src/Arduino.h")
|
514
|
-
shutil.copy(ARDUINO_H_SRC, JS_SRC / "Arduino.h")
|
508
|
+
copy_files(src_dir, _JS_SRC)
|
515
509
|
if args.only_copy:
|
516
510
|
return 0
|
517
511
|
|
518
512
|
if do_insert_header:
|
519
|
-
process_ino_files(
|
513
|
+
process_ino_files(_JS_SRC)
|
520
514
|
if args.only_insert_header:
|
521
515
|
print("Transform to cpp and insert header operations completed.")
|
522
516
|
return 0
|
@@ -524,7 +518,7 @@ def main() -> int:
|
|
524
518
|
if _CHECK_SYNTAX:
|
525
519
|
print("Performing syntax check...")
|
526
520
|
syntax_results = check_syntax(
|
527
|
-
directory_path=
|
521
|
+
directory_path=_JS_SRC, gcc_path=_COMPILER_PATH
|
528
522
|
)
|
529
523
|
failed_checks = [r for r in syntax_results if not r.is_valid]
|
530
524
|
if failed_checks:
|
@@ -549,7 +543,7 @@ def main() -> int:
|
|
549
543
|
build_mode = BuildMode.QUICK
|
550
544
|
|
551
545
|
process_compile(
|
552
|
-
|
546
|
+
_JS_DIR=_JS_DIR,
|
553
547
|
build_mode=build_mode,
|
554
548
|
auto_clean=not args.disable_auto_clean,
|
555
549
|
no_platformio=no_platformio,
|
@@ -559,16 +553,16 @@ def main() -> int:
|
|
559
553
|
return 1
|
560
554
|
|
561
555
|
def _get_build_dir_platformio() -> Path:
|
562
|
-
build_dirs = [d for d in
|
556
|
+
build_dirs = [d for d in _PIO_BUILD_DIR.iterdir() if d.is_dir()]
|
563
557
|
if len(build_dirs) != 1:
|
564
558
|
raise RuntimeError(
|
565
|
-
f"Expected exactly one build directory in {
|
559
|
+
f"Expected exactly one build directory in {_PIO_BUILD_DIR}, found {len(build_dirs)}: {build_dirs}"
|
566
560
|
)
|
567
561
|
build_dir: Path = build_dirs[0]
|
568
562
|
return build_dir
|
569
563
|
|
570
564
|
def _get_build_dir_cmake() -> Path:
|
571
|
-
return
|
565
|
+
return _JS_DIR / "build"
|
572
566
|
|
573
567
|
if no_platformio:
|
574
568
|
build_dir = _get_build_dir_cmake()
|
@@ -576,45 +570,45 @@ def main() -> int:
|
|
576
570
|
build_dir = _get_build_dir_platformio()
|
577
571
|
|
578
572
|
print("Copying output files...")
|
579
|
-
|
580
|
-
|
573
|
+
fastled__JS_DIR: Path = src_dir / _FASTLED_OUTPUT_DIR_NAME
|
574
|
+
fastled__JS_DIR.mkdir(parents=True, exist_ok=True)
|
581
575
|
|
582
576
|
for file in ["fastled.js", "fastled.wasm"]:
|
583
577
|
_src = build_dir / file
|
584
|
-
_dst =
|
578
|
+
_dst = fastled__JS_DIR / file
|
585
579
|
print(f"Copying {_src} to {_dst}")
|
586
580
|
shutil.copy2(_src, _dst)
|
587
581
|
|
588
|
-
print(f"Copying {
|
589
|
-
shutil.copy2(
|
590
|
-
print(f"Copying {
|
591
|
-
shutil.copy2(
|
582
|
+
print(f"Copying {_INDEX_HTML_SRC} to output directory")
|
583
|
+
shutil.copy2(_INDEX_HTML_SRC, fastled__JS_DIR / "index.html")
|
584
|
+
print(f"Copying {_INDEX_CSS_SRC} to output directory")
|
585
|
+
shutil.copy2(_INDEX_CSS_SRC, fastled__JS_DIR / "index.css")
|
592
586
|
|
593
|
-
# copy all js files in
|
594
|
-
Path(
|
595
|
-
for _file in
|
587
|
+
# copy all js files in _FASTLED_COMPILER_DIR to output directory
|
588
|
+
Path(fastled__JS_DIR / "modules").mkdir(parents=True, exist_ok=True)
|
589
|
+
for _file in _FASTLED_MODULES_DIR.iterdir():
|
596
590
|
if _file.suffix == ".js":
|
597
591
|
print(f"Copying {_file} to output directory")
|
598
|
-
shutil.copy2(_file,
|
592
|
+
shutil.copy2(_file, fastled__JS_DIR / "modules" / _file.name)
|
599
593
|
|
600
594
|
fastled_js_mem = build_dir / "fastled.js.mem"
|
601
595
|
fastled_wasm_map = build_dir / "fastled.wasm.map"
|
602
596
|
fastled_js_symbols = build_dir / "fastled.js.symbols"
|
603
597
|
if fastled_js_mem.exists():
|
604
598
|
print(f"Copying {fastled_js_mem} to output directory")
|
605
|
-
shutil.copy2(fastled_js_mem,
|
599
|
+
shutil.copy2(fastled_js_mem, fastled__JS_DIR / fastled_js_mem.name)
|
606
600
|
if fastled_wasm_map.exists():
|
607
601
|
print(f"Copying {fastled_wasm_map} to output directory")
|
608
|
-
shutil.copy2(fastled_wasm_map,
|
602
|
+
shutil.copy2(fastled_wasm_map, fastled__JS_DIR / fastled_wasm_map.name)
|
609
603
|
if fastled_js_symbols.exists():
|
610
604
|
print(f"Copying {fastled_js_symbols} to output directory")
|
611
605
|
shutil.copy2(
|
612
|
-
fastled_js_symbols,
|
606
|
+
fastled_js_symbols, fastled__JS_DIR / fastled_js_symbols.name
|
613
607
|
)
|
614
608
|
print("Copying index.js to output directory")
|
615
|
-
shutil.copy2(
|
609
|
+
shutil.copy2(_INDEX_JS_SRC, fastled__JS_DIR / "index.js")
|
616
610
|
optional_input_data_dir = src_dir / "data"
|
617
|
-
output_data_dir =
|
611
|
+
output_data_dir = fastled__JS_DIR / optional_input_data_dir.name
|
618
612
|
|
619
613
|
# Handle data directory if it exists
|
620
614
|
manifest: list[dict] = []
|
@@ -663,9 +657,9 @@ def main() -> int:
|
|
663
657
|
# Write manifest file even if empty
|
664
658
|
print("Writing manifest files.json")
|
665
659
|
manifest_json_str = json.dumps(manifest, indent=2, sort_keys=True)
|
666
|
-
with open(
|
660
|
+
with open(fastled__JS_DIR / "files.json", "w") as f:
|
667
661
|
f.write(manifest_json_str)
|
668
|
-
cleanup(args,
|
662
|
+
cleanup(args, _JS_SRC)
|
669
663
|
|
670
664
|
print("Compilation process completed successfully")
|
671
665
|
return 0
|
@@ -1,26 +1,24 @@
|
|
1
|
-
|
2
|
-
import os
|
3
|
-
from pathlib import Path
|
4
1
|
import glob
|
2
|
+
import os
|
5
3
|
import warnings
|
6
4
|
from concurrent.futures import ThreadPoolExecutor
|
5
|
+
from pathlib import Path
|
7
6
|
|
8
7
|
HERE = Path(__file__).parent
|
9
8
|
|
10
9
|
|
11
10
|
_COMPILER_DIR = Path("/js/compiler")
|
12
|
-
|
13
|
-
|
14
|
-
_FASTLED_COMPILER_DIR = _WASM_DIR / "compiler"
|
11
|
+
_FASTLED_COMPILER_DIR = Path("/js/fastled/src/platforms/wasm/compiler")
|
12
|
+
|
15
13
|
|
16
14
|
def copy_task(src: str | Path) -> None:
|
17
15
|
src = Path(src)
|
18
16
|
if "entrypoint.sh" in str(src):
|
19
17
|
return
|
20
18
|
link_dst = Path("/js") / src.name
|
21
|
-
|
19
|
+
|
22
20
|
# Handle shell scripts
|
23
|
-
if src.suffix ==
|
21
|
+
if src.suffix == ".sh":
|
24
22
|
os.system(f"dos2unix {src} && chmod +x {src}")
|
25
23
|
|
26
24
|
# if link exists, remove it
|
@@ -31,7 +29,6 @@ def copy_task(src: str | Path) -> None:
|
|
31
29
|
except Exception as e:
|
32
30
|
warnings.warn(f"Failed to remove {link_dst}: {e}")
|
33
31
|
|
34
|
-
|
35
32
|
if not link_dst.exists():
|
36
33
|
print(f"Linking {src} to {link_dst}")
|
37
34
|
try:
|
@@ -44,8 +41,18 @@ def copy_task(src: str | Path) -> None:
|
|
44
41
|
|
45
42
|
def make_links() -> None:
|
46
43
|
# Define file patterns to include
|
47
|
-
patterns = [
|
48
|
-
|
44
|
+
patterns = [
|
45
|
+
"*.h",
|
46
|
+
"*.hpp",
|
47
|
+
"*.cpp",
|
48
|
+
"*.py",
|
49
|
+
"*.css",
|
50
|
+
"*.sh",
|
51
|
+
"*.ino",
|
52
|
+
"*.ini",
|
53
|
+
"*.txt",
|
54
|
+
]
|
55
|
+
|
49
56
|
# Get all matching files in compiler directory
|
50
57
|
files = []
|
51
58
|
for pattern in patterns:
|