@geastack/targets 0.1.77 → 0.1.78

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/targets",
3
- "version": "0.1.77",
3
+ "version": "0.1.78",
4
4
  "description": "Native embedded build targets (ESP32-IDF, RP2350) for geastack apps: board sources, target catalog, and CMake glue driven by the gea CLI.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {
@@ -35,14 +35,14 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@geastack/chips": "^0.1.1",
39
- "@geastack/compiler": "^1.0.12",
40
- "@geastack/core": "^0.1.21",
41
- "@geastack/elements": "^0.1.0",
42
- "@geastack/engine": "^0.1.2",
43
- "@geastack/geaos": "^0.1.1",
44
- "@geastack/geatsc-plugin-gea": "^0.1.3",
45
- "@geastack/host": "^0.1.6"
38
+ "@geastack/chips": "^0.1.3",
39
+ "@geastack/compiler": "^1.0.15",
40
+ "@geastack/core": "^0.1.23",
41
+ "@geastack/elements": "^0.1.2",
42
+ "@geastack/engine": "^0.1.5",
43
+ "@geastack/geaos": "^0.1.3",
44
+ "@geastack/geatsc-plugin-gea": "^0.1.6",
45
+ "@geastack/host": "^0.1.8"
46
46
  },
47
47
  "scripts": {
48
48
  "test": "for f in $(git ls-files | grep -E '(^|/)(test[-_][^/]*|[^/]*\\.test)\\.mjs$'); do echo \"==> $f\"; node \"$f\" || exit 1; done"
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ // Portable replacement for the find(1) walk the target CMakeLists used to enumerate
3
+ // geatsc dependencies. Windows has no find(1) (find.exe is a text filter), so the
4
+ // configure step there produced an empty DEPENDS list and TSX edits never re-ran
5
+ // codegen. Node is already required by the build, so the walk lives here.
6
+ //
7
+ // usage: node gea-find-files.mjs <dir> [--follow-symlinks] [--prune a,b] [--ext .x,.y] [--name f.json,...]
8
+ //
9
+ // Prints one absolute path per line, forward slashes, in directory order. Pruned
10
+ // directory names are skipped at the directory boundary (like find -prune), which is
11
+ // what keeps configure fast next to a node_modules tree. A missing directory prints
12
+ // nothing and exits 0, matching the old behaviour where find's error was ignored.
13
+ import fs from 'node:fs'
14
+ import path from 'node:path'
15
+ import { fileURLToPath } from 'node:url'
16
+
17
+ function parseArgs(argv) {
18
+ const options = { dir: null, followSymlinks: false, prune: [], ext: [], name: [] }
19
+ for (let i = 0; i < argv.length; i += 1) {
20
+ const arg = argv[i]
21
+ const list = () => String(argv[++i] || '').split(',').filter(Boolean)
22
+ if (arg === '--follow-symlinks') options.followSymlinks = true
23
+ else if (arg === '--prune') options.prune.push(...list())
24
+ else if (arg === '--ext') options.ext.push(...list())
25
+ else if (arg === '--name') options.name.push(...list())
26
+ else if (arg.startsWith('--')) throw new Error(`unknown option ${arg}`)
27
+ else if (options.dir === null) options.dir = arg
28
+ else throw new Error(`unexpected argument ${arg}`)
29
+ }
30
+ if (options.dir === null) throw new Error('usage: gea-find-files.mjs <dir> [options]')
31
+ return options
32
+ }
33
+
34
+ export function findFiles({ dir, followSymlinks = false, prune = [], ext = [], name = [] }) {
35
+ const pruned = new Set(prune)
36
+ const exts = new Set(ext.map((e) => e.toLowerCase()))
37
+ const names = new Set(name)
38
+ const visited = new Set()
39
+ const out = []
40
+
41
+ const kind = (dirent, full) => {
42
+ if (dirent.isDirectory()) return 'dir'
43
+ if (dirent.isFile()) return 'file'
44
+ if (dirent.isSymbolicLink() && followSymlinks) {
45
+ try {
46
+ const stat = fs.statSync(full)
47
+ if (stat.isDirectory()) return 'dir'
48
+ if (stat.isFile()) return 'file'
49
+ } catch {
50
+ return null
51
+ }
52
+ }
53
+ return null
54
+ }
55
+
56
+ const walk = (current) => {
57
+ if (followSymlinks) {
58
+ let real
59
+ try {
60
+ real = fs.realpathSync(current)
61
+ } catch {
62
+ return
63
+ }
64
+ if (visited.has(real)) return
65
+ visited.add(real)
66
+ }
67
+ let entries
68
+ try {
69
+ entries = fs.readdirSync(current, { withFileTypes: true })
70
+ } catch {
71
+ return
72
+ }
73
+ for (const entry of entries) {
74
+ const full = path.join(current, entry.name)
75
+ const type = kind(entry, full)
76
+ if (type === 'dir') {
77
+ if (!pruned.has(entry.name)) walk(full)
78
+ } else if (type === 'file') {
79
+ if (names.has(entry.name) || exts.has(path.extname(entry.name).toLowerCase())) {
80
+ out.push(full.split(path.sep).join('/'))
81
+ }
82
+ }
83
+ }
84
+ }
85
+
86
+ let root = path.resolve(dir)
87
+ try {
88
+ root = fs.realpathSync(root)
89
+ } catch {
90
+ return out
91
+ }
92
+ walk(root)
93
+ return out
94
+ }
95
+
96
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
97
+ try {
98
+ const files = findFiles(parseArgs(process.argv.slice(2)))
99
+ if (files.length) process.stdout.write(files.join('\n') + '\n')
100
+ } catch (error) {
101
+ process.stderr.write(`gea-find-files: ${error.message}\n`)
102
+ process.exit(2)
103
+ }
104
+ }
@@ -0,0 +1,78 @@
1
+ # Shared enumeration of the files that feed the geatsc codegen DEPENDS lists.
2
+ #
3
+ # These used to be eight copies of an `execute_process(COMMAND find ...)` block, one per
4
+ # target. find(1) prunes node_modules / dist / .vite at the directory boundary, which is
5
+ # what keeps configure under a second (file(GLOB_RECURSE) stats every file first, half a
6
+ # minute next to a node_modules tree). Windows has no find(1): find.exe is a text filter,
7
+ # so the walk silently returned nothing and TSX edits never re-triggered codegen. The
8
+ # walk now lives in gea-find-files.mjs next to this file; node is already a build
9
+ # requirement.
10
+ #
11
+ # Knobs a target may set before including this file:
12
+ # GEA_FIND_SOURCES_FOLLOW_SYMLINKS ON (default) follows symlinks like `find -L`; a
13
+ # pnpm-style tree may want OFF.
14
+ # GEA_FIND_SOURCES_EXTRA_PRUNES directory names pruned in addition to the defaults.
15
+ if(NOT DEFINED GEA_FIND_SOURCES_FOLLOW_SYMLINKS)
16
+ set(GEA_FIND_SOURCES_FOLLOW_SYMLINKS ON)
17
+ endif()
18
+ set(_GEA_FIND_FILES_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/gea-find-files.mjs")
19
+ set(_GEA_FIND_DEFAULT_PRUNES
20
+ node_modules dist .vite build .build .scratch .test-tmp generated-output
21
+ ${GEA_FIND_SOURCES_EXTRA_PRUNES})
22
+
23
+ function(_gea_run_find_files OUT_VAR DIR)
24
+ get_filename_component(_dir "${DIR}" REALPATH)
25
+ set(_args "${_dir}")
26
+ if(GEA_FIND_SOURCES_FOLLOW_SYMLINKS)
27
+ list(APPEND _args --follow-symlinks)
28
+ endif()
29
+ execute_process(
30
+ COMMAND node "${_GEA_FIND_FILES_SCRIPT}" ${_args} ${ARGN}
31
+ OUTPUT_VARIABLE _output
32
+ ERROR_VARIABLE _error
33
+ RESULT_VARIABLE _result
34
+ OUTPUT_STRIP_TRAILING_WHITESPACE
35
+ )
36
+ if(NOT _result EQUAL 0)
37
+ message(FATAL_ERROR "gea-find-files failed for ${_dir}: ${_error}")
38
+ endif()
39
+ if(_output STREQUAL "")
40
+ set(${OUT_VAR} "" PARENT_SCOPE)
41
+ else()
42
+ string(REPLACE "\n" ";" _list "${_output}")
43
+ set(${OUT_VAR} "${_list}" PARENT_SCOPE)
44
+ endif()
45
+ endfunction()
46
+
47
+ # Source files and configs under DIR that affect Gea compiler -> geatsc output.
48
+ # Pass PRUNE_VENDOR to also skip `vendor` directories (the upstream compiler tree).
49
+ function(_gea_find_sources OUT_VAR DIR)
50
+ set(_prunes ${_GEA_FIND_DEFAULT_PRUNES})
51
+ if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
52
+ list(APPEND _prunes vendor)
53
+ endif()
54
+ list(JOIN _prunes "," _prune_arg)
55
+ _gea_run_find_files(_src "${DIR}"
56
+ --prune "${_prune_arg}"
57
+ --ext ".tsx,.ts,.jsx,.js,.css,.html"
58
+ --name "package.json,tsconfig.json,vite.config.ts")
59
+ set(${OUT_VAR} "${_src}" PARENT_SCOPE)
60
+ endfunction()
61
+
62
+ function(_gea_collect_app_sources OUT_VAR APP_DIR)
63
+ _gea_find_sources(_src "${APP_DIR}")
64
+ set(${OUT_VAR} "${_src}" PARENT_SCOPE)
65
+ endfunction()
66
+
67
+ # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
68
+ # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
69
+ # list: otherwise resizing/replacing an image never re-runs codegen and the stale
70
+ # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
71
+ # the app dir (not the framework) so configure stays fast.
72
+ function(_gea_collect_app_assets OUT_VAR APP_DIR)
73
+ list(JOIN _GEA_FIND_DEFAULT_PRUNES "," _prune_arg)
74
+ _gea_run_find_files(_assets "${APP_DIR}"
75
+ --prune "${_prune_arg}"
76
+ --ext ".png,.jpg,.jpeg,.gif")
77
+ set(${OUT_VAR} "${_assets}" PARENT_SCOPE)
78
+ endfunction()
@@ -54,63 +54,11 @@ function(_gea_write_if_different FILE_PATH CONTENT)
54
54
  endif()
55
55
  endfunction()
56
56
 
57
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
58
- # node_modules / dist / .vite at directory boundaries. CMake's file(GLOB_RECURSE) walks every file
59
- # in the tree before filtering — for example dirs that's ~1000 stat calls per node_modules. find(1)
60
- # prunes at the directory level; do not follow symlinks, or pnpm's dependency graph turns configure
61
- # into a slow walk through node_modules internals.
62
- function(_gea_find_sources OUT_VAR DIR)
63
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
64
- execute_process(
65
- COMMAND find "${_gea_find_dir}"
66
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name .build -o -name build
67
- -o -name .test-tmp -o -name generated-output -o -name .scratch -o -name vendor
68
- -o -name test262 -o -name bench -o -name test \) -prune
69
- -o -type f \(
70
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
71
- -o -name "*.css" -o -name "*.html"
72
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
73
- \) -print
74
- OUTPUT_VARIABLE _output
75
- OUTPUT_STRIP_TRAILING_WHITESPACE
76
- )
77
- if(_output STREQUAL "")
78
- set(${OUT_VAR} "" PARENT_SCOPE)
79
- else()
80
- string(REPLACE "\n" ";" _list "${_output}")
81
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
82
- endif()
83
- endfunction()
84
-
85
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
86
- _gea_find_sources(_src "${APP_DIR}")
87
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
88
- endfunction()
89
-
90
- # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
91
- # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
92
- # list: otherwise resizing/replacing an image never re-runs codegen and the stale
93
- # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
94
- # the app dir (not the framework) so configure stays fast.
95
- function(_gea_collect_app_assets OUT_VAR APP_DIR)
96
- execute_process(
97
- COMMAND find "${APP_DIR}"
98
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build
99
- -o -name .test-tmp -o -name generated-output -o -name .scratch -o -name vendor
100
- -o -name test262 -o -name bench -o -name test \) -prune
101
- -o -type f \(
102
- -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif"
103
- \) -print
104
- OUTPUT_VARIABLE _output
105
- OUTPUT_STRIP_TRAILING_WHITESPACE
106
- )
107
- if(_output STREQUAL "")
108
- set(${OUT_VAR} "" PARENT_SCOPE)
109
- else()
110
- string(REPLACE "\n" ";" _list "${_output}")
111
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
112
- endif()
113
- endfunction()
57
+ # pnpm-style trees turn a symlink-following walk into a crawl through node_modules
58
+ # internals, so this target walks physical directories only and prunes test trees.
59
+ set(GEA_FIND_SOURCES_FOLLOW_SYMLINKS OFF)
60
+ set(GEA_FIND_SOURCES_EXTRA_PRUNES vendor test262 bench test)
61
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
114
62
 
115
63
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
116
64
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.
@@ -46,62 +46,7 @@ function(_gea_write_if_different FILE_PATH CONTENT)
46
46
  endif()
47
47
  endfunction()
48
48
 
49
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
50
- # node_modules / dist / .vite at directory boundaries. CMake's file(GLOB_RECURSE) walks every file
51
- # in the tree before filtering — for example dirs that's ~1000 stat calls per node_modules. find(1)
52
- # prunes at the directory level, so configure stays under a second instead of half a minute.
53
- function(_gea_find_sources OUT_VAR DIR)
54
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
55
- set(_gea_optional_prunes "")
56
- if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
57
- list(APPEND _gea_optional_prunes -o -name vendor)
58
- endif()
59
- execute_process(
60
- COMMAND find -L "${_gea_find_dir}"
61
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name .build -o -name build -o -name .scratch -o -name .test-tmp -o -name generated-output ${_gea_optional_prunes} \) -prune
62
- -o -type f \(
63
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
64
- -o -name "*.css" -o -name "*.html"
65
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
66
- \) -print
67
- OUTPUT_VARIABLE _output
68
- OUTPUT_STRIP_TRAILING_WHITESPACE
69
- )
70
- if(_output STREQUAL "")
71
- set(${OUT_VAR} "" PARENT_SCOPE)
72
- else()
73
- string(REPLACE "\n" ";" _list "${_output}")
74
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
75
- endif()
76
- endfunction()
77
-
78
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
79
- _gea_find_sources(_src "${APP_DIR}")
80
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
81
- endfunction()
82
-
83
- # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
84
- # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
85
- # list: otherwise resizing/replacing an image never re-runs codegen and the stale
86
- # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
87
- # the app dir (not the framework) so configure stays fast.
88
- function(_gea_collect_app_assets OUT_VAR APP_DIR)
89
- execute_process(
90
- COMMAND find -L "${APP_DIR}"
91
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build \) -prune
92
- -o -type f \(
93
- -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif"
94
- \) -print
95
- OUTPUT_VARIABLE _output
96
- OUTPUT_STRIP_TRAILING_WHITESPACE
97
- )
98
- if(_output STREQUAL "")
99
- set(${OUT_VAR} "" PARENT_SCOPE)
100
- else()
101
- string(REPLACE "\n" ";" _list "${_output}")
102
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
103
- endif()
104
- endfunction()
49
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
105
50
 
106
51
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
107
52
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.
@@ -46,62 +46,7 @@ function(_gea_write_if_different FILE_PATH CONTENT)
46
46
  endif()
47
47
  endfunction()
48
48
 
49
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
50
- # node_modules / dist / .vite at directory boundaries. CMake's file(GLOB_RECURSE) walks every file
51
- # in the tree before filtering — for example dirs that's ~1000 stat calls per node_modules. find(1)
52
- # prunes at the directory level, so configure stays under a second instead of half a minute.
53
- function(_gea_find_sources OUT_VAR DIR)
54
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
55
- set(_gea_optional_prunes "")
56
- if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
57
- list(APPEND _gea_optional_prunes -o -name vendor)
58
- endif()
59
- execute_process(
60
- COMMAND find -L "${_gea_find_dir}"
61
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name .build -o -name build -o -name .scratch -o -name .test-tmp -o -name generated-output ${_gea_optional_prunes} \) -prune
62
- -o -type f \(
63
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
64
- -o -name "*.css" -o -name "*.html"
65
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
66
- \) -print
67
- OUTPUT_VARIABLE _output
68
- OUTPUT_STRIP_TRAILING_WHITESPACE
69
- )
70
- if(_output STREQUAL "")
71
- set(${OUT_VAR} "" PARENT_SCOPE)
72
- else()
73
- string(REPLACE "\n" ";" _list "${_output}")
74
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
75
- endif()
76
- endfunction()
77
-
78
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
79
- _gea_find_sources(_src "${APP_DIR}")
80
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
81
- endfunction()
82
-
83
- # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
84
- # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
85
- # list: otherwise resizing/replacing an image never re-runs codegen and the stale
86
- # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
87
- # the app dir (not the framework) so configure stays fast.
88
- function(_gea_collect_app_assets OUT_VAR APP_DIR)
89
- execute_process(
90
- COMMAND find -L "${APP_DIR}"
91
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build \) -prune
92
- -o -type f \(
93
- -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif"
94
- \) -print
95
- OUTPUT_VARIABLE _output
96
- OUTPUT_STRIP_TRAILING_WHITESPACE
97
- )
98
- if(_output STREQUAL "")
99
- set(${OUT_VAR} "" PARENT_SCOPE)
100
- else()
101
- string(REPLACE "\n" ";" _list "${_output}")
102
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
103
- endif()
104
- endfunction()
49
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
105
50
 
106
51
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
107
52
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.
@@ -46,39 +46,7 @@ function(_gea_write_if_different FILE_PATH CONTENT)
46
46
  endif()
47
47
  endfunction()
48
48
 
49
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
50
- # node_modules / dist / .vite at directory boundaries. CMake's file(GLOB_RECURSE) walks every file
51
- # in the tree before filtering — for example dirs that's ~1000 stat calls per node_modules. find(1)
52
- # prunes at the directory level, so configure stays under a second instead of half a minute.
53
- function(_gea_find_sources OUT_VAR DIR)
54
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
55
- set(_gea_optional_prunes "")
56
- if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
57
- list(APPEND _gea_optional_prunes -o -name vendor)
58
- endif()
59
- execute_process(
60
- COMMAND find -L "${_gea_find_dir}"
61
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build -o -name .build -o -name .scratch -o -name .test-tmp -o -name generated-output ${_gea_optional_prunes} \) -prune
62
- -o -type f \(
63
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
64
- -o -name "*.css" -o -name "*.html"
65
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
66
- \) -print
67
- OUTPUT_VARIABLE _output
68
- OUTPUT_STRIP_TRAILING_WHITESPACE
69
- )
70
- if(_output STREQUAL "")
71
- set(${OUT_VAR} "" PARENT_SCOPE)
72
- else()
73
- string(REPLACE "\n" ";" _list "${_output}")
74
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
75
- endif()
76
- endfunction()
77
-
78
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
79
- _gea_find_sources(_src "${APP_DIR}")
80
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
81
- endfunction()
49
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
82
50
 
83
51
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
84
52
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.
@@ -108,62 +108,7 @@ function(_gea_write_if_different FILE_PATH CONTENT)
108
108
  endif()
109
109
  endfunction()
110
110
 
111
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
112
- # node_modules / dist / .vite at directory boundaries. CMake's file(GLOB_RECURSE) walks every file
113
- # in the tree before filtering — for example dirs that's ~1000 stat calls per node_modules. find(1)
114
- # prunes at the directory level, so configure stays under a second instead of half a minute.
115
- function(_gea_find_sources OUT_VAR DIR)
116
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
117
- set(_gea_optional_prunes "")
118
- if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
119
- list(APPEND _gea_optional_prunes -o -name vendor)
120
- endif()
121
- execute_process(
122
- COMMAND find -L "${_gea_find_dir}"
123
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build -o -name .build -o -name .scratch -o -name .test-tmp -o -name generated-output ${_gea_optional_prunes} \) -prune
124
- -o -type f \(
125
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
126
- -o -name "*.css" -o -name "*.html"
127
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
128
- \) -print
129
- OUTPUT_VARIABLE _output
130
- OUTPUT_STRIP_TRAILING_WHITESPACE
131
- )
132
- if(_output STREQUAL "")
133
- set(${OUT_VAR} "" PARENT_SCOPE)
134
- else()
135
- string(REPLACE "\n" ";" _list "${_output}")
136
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
137
- endif()
138
- endfunction()
139
-
140
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
141
- _gea_find_sources(_src "${APP_DIR}")
142
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
143
- endfunction()
144
-
145
- # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
146
- # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
147
- # list: otherwise resizing/replacing an image never re-runs codegen and the stale
148
- # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
149
- # the app dir (not the framework) so configure stays fast.
150
- function(_gea_collect_app_assets OUT_VAR APP_DIR)
151
- execute_process(
152
- COMMAND find -L "${APP_DIR}"
153
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build \) -prune
154
- -o -type f \(
155
- -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif"
156
- \) -print
157
- OUTPUT_VARIABLE _output
158
- OUTPUT_STRIP_TRAILING_WHITESPACE
159
- )
160
- if(_output STREQUAL "")
161
- set(${OUT_VAR} "" PARENT_SCOPE)
162
- else()
163
- string(REPLACE "\n" ";" _list "${_output}")
164
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
165
- endif()
166
- endfunction()
111
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
167
112
 
168
113
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
169
114
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.
@@ -46,62 +46,7 @@ function(_gea_write_if_different FILE_PATH CONTENT)
46
46
  endif()
47
47
  endfunction()
48
48
 
49
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
50
- # node_modules / dist / .vite at directory boundaries. CMake's file(GLOB_RECURSE) walks every file
51
- # in the tree before filtering — for example dirs that's ~1000 stat calls per node_modules. find(1)
52
- # prunes at the directory level, so configure stays under a second instead of half a minute.
53
- function(_gea_find_sources OUT_VAR DIR)
54
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
55
- set(_gea_optional_prunes "")
56
- if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
57
- list(APPEND _gea_optional_prunes -o -name vendor)
58
- endif()
59
- execute_process(
60
- COMMAND find -L "${_gea_find_dir}"
61
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build -o -name .build -o -name .scratch -o -name .test-tmp -o -name generated-output ${_gea_optional_prunes} \) -prune
62
- -o -type f \(
63
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
64
- -o -name "*.css" -o -name "*.html"
65
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
66
- \) -print
67
- OUTPUT_VARIABLE _output
68
- OUTPUT_STRIP_TRAILING_WHITESPACE
69
- )
70
- if(_output STREQUAL "")
71
- set(${OUT_VAR} "" PARENT_SCOPE)
72
- else()
73
- string(REPLACE "\n" ";" _list "${_output}")
74
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
75
- endif()
76
- endfunction()
77
-
78
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
79
- _gea_find_sources(_src "${APP_DIR}")
80
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
81
- endfunction()
82
-
83
- # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
84
- # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
85
- # list: otherwise resizing/replacing an image never re-runs codegen and the stale
86
- # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
87
- # the app dir (not the framework) so configure stays fast.
88
- function(_gea_collect_app_assets OUT_VAR APP_DIR)
89
- execute_process(
90
- COMMAND find -L "${APP_DIR}"
91
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build \) -prune
92
- -o -type f \(
93
- -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif"
94
- \) -print
95
- OUTPUT_VARIABLE _output
96
- OUTPUT_STRIP_TRAILING_WHITESPACE
97
- )
98
- if(_output STREQUAL "")
99
- set(${OUT_VAR} "" PARENT_SCOPE)
100
- else()
101
- string(REPLACE "\n" ";" _list "${_output}")
102
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
103
- endif()
104
- endfunction()
49
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
105
50
 
106
51
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
107
52
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.
@@ -160,62 +160,7 @@ function(_gea_write_if_different FILE_PATH CONTENT)
160
160
  endif()
161
161
  endfunction()
162
162
 
163
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
164
- # node_modules / dist / .vite at directory boundaries. CMake's file(GLOB_RECURSE) walks every file
165
- # in the tree before filtering — for example dirs that's ~1000 stat calls per node_modules. find(1)
166
- # prunes at the directory level, so configure stays under a second instead of half a minute.
167
- function(_gea_find_sources OUT_VAR DIR)
168
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
169
- set(_gea_optional_prunes "")
170
- if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
171
- list(APPEND _gea_optional_prunes -o -name vendor)
172
- endif()
173
- execute_process(
174
- COMMAND find -L "${_gea_find_dir}"
175
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build -o -name .build -o -name .scratch -o -name .test-tmp -o -name generated-output ${_gea_optional_prunes} \) -prune
176
- -o -type f \(
177
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
178
- -o -name "*.css" -o -name "*.html"
179
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
180
- \) -print
181
- OUTPUT_VARIABLE _output
182
- OUTPUT_STRIP_TRAILING_WHITESPACE
183
- )
184
- if(_output STREQUAL "")
185
- set(${OUT_VAR} "" PARENT_SCOPE)
186
- else()
187
- string(REPLACE "\n" ";" _list "${_output}")
188
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
189
- endif()
190
- endfunction()
191
-
192
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
193
- _gea_find_sources(_src "${APP_DIR}")
194
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
195
- endfunction()
196
-
197
- # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
198
- # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
199
- # list: otherwise resizing/replacing an image never re-runs codegen and the stale
200
- # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
201
- # the app dir (not the framework) so configure stays fast.
202
- function(_gea_collect_app_assets OUT_VAR APP_DIR)
203
- execute_process(
204
- COMMAND find -L "${APP_DIR}"
205
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build \) -prune
206
- -o -type f \(
207
- -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif"
208
- \) -print
209
- OUTPUT_VARIABLE _output
210
- OUTPUT_STRIP_TRAILING_WHITESPACE
211
- )
212
- if(_output STREQUAL "")
213
- set(${OUT_VAR} "" PARENT_SCOPE)
214
- else()
215
- string(REPLACE "\n" ";" _list "${_output}")
216
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
217
- endif()
218
- endfunction()
163
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
219
164
 
220
165
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
221
166
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.
@@ -63,71 +63,7 @@ function(_gea_write_if_different FILE_PATH CONTENT)
63
63
  endif()
64
64
  endfunction()
65
65
 
66
- # Enumerate files under DIR matching one of the source extensions / config filenames, pruning
67
- # node_modules / dist / .vite / generated-output at directory boundaries. CMake's
68
- # file(GLOB_RECURSE) walks every file in the tree before filtering — for example dirs that's
69
- # ~1000 stat calls per node_modules. find(1) prunes at the directory level, so configure stays
70
- # under a second instead of half a minute. generated-output is geatsc's own test-verification
71
- # scratch tree (tsc-verify/test262 fixtures) — not compiler source, but matched extensions
72
- # (.ts/.js) and pathological filenames from Windows-path test cases (literal backslashes) can
73
- # reach CMake's dependency list and corrupt it (invalid escape sequence in the generated
74
- # Makefile). Pruning it here keeps this scan scoped to real compiler/plugin/core source, exactly
75
- # like dist/build are already excluded as build output rather than source. `.build` is the
76
- # geatsc test-runner scratch tree (core/packages/core/test/.build/*) whose transient .js
77
- # fixtures otherwise land in the stamp's DEPENDS and break the build once the tests clean them
78
- # up ("No rule to make target ...button-tetris-drop-driver.js").
79
- function(_gea_find_sources OUT_VAR DIR)
80
- get_filename_component(_gea_find_dir "${DIR}" REALPATH)
81
- set(_gea_optional_prunes "")
82
- if(ARGC GREATER 2 AND "${ARGV2}" STREQUAL "PRUNE_VENDOR")
83
- list(APPEND _gea_optional_prunes -o -name vendor)
84
- endif()
85
- execute_process(
86
- COMMAND find -L "${_gea_find_dir}"
87
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build -o -name .build -o -name .scratch -o -name .test-tmp -o -name generated-output ${_gea_optional_prunes} \) -prune
88
- -o -type f \(
89
- -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js"
90
- -o -name "*.css" -o -name "*.html"
91
- -o -name "package.json" -o -name "tsconfig.json" -o -name "vite.config.ts"
92
- \) -print
93
- OUTPUT_VARIABLE _output
94
- OUTPUT_STRIP_TRAILING_WHITESPACE
95
- )
96
- if(_output STREQUAL "")
97
- set(${OUT_VAR} "" PARENT_SCOPE)
98
- else()
99
- string(REPLACE "\n" ";" _list "${_output}")
100
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
101
- endif()
102
- endfunction()
103
-
104
- function(_gea_collect_app_sources OUT_VAR APP_DIR)
105
- _gea_find_sources(_src "${APP_DIR}")
106
- set(${OUT_VAR} "${_src}" PARENT_SCOPE)
107
- endfunction()
108
-
109
- # App image assets (PNG/JPG/GIF). generate-gea-embedded-assets.mjs embeds these as
110
- # .rodata referenced by `<img src>`, so they MUST be on the geatsc_build DEPENDS
111
- # list: otherwise resizing/replacing an image never re-runs codegen and the stale
112
- # bytes ship (and an oversized PNG silently fails to decode on-device). Scoped to
113
- # the app dir (not the framework) so configure stays fast.
114
- function(_gea_collect_app_assets OUT_VAR APP_DIR)
115
- execute_process(
116
- COMMAND find -L "${APP_DIR}"
117
- -type d \( -name node_modules -o -name dist -o -name .vite -o -name build -o -name .build \) -prune
118
- -o -type f \(
119
- -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" -o -name "*.gif"
120
- \) -print
121
- OUTPUT_VARIABLE _output
122
- OUTPUT_STRIP_TRAILING_WHITESPACE
123
- )
124
- if(_output STREQUAL "")
125
- set(${OUT_VAR} "" PARENT_SCOPE)
126
- else()
127
- string(REPLACE "\n" ";" _list "${_output}")
128
- set(${OUT_VAR} "${_list}" PARENT_SCOPE)
129
- endif()
130
- endfunction()
66
+ include("${GEA_EMBEDDED_ROOT}/targets/esp32/gea_find_sources.cmake")
131
67
 
132
68
  # Source files that affect Gea compiler -> geatsc output. Keep this scoped to
133
69
  # the embedded framework, upstream Gea compiler, and @geatsc/plugin-gea.