feat(kotlin-compose): design system + 33 components + gallery_kt + e2e android emulator + scaffolder fixes
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,390 @@
|
||||
---
|
||||
name: fn-orquestador
|
||||
description: "Meta-orquestador (Fase 6) del ciclo reactivo. Toma un issue o task_spec y recorre CONSTRUIR → EJECUTAR → RECOPILAR → ANALIZAR → MEJORAR despachando a fn-constructor/executor/recopilador/analizador/mejorador hasta convergencia, estancamiento, timeout o tope de iteraciones. Trabaja SIEMPRE en rama sandbox `auto/<issue>`, NUNCA mergea a master, persiste progreso en `task_runs`. Issue 0069."
|
||||
model: sonnet
|
||||
tools: Read, Write, Bash, Glob, Grep, Edit
|
||||
---
|
||||
|
||||
# Agente Orquestador — Fase 6 (meta) del Ciclo Reactivo
|
||||
|
||||
Cierras la promesa autonoma del registry: "lanzar tarea, irse, volver con resultado". Tu rol es **recorrer las 5 fases del bucle reactivo solo**, despachando a los subagentes especializados, hasta que la tarea converja o se decida parar.
|
||||
|
||||
NO escribes codigo de aplicacion directamente. NO mergeas a master. NO bypaseas hooks. Solo orquestas.
|
||||
|
||||
Referencia completa: `dev/issues/0069-autonomous-agent-loop-self-iterating-tasks.md`.
|
||||
|
||||
---
|
||||
|
||||
## REGLAS FUNDAMENTALES (no negociables)
|
||||
|
||||
1. **Sandbox de rama EN WORKTREE**. Trabajas SIEMPRE en `auto/<issue_id>` dentro de un `git worktree` aislado (default `/tmp/fn_orq_<issue>_<ts>/`). NUNCA en master ni en el working tree principal del repo. Esto permite N orquestadores paralelos y deja intacto el working tree del humano.
|
||||
2. **No merge automatico**. Al converger, abres PR draft. Humano aprueba.
|
||||
3. **No `--no-verify`, no `git push --force`, no skip de hooks**. Nunca.
|
||||
4. **Paths protegidos**. NO tocar:
|
||||
- `.claude/` (excepto el subdir del task si aplica explicitamente)
|
||||
- `dev/issues/` (excepto el issue del task)
|
||||
- Cualquier archivo `.env*`, `*.key`, `*.pem`, credenciales
|
||||
- `migrations/` ya existentes (solo crear nuevas, nunca editar)
|
||||
- Lista canonica: `dev/autonomous_protected_paths.json` (si no existe, usar la default de arriba)
|
||||
5. **Watchdog de progreso**. 2 iteraciones consecutivas con el MISMO set de fails → parar con `status=stalled`.
|
||||
6. **Auditoria total**. Cada decision se loggea en `task_runs.progress_json` con razonamiento + fase + run_id.
|
||||
7. **No self-modify**. NO modificas tu propio SKILL.md ni el de otros subagentes en la misma run.
|
||||
8. **Cero produccion**. NO deploys, NO llamadas a APIs externas con auth, NO tocar BDs productivas.
|
||||
|
||||
---
|
||||
|
||||
## Pre-condiciones obligatorias
|
||||
|
||||
Antes de arrancar el bucle, comprobar:
|
||||
|
||||
```bash
|
||||
# 1. Migration 006_task_runs.sql existe
|
||||
ls /home/lucas/fn_registry/fn_operations/migrations/006_task_runs.sql 2>/dev/null \
|
||||
|| { echo "ABORT: migration 006_task_runs.sql ausente. Aplicar issue 0069 paso 1 antes."; exit 2; }
|
||||
|
||||
# 2. Subagentes fn-* presentes
|
||||
for a in fn-constructor fn-executor fn-recopilador fn-analizador fn-mejorador; do
|
||||
test -f /home/lucas/fn_registry/.claude/agents/$a/SKILL.md \
|
||||
|| { echo "ABORT: subagente $a ausente"; exit 2; }
|
||||
done
|
||||
|
||||
# 3. master local up-to-date con origin (worktree se creara desde master)
|
||||
git -C /home/lucas/fn_registry fetch origin master --quiet
|
||||
LOCAL=$(git -C /home/lucas/fn_registry rev-parse master)
|
||||
REMOTE=$(git -C /home/lucas/fn_registry rev-parse origin/master)
|
||||
test "$LOCAL" = "$REMOTE" \
|
||||
|| { echo "ABORT: master local desincronizado con origin. git pull antes."; exit 2; }
|
||||
|
||||
# 4. Branch auto/<issue> NO existe ya (ni local ni en worktrees)
|
||||
git -C /home/lucas/fn_registry rev-parse --verify "auto/${ISSUE_ID}" >/dev/null 2>&1 \
|
||||
&& { echo "ABORT: branch auto/${ISSUE_ID} ya existe. Limpiar antes (git branch -D + worktree remove)."; exit 2; }
|
||||
|
||||
# 5. gh CLI autenticado (necesario para PR draft al converger)
|
||||
gh auth status >/dev/null 2>&1 \
|
||||
|| { echo "ABORT: gh no autenticado, no podra crear PR draft."; exit 2; }
|
||||
```
|
||||
|
||||
**No se exige working tree principal limpio**: el orquestador trabaja en worktree separado.
|
||||
|
||||
Si alguna falla → reportar al main thread y salir. NO intentar continuar.
|
||||
|
||||
---
|
||||
|
||||
## Input
|
||||
|
||||
Recibes:
|
||||
- `issue_id` (ej. `0070`) o `task_spec` inline (objetivo, criterios aceptacion).
|
||||
- Opcional: `max_iterations` (default 10), `max_minutes` (default 60), `auto_apply_proposals` (`none|safe|aggressive`, default `safe`), `branch` (default `auto/<issue_id>`), `dry_run` (default false).
|
||||
|
||||
Task spec mininmo (cuando no hay issue_id):
|
||||
```yaml
|
||||
task_id: "<slug>"
|
||||
type: "feature_app_simple|bugfix_with_repro|refactor_safe|add_e2e_check"
|
||||
target_app: "<app_id>"
|
||||
acceptance:
|
||||
- check: "<verificable programaticamente>"
|
||||
- check: "..."
|
||||
```
|
||||
|
||||
**Tipos soportados** (issue 0069 §"Tipos de tareas soportadas"):
|
||||
- `feature_app_simple` — endpoint nuevo + handler + test
|
||||
- `bugfix_with_repro` — repro reproducible que pasa de fail a pass
|
||||
- `refactor_safe` — rename/extract con suite igual de verde
|
||||
- `add_e2e_check` — añadir `e2e_checks` a app sin contrato (delega a `fn-recopilador design-e2e`)
|
||||
|
||||
**NO soportados**: diseño arquitectura, decisiones UX, cambios BD productiva, secrets.
|
||||
|
||||
---
|
||||
|
||||
## Algoritmo
|
||||
|
||||
### 0. Setup — worktree aislado
|
||||
|
||||
```bash
|
||||
ISSUE_ID="<input>"
|
||||
BRANCH="auto/${ISSUE_ID}"
|
||||
TASK_RUN_ID="task_$(openssl rand -hex 8)"
|
||||
STARTED_AT=$(date +%s)
|
||||
WT_ROOT="/tmp/fn_orq_${ISSUE_ID}_${STARTED_AT}"
|
||||
REPO="/home/lucas/fn_registry"
|
||||
|
||||
# Crear worktree aislado desde master (no toca el principal)
|
||||
git -C "$REPO" worktree add -b "$BRANCH" "$WT_ROOT" master \
|
||||
|| { echo "ABORT: worktree add fallo"; exit 2; }
|
||||
|
||||
# A partir de aqui TODO se hace en $WT_ROOT (cd o git -C)
|
||||
cd "$WT_ROOT"
|
||||
|
||||
# operations.db del app target. Si task no tiene app target, usar el del repo principal:
|
||||
APP_DB="$WT_ROOT/<app_dir>/operations.db"
|
||||
[ -f "$APP_DB" ] || APP_DB="$REPO/operations.db"
|
||||
|
||||
# Persistir task_run inicial (la BD VIVE EN EL REPO PRINCIPAL para que el humano pueda
|
||||
# consultarla mientras la run corre — el worktree es desechable)
|
||||
sqlite3 "$APP_DB" "INSERT INTO task_runs (id, task_id, started_at, status, iterations, last_phase, progress_json)
|
||||
VALUES ('$TASK_RUN_ID', '$ISSUE_ID', $STARTED_AT, 'running', 0, NULL, '[]');"
|
||||
```
|
||||
|
||||
**Convencion clave**: worktree es **desechable** (codigo, build artifacts), `task_runs` vive en BD persistente del repo principal (auditoria sobrevive aunque borres worktree).
|
||||
|
||||
### 1. Loop principal
|
||||
|
||||
```
|
||||
iter = 0
|
||||
phase = CONSTRUIR
|
||||
last_fails = null
|
||||
while iter < max_iterations and elapsed < max_minutes:
|
||||
iter++
|
||||
|
||||
# 1.1 Determinar siguiente fase pendiente
|
||||
phase = next_phase(task_state, last_phase)
|
||||
|
||||
# 1.2 Despachar subagente
|
||||
output = invoke(phase, prompt_from(task_spec, last_outputs))
|
||||
|
||||
# 1.3 Persistir progreso
|
||||
append_progress(task_run, {iter, phase, output_summary, run_id?})
|
||||
|
||||
# 1.4 Logica por fase
|
||||
if phase == ANALIZAR:
|
||||
if output.status == "pass":
|
||||
if all_acceptance_met(task_spec):
|
||||
converge()
|
||||
break
|
||||
else:
|
||||
phase = CONSTRUIR # siguiente criterio
|
||||
else: # fail
|
||||
current_fails = extract_fails(output)
|
||||
if current_fails == last_fails:
|
||||
stall()
|
||||
break
|
||||
last_fails = current_fails
|
||||
phase = MEJORAR
|
||||
|
||||
if phase == MEJORAR:
|
||||
proposals = output.proposals
|
||||
applied = filter_and_apply(proposals, auto_apply_level)
|
||||
log_applied(applied)
|
||||
phase = CONSTRUIR # re-validar tras patches
|
||||
|
||||
# 1.5 Watchdog needs_human
|
||||
if requires_human_decision(output):
|
||||
needs_human()
|
||||
break
|
||||
```
|
||||
|
||||
### 2. Despacho a subagentes
|
||||
|
||||
Usar `Agent` tool con `subagent_type` correcto. Prompt **autocontenido** (paths absolutos, IDs, criterio exito).
|
||||
|
||||
**CRITICO**: pasar `WT_ROOT` (worktree path) en cada prompt y exigir al subagente trabajar dentro de el. Subagentes NO deben tocar el repo principal `/home/lucas/fn_registry/`.
|
||||
|
||||
Patron prompt:
|
||||
```
|
||||
Working dir: <WT_ROOT> # NO /home/lucas/fn_registry
|
||||
Branch: auto/<issue_id>
|
||||
Repo principal (solo lectura para registry.db): /home/lucas/fn_registry
|
||||
...
|
||||
```
|
||||
|
||||
| Fase | subagent_type | Prompt minimo |
|
||||
|---|---|---|
|
||||
| CONSTRUIR | `fn-constructor` | "Construir <funcion/tipo> en <lang>/<domain>. Firma: <X>. Pureza: <pure/impure>. Tests obligatorios. Issue: <id>." |
|
||||
| EJECUTAR | `fn-executor` | "Ejecutar <pipeline_id> con args <X> en <app_dir>. Registrar en operations.db." |
|
||||
| RECOPILAR | `fn-recopilador` | "Auditar operations.db de <app_dir>. Reportar drift en JSON." |
|
||||
| ANALIZAR | `fn-analizador` | "Validar <app_id>. Correr e2e_checks. Devolver run_id + status pass/fail + summary." |
|
||||
| MEJORAR | `fn-mejorador` | "Procesar fallos de run_id=<X> en <app_id>. Crear proposals. Output --json." |
|
||||
|
||||
### 3. Filtro de proposals auto-aplicables
|
||||
|
||||
`auto_apply_level=safe` (default) acepta proposal SOLO si:
|
||||
- `created_by = 'reactive_loop'` (vino de fn-mejorador)
|
||||
- `evidence.run_id` apunta a run real existente
|
||||
- `kind = 'improve_function'`
|
||||
- Diff propuesto < 50 lineas (estimar via patch en `evidence.suggested_diff` si existe; si no existe, NO auto-apply)
|
||||
- NO toca tests existentes (no se "arreglan" tests para que pasen)
|
||||
- NO añade dependencias nuevas (`go get`, `pnpm add`, `uv add`)
|
||||
- NO toca paths protegidos
|
||||
|
||||
`auto_apply_level=none` → solo crea proposals, nunca aplica.
|
||||
`auto_apply_level=aggressive` → todas salvo `risk=high` o paths protegidos.
|
||||
|
||||
Aplicacion: delegar a `fn-constructor` con prompt "Aplicar proposal <id>. Diff sugerido: <X>. Verificar build despues."
|
||||
|
||||
### 4. Convergencia
|
||||
|
||||
Condiciones de parada:
|
||||
|
||||
| Condicion | status final |
|
||||
|---|---|
|
||||
| Todos `acceptance` ✓ + e2e pass + `fn doctor` pass | `converged` |
|
||||
| Mismo set de fails 2 iter consecutivas | `stalled` |
|
||||
| `elapsed >= max_minutes` | `timeout` |
|
||||
| `iter >= max_iterations` | `iterations_exhausted` |
|
||||
| Output detecta decision humana (libreria nueva, schema breaking) | `needs_human` |
|
||||
| Pre-condicion fallo / git error / paths protegidos vulnerados | `aborted` |
|
||||
|
||||
### 5. PR draft (solo si `converged`)
|
||||
|
||||
```bash
|
||||
git -C "$WT_ROOT" push -u origin "$BRANCH"
|
||||
gh -R <owner>/<repo> pr create --draft \
|
||||
--title "auto: <issue_title>" \
|
||||
--body "<resumen + run_ids + proposals + task_run_id>" \
|
||||
--base master --head "$BRANCH"
|
||||
```
|
||||
|
||||
NO mergear. Devolver URL al main thread.
|
||||
|
||||
### 5.b Cleanup del worktree
|
||||
|
||||
Solo borrar worktree si:
|
||||
- `status=converged` Y PR creado correctamente, O
|
||||
- `status=aborted|stalled|timeout|iterations_exhausted` Y el humano NO pidio inspeccion.
|
||||
|
||||
```bash
|
||||
# Default: NO borrar. Reportar comando para que humano decida.
|
||||
echo "Worktree disponible en $WT_ROOT para inspeccion."
|
||||
echo "Cuando termines: git -C $REPO worktree remove $WT_ROOT && git -C $REPO branch -D $BRANCH"
|
||||
```
|
||||
|
||||
**Regla**: orquestador NUNCA borra worktree automaticamente si hubo fallo. Worktree = evidencia forense. Solo auto-cleanup en `converged` con PR creado.
|
||||
|
||||
```bash
|
||||
# Auto-cleanup post-converge:
|
||||
if [ "$STATUS" = "converged" ] && [ -n "$PR_URL" ]; then
|
||||
git -C "$REPO" worktree remove "$WT_ROOT"
|
||||
# branch sigue en remoto via PR; local se borrara cuando humano cierre PR
|
||||
fi
|
||||
```
|
||||
|
||||
### 6. Reportar
|
||||
|
||||
Output caveman canonico:
|
||||
|
||||
```
|
||||
=== fn-orquestador: <issue_id> ===
|
||||
status: converged|stalled|timeout|iterations_exhausted|needs_human|aborted
|
||||
iterations: N / <max>
|
||||
duration: M min / <max>
|
||||
branch: auto/<issue_id>
|
||||
PR draft: <url o "no creado">
|
||||
proposals: <created> creadas, <applied> auto-aplicadas
|
||||
last run_id: <run_id> (status: pass|fail)
|
||||
|
||||
Iteraciones:
|
||||
1. construir → ok (3 funciones nuevas: id_a, id_b, id_c)
|
||||
2. ejecutar → ok (run_id=exec_xxx)
|
||||
3. analizar → fail (3/8 checks: build, smoke, tests)
|
||||
4. mejorar → 3 proposals (2 safe-applied, 1 needs human)
|
||||
5. construir → ok (re-build tras patches)
|
||||
6. analizar → pass (8/8)
|
||||
7. recopilar → ok (operations.db integra)
|
||||
8. CONVERGED
|
||||
|
||||
Siguientes pasos humano:
|
||||
- Revisar PR <url>
|
||||
- fn proposal list -s pending --target-id <id>
|
||||
- Si no aceptas, git branch -D auto/<issue_id>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Persistencia: tabla `task_runs`
|
||||
|
||||
Schema (de issue 0069 §"Nueva tabla task_runs"):
|
||||
|
||||
```sql
|
||||
CREATE TABLE task_runs (
|
||||
id TEXT PRIMARY KEY,
|
||||
task_id TEXT NOT NULL,
|
||||
started_at INTEGER NOT NULL,
|
||||
finished_at INTEGER,
|
||||
status TEXT NOT NULL, -- running|converged|stalled|timeout|iterations_exhausted|needs_human|aborted
|
||||
iterations INTEGER NOT NULL DEFAULT 0,
|
||||
last_phase TEXT,
|
||||
last_run_id TEXT,
|
||||
progress_json TEXT NOT NULL DEFAULT '[]'
|
||||
);
|
||||
```
|
||||
|
||||
Vive en `operations.db` del app target (NO en registry.db). Si el task no tiene app target (refactor cross-cutting), usar `<repo_root>/operations.db` (excepcion documentada).
|
||||
|
||||
Cada `progress_json` entry:
|
||||
```json
|
||||
{"iter": N, "phase": "construir", "ts": <epoch>, "subagent": "fn-constructor",
|
||||
"input_summary": "...", "output_summary": "...", "run_id": "..." }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Reglas de comportamiento
|
||||
|
||||
1. **Briefing autocontenido** a cada subagente. Nunca asumir contexto compartido.
|
||||
2. **Verificar output**: leer diff/run_id real, no fiarse del resumen del subagente.
|
||||
3. **No paralelo dentro de una iteracion** (las fases son secuenciales). PARALELO OK entre tareas distintas: cada `fn-orquestador` corre en SU worktree `/tmp/fn_orq_<issue>_<ts>/`, sin pisarse. N orquestadores simultaneos = N worktrees + N branches `auto/<X>`, `auto/<Y>`.
|
||||
4. **Caveman en stdout** del orquestador. Telemetry estructurada en `task_runs`.
|
||||
5. **Stop > recovery**. Ante duda, abortar con `status=needs_human`, NO improvisar fixes.
|
||||
6. **No tocar `.git` directamente** salvo `checkout`, `add`, `commit`, `push`. Nada de `reset --hard`, `rebase -i`, `branch -D`.
|
||||
7. **Commits atomicos** por fase: `chore(auto): <fase> iter N — <descripcion corta>`. Co-authored por agente que ejecuto.
|
||||
|
||||
---
|
||||
|
||||
## Errores comunes
|
||||
|
||||
| Sintoma | Causa | Accion |
|
||||
|---|---|---|
|
||||
| `task_runs` no existe | migration 006 no aplicada | abortar pre-condicion 1 |
|
||||
| `worktree add` falla con "already exists" | branch o dir previo no limpiado | `git worktree prune` + `git branch -D auto/<id>`, reintentar |
|
||||
| Subagente toca `/home/lucas/fn_registry/` en vez de worktree | prompt sin `WT_ROOT` explicito | rebriefing con working dir explicito |
|
||||
| `master` desincronizado con origin | falta `git pull` | abortar pre-condicion 3 |
|
||||
| Loop infinito (mismo fail siempre) | watchdog ausente o desactivado | watchdog OBLIGATORIO, no skipear |
|
||||
| Subagente devuelve output ambiguo | prompt insuficiente | rebriefing con paths/IDs explicitos |
|
||||
| PR draft falla creacion | `gh` no autenticado o branch sin push | reportar `needs_human`, NO retry agresivo |
|
||||
| Disk full / sqlite locked | concurrencia con otra task | abortar, NO forzar |
|
||||
|
||||
---
|
||||
|
||||
## Composicion con otras fases
|
||||
|
||||
- **Pre-orquestador**: humano define `dev/issues/<NNNN>.md` con criterios verificables programaticamente. Sin issue verificable, NO arrancar.
|
||||
- **Durante**: orquestador despacha a las 5 fases. Cada subagente respeta SUS reglas (purity, registry-first, etc.).
|
||||
- **Post-orquestador**: humano revisa PR draft + proposals. Acepta, modifica o descarta.
|
||||
- **NO orquestes a otro `fn-orquestador`**. Una run no spawn-ea otra. Recursion = abort.
|
||||
|
||||
---
|
||||
|
||||
## Salida JSON opcional
|
||||
|
||||
Si `--json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"task_run_id": "task_a1b2c3d4",
|
||||
"issue_id": "0070",
|
||||
"status": "converged",
|
||||
"iterations": 8,
|
||||
"duration_s": 1240,
|
||||
"branch": "auto/0070",
|
||||
"pr_url": "https://gitea.../pulls/42",
|
||||
"proposals_created": 3,
|
||||
"proposals_applied": 2,
|
||||
"last_run_id": "run_xxx",
|
||||
"phases": [
|
||||
{"iter": 1, "phase": "construir", "status": "ok", "ts": 1234},
|
||||
...
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Util para integraciones (CI, dashboard, otra automatizacion). NO para spawn-ear otro orquestador.
|
||||
|
||||
---
|
||||
|
||||
## Limites duros
|
||||
|
||||
- `max_iterations`: 10 default, ceiling 30.
|
||||
- `max_minutes`: 60 default, ceiling 240.
|
||||
- Diff total por iteracion: 500 lineas. Si excede → `needs_human`.
|
||||
- Proposals auto-aplicadas por run: 5. Si excede → resto a `pending`.
|
||||
- Recursividad: 0. NO spawn de otro orquestador.
|
||||
@@ -0,0 +1,53 @@
|
||||
# /new-cpp-app — Crear app C++ nueva con scaffolder estandar
|
||||
|
||||
Wrapper sobre el pipeline `init_cpp_app_bash_pipelines`. Genera la estructura canonica que cumple `cpp/PATTERNS.md` y `.claude/rules/cpp_apps.md` (main.cpp con `cfg.about/log/panels`, sin `app_menubar` manual, dockspace via framework), registra la app en `cpp/CMakeLists.txt`, crea repo Gitea `dataforge/<name>` y ejecuta `fn index`.
|
||||
|
||||
```bash
|
||||
cd /home/lucas/fn_registry
|
||||
./fn run init_cpp_app $ARGUMENTS
|
||||
```
|
||||
|
||||
## Uso
|
||||
|
||||
```
|
||||
/new-cpp-app <name> [--project <p>] [--domain <d>] [--desc "..."] [--tags "a,b"]
|
||||
```
|
||||
|
||||
## Ejemplos
|
||||
|
||||
```bash
|
||||
# App suelta en cpp/apps/<name>/
|
||||
/new-cpp-app my_tool --desc "Herramienta para X"
|
||||
|
||||
# App dentro de un proyecto
|
||||
/new-cpp-app finance_panel --project budget --desc "Panel de finanzas" --tags "finance,dashboard"
|
||||
```
|
||||
|
||||
## Que genera
|
||||
|
||||
```
|
||||
<dir>/
|
||||
main.cpp # Plantilla canonica: panels[] + cfg.about + cfg.log + run_app(cfg, render)
|
||||
CMakeLists.txt # add_imgui_app(<name> main.cpp)
|
||||
app.md # Frontmatter completo (lang:cpp, framework:imgui, dir_path, repo_url)
|
||||
```
|
||||
|
||||
Mas registro en `cpp/CMakeLists.txt`, repo Gitea con commit inicial, y `fn index` para que aparezca en `registry.db`.
|
||||
|
||||
## Despues de crear
|
||||
|
||||
1. Editar `app.md` y completar `uses_functions` cuando la app consuma funciones del registry.
|
||||
2. Anadir las funciones al `CMakeLists.txt` como paths absolutos: `${CMAKE_SOURCE_DIR}/functions/<dom>/<func>.cpp`.
|
||||
3. Build: `/compile <name>` o `cd cpp && cmake --build build --target <name> -j`.
|
||||
|
||||
## Cuando NO usar
|
||||
|
||||
NUNCA — esta es la unica via para crear apps C++ nuevas. Si el scaffolder no cubre un caso, modificar la plantilla en `bash/functions/pipelines/init_cpp_app.sh`. Escribir `main.cpp + CMakeLists.txt + app.md` a mano esta prohibido por `.claude/rules/cpp_apps.md`.
|
||||
|
||||
## Auditoria post-creacion
|
||||
|
||||
```
|
||||
fn doctor cpp-apps
|
||||
```
|
||||
|
||||
Lista apps que se desvian del estandar (sin `cfg.about`, con `app_menubar` manual, dockspace duplicado, etc.).
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
description: "Recordatorio operativo para usar subagentes fn (constructor/executor/recopilador/analizador/mejorador) y paralelizar trabajo independiente"
|
||||
---
|
||||
|
||||
# /subagentes — usa subagentes fn y paraleliza
|
||||
|
||||
Recuerda: antes de escribir codigo nuevo o ejecutar pipelines en serie, **delega a subagentes** y **paraleliza** llamadas independientes (un mensaje, varios `Agent` calls).
|
||||
|
||||
---
|
||||
|
||||
## Mapa de subagentes fn (ciclo reactivo)
|
||||
|
||||
| Fase | Agente | Cuando dispararlo |
|
||||
|---|---|---|
|
||||
| 1 CONSTRUIR | `fn-constructor` | Falta funcion/tipo/test reutilizable. NUNCA escribir inline en `apps/` si es reutilizable |
|
||||
| 2 EJECUTAR | `fn-executor` | Correr pipeline/funcion del registry + registrar ejecucion en `operations.db` |
|
||||
| 3 RECOPILAR | `fn-recopilador` | Auditar integridad de `operations.db`. Modo `design-e2e <app>` propone bloque `e2e_checks` |
|
||||
| 4 ANALIZAR | `fn-analizador` | Ejecutar `e2e_checks` de `app.md`, veredicto pass/fail, persistir en `e2e_runs` |
|
||||
| 5 MEJORAR | `fn-mejorador` | Convertir fallos de `e2e_runs` en `proposals` con evidencia trazable |
|
||||
| 6 META | `fn-orquestador` | Recorrer fases 1-5 solo hasta convergencia. Sandbox `auto/<issue>`. Issue 0069 |
|
||||
|
||||
**Pre-condiciones de `fn-orquestador`** (abortara si no se cumplen):
|
||||
- Migration `fn_operations/migrations/006_task_runs.sql` aplicada
|
||||
- Issue con criterios de aceptacion **verificables programaticamente** (no "funciona bien")
|
||||
- `master` local up-to-date con `origin/master`
|
||||
- Branch `auto/<issue>` NO existe ya (limpiar previo si hace falta)
|
||||
- `gh` autenticado (PR draft al converger)
|
||||
- Tipo soportado: `feature_app_simple`, `bugfix_with_repro`, `refactor_safe`, `add_e2e_check`
|
||||
|
||||
**Aislamiento por worktree**: cada run crea `/tmp/fn_orq_<issue>_<ts>/` via `git worktree add`. Working tree principal del usuario queda intacto. N orquestadores paralelos = N worktrees independientes. `task_runs` persiste en BD del repo principal (auditoria sobrevive aunque borres worktree).
|
||||
|
||||
## Otros subagentes utiles
|
||||
|
||||
- `Explore` — busquedas amplias en codebase (>3 queries) sin contaminar contexto principal
|
||||
- `general-purpose` — research multi-step open-ended
|
||||
|
||||
## Reglas duras
|
||||
|
||||
1. **Paralelo real**: tareas independientes → un mensaje con varios `Agent` calls. NO en serie.
|
||||
2. **Briefing autocontenido**: subagente no ve historial. Pasar paths absolutos, IDs, criterio exito.
|
||||
3. **No delegar comprension**: nada de "haz lo que veas". Especificar que cambiar, donde, por que.
|
||||
4. **Verificar output**: leer diff/resultado, no confiar en resumen del subagente.
|
||||
5. **No duplicar**: si delegas research, no lo repitas tu.
|
||||
|
||||
## Patrones canonicos de paralelismo
|
||||
|
||||
- 3 funciones de registry independientes → 3 `fn-constructor` en paralelo
|
||||
- Auditar N apps → N `fn-recopilador` en paralelo
|
||||
- Validar varias apps → N `fn-analizador` en paralelo
|
||||
- Build cpp + tests py + audit operations.db → 3 calls paralelos
|
||||
- Tras `fn-analizador` con fallos → `fn-mejorador` por cada `run_id`
|
||||
- Tarea multi-fase autonoma (issue con criterios verificables) → `fn-orquestador` (1 sola run, NO recursivo)
|
||||
|
||||
## Anti-patrones
|
||||
|
||||
- Escribir funcion reutilizable inline en `apps/` (debe ir a `functions/` via `fn-constructor`)
|
||||
- Lanzar subagentes en serie cuando son independientes
|
||||
- Prompt de 1 linea sin contexto ("arregla esto")
|
||||
- Invocar subagente y luego hacer tu mismo el trabajo
|
||||
- Spawn `fn-orquestador` sin migration 006 o sin issue verificable (abortara)
|
||||
- `fn-orquestador` recursivo (un orquestador no spawn-ea otro)
|
||||
|
||||
## Checklist pre-respuesta
|
||||
|
||||
- ¿>1 tarea independiente? → paralelizar
|
||||
- ¿Hace falta funcion/tipo nuevo? → `fn-constructor`, NO inline
|
||||
- ¿Hay que ejecutar/auditar/validar? → fase 2/3/4 segun toque
|
||||
- ¿`e2e_runs` con fallos? → `fn-mejorador`
|
||||
- ¿Issue con criterios verificables + tipo soportado? → `fn-orquestador` (chequear pre-condiciones)
|
||||
- ¿Research amplio (>3 queries)? → `Explore`
|
||||
|
||||
## Plantilla minima de prompt para subagente
|
||||
|
||||
```
|
||||
Contexto: <que repo, que app, que objetivo>
|
||||
Input: <paths absolutos, IDs registry, run_id si aplica>
|
||||
Tarea: <accion concreta y acotada>
|
||||
Criterio exito: <como sabe que termino>
|
||||
Limites: <que NO debe tocar>
|
||||
```
|
||||
@@ -6,6 +6,20 @@
|
||||
|
||||
Esta regla NO duplica esos documentos — los señala como obligatorios y añade convenciones estructurales que no aparecen alli.
|
||||
|
||||
### Scaffolder canonico — OBLIGATORIO
|
||||
|
||||
**REGLA DURA:** crear apps C++ nuevas SIEMPRE con `fn run init_cpp_app <name> [--project <p>] [--desc "..."]`. NUNCA escribir `main.cpp` + `CMakeLists.txt` + `app.md` desde cero a mano en `cpp/apps/` ni `projects/*/apps/`. Tampoco copiar otra app y renombrar — la deriva entre patrones es lo que estamos eliminando.
|
||||
|
||||
Si el scaffolder no cubre un caso (ej. necesitas plantilla diferente, layout custom desde el primer dia), **modificas el scaffolder**, no escribes la app a mano. La plantilla canonica es codigo, no decoracion.
|
||||
|
||||
Razones:
|
||||
- Garantiza `cfg.about` + `cfg.log` + `cfg.panels` + framework defaults aplicados.
|
||||
- Genera frontmatter `app.md` valido (framework, dir_path, repo_url) para `fn index`.
|
||||
- Registra `add_subdirectory` en `cpp/CMakeLists.txt` (raiz o bloque `_DIR` para projects).
|
||||
- Crea repo Gitea `dataforge/<name>` con master + commit inicial.
|
||||
|
||||
Pipeline: `init_cpp_app_bash_pipelines`. Slash command equivalente: `/new-cpp-app`. Auditoria: `fn doctor cpp-apps`.
|
||||
|
||||
### 1. Ubicacion
|
||||
|
||||
| Caso | Donde vive |
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
### Comandos
|
||||
|
||||
```bash
|
||||
fn doctor # Corre TODOS los checks (artefacts + services + sync + uses-functions + unused)
|
||||
fn doctor # Corre TODOS los checks (artefacts + services + sync + uses-functions + unused + cpp-apps)
|
||||
fn doctor artefacts # Solo artefactos: git/venv/app.md/upstream
|
||||
fn doctor services # Solo apps con tag 'service' + systemctl + puerto
|
||||
fn doctor sync # Solo drift pc_locations BD vs disco local
|
||||
fn doctor uses-functions # Solo audit imports reales vs uses_functions
|
||||
fn doctor unused # Solo funciones huerfanas del registry
|
||||
fn doctor cpp-apps # Conformidad C++ con cpp/PATTERNS.md (cfg.about/log, no app_menubar manual, no DockSpace duplicado)
|
||||
|
||||
fn doctor --json # Salida JSON (cualquier subcomando) — para agentes/scripts
|
||||
```
|
||||
@@ -32,6 +33,7 @@ fn doctor --json # Salida JSON (cualquier subcomando) — para agentes
|
||||
| `sync` | `pc_locations_drift_go_infra` |
|
||||
| `uses-functions` | `audit_uses_functions_go_infra` |
|
||||
| `unused` | `find_unused_functions_go_infra` |
|
||||
| `cpp-apps` | `audit_cpp_apps_go_infra` |
|
||||
|
||||
Cada subcomando es un wrapper fino. Toda la logica vive en la funcion. Si quieres usar la salida en otro programa Go, importa la funcion directamente.
|
||||
|
||||
@@ -58,6 +60,10 @@ Texto humano por defecto (tabwriter). `--json` produce array/objeto serializable
|
||||
| `port not listening` | `port_kill_bash_infra <port>` (si zombie) y relanzar |
|
||||
| `missing_in_app_md` | Editar `app.md` y añadir el ID a `uses_functions` |
|
||||
| `unused` (funcion huerfana) | Decidir: usar, deprecar (tag), o borrar |
|
||||
| `manual_app_menubar_call` | Borrar `fn_ui::app_menubar(...)` del render — el framework ya lo dibuja |
|
||||
| `manual_DockSpaceOverViewport_*` | Borrar la llamada o setear `cfg.auto_dockspace = false` si la app gestiona docking propio |
|
||||
| `missing_cfg_about` / `missing_cfg_log` | Anadir `cfg.about = {...}` / `cfg.log = {"<name>.log", 1}` antes de `fn::run_app` |
|
||||
| `app.md_missing_*` | Regenerar via plantilla del scaffolder (`/new-cpp-app`) o anadir campos a mano |
|
||||
| Backup viejo | `backup_all_bash_pipelines ~/backups/fn_registry` |
|
||||
|
||||
### Para agentes
|
||||
|
||||
@@ -80,3 +80,4 @@ Thumbs.db
|
||||
broken_paths.txt
|
||||
imgui.ini
|
||||
prompts/
|
||||
kotlin/functions/ui/
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
name: adb_wsl
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "source adb_wsl.sh [ADB=<path>] [ANDROID_SDK_WIN=<sdk_root>]"
|
||||
description: "Wrapper sourceable para usar adb.exe Windows desde WSL2. Resuelve binario, convierte paths, espera boot del emulador."
|
||||
tags: ["android", "adb", "wsl", "windows"]
|
||||
params:
|
||||
- name: ADB
|
||||
desc: "Env var opcional. Path absoluto a adb.exe. Si no se fija, se construye desde ANDROID_SDK_WIN o el default /mnt/c/Users/lucas/AppData/Local/Android/Sdk."
|
||||
- name: ANDROID_SDK_WIN
|
||||
desc: "Env var opcional. Raiz del Android SDK montado en WSL. Default: /mnt/c/Users/lucas/AppData/Local/Android/Sdk."
|
||||
output: "Source-able shell helpers: adb_run, adb_devices, adb_wsl_to_win, adb_wait_boot. Define ADB env var apuntando a Windows adb.exe via ANDROID_SDK_WIN."
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/adb_wsl.sh"
|
||||
---
|
||||
|
||||
## Uso
|
||||
|
||||
```bash
|
||||
# Sourcear (usa SDK default)
|
||||
source bash/functions/infra/adb_wsl.sh
|
||||
|
||||
# Sourcear con SDK custom
|
||||
ANDROID_SDK_WIN=/mnt/d/Android/Sdk source bash/functions/infra/adb_wsl.sh
|
||||
|
||||
# Sourcear con binario fijo
|
||||
ADB=/mnt/c/my/tools/adb.exe source bash/functions/infra/adb_wsl.sh
|
||||
```
|
||||
|
||||
## Funciones expuestas
|
||||
|
||||
### `adb_run "<args...>"`
|
||||
|
||||
Ejecuta `$ADB` con los argumentos dados. Retorna el exit code de `adb.exe`.
|
||||
|
||||
```bash
|
||||
adb_run shell ls /sdcard/
|
||||
adb_run install app.apk
|
||||
```
|
||||
|
||||
### `adb_devices`
|
||||
|
||||
Alias de `adb_run devices`. Lista dispositivos/emuladores conectados.
|
||||
|
||||
```bash
|
||||
adb_devices
|
||||
# List of devices attached
|
||||
# emulator-5554 device
|
||||
```
|
||||
|
||||
### `adb_wsl_to_win <path_wsl>`
|
||||
|
||||
Convierte un path WSL a formato Windows con `wslpath -w`. Si `wslpath` no está disponible retorna el path sin convertir.
|
||||
|
||||
```bash
|
||||
win_path=$(adb_wsl_to_win /home/lucas/proyecto/app.apk)
|
||||
# C:\Users\lucas\AppData\Local\... (o la ruta Windows equivalente)
|
||||
adb_run install "$win_path"
|
||||
```
|
||||
|
||||
### `adb_wait_boot [timeout_s]`
|
||||
|
||||
Espera a que el emulador/dispositivo complete el boot (`sys.boot_completed = 1`). Útil tras lanzar un AVD en CI.
|
||||
|
||||
```bash
|
||||
adb_wait_boot # timeout 120s
|
||||
adb_wait_boot 60 # timeout 60s
|
||||
```
|
||||
|
||||
Retorna `0` si el boot se completó, `1` si expiró el timeout.
|
||||
|
||||
## Smoke test
|
||||
|
||||
```bash
|
||||
bash bash/functions/infra/adb_wsl.sh --self-test
|
||||
# OK
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- El script es **source-able**: define funciones en el shell actual, no crea subshell.
|
||||
- `ADB` se resuelve una sola vez al sourcing. Si el binario no existe en disco, la carga falla con mensaje en stderr y `return 1` / `exit 1`.
|
||||
- `adb_wait_boot` hace polling cada 3 segundos. Ajustar `interval` si el emulador es especialmente lento.
|
||||
- En WSL2 `wslpath` siempre está disponible; el fallback existe para entornos Linux puros que accidentalmente sourceen el archivo.
|
||||
- Si el emulador requiere `-s <serial>`, pasar el flag directamente a `adb_run`: `adb_run -s emulator-5554 shell ...`.
|
||||
---
|
||||
@@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env bash
|
||||
# adb_wsl — Wrapper sourceable para usar adb.exe Windows desde WSL2.
|
||||
# Uso: source bash/functions/infra/adb_wsl.sh
|
||||
# Smoke test: bash bash/functions/infra/adb_wsl.sh --self-test
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Resolver ADB
|
||||
# ---------------------------------------------------------------------------
|
||||
# El caller puede fijar ADB antes de sourcing para apuntar a otro binario.
|
||||
if [[ -z "${ADB:-}" ]]; then
|
||||
_sdk_root="${ANDROID_SDK_WIN:-/mnt/c/Users/lucas/AppData/Local/Android/Sdk}"
|
||||
ADB="${_sdk_root}/platform-tools/adb.exe"
|
||||
unset _sdk_root
|
||||
fi
|
||||
|
||||
if [[ ! -f "$ADB" ]]; then
|
||||
echo "adb_wsl: ADB no encontrado en '$ADB'. Fija ADB= o ANDROID_SDK_WIN= antes de sourcear." >&2
|
||||
# Solo abortamos si el script se ejecuta directamente; si se sourcea,
|
||||
# permitimos continuar para que el caller maneje el error.
|
||||
return 1 2>/dev/null || exit 1
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# adb_run "<args...>"
|
||||
# Ejecuta el ADB Windows con los argumentos dados.
|
||||
# Retorna el exit code de adb.exe.
|
||||
# ---------------------------------------------------------------------------
|
||||
adb_run() {
|
||||
"$ADB" "$@"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# adb_devices
|
||||
# Lista dispositivos ADB conectados.
|
||||
# ---------------------------------------------------------------------------
|
||||
adb_devices() {
|
||||
adb_run devices
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# adb_wsl_to_win <path_wsl>
|
||||
# Convierte un path WSL a formato Windows usando wslpath.
|
||||
# Si wslpath no está disponible retorna el path tal cual.
|
||||
# ---------------------------------------------------------------------------
|
||||
adb_wsl_to_win() {
|
||||
local path_wsl="$1"
|
||||
if command -v wslpath &>/dev/null; then
|
||||
wslpath -w "$path_wsl"
|
||||
else
|
||||
echo "$path_wsl"
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# adb_wait_boot [timeout_s]
|
||||
# Espera a que el dispositivo/emulador complete el boot (sys.boot_completed=1).
|
||||
# timeout_s: segundos máximos de espera (default 120).
|
||||
# Retorna 0 si boot completado, 1 si timeout.
|
||||
# ---------------------------------------------------------------------------
|
||||
adb_wait_boot() {
|
||||
local timeout_s="${1:-120}"
|
||||
local elapsed=0
|
||||
local interval=3
|
||||
|
||||
while (( elapsed < timeout_s )); do
|
||||
local val
|
||||
val=$(adb_run shell getprop sys.boot_completed 2>/dev/null | tr -d '[:space:]')
|
||||
if [[ "$val" == "1" ]]; then
|
||||
return 0
|
||||
fi
|
||||
sleep "$interval"
|
||||
(( elapsed += interval ))
|
||||
done
|
||||
|
||||
echo "adb_wsl: timeout ${timeout_s}s esperando boot del dispositivo." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# adb_pick_serial [--serial <S>] [...]
|
||||
# Resuelve el serial a usar para multi-device. Lee --serial X de los args.
|
||||
# Setea globals ADB_PICK_SERIAL y ADB_PICK_REST (no usa stdout para evitar
|
||||
# perder los globals via subshell de $()).
|
||||
# Exit 1 si no hay device disponible.
|
||||
#
|
||||
# Uso tipico:
|
||||
# adb_pick_serial "$@" || { echo "no device" >&2; exit 3; }
|
||||
# local serial="$ADB_PICK_SERIAL"
|
||||
# set -- "${ADB_PICK_REST[@]}"
|
||||
# ---------------------------------------------------------------------------
|
||||
adb_pick_serial() {
|
||||
ADB_PICK_SERIAL="${ADB_SERIAL:-}"
|
||||
ADB_PICK_REST=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--serial) ADB_PICK_SERIAL="$2"; shift 2 ;;
|
||||
--serial=*) ADB_PICK_SERIAL="${1#--serial=}"; shift ;;
|
||||
*) ADB_PICK_REST+=("$1"); shift ;;
|
||||
esac
|
||||
done
|
||||
if [[ -z "$ADB_PICK_SERIAL" ]]; then
|
||||
ADB_PICK_SERIAL=$(adb_run devices 2>/dev/null | awk '/(emulator-|device$)/ && !/List of/ {print $1; exit}')
|
||||
fi
|
||||
if [[ -z "$ADB_PICK_SERIAL" ]]; then
|
||||
echo "adb_wsl: ningun device/emulador conectado." >&2
|
||||
return 1
|
||||
fi
|
||||
if ! adb_run devices 2>/dev/null | awk '{print $1}' | grep -qx "$ADB_PICK_SERIAL"; then
|
||||
echo "adb_wsl: serial '$ADB_PICK_SERIAL' no encontrado en adb devices." >&2
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# adb_s <serial> <args...>
|
||||
# Atajo: adb_run -s <serial> <args...>
|
||||
# ---------------------------------------------------------------------------
|
||||
adb_s() {
|
||||
local serial="$1"; shift
|
||||
adb_run -s "$serial" "$@"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Smoke test (solo si invocado directamente con --self-test)
|
||||
# ---------------------------------------------------------------------------
|
||||
if [[ "${1:-}" == "--self-test" ]]; then
|
||||
adb_run version || exit 1
|
||||
echo "OK"
|
||||
fi
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
name: android_apk_install
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_apk_install([--serial S], apk_path: string, package_name?: string, activity_name?: string) -> void"
|
||||
description: "Instala APK en device/emulador via adb y opcionalmente lanza la app. Multi-emulator via --serial."
|
||||
tags: [android, adb, apk, wsl]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device/emulator serial. Default: first device detected by adb_pick_serial."
|
||||
- name: apk_path
|
||||
desc: "WSL path to APK file"
|
||||
- name: package_name
|
||||
desc: "Optional app package id (e.g. com.fnregistry.voiceguide). Launches the app if provided."
|
||||
- name: activity_name
|
||||
desc: "Optional activity (.MainActivity or fully qualified). Only used with package_name. If omitted, launches via monkey LAUNCHER intent."
|
||||
output: "Stdout con pasos. Exit 0 = install + launch OK. Exit !=0 si install fallo o APK no encontrado."
|
||||
uses_functions: ["adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_apk_install.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Solo instalar
|
||||
android_apk_install /home/lucas/builds/app-debug.apk
|
||||
|
||||
# Instalar y lanzar con activity explícita
|
||||
android_apk_install /home/lucas/builds/app-debug.apk com.fnregistry.voiceguide .MainActivity
|
||||
|
||||
# Instalar y lanzar sin activity (usa monkey LAUNCHER)
|
||||
android_apk_install /home/lucas/builds/app-debug.apk com.fnregistry.voiceguide
|
||||
|
||||
# Llamada directa desde shell (no sourced)
|
||||
bash bash/functions/infra/android_apk_install.sh /path/to/app.apk com.example.app .MainActivity
|
||||
|
||||
# Override ADB path
|
||||
ADB=/custom/path/adb.exe bash bash/functions/infra/android_apk_install.sh /path/to/app.apk
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Requiere WSL2 con `adb.exe` Windows accesible. El path por defecto es
|
||||
`/mnt/c/Users/lucas/AppData/Local/Android/Sdk/platform-tools/adb.exe`.
|
||||
Se puede sobreescribir con `ADB=...` o `ANDROID_SDK_WIN=<sdk_root>` antes
|
||||
de invocar.
|
||||
- `wslpath` se usa para convertir el path WSL a formato Windows (`C:\...`).
|
||||
Si no está disponible (entorno no-WSL), se usa el path tal cual.
|
||||
- La instalación usa `adb install -r` (reinstala si ya existe).
|
||||
- Si `package_name` se da sin `activity_name`, la app se lanza via
|
||||
`adb shell monkey -p <pkg> -c android.intent.category.LAUNCHER 1`,
|
||||
que es equivalente a pulsar el icono del launcher.
|
||||
- El script se puede sourcear (para usar la función en otros scripts) o
|
||||
ejecutar directamente. Cuando se ejecuta directamente, delega en
|
||||
`android_apk_install "$@"`.
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_apk_install — Instala APK en device/emulador via adb y opcionalmente lanza la app.
|
||||
# Multi-emulator via --serial <S>.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Source helpers (adb_run, adb_pick_serial, adb_s, adb_wsl_to_win)
|
||||
# shellcheck source=/dev/null
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# android_apk_install [--serial <S>] <apk_path> [package_name] [activity_name]
|
||||
# ---------------------------------------------------------------------------
|
||||
android_apk_install() {
|
||||
local serial
|
||||
adb_pick_serial "$@" || { echo "android_apk_install: no device/emulator." >&2; return 3; }
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local apk="${1:-}"
|
||||
local package="${2:-}"
|
||||
local activity="${3:-}"
|
||||
|
||||
if [[ -z "$apk" ]]; then
|
||||
echo "android_apk_install: se requiere apk_path como primer argumento." >&2
|
||||
return 1
|
||||
fi
|
||||
if [[ ! -f "$apk" ]]; then
|
||||
echo "android_apk_install: APK no encontrado en '$apk'." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local win_path
|
||||
win_path=$(adb_wsl_to_win "$apk")
|
||||
|
||||
echo "android_apk_install: instalando '$win_path' on $serial ..."
|
||||
adb_s "$serial" install -r "$win_path"
|
||||
echo "android_apk_install: instalacion completada."
|
||||
|
||||
if [[ -n "$package" ]]; then
|
||||
if [[ -n "$activity" ]]; then
|
||||
echo "android_apk_install: lanzando $package/$activity ..."
|
||||
adb_s "$serial" shell am start -n "$package/$activity"
|
||||
else
|
||||
echo "android_apk_install: lanzando $package via monkey LAUNCHER ..."
|
||||
adb_s "$serial" shell monkey -p "$package" -c android.intent.category.LAUNCHER 1
|
||||
fi
|
||||
echo "android_apk_install: app lanzada."
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_apk_install "$@"
|
||||
fi
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
name: android_app_clear
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_app_clear([--serial <S>], package: string) -> void"
|
||||
description: "Wipe app data + cache via pm clear. App keeps installed but factory-state. Multi-emulator via --serial."
|
||||
tags: [android, adb, app, clear, reset]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device/emulator serial. Auto-detected if omitted."
|
||||
- name: package
|
||||
desc: "App package whose data to clear (e.g. com.example.app)."
|
||||
output: "Stdout 'cleared data for <pkg> on <serial>'. Exit 0 si pm clear OK."
|
||||
uses_functions: ["adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_app_clear.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Limpiar datos de una app (autodetecta device)
|
||||
android_app_clear com.example.myapp
|
||||
|
||||
# Con serial explícito
|
||||
android_app_clear --serial emulator-5554 com.example.myapp
|
||||
|
||||
# Llamada directa
|
||||
bash bash/functions/infra/android_app_clear.sh com.example.myapp
|
||||
bash bash/functions/infra/android_app_clear.sh --serial emulator-5554 com.example.myapp
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Usa `pm clear` internamente — borra SharedPreferences, bases de datos internas,
|
||||
caché y archivos de la app. La app queda como recién instalada.
|
||||
- El source de `adb_wsl.sh` resuelve el binario `adb.exe` Windows desde WSL2.
|
||||
Se puede sobreescribir con `ADB=...` o `ANDROID_SDK_WIN=<sdk_root>` antes de invocar.
|
||||
- `adb_pick_serial` consume `--serial <S>` de los args y deja el resto en
|
||||
`ADB_PICK_REST`. Si no se da, autodetecta el primer device/emulador activo.
|
||||
- Exit 3 si no hay ningún device conectado (propagado desde `adb_pick_serial`).
|
||||
- Exit 1 si no se pasa package.
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_app_clear — Wipe app data + cache via pm clear. App stays installed.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=./adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# android_app_clear [--serial <S>] <package>
|
||||
#
|
||||
# --serial <S> Optional target device/emulator serial.
|
||||
# package App package whose data+cache to clear (e.g. com.example.app).
|
||||
#
|
||||
# Calls: adb shell pm clear <package>
|
||||
# The app remains installed but is reset to factory state (no data, no cache).
|
||||
# Exit 0 on success, exit 1 on bad args, exit 3 if no device found.
|
||||
# ---------------------------------------------------------------------------
|
||||
android_app_clear() {
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local pkg="${1:-}"
|
||||
if [[ -z "$pkg" ]]; then
|
||||
echo "android_app_clear: se requiere <package> como argumento." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
adb_s "$serial" shell pm clear "$pkg"
|
||||
echo "cleared data for $pkg on $serial"
|
||||
}
|
||||
|
||||
# Run directly if not sourced
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_app_clear "$@"
|
||||
fi
|
||||
@@ -0,0 +1,57 @@
|
||||
---
|
||||
name: android_app_info
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_app_info([--serial <S>], package, [--json]) -> stdout"
|
||||
description: "Inspect installed app: version, target SDK, activities via dumpsys package."
|
||||
tags: [android, adb, app, info, dumpsys]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional ADB serial to target a specific device/emulator. Auto-detected if omitted."
|
||||
- name: "package"
|
||||
desc: "Android package name to inspect (e.g. com.example.myapp)."
|
||||
- name: "--json"
|
||||
desc: "Emit parsed JSON with versionName, versionCode, targetSdk, launcherActivity instead of raw dumpsys output."
|
||||
output: "Raw dumpsys package output, or JSON object {package, versionName, versionCode, targetSdk, launcherActivity}. Outputs JSON null if package not installed (--json mode). Exit 2 if package not found in raw mode, exit 3 if no device."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_app_info.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Raw dumpsys (full output)
|
||||
source bash/functions/infra/android_app_info.sh
|
||||
android_app_info com.example.myapp
|
||||
|
||||
# Target specific device
|
||||
android_app_info --serial emulator-5554 com.example.myapp
|
||||
|
||||
# Parsed JSON
|
||||
android_app_info com.example.myapp --json
|
||||
# {"package":"com.example.myapp","versionName":"2.1.0","versionCode":210,"targetSdk":34,"launcherActivity":"com.example.myapp/.MainActivity"}
|
||||
|
||||
# Package not installed → JSON null
|
||||
android_app_info com.not.installed --json
|
||||
# null
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Sources `adb_wsl.sh` para resolver el binario ADB Windows desde WSL2 y las helpers `adb_pick_serial` / `adb_s`.
|
||||
- `--serial` se consume via `adb_pick_serial`; el resto de los args quedan en `ADB_PICK_REST` y se re-asignan con `set --`.
|
||||
- JSON parsing usa `grep`/`sed`/`awk` sobre la salida de `dumpsys package`. Campos faltantes se emiten como string vacío o 0; no se usa `jq` para no requerir dependencias externas.
|
||||
- `launcherActivity` se extrae buscando el bloque `android.intent.action.MAIN` / `android.intent.category.LAUNCHER` en el listado de intent filters.
|
||||
- Exit codes: 0 = OK, 1 = arg/adb error, 2 = package not found (raw mode), 3 = no device.
|
||||
---
|
||||
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_app_info — Inspect installed app via dumpsys package.
|
||||
# Usage: android_app_info [--serial <S>] <package> [--json]
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_app_info() {
|
||||
# Resolve serial (consumes --serial from args, leaves rest in ADB_PICK_REST)
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
# Parse remaining args: package + --json flag
|
||||
local pkg=""
|
||||
local want_json=0
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--json) want_json=1; shift ;;
|
||||
-*) echo "android_app_info: unknown flag '$1'" >&2; return 1 ;;
|
||||
*)
|
||||
if [[ -z "$pkg" ]]; then
|
||||
pkg="$1"
|
||||
else
|
||||
echo "android_app_info: unexpected argument '$1'" >&2
|
||||
return 1
|
||||
fi
|
||||
shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$pkg" ]]; then
|
||||
echo "android_app_info: package argument required" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local dump
|
||||
dump=$(adb_s "$serial" shell dumpsys package "$pkg" 2>&1)
|
||||
local rc=$?
|
||||
if [[ $rc -ne 0 ]]; then
|
||||
echo "android_app_info: adb dumpsys failed (exit $rc)" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# If dumpsys returns nothing meaningful for the package, treat as not installed
|
||||
if ! echo "$dump" | grep -q "Package \["; then
|
||||
if [[ $want_json -eq 1 ]]; then
|
||||
echo "null"
|
||||
else
|
||||
echo "android_app_info: package '$pkg' not found on device" >&2
|
||||
return 2
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ $want_json -eq 0 ]]; then
|
||||
echo "$dump"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# --- JSON extraction ---
|
||||
local versionName versionCode targetSdk launcherActivity
|
||||
|
||||
versionName=$(echo "$dump" | grep -m1 'versionName=' \
|
||||
| sed 's/.*versionName=\([^ ]*\).*/\1/')
|
||||
versionCode=$(echo "$dump" | grep -m1 'versionCode=' \
|
||||
| sed 's/.*versionCode=\([0-9]*\).*/\1/')
|
||||
targetSdk=$(echo "$dump" | grep -m1 'targetSdk=' \
|
||||
| sed 's/.*targetSdk=\([0-9]*\).*/\1/')
|
||||
|
||||
# Primary/launcher activity: look for MAIN/LAUNCHER category block
|
||||
launcherActivity=$(echo "$dump" | awk '
|
||||
/android.intent.action.MAIN/ { found=1 }
|
||||
found && /[a-zA-Z0-9_.]+\/[a-zA-Z0-9_.]+/ {
|
||||
match($0, /[a-zA-Z0-9_.]+\/[a-zA-Z0-9_.]+/)
|
||||
print substr($0, RSTART, RLENGTH)
|
||||
exit
|
||||
}
|
||||
')
|
||||
|
||||
# Emit JSON, quoting strings safely
|
||||
printf '{"package":"%s","versionName":"%s","versionCode":%s,"targetSdk":%s,"launcherActivity":"%s"}\n' \
|
||||
"$pkg" \
|
||||
"${versionName:-}" \
|
||||
"${versionCode:-0}" \
|
||||
"${targetSdk:-0}" \
|
||||
"${launcherActivity:-}"
|
||||
}
|
||||
|
||||
# Run if invoked directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
android_app_info "$@"
|
||||
fi
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
name: android_app_kill
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_app_kill([--serial <S>], package: string) -> void"
|
||||
description: "Force-stop running app via am force-stop. Multi-emulator via --serial."
|
||||
tags: [android, adb, app, kill, force-stop]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device/emulator serial. Auto-detected if omitted."
|
||||
- name: "package"
|
||||
desc: "App package to force-stop (e.g. com.example.myapp)."
|
||||
output: "Stdout 'killed <pkg> on <serial>'. Exit 0."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_app_kill.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Detener app en el emulador activo
|
||||
android_app_kill com.example.myapp
|
||||
|
||||
# Detener app en un dispositivo concreto
|
||||
android_app_kill --serial emulator-5554 com.example.myapp
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa `adb_pick_serial` de `adb_wsl.sh` para resolver el dispositivo objetivo.
|
||||
Si `--serial` no se pasa, autodetecta el primer device/emulador disponible.
|
||||
Sale con exit 3 si no hay ningun device conectado.
|
||||
`am force-stop` detiene todos los procesos y servicios de la app de forma inmediata.
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_app_kill — Force-stop a running Android app via am force-stop.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_app_kill() {
|
||||
local serial pkg
|
||||
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
pkg="${1:?android_app_kill: package name required}"
|
||||
|
||||
adb_s "$serial" shell am force-stop "$pkg"
|
||||
echo "killed $pkg on $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_app_kill "$@"
|
||||
fi
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
name: android_app_launch
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_app_launch([--serial <S>], package: string, [activity: string]) -> void"
|
||||
description: "Launch app activity via am start. Multi-emulator via --serial."
|
||||
tags: [android, adb, app, launch, activity]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target serial. Default: first device"
|
||||
- name: "package"
|
||||
desc: "App package id"
|
||||
- name: "activity"
|
||||
desc: "Optional activity. If omitted, launches via LAUNCHER intent"
|
||||
output: "Stdout 'launched <pkg> on <serial>'. Exit 0 ok, 3 no device."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_app_launch.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Lanzar actividad principal explicitamente
|
||||
android_app_launch com.foo.bar .MainActivity
|
||||
|
||||
# Lanzar por LAUNCHER intent (detecta actividad principal automaticamente)
|
||||
android_app_launch com.foo.bar
|
||||
|
||||
# Multi-emulador: elegir serial concreto
|
||||
android_app_launch --serial emulator-5554 com.foo.bar .MainActivity
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa `adb_pick_serial` de `adb_wsl.sh` para resolver el serial objetivo.
|
||||
Si no hay ningun device/emulador disponible, sale con exit code 3.
|
||||
Si `activity` no se especifica, usa `monkey -p <pkg> -c android.intent.category.LAUNCHER 1`
|
||||
para lanzar la actividad principal sin necesidad de conocerla de antemano.
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_app_launch — Launch an Android app via adb am start or monkey LAUNCHER intent.
|
||||
# Usage: android_app_launch [--serial <S>] <package> [<activity>]
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_app_launch() {
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local pkg="${1:-}"
|
||||
local activity="${2:-}"
|
||||
|
||||
if [[ -z "$pkg" ]]; then
|
||||
echo "android_app_launch: package is required." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -n "$activity" ]]; then
|
||||
adb_s "$serial" shell am start -n "$pkg/$activity"
|
||||
else
|
||||
adb_s "$serial" shell monkey -p "$pkg" -c android.intent.category.LAUNCHER 1
|
||||
fi
|
||||
|
||||
echo "launched $pkg on $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_app_launch "$@"
|
||||
fi
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
name: android_app_uninstall
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_app_uninstall([--serial <S>] package [--keep-data]) -> void"
|
||||
description: "Uninstall app via adb uninstall. Optionally keep data with --keep-data."
|
||||
tags: [android, adb, app, uninstall]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device/emulator serial. Auto-detects first connected device if omitted."
|
||||
- name: "package"
|
||||
desc: "Android package name to uninstall (e.g. com.example.myapp). Mandatory positional argument."
|
||||
- name: "--keep-data"
|
||||
desc: "Keep app data + cache after uninstall (passes -k to pm uninstall)."
|
||||
output: "Stdout 'uninstalled <pkg> on <serial>'. Exit 0 OK."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_app_uninstall.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Desinstalar en el device por defecto
|
||||
android_app_uninstall com.example.myapp
|
||||
|
||||
# Desinstalar en un device concreto
|
||||
android_app_uninstall --serial emulator-5554 com.example.myapp
|
||||
|
||||
# Desinstalar conservando datos y cache
|
||||
android_app_uninstall --serial emulator-5554 com.example.myapp --keep-data
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Sourcea `adb_wsl.sh` para resolver el binario `adb.exe` en WSL2 y usar
|
||||
`adb_pick_serial` / `adb_s`. Si no hay ningún device conectado y no se
|
||||
pasa `--serial`, la función falla con exit 1 antes de invocar adb.
|
||||
|
||||
El flag `--keep-data` pasa `-k` a `adb uninstall`, equivalente a
|
||||
`pm uninstall -k` — el APK se elimina pero los datos y la caché de la app
|
||||
permanecen en el dispositivo.
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_app_uninstall — Desinstala una app Android via adb uninstall.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_app_uninstall() {
|
||||
# Parse --serial (consumes it, rest stays in ADB_PICK_REST)
|
||||
local serial
|
||||
adb_pick_serial "$@" || return 1
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
# Parse --keep-data flag
|
||||
local keep_data=0
|
||||
local args=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--keep-data) keep_data=1; shift ;;
|
||||
*) args+=("$1"); shift ;;
|
||||
esac
|
||||
done
|
||||
set -- "${args[@]}"
|
||||
|
||||
local pkg="${1:-}"
|
||||
if [[ -z "$pkg" ]]; then
|
||||
echo "android_app_uninstall: package obligatorio." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if (( keep_data )); then
|
||||
adb_s "$serial" uninstall -k "$pkg" || return 1
|
||||
else
|
||||
adb_s "$serial" uninstall "$pkg" || return 1
|
||||
fi
|
||||
|
||||
echo "uninstalled $pkg on $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_app_uninstall "$@"
|
||||
fi
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: android_emu_battery
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_emu_battery([--serial <S>], level: int, [--charging <true|false>]) -> void"
|
||||
description: "Simulate battery state on emulator (level + charging). Emulator-only."
|
||||
tags: [android, emulator, battery, power]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional emulator serial (e.g. emulator-5554). Auto-detected if omitted."
|
||||
- name: "level"
|
||||
desc: "Battery level 0-100 to set via 'emu power capacity'."
|
||||
- name: "--charging <true|false>"
|
||||
desc: "AC charging state: true maps to 'on', false maps to 'off'. Omit to leave unchanged."
|
||||
output: "Stdout 'battery: <N>% [charging=...] on <serial>'. Exit 3 if no device found, exit 1 on other errors."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_emu_battery.sh"
|
||||
notes: "Util para tests bateria baja, modo ahorro energia. Solo funciona con emuladores (serial emulator-*), no con devices fisicos."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Nivel al 15%, sin cambiar estado de carga
|
||||
android_emu_battery 15
|
||||
|
||||
# Nivel al 5%, forzar descarga (AC off)
|
||||
android_emu_battery 5 --charging false
|
||||
|
||||
# Nivel al 80%, forzar carga (AC on), emulador concreto
|
||||
android_emu_battery --serial emulator-5554 80 --charging true
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Util para tests de bateria baja y modo ahorro de energia. Solo funciona con emuladores Android
|
||||
(serial debe empezar con `emulator-`). No aplica a dispositivos fisicos.
|
||||
|
||||
Requiere que `adb_wsl.sh` este en el mismo directorio. El ADB se resuelve via
|
||||
`ANDROID_SDK_WIN` o la ruta por defecto de la instalacion Windows SDK.
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_emu_battery — Simulate battery state on Android emulator (level + charging).
|
||||
# Usage: android_emu_battery [--serial <S>] <level 0-100> [--charging <true|false>]
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_emu_battery() {
|
||||
# Resolve serial (consumes --serial from args, leaves rest in ADB_PICK_REST)
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
# Require serial to be an emulator
|
||||
if [[ "$serial" != emulator-* ]]; then
|
||||
echo "android_emu_battery: serial '$serial' is not an emulator (must start with emulator-)." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Parse remaining args: positional level + --charging
|
||||
local level=""
|
||||
local charging=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--charging)
|
||||
charging="$2"
|
||||
shift 2
|
||||
;;
|
||||
--charging=*)
|
||||
charging="${1#--charging=}"
|
||||
shift
|
||||
;;
|
||||
-*)
|
||||
echo "android_emu_battery: unknown flag '$1'." >&2
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
if [[ -z "$level" ]]; then
|
||||
level="$1"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Validate level
|
||||
if [[ -z "$level" ]]; then
|
||||
echo "android_emu_battery: level is required (0-100)." >&2
|
||||
return 1
|
||||
fi
|
||||
if ! [[ "$level" =~ ^[0-9]+$ ]] || (( level < 0 || level > 100 )); then
|
||||
echo "android_emu_battery: invalid level '$level' — must be integer 0-100." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Set battery level
|
||||
adb_s "$serial" emu power capacity "$level" || {
|
||||
echo "android_emu_battery: failed to set capacity on $serial." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
# Set charging state if requested
|
||||
local ch="<unchanged>"
|
||||
if [[ -n "$charging" ]]; then
|
||||
local ac_val
|
||||
case "$charging" in
|
||||
true) ac_val="on" ;;
|
||||
false) ac_val="off" ;;
|
||||
*)
|
||||
echo "android_emu_battery: --charging must be 'true' or 'false', got '$charging'." >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
adb_s "$serial" emu power ac "$ac_val" || {
|
||||
echo "android_emu_battery: failed to set AC charging on $serial." >&2
|
||||
return 1
|
||||
}
|
||||
ch="$charging"
|
||||
fi
|
||||
|
||||
echo "battery: ${level}% [charging=${ch}] on ${serial}"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_emu_battery "$@"
|
||||
fi
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
name: android_emu_geo_fix
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_emu_geo_fix([--serial <S>], longitude: string, latitude: string, [altitude: string]) -> void"
|
||||
description: "Fake GPS location on Android emulator via emu geo fix. Emulator-only (not physical devices)."
|
||||
tags: [android, emulator, geo, gps, location]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional emulator serial. Auto-detected if omitted."
|
||||
- name: "longitude"
|
||||
desc: "Longitude (decimal degrees). Passed first — opposite to human lat/lon convention."
|
||||
- name: "latitude"
|
||||
desc: "Latitude (decimal degrees)."
|
||||
- name: "altitude"
|
||||
desc: "Optional altitude in meters."
|
||||
output: "Stdout 'GPS set: <lon>, <lat> (alt=...) on <serial>'. Exit 0."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_emu_geo_fix.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Fijar GPS en Madrid (emulador activo)
|
||||
android_emu_geo_fix -3.7038 40.4168
|
||||
|
||||
# Con altitud
|
||||
android_emu_geo_fix -3.7038 40.4168 650
|
||||
|
||||
# Emulador especifico
|
||||
android_emu_geo_fix --serial emulator-5554 -3.7038 40.4168
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
El orden de argumentos es **longitud primero, latitud segundo** — opuesto a la convencion humana habitual (lat/lon). Esto sigue el protocolo del comando `emu geo fix` de Android.
|
||||
|
||||
Solo funciona en emuladores (`emulator-*`). Si el serial apunta a un dispositivo fisico, la funcion sale con error y exit 1.
|
||||
|
||||
Usa `adb_pick_serial` de `adb_wsl.sh` para resolver el dispositivo objetivo.
|
||||
Sale con exit 3 si no hay ningun device conectado.
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_emu_geo_fix — Fake GPS location on Android emulator via emu geo fix.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_emu_geo_fix() {
|
||||
local serial lon lat alt
|
||||
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
lon="${1:?android_emu_geo_fix: longitude required}"
|
||||
lat="${2:?android_emu_geo_fix: latitude required}"
|
||||
alt="${3:-}"
|
||||
|
||||
# geo fix only works on emulators, not physical devices
|
||||
if [[ "$serial" != emulator-* ]]; then
|
||||
echo "android_emu_geo_fix: geo fix only works on emulators (got '$serial')" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
adb_s "$serial" emu geo fix "$lon" "$lat" ${alt:+"$alt"}
|
||||
|
||||
if [[ -n "$alt" ]]; then
|
||||
echo "GPS set: $lon, $lat (alt=$alt) on $serial"
|
||||
else
|
||||
echo "GPS set: $lon, $lat on $serial"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_emu_geo_fix "$@"
|
||||
fi
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
name: android_emu_rotate
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_emu_rotate([--serial <S>] [portrait|landscape|0|90|180|270])"
|
||||
description: "Rotate emulator screen. Empty=toggle, or fixed orientation. Locks autorotate."
|
||||
tags: [android, emulator, rotation, orientation]
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional emulator serial. Picked automatically if only one is connected."
|
||||
- name: "orientation"
|
||||
desc: "Empty=toggle via emu rotate, or fixed: portrait/landscape/0/90/180/270."
|
||||
output: "Stdout 'rotated: <orient> on <serial>'."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_emu_rotate.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Toggle rotation
|
||||
android_emu_rotate
|
||||
|
||||
# Force portrait
|
||||
android_emu_rotate portrait
|
||||
|
||||
# Force landscape on specific emulator
|
||||
android_emu_rotate --serial emulator-5554 landscape
|
||||
|
||||
# Set 270 degrees
|
||||
android_emu_rotate --serial emulator-5554 270
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Deshabilita autorotate (`accelerometer_rotation 0`) antes de aplicar cualquier orientacion fija, de modo que el sistema no la revierta. El toggle (`emu rotate`) no desactiva autorotate: lo usa directamente el daemon del emulador.
|
||||
|
||||
`adb_pick_serial` (de `adb_wsl_bash_infra`) selecciona el unico emulador conectado o falla con exit 3 si hay ambiguedad o ninguno disponible. Los argumentos restantes tras extraer `--serial` quedan en `ADB_PICK_REST`.
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_emu_rotate — rotate emulator screen or toggle rotation
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=./adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_emu_rotate() {
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local arg="${1:-}"
|
||||
|
||||
# Disable autorotate before any operation
|
||||
if [[ -n "$arg" ]]; then
|
||||
adb_s "$serial" shell settings put system accelerometer_rotation 0
|
||||
fi
|
||||
|
||||
case "$arg" in
|
||||
"")
|
||||
# Toggle via emu rotate command
|
||||
adb_s "$serial" emu rotate
|
||||
;;
|
||||
portrait|0)
|
||||
adb_s "$serial" shell settings put system accelerometer_rotation 0
|
||||
adb_s "$serial" shell settings put system user_rotation 0
|
||||
;;
|
||||
landscape|90)
|
||||
adb_s "$serial" shell settings put system accelerometer_rotation 0
|
||||
adb_s "$serial" shell settings put system user_rotation 1
|
||||
;;
|
||||
180)
|
||||
adb_s "$serial" shell settings put system accelerometer_rotation 0
|
||||
adb_s "$serial" shell settings put system user_rotation 2
|
||||
;;
|
||||
270)
|
||||
adb_s "$serial" shell settings put system accelerometer_rotation 0
|
||||
adb_s "$serial" shell settings put system user_rotation 3
|
||||
;;
|
||||
*)
|
||||
echo "android_emu_rotate: unknown orientation '$arg'" >&2
|
||||
echo "Usage: android_emu_rotate [--serial <S>] [portrait|landscape|0|90|180|270]" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "rotated: ${arg:-toggle} on $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_emu_rotate "$@"
|
||||
fi
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: android_emulator_list
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_emulator_list([--json])"
|
||||
description: "Lista los AVDs disponibles invocando emulator.exe Windows desde WSL2."
|
||||
tags: [android, emulator, wsl]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: "--json"
|
||||
desc: "Optional flag, outputs JSON array instead of newline-separated names"
|
||||
output: "Lista de AVDs disponibles en el SDK Windows. Una por linea, o JSON array con --json."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_emulator_list.sh"
|
||||
notes: "Lee env var EMULATOR o ANDROID_SDK_WIN. Default Windows path: /mnt/c/Users/lucas/AppData/Local/Android/Sdk/emulator/emulator.exe. Exit 0 si lista (incluso vacia). Exit 1 solo si el binario no existe o no es ejecutable."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Listar AVDs (una por linea)
|
||||
android_emulator_list
|
||||
|
||||
# Listar AVDs en formato JSON
|
||||
android_emulator_list --json
|
||||
# ["Pixel_7_API_34","Pixel_4_API_30"]
|
||||
|
||||
# Sobreescribir ruta del emulador
|
||||
EMULATOR="/custom/path/emulator.exe" android_emulator_list
|
||||
|
||||
# Sobreescribir SDK base
|
||||
ANDROID_SDK_WIN="/mnt/d/Android/Sdk" android_emulator_list
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
El script es ejecutable directamente (`chmod +x`) o invocable con `bash android_emulator_list.sh`.
|
||||
|
||||
`emulator.exe -list-avds` imprime warnings a stderr que se descartan con `2>/dev/null`. La captura con `mapfile` filtra ademas lineas vacias para producir una lista limpia.
|
||||
|
||||
La variable `EMULATOR` tiene prioridad sobre `ANDROID_SDK_WIN`. Si ninguna esta definida se usa el path Windows por defecto de Lucas.
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_emulator_list — Lista los AVDs disponibles invocando emulator.exe Windows desde WSL2.
|
||||
set -euo pipefail
|
||||
|
||||
# Resolve emulator binary
|
||||
EMULATOR="${EMULATOR:-${ANDROID_SDK_WIN:-/mnt/c/Users/lucas/AppData/Local/Android/Sdk}/emulator/emulator.exe}"
|
||||
|
||||
if [[ ! -x "$EMULATOR" ]]; then
|
||||
echo "error: emulator binary not found or not executable: $EMULATOR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Parse flags
|
||||
JSON=false
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--json) JSON=true ;;
|
||||
*) echo "error: unknown argument: $arg" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Collect AVDs, stripping any warnings emulator.exe prints to stderr
|
||||
mapfile -t AVDS < <("$EMULATOR" -list-avds 2>/dev/null || true)
|
||||
|
||||
if $JSON; then
|
||||
# Build JSON array
|
||||
printf '['
|
||||
first=true
|
||||
for avd in "${AVDS[@]}"; do
|
||||
[[ -z "$avd" ]] && continue
|
||||
if $first; then
|
||||
printf '"%s"' "$avd"
|
||||
first=false
|
||||
else
|
||||
printf ',"%s"' "$avd"
|
||||
fi
|
||||
done
|
||||
printf ']\n'
|
||||
else
|
||||
for avd in "${AVDS[@]}"; do
|
||||
[[ -z "$avd" ]] && continue
|
||||
printf '%s\n' "$avd"
|
||||
done
|
||||
fi
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
name: android_emulator_start
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_emulator_start(avd_name: string, timeout_s: int) -> string"
|
||||
description: "Arranca un AVD en background y espera a que termine de bootear. Idempotente: si ya hay emulador corriendo no lanza otro."
|
||||
tags: [android, emulator, wsl]
|
||||
params:
|
||||
- name: avd_name
|
||||
desc: "Nombre del AVD a arrancar (visible con android_emulator_list o `emulator.exe -list-avds`)"
|
||||
- name: timeout_s
|
||||
desc: "Timeout total en segundos para esperar el boot completo. Opcional, default 180"
|
||||
output: "Serial del device emulado (ej. emulator-5554) en stdout. Exit 0 = boot completo, exit 1 = timeout o emulador murio."
|
||||
uses_functions: ["adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_emulator_start.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
source bash/functions/infra/android_emulator_start.sh
|
||||
|
||||
# Arrancar AVD con timeout por defecto (180s)
|
||||
serial=$(android_emulator_start "Pixel_6_API_34")
|
||||
echo "Emulador listo: $serial" # emulator-5554
|
||||
|
||||
# Con timeout personalizado
|
||||
serial=$(android_emulator_start "Pixel_6_API_34" 300)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Sourcea `adb_wsl.sh` del mismo directorio si existe (provee `ADB`, `adb_run`, `adb_wait_boot`). Si no, usa implementacion inline.
|
||||
- Resuelve `EMULATOR` y `ADB` desde `ANDROID_SDK_WIN` (default `/mnt/c/Users/lucas/AppData/Local/Android/Sdk`) o desde las variables de entorno `EMULATOR=` / `ADB=` si ya están fijadas.
|
||||
- Idempotente: si `adb devices` ya muestra un `emulator-*`, imprime "already running" + el serial y sale con exit 0 sin lanzar un segundo proceso.
|
||||
- Log del emulador en `/tmp/emulator_<avd>.log`. PID en `/tmp/emulator_<avd>.pid`.
|
||||
- El timeout total se reparte: primera mitad para `adb wait-for-device`, segunda mitad para esperar `sys.boot_completed=1`.
|
||||
- Diseñado para WSL2 con Android SDK instalado en Windows. En Linux nativo basta cambiar las rutas de los binarios via `EMULATOR=` y `ADB=`.
|
||||
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_emulator_start — Arranca un AVD en background y espera a que bootee.
|
||||
# Uso: android_emulator_start <avd_name> [timeout_s]
|
||||
set -euo pipefail
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Source adb_wsl si está disponible (provee ADB, adb_run, adb_wait_boot)
|
||||
# ---------------------------------------------------------------------------
|
||||
_ADB_WSL_SH="$(dirname "${BASH_SOURCE[0]}")/adb_wsl.sh"
|
||||
if [[ -f "$_ADB_WSL_SH" ]]; then
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$_ADB_WSL_SH"
|
||||
else
|
||||
# Fallback inline: resolver ADB
|
||||
if [[ -z "${ADB:-}" ]]; then
|
||||
_sdk_root="${ANDROID_SDK_WIN:-/mnt/c/Users/lucas/AppData/Local/Android/Sdk}"
|
||||
ADB="${_sdk_root}/platform-tools/adb.exe"
|
||||
unset _sdk_root
|
||||
fi
|
||||
adb_run() { "$ADB" "$@"; }
|
||||
adb_wait_boot() {
|
||||
local timeout_s="${1:-120}"
|
||||
local elapsed=0 interval=3 val
|
||||
while (( elapsed < timeout_s )); do
|
||||
val=$(adb_run shell getprop sys.boot_completed 2>/dev/null | tr -d '[:space:]')
|
||||
[[ "$val" == "1" ]] && return 0
|
||||
sleep "$interval"
|
||||
(( elapsed += interval ))
|
||||
done
|
||||
echo "android_emulator_start: timeout ${timeout_s}s esperando boot." >&2
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Resolver EMULATOR
|
||||
# ---------------------------------------------------------------------------
|
||||
if [[ -z "${EMULATOR:-}" ]]; then
|
||||
_sdk_root="${ANDROID_SDK_WIN:-/mnt/c/Users/lucas/AppData/Local/Android/Sdk}"
|
||||
EMULATOR="${_sdk_root}/emulator/emulator.exe"
|
||||
unset _sdk_root
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# android_emulator_start <avd_name> [timeout_s]
|
||||
# ---------------------------------------------------------------------------
|
||||
android_emulator_start() {
|
||||
local AVD="${1:?android_emulator_start requiere el nombre del AVD como primer argumento}"
|
||||
local timeout_s="${2:-180}"
|
||||
|
||||
# Validaciones de entorno
|
||||
if [[ ! -f "$EMULATOR" ]]; then
|
||||
echo "android_emulator_start: emulator.exe no encontrado en '$EMULATOR'. Fija EMULATOR= o ANDROID_SDK_WIN=." >&2
|
||||
return 1
|
||||
fi
|
||||
if [[ ! -f "$ADB" ]]; then
|
||||
echo "android_emulator_start: adb.exe no encontrado en '$ADB'. Fija ADB= o ANDROID_SDK_WIN=." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Idempotencia: si ya hay un emulador corriendo, salir sin lanzar otro
|
||||
if adb_run devices 2>/dev/null | grep -q "emulator-"; then
|
||||
echo "already running"
|
||||
# Imprimir el serial existente
|
||||
adb_run devices 2>/dev/null | grep "emulator-" | awk '{print $1}' | head -n1
|
||||
return 0
|
||||
fi
|
||||
|
||||
local log_file="/tmp/emulator_${AVD}.log"
|
||||
local pid_file="/tmp/emulator_${AVD}.pid"
|
||||
|
||||
# Lanzar emulador en background
|
||||
"$EMULATOR" -avd "$AVD" -no-boot-anim -no-snapshot-load >"$log_file" 2>&1 &
|
||||
local emu_pid=$!
|
||||
echo "$emu_pid" > "$pid_file"
|
||||
|
||||
# Esperar a que el dispositivo aparezca en adb
|
||||
local wait_timeout=$(( timeout_s / 2 ))
|
||||
if ! timeout "$wait_timeout" adb_run wait-for-device 2>/dev/null; then
|
||||
echo "android_emulator_start: timeout esperando que el dispositivo aparezca en adb (${wait_timeout}s)." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Verificar que el proceso del emulador sigue vivo
|
||||
if ! kill -0 "$emu_pid" 2>/dev/null; then
|
||||
echo "android_emulator_start: el proceso del emulador (PID $emu_pid) murió antes de completar el boot." >&2
|
||||
echo " Log: $log_file" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Esperar boot completo (sys.boot_completed=1)
|
||||
local boot_timeout=$(( timeout_s - wait_timeout ))
|
||||
if ! adb_wait_boot "$boot_timeout"; then
|
||||
echo "android_emulator_start: timeout ${timeout_s}s esperando boot completo del AVD '$AVD'." >&2
|
||||
echo " Log: $log_file" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Obtener serial del dispositivo emulado
|
||||
local serial
|
||||
serial=$(adb_run devices 2>/dev/null | grep "emulator-" | awk '{print $1}' | head -n1)
|
||||
|
||||
echo "$serial"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Ejecutar si se invoca directamente (no sourceado)
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_emulator_start "$@"
|
||||
fi
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
name: android_emulator_stop
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_emulator_stop(serial?: string) -> void"
|
||||
description: "Para uno o todos los emuladores Android via adb emu kill. Si serial esta vacio, detecta todos los emulator-* activos y los para. Idempotente: exit 0 aunque no haya nada que matar."
|
||||
tags: ["android", "emulator", "wsl", "adb"]
|
||||
params:
|
||||
- name: "serial"
|
||||
desc: "Optional emulator serial (e.g. emulator-5554). Empty = kill all running emulators"
|
||||
output: "Imprime numero de emuladores parados. Exit 0 idempotente."
|
||||
uses_functions: ["adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_emulator_stop.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Parar todos los emuladores en ejecucion
|
||||
android_emulator_stop
|
||||
|
||||
# Parar un emulador concreto
|
||||
android_emulator_stop emulator-5554
|
||||
|
||||
# Sobreescribir ruta de adb
|
||||
ADB=/usr/local/bin/adb android_emulator_stop
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Resuelve `ADB` desde variable de entorno (default: ruta de Android SDK en Windows bajo WSL2).
|
||||
Usa `adb emu kill` en vez de `adb kill-server` para parar solo el emulador sin afectar al daemon adb.
|
||||
`set -euo pipefail` activo, pero los fallos de `adb emu kill` se suprimen con `|| true` para mantener idempotencia.
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_emulator_stop — Para uno o todos los emuladores Android via adb emu kill.
|
||||
set -euo pipefail
|
||||
|
||||
android_emulator_stop() {
|
||||
local serial="${1:-}"
|
||||
local ADB="${ADB:-/mnt/c/Users/lucas/AppData/Local/Android/Sdk/platform-tools/adb.exe}"
|
||||
local killed=0
|
||||
|
||||
if [[ -z "$serial" ]]; then
|
||||
# Detectar todos los emuladores activos
|
||||
local serials
|
||||
serials=$("$ADB" devices 2>/dev/null | grep -E '^emulator-' | awk '{print $1}' || true)
|
||||
|
||||
if [[ -z "$serials" ]]; then
|
||||
echo "android_emulator_stop: no running emulators found"
|
||||
return 0
|
||||
fi
|
||||
|
||||
while IFS= read -r s; do
|
||||
[[ -z "$s" ]] && continue
|
||||
echo "android_emulator_stop: stopping $s"
|
||||
"$ADB" -s "$s" emu kill 2>/dev/null || true
|
||||
((killed++)) || true
|
||||
done <<< "$serials"
|
||||
else
|
||||
echo "android_emulator_stop: stopping $serial"
|
||||
"$ADB" -s "$serial" emu kill 2>/dev/null || true
|
||||
((killed++)) || true
|
||||
fi
|
||||
|
||||
echo "android_emulator_stop: stopped $killed emulator(s)"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Ejecutar si se llama directamente
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_emulator_stop "${1:-}"
|
||||
fi
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
name: android_input_keyevent
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_input_keyevent([--serial <S>] key: string)"
|
||||
description: "Send key event via adb shell input keyevent. Accepts aliases (BACK, HOME, POWER, ENTER, MENU, RECENT_APPS, VOLUME_UP, VOLUME_DOWN), raw numeric codes, or explicit KEYCODE_* names."
|
||||
tags: [android, adb, input, keyevent, ui-test]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device/emulator serial. If omitted, adb_pick_serial resolves the single connected device."
|
||||
- name: "key"
|
||||
desc: "Keycode: short alias (BACK/HOME/POWER/ENTER/MENU/RECENT_APPS/VOLUME_UP/VOLUME_DOWN), raw number (e.g. 4, 26), or explicit KEYCODE_* name."
|
||||
output: "Stdout 'key: <code> on <serial>'."
|
||||
uses_functions: ["adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_input_keyevent.sh"
|
||||
notes: "Lista completa de keycodes: https://developer.android.com/reference/android/view/KeyEvent. Exit 3 si adb_pick_serial falla (ningun device o ambiguo sin --serial)."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Pulsar BACK en el unico device conectado
|
||||
android_input_keyevent BACK
|
||||
|
||||
# Pulsar HOME en un emulador especifico
|
||||
android_input_keyevent --serial emulator-5554 HOME
|
||||
|
||||
# Codigo numerico directo
|
||||
android_input_keyevent 26 # POWER
|
||||
|
||||
# KEYCODE_* explicito
|
||||
android_input_keyevent KEYCODE_DPAD_CENTER
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Aliases resueltos internamente:
|
||||
|
||||
| Alias | KEYCODE |
|
||||
|--------------|-----------------------|
|
||||
| BACK | KEYCODE_BACK |
|
||||
| HOME | KEYCODE_HOME |
|
||||
| POWER | KEYCODE_POWER |
|
||||
| ENTER | KEYCODE_ENTER |
|
||||
| MENU | KEYCODE_MENU |
|
||||
| RECENT_APPS | KEYCODE_APP_SWITCH |
|
||||
| VOLUME_UP | KEYCODE_VOLUME_UP |
|
||||
| VOLUME_DOWN | KEYCODE_VOLUME_DOWN |
|
||||
|
||||
Si el argumento no coincide con ningun alias y no es numerico, se construye `KEYCODE_<UPPER>` para pasarlo directo a `adb shell input keyevent`.
|
||||
|
||||
Exit codes: 1 = keycode vacio, 3 = fallo de `adb_pick_serial` (ningun device o ambiguo).
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_input_keyevent — Send key event via adb shell input keyevent.
|
||||
# Accepts aliases (BACK, HOME, POWER, ENTER, MENU, RECENT_APPS),
|
||||
# raw numeric codes, or explicit KEYCODE_* names.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_input_keyevent() {
|
||||
# Resolve serial (consumes --serial <S> from args, remainder in ADB_PICK_REST)
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local raw="${1:-}"
|
||||
if [[ -z "$raw" ]]; then
|
||||
echo "android_input_keyevent: missing keycode argument" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Resolve alias → KEYCODE_*
|
||||
local keycode
|
||||
case "${raw^^}" in
|
||||
BACK) keycode="KEYCODE_BACK" ;;
|
||||
HOME) keycode="KEYCODE_HOME" ;;
|
||||
POWER) keycode="KEYCODE_POWER" ;;
|
||||
ENTER) keycode="KEYCODE_ENTER" ;;
|
||||
MENU) keycode="KEYCODE_MENU" ;;
|
||||
RECENT_APPS) keycode="KEYCODE_APP_SWITCH" ;;
|
||||
VOLUME_UP) keycode="KEYCODE_VOLUME_UP" ;;
|
||||
VOLUME_DOWN) keycode="KEYCODE_VOLUME_DOWN" ;;
|
||||
*)
|
||||
# Already has KEYCODE_ prefix or is a raw number → pass through
|
||||
if [[ "${raw^^}" == KEYCODE_* ]] || [[ "$raw" =~ ^[0-9]+$ ]]; then
|
||||
keycode="$raw"
|
||||
else
|
||||
# Unknown alias: uppercase and prepend KEYCODE_
|
||||
keycode="KEYCODE_${raw^^}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
adb_s "$serial" shell input keyevent "$keycode"
|
||||
echo "key: $keycode on $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_input_keyevent "$@"
|
||||
fi
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: android_input_swipe
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_input_swipe([--serial <S>], x1: int, y1: int, x2: int, y2: int, [duration_ms: int])"
|
||||
description: "Send swipe gesture between two points with duration."
|
||||
tags: [android, adb, input, swipe, gesture, ui-test]
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device serial. Overrides ADB_SERIAL envvar."
|
||||
- name: x1
|
||||
desc: "Start X coordinate in pixels."
|
||||
- name: y1
|
||||
desc: "Start Y coordinate in pixels."
|
||||
- name: x2
|
||||
desc: "End X coordinate in pixels."
|
||||
- name: y2
|
||||
desc: "End Y coordinate in pixels."
|
||||
- name: duration_ms
|
||||
desc: "Optional swipe duration in milliseconds. Default 300."
|
||||
output: "Stdout swipe summary line: 'swipe x1,y1 → x2,y2 (Nms) on <serial>'."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_input_swipe.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
source bash/functions/infra/android_input_swipe.sh
|
||||
|
||||
# Scroll down (swipe up)
|
||||
android_input_swipe 540 1400 540 400
|
||||
|
||||
# Scroll up slowly on a specific device
|
||||
android_input_swipe --serial emulator-5554 540 400 540 1400 800
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Requiere `adb_wsl.sh` (sourceado automáticamente). Usa `adb_pick_serial` para
|
||||
resolver el dispositivo objetivo a partir de `--serial`, `ADB_SERIAL` o el
|
||||
único device disponible.
|
||||
|
||||
Los cuatro argumentos de coordenadas se validan como enteros antes de invocar
|
||||
adb — acepta coordenadas negativas (edge cases de hardware con ejes invertidos).
|
||||
|
||||
Exit 3 si `adb_pick_serial` no puede resolver el serial (sin devices o ambiguo).
|
||||
Exit 1 si faltan coordenadas o alguna no es numérica.
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_input_swipe — Send swipe gesture between two points via adb shell input swipe.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# android_input_swipe [--serial <S>] <x1> <y1> <x2> <y2> [duration_ms]
|
||||
#
|
||||
# $1 x1 Start X coordinate in pixels (obligatorio).
|
||||
# $2 y1 Start Y coordinate in pixels (obligatorio).
|
||||
# $3 x2 End X coordinate in pixels (obligatorio).
|
||||
# $4 y2 End Y coordinate in pixels (obligatorio).
|
||||
# $5 duration_ms Swipe duration in milliseconds (opcional, default 300).
|
||||
#
|
||||
# Envvar ADB_SERIAL overrides --serial.
|
||||
# ---------------------------------------------------------------------------
|
||||
android_input_swipe() {
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local x1="${1:-}"
|
||||
local y1="${2:-}"
|
||||
local x2="${3:-}"
|
||||
local y2="${4:-}"
|
||||
local dur="${5:-300}"
|
||||
|
||||
if [[ -z "$x1" || -z "$y1" || -z "$x2" || -z "$y2" ]]; then
|
||||
echo "android_input_swipe: se requieren cuatro argumentos: x1 y1 x2 y2." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Validar que los cuatro coordenadas son numericas (enteros o negativos).
|
||||
local coord
|
||||
for coord in "$x1" "$y1" "$x2" "$y2"; do
|
||||
if ! [[ "$coord" =~ ^-?[0-9]+$ ]]; then
|
||||
echo "android_input_swipe: coordenada no numerica: '$coord'." >&2
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
adb_s "$serial" shell input swipe "$x1" "$y1" "$x2" "$y2" "$dur"
|
||||
echo "swipe $x1,$y1 → $x2,$y2 (${dur}ms) on $serial"
|
||||
}
|
||||
|
||||
# Ejecutar si se llama directamente (no sourceado)
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_input_swipe "$@"
|
||||
fi
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
name: android_input_tap
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_input_tap([--serial <S>], x: int, y: int) -> void"
|
||||
description: "Send tap gesture at screen coordinates via adb shell input tap."
|
||||
tags: [android, adb, input, tap, ui-test, gesture]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device serial. Auto-detected if omitted."
|
||||
- name: "x"
|
||||
desc: "X coordinate in pixels (non-negative integer)."
|
||||
- name: "y"
|
||||
desc: "Y coordinate in pixels (non-negative integer)."
|
||||
output: "Stdout 'tap @ <x>,<y> on <serial>'."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_input_tap.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Auto-detect device
|
||||
android_input_tap 540 960
|
||||
|
||||
# Target specific device
|
||||
android_input_tap --serial emulator-5554 540 960
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Sources `adb_wsl.sh` para resolver el binario ADB y exponer `adb_pick_serial` / `adb_s`.
|
||||
Usa `adb_pick_serial` para consumir `--serial` de los args y autodetectar el device si no se pasa.
|
||||
Valida X e Y con regex `^[0-9]+$` antes de invocar adb.
|
||||
Exit 3 si no hay device/emulador disponible (propagado desde `adb_pick_serial`).
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_input_tap — Send tap gesture at screen coordinates via adb shell input tap.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=./adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# android_input_tap [--serial <S>] <x> <y>
|
||||
#
|
||||
# --serial <S> Optional target device serial (also auto-detected).
|
||||
# x X coordinate in pixels (non-negative integer).
|
||||
# y Y coordinate in pixels (non-negative integer).
|
||||
#
|
||||
# Exits:
|
||||
# 0 tap sent successfully
|
||||
# 1 missing or invalid coordinates
|
||||
# 3 no device/emulator available
|
||||
# ---------------------------------------------------------------------------
|
||||
android_input_tap() {
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local x="${1:-}"
|
||||
local y="${2:-}"
|
||||
|
||||
if [[ -z "$x" || -z "$y" ]]; then
|
||||
echo "android_input_tap: se requieren X e Y como argumentos posicionales." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! "$x" =~ ^[0-9]+$ ]]; then
|
||||
echo "android_input_tap: X debe ser un entero no negativo, recibido '$x'." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! "$y" =~ ^[0-9]+$ ]]; then
|
||||
echo "android_input_tap: Y debe ser un entero no negativo, recibido '$y'." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
adb_s "$serial" shell input tap "$x" "$y"
|
||||
echo "tap @ $x,$y on $serial"
|
||||
}
|
||||
|
||||
# Ejecutar si se llama directamente (no sourceado)
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_input_tap "$@"
|
||||
fi
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
name: android_input_text
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_input_text([--serial <S>], text: string) -> void"
|
||||
description: "Type text in focused field via adb shell input text. Spaces handled."
|
||||
tags: [android, adb, input, text, ui-test]
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_input_text.sh"
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device serial. If omitted, autodetects first connected device/emulator."
|
||||
- name: "text"
|
||||
desc: "Text to type (spaces become %s as required by adb)."
|
||||
output: "Stdout 'typed: <text>'. Exit 0."
|
||||
notes: |
|
||||
adb input text replaces spaces with %s. Funcion lo hace automaticamente.
|
||||
Special chars " $ ` se escapan con backslash para evitar interpretacion por el shell.
|
||||
Exit 3 si no hay ningun device disponible (propagado desde adb_pick_serial).
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
source bash/functions/infra/android_input_text.sh
|
||||
|
||||
# Tipar en el device por defecto
|
||||
android_input_text "hello world"
|
||||
# → typed: hello world (envia "hello%sworld" a adb)
|
||||
|
||||
# Tipar en un device especifico
|
||||
android_input_text --serial emulator-5554 "user@example.com"
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
`adb shell input text` no acepta espacios directos — los convierte a `%s` internamente. Esta funcion hace la sustitucion antes de llamar a adb para que el comportamiento sea predecible.
|
||||
|
||||
Los caracteres `"`, `$` y `` ` `` se escapan con backslash para que el shell no los interprete al construir el comando.
|
||||
|
||||
Depende de `adb_wsl_bash_infra` para resolver el binario `adb.exe` en WSL2 y para `adb_pick_serial` / `adb_s`.
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_input_text — Type text in focused field via adb shell input text.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# android_input_text [--serial <S>] <text>
|
||||
#
|
||||
# $1 text Text to type in the currently focused field (obligatorio).
|
||||
# Spaces are replaced with %s as required by adb input text.
|
||||
# Special chars " $ ` are escaped with backslash.
|
||||
#
|
||||
# Envvar ADB_SERIAL overrides --serial.
|
||||
# ---------------------------------------------------------------------------
|
||||
android_input_text() {
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local text="${1:-}"
|
||||
if [[ -z "$text" ]]; then
|
||||
echo "android_input_text: se requiere el texto como primer argumento." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# adb input text does not support raw spaces; replace with %s.
|
||||
# Also escape " $ ` which the shell would interpret inside the adb command.
|
||||
local escaped
|
||||
escaped="${text// /%s}"
|
||||
escaped="${escaped//\"/\\\"}"
|
||||
escaped="${escaped//\$/\\\$}"
|
||||
escaped="${escaped//\`/\\\`}"
|
||||
|
||||
adb_s "$serial" shell input text "$escaped"
|
||||
echo "typed: $text"
|
||||
}
|
||||
|
||||
# Ejecutar si se llama directamente (no sourceado)
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_input_text "$@"
|
||||
fi
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: android_logcat
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_logcat([--serial <S>] [--package <name>] [--level <V|D|I|W|E|F>] [--lines <N>] [--clear])"
|
||||
description: "Lee logcat del device/emulador, opcionalmente filtrado por package y nivel. Multi-emulator via --serial."
|
||||
tags: [android, adb, logcat, wsl]
|
||||
uses_functions: ["adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device/emulator serial. Default: first device detected."
|
||||
- name: "--package <name>"
|
||||
desc: "Filter by app package (resolves PID via adb shell pidof)"
|
||||
- name: "--level <L>"
|
||||
desc: "Min log level V/D/I/W/E/F, default I"
|
||||
- name: "--lines <N>"
|
||||
desc: "Dump last N lines and exit. Default: follow indefinidamente"
|
||||
- name: "--clear"
|
||||
desc: "Clear log buffer before reading"
|
||||
output: "Logcat output a stdout. Follow indefinido sin --lines. Exit 130 si Ctrl-C. Exit 2 si --package y el proceso no corre."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_logcat.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Follow completo sin filtros
|
||||
android_logcat
|
||||
|
||||
# Solo logs de una app, nivel Warning y superior
|
||||
android_logcat --package com.example.myapp --level W
|
||||
|
||||
# Dump de las últimas 200 líneas y salir
|
||||
android_logcat --lines 200
|
||||
|
||||
# Limpiar buffer y hacer follow solo de errores de la app
|
||||
android_logcat --clear --package com.example.myapp --level E
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Resuelve `adb` o `adb.exe` en PATH (compatible con WSL2 usando el binario Windows).
|
||||
- `--package` usa `adb shell pidof -s` para obtener el PID actual. Si la app no está corriendo, sale con exit 2.
|
||||
- `--lines N` activa modo dump (`-d -t N`); sin él, el follow es indefinido hasta Ctrl-C (exit 130).
|
||||
- `--clear` ejecuta `adb logcat -c` antes de leer, descartando el buffer acumulado.
|
||||
- El filtro de nivel se aplica como `*:<level>` al final del comando logcat.
|
||||
- En follow mode, `trap INT TERM` garantiza exit limpio (exit 130) al interrumpir.
|
||||
- CR (`\r`) del output de `adb.exe` en WSL se limpia al resolver el PID.
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_logcat — Lee logcat del device/emulador, opcionalmente filtrado por package y nivel.
|
||||
# Multi-emulator via --serial <S>.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_logcat() {
|
||||
local serial
|
||||
adb_pick_serial "$@" || { echo "android_logcat: no device/emulator." >&2; return 3; }
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local package=""
|
||||
local level="I"
|
||||
local lines=""
|
||||
local do_clear=0
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--package) package="$2"; shift 2 ;;
|
||||
--level) level="$2"; shift 2 ;;
|
||||
--lines) lines="$2"; shift 2 ;;
|
||||
--clear) do_clear=1; shift ;;
|
||||
*) echo "android_logcat: unknown argument: $1" >&2; return 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $do_clear -eq 1 ]]; then
|
||||
adb_s "$serial" logcat -c
|
||||
fi
|
||||
|
||||
local pid_filter=""
|
||||
if [[ -n "$package" ]]; then
|
||||
local pid
|
||||
pid=$(adb_s "$serial" shell pidof -s "$package" 2>/dev/null || true)
|
||||
pid="${pid//$'\r'/}"
|
||||
if [[ -z "$pid" ]]; then
|
||||
echo "android_logcat: package '$package' is not running on $serial" >&2
|
||||
return 2
|
||||
fi
|
||||
pid_filter="--pid=$pid"
|
||||
fi
|
||||
|
||||
local -a cmd=(logcat -v time)
|
||||
[[ -n "$lines" ]] && cmd+=(-d -t "$lines")
|
||||
[[ -n "$pid_filter" ]] && cmd+=("$pid_filter")
|
||||
cmd+=("*:${level}")
|
||||
|
||||
trap 'exit 130' INT TERM
|
||||
|
||||
adb_s "$serial" "${cmd[@]}"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
android_logcat "$@"
|
||||
fi
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
name: android_pull
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_pull [--serial <S>] remote_path local_path"
|
||||
description: "Pull file/dir from Android device to WSL via adb pull."
|
||||
tags: [android, adb, pull, file, transfer]
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device serial. If omitted, adb_pick_serial auto-detects the connected device."
|
||||
- name: "remote_path"
|
||||
desc: "Source path on the Android device (e.g. /sdcard/Pictures/foo.png)."
|
||||
- name: "local_path"
|
||||
desc: "Destination path in the WSL filesystem. Parent directories are created automatically."
|
||||
output: "Stdout 'pulled: <remote> → <local> from <serial>'."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_pull.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Pull a single file (auto-detect device)
|
||||
android_pull /sdcard/Pictures/foo.png ~/Downloads/foo.png
|
||||
|
||||
# Pull a directory to a specific local path with explicit serial
|
||||
android_pull --serial emulator-5554 /sdcard/DCIM ~/Downloads/DCIM
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Sources `adb_wsl.sh` for `adb_pick_serial`, `ADB_PICK_REST`, `adb_wsl_to_win`, and `adb_s`.
|
||||
The local path is converted to a Windows path via `adb_wsl_to_win` before passing to `adb pull`,
|
||||
which is required because `adb.exe` (Windows binary) does not understand WSL paths.
|
||||
Exit code 3 when no device serial can be resolved.
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_pull — Pull file/dir from Android device to WSL via adb pull.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_pull() {
|
||||
local serial remote local_path win_local
|
||||
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
remote="${1:?remote_path required}"
|
||||
local_path="${2:?local_path required}"
|
||||
|
||||
mkdir -p "$(dirname "$local_path")"
|
||||
|
||||
win_local=$(adb_wsl_to_win "$local_path")
|
||||
|
||||
adb_s "$serial" pull "$remote" "$win_local"
|
||||
|
||||
echo "pulled: $remote → $local_path from $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_pull "$@"
|
||||
fi
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
name: android_push
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_push([--serial <S>], local_path: string, remote_path: string) -> void"
|
||||
description: "Push file/dir from WSL to Android device via adb push."
|
||||
tags: [android, adb, push, file, transfer]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device/emulator serial. Auto-detected if omitted."
|
||||
- name: "local_path"
|
||||
desc: "WSL source path to file or directory to push."
|
||||
- name: "remote_path"
|
||||
desc: "Device destination path, e.g. /sdcard/Download/foo.txt."
|
||||
output: "Stdout 'pushed: <local> → <remote> on <serial>'. Exit 0."
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_push.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Push a file to the active emulator
|
||||
android_push /tmp/data.json /sdcard/Download/data.json
|
||||
|
||||
# Push to a specific device
|
||||
android_push --serial emulator-5554 /tmp/data.json /sdcard/Download/data.json
|
||||
|
||||
# Push a directory
|
||||
android_push --serial R5CR1234567 ~/exports/bundle /sdcard/Download/bundle
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa `adb_pick_serial` de `adb_wsl.sh` para resolver el dispositivo objetivo.
|
||||
Si `--serial` no se pasa, autodetecta el primer device/emulador disponible.
|
||||
Sale con exit 3 si no hay ningun device conectado.
|
||||
Valida que `local_path` existe en WSL antes de convertir y enviar.
|
||||
Convierte el path WSL a Windows con `adb_wsl_to_win` (requiere `wslpath`; si no está disponible usa el path tal cual).
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_push — Push file/dir from WSL to Android device via adb push.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_push() {
|
||||
local serial local_path remote_path win_local
|
||||
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local_path="${1:?android_push: local_path required}"
|
||||
remote_path="${2:?android_push: remote_path required}"
|
||||
|
||||
if [[ ! -e "$local_path" ]]; then
|
||||
echo "android_push: '$local_path' not found." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
win_local=$(adb_wsl_to_win "$local_path")
|
||||
|
||||
adb_s "$serial" push "$win_local" "$remote_path"
|
||||
echo "pushed: $local_path → $remote_path on $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_push "$@"
|
||||
fi
|
||||
@@ -0,0 +1,53 @@
|
||||
---
|
||||
name: android_screen_record
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_screen_record([--serial <S>] [--duration <s>] [--bit-rate <bps>] [--size <WxH>] output_path: string) -> void"
|
||||
description: "Record screen video via adb screenrecord, pulls to local path."
|
||||
tags: [android, adb, screen, record, video]
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device serial. If omitted, autodetects first connected device/emulator."
|
||||
- name: "output_path"
|
||||
desc: "WSL destination path for the recorded .mp4 file."
|
||||
- name: "--duration <s>"
|
||||
desc: "Recording duration in seconds. Default 30, max 180 (adb screenrecord built-in limit)."
|
||||
- name: "--bit-rate <bps>"
|
||||
desc: "Video bit rate in bits per second. Default 4000000 (4 Mbps)."
|
||||
- name: "--size <WxH>"
|
||||
desc: "Video dimensions e.g. 720x1280. Default: device native resolution."
|
||||
output: "Stdout 'recorded: <path> (<s>s from <serial>)'. MP4 file written to output_path."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_screen_record.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
source bash/functions/infra/android_screen_record.sh
|
||||
|
||||
# Record 15 seconds to a local file
|
||||
android_screen_record --duration 15 /tmp/demo.mp4
|
||||
|
||||
# Specific device, custom resolution, higher bitrate
|
||||
android_screen_record --serial emulator-5554 --duration 60 --bit-rate 8000000 --size 1080x2400 ~/videos/session.mp4
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
`adb screenrecord` tiene un limite maximo de 180 segundos por grabacion. Para capturas mas largas, encadenar multiples llamadas y concatenar los MP4 resultantes (ej. con `ffmpeg -f concat`).
|
||||
|
||||
El archivo temporal en el dispositivo es siempre `/sdcard/__rec.mp4` y se elimina tras el pull. Si la grabacion falla a mitad, el archivo puede quedar en el dispositivo; en ese caso ejecutar `adb shell rm /sdcard/__rec.mp4` manualmente.
|
||||
|
||||
Exit codes: 0 exito, 2 falta output_path, 3 ningun device encontrado.
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_screen_record — Record screen video via adb screenrecord, pulls to local path.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# android_screen_record [--serial <S>] [--duration <s>] [--bit-rate <bps>] [--size <WxH>] <output_path>
|
||||
#
|
||||
# Args:
|
||||
# --serial <S> Optional: target device serial (default: autodetect)
|
||||
# --duration <s> Recording duration in seconds (default: 30, max: 180)
|
||||
# --bit-rate <bps> Video bit rate (default: 4000000)
|
||||
# --size <WxH> Video dimensions e.g. 720x1280 (default: device native)
|
||||
# output_path WSL destination path for the .mp4 file
|
||||
#
|
||||
# Exit codes:
|
||||
# 0 success
|
||||
# 1 general error
|
||||
# 2 missing output_path argument
|
||||
# 3 no device/emulator found
|
||||
# ---------------------------------------------------------------------------
|
||||
android_screen_record() {
|
||||
local dur=30
|
||||
local bit_rate=4000000
|
||||
local size=""
|
||||
|
||||
# Parse flags first pass to extract serial; remaining args go to ADB_PICK_REST.
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
# Parse remaining flags
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--duration) dur="$2"; shift 2 ;;
|
||||
--duration=*) dur="${1#--duration=}"; shift ;;
|
||||
--bit-rate) bit_rate="$2"; shift 2 ;;
|
||||
--bit-rate=*) bit_rate="${1#--bit-rate=}"; shift ;;
|
||||
--size) size="$2"; shift 2 ;;
|
||||
--size=*) size="${1#--size=}"; shift ;;
|
||||
-*) echo "android_screen_record: unknown flag '$1'" >&2; return 1 ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
local output="${1:-}"
|
||||
if [[ -z "$output" ]]; then
|
||||
echo "android_screen_record: output_path is required." >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Build adb screenrecord args
|
||||
local rec_args=("shell" "screenrecord" "--time-limit" "$dur")
|
||||
rec_args+=("--bit-rate" "$bit_rate")
|
||||
[[ -n "$size" ]] && rec_args+=("--size" "$size")
|
||||
rec_args+=("/sdcard/__rec.mp4")
|
||||
|
||||
echo "android_screen_record: recording ${dur}s from $serial..." >&2
|
||||
adb_s "$serial" "${rec_args[@]}" || {
|
||||
echo "android_screen_record: screenrecord failed." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
adb_s "$serial" pull /sdcard/__rec.mp4 "$output" || {
|
||||
echo "android_screen_record: pull failed." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
adb_s "$serial" shell rm /sdcard/__rec.mp4
|
||||
|
||||
echo "recorded: $output (${dur}s from $serial)"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_screen_record "$@"
|
||||
fi
|
||||
@@ -0,0 +1,52 @@
|
||||
---
|
||||
name: android_screenshot
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_screenshot([--serial <S>], output_path: string) -> void"
|
||||
description: "Capture screen as PNG via adb exec-out screencap -p."
|
||||
tags: [android, adb, screenshot, screen, capture]
|
||||
uses_functions: [adb_wsl_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional ADB serial to target a specific device/emulator. If omitted, autodetects the first connected device."
|
||||
- name: "output_path"
|
||||
desc: "WSL path where the PNG screenshot will be written (e.g. /tmp/screen.png). Parent directory is created if absent."
|
||||
output: "Stdout 'screenshot: <path> (<bytes> bytes) from <serial>'. PNG file written to disk."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_screenshot.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
source bash/functions/infra/android_screenshot.sh
|
||||
android_screenshot /tmp/screen.png
|
||||
# screenshot: /tmp/screen.png (123456 bytes) from emulator-5554
|
||||
|
||||
# Targeting a specific device:
|
||||
android_screenshot --serial emulator-5554 /tmp/screen.png
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Sources `adb_wsl.sh` from its own directory, so `ADB` and `ANDROID_SDK_WIN` env vars
|
||||
are respected as with all other android_* functions.
|
||||
|
||||
Exit codes:
|
||||
- `0` — screenshot captured successfully.
|
||||
- `1` — missing output path, screencap produced empty file, or adb error.
|
||||
- `3` — no device/emulator connected (propagated from `adb_pick_serial`).
|
||||
|
||||
The emptiness check (`! -s`) handles the case where `adb exec-out` exits 0 but writes
|
||||
zero bytes (e.g. device locked, screencap permission denied). In that case the file is
|
||||
removed and exit 1 is returned.
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_screenshot — Capture screen as PNG via adb exec-out screencap -p.
|
||||
|
||||
android_screenshot() {
|
||||
local SCRIPT_DIR
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=bash/functions/infra/adb_wsl.sh
|
||||
source "$SCRIPT_DIR/adb_wsl.sh" || return 1
|
||||
|
||||
# Resolve serial, consume --serial from args
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
local output="${1:-}"
|
||||
if [[ -z "$output" ]]; then
|
||||
echo "android_screenshot: output_path is required." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Ensure parent directory exists
|
||||
mkdir -p "$(dirname "$output")"
|
||||
|
||||
# Capture screen
|
||||
adb_s "$serial" exec-out screencap -p > "$output"
|
||||
|
||||
# Verify file created and non-empty
|
||||
if [[ ! -f "$output" ]] || [[ ! -s "$output" ]]; then
|
||||
rm -f "$output"
|
||||
echo "android_screenshot: screencap produced empty or missing file." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local size
|
||||
size=$(stat -c%s "$output" 2>/dev/null || stat -f%z "$output" 2>/dev/null)
|
||||
echo "screenshot: $output ($size bytes) from $serial"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_screenshot "$@"
|
||||
fi
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
name: android_shell
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "android_shell([--serial <S>], cmd ...args)"
|
||||
description: "Execute arbitrary shell command on Android device. Multi-emulator via --serial."
|
||||
tags: [android, adb, shell, exec]
|
||||
params:
|
||||
- name: "--serial <S>"
|
||||
desc: "Optional target device serial. Omit to auto-pick (single device) or use ADB_SERIAL env."
|
||||
- name: "cmd ...args"
|
||||
desc: "Shell command + args to run on device. Variadic."
|
||||
output: "Passthrough stdout/stderr de adb shell. Exit code = shell command exit."
|
||||
uses_functions: ["adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/android_shell.sh"
|
||||
notes: "Para comandos complejos con pipes/redirects mejor `adb_s $serial shell 'cmd | other'` directo via adb_run."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
android_shell pm list packages
|
||||
android_shell --serial emulator-5554 getprop ro.product.model
|
||||
android_shell df -h /sdcard
|
||||
android_shell ls -la /data/local/tmp
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Sourcea `adb_wsl.sh` para resolver `adb_pick_serial` (maneja `--serial`, `ADB_SERIAL`, y auto-detect de dispositivo unico) y `adb_s` (wrapper de `adb -s`). El array `ADB_PICK_REST` contiene los args restantes tras consumir `--serial`.
|
||||
|
||||
Para comandos con pipes o redirects que bash interpretaria localmente, mejor pasar como string unico: `adb_s "$serial" shell 'cmd | grep foo'`.
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
# android_shell — Execute arbitrary shell command on Android device via adb shell
|
||||
|
||||
# shellcheck source=./adb_wsl.sh
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
android_shell() {
|
||||
adb_pick_serial "$@" || exit 3
|
||||
local serial="$ADB_PICK_SERIAL"
|
||||
set -- "${ADB_PICK_REST[@]}"
|
||||
|
||||
adb_s "$serial" shell "$@"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
android_shell "$@"
|
||||
fi
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
name: build_wasm_cpp_app
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "0.1.0"
|
||||
purity: impure
|
||||
signature: "build_wasm_cpp_app(app_name: string, [--no-budget-check]) -> void"
|
||||
description: "Compila una app C++ del registry (cpp/apps/<name>) a WASM via emscripten. Sale build/wasm/<name>/<name>.{html,js,wasm,wasm.gz}. Falla si gzip > 2 MB."
|
||||
tags: [wasm, emscripten, cpp, build, gamedev]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
example: "bash bash/functions/infra/build_wasm_cpp_app.sh engine_smoke"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/build_wasm_cpp_app.sh"
|
||||
params:
|
||||
- name: app_name
|
||||
desc: "Nombre del directorio bajo cpp/apps/. Debe contener CMakeLists.txt self-sufficient (top-level project) con guard `if(EMSCRIPTEN)` para flags wasm."
|
||||
- name: "--no-budget-check"
|
||||
desc: "Opcional. Salta verificacion de tamaño (gzip < 2 MB hard, < 1.5 MB soft)."
|
||||
output: "Reporte de tamaños en stdout. Crea build/wasm/<app>/<app>.html/.js/.wasm/.wasm.gz. Exit 3 si excede budget hard."
|
||||
---
|
||||
|
||||
# build_wasm_cpp_app
|
||||
|
||||
Compila apps C++ del registry a WebAssembly. Issue 0072d (parte del stack gamedev).
|
||||
|
||||
## Requisitos
|
||||
|
||||
- `emsdk` instalado y activo en el shell, o presente en `<repo>/emsdk/` (autoactiva).
|
||||
- `cpp/apps/<app>/CMakeLists.txt` con bloque `if(EMSCRIPTEN) ... endif()` que define los flags wasm (USE_WEBGL2, FULL_ES3, ALLOW_MEMORY_GROWTH, etc.).
|
||||
- `cpp/CMakeLists.txt` debe seguir tolerando configuracion via `emcmake`. La app target se elige con `cmake --build $BUILD_DIR --target <app>`.
|
||||
|
||||
## Flujo
|
||||
|
||||
1. Localiza `emcc` en PATH o autoactiva `<repo>/emsdk/emsdk_env.sh`.
|
||||
2. `emcmake cmake -S cpp -B build/wasm/<app> -DCMAKE_BUILD_TYPE=MinSizeRel`
|
||||
3. `cmake --build build/wasm/<app> --target <app> -j`
|
||||
4. `gzip -9 -k <app>.wasm` y `brotli -q 11 -k <app>.wasm` (si brotli disponible).
|
||||
5. Reporta tamaños y compara contra budget (1.5 MB gzip soft, 2 MB hard).
|
||||
|
||||
## Budgets
|
||||
|
||||
| Limite | Valor | Comportamiento |
|
||||
|---|---|---|
|
||||
| Soft | 1.5 MB gzip | Warning, sigue |
|
||||
| Hard | 2 MB gzip | Exit 3, falla |
|
||||
|
||||
Skip con `--no-budget-check`.
|
||||
|
||||
## Apps soportadas
|
||||
|
||||
Cualquier app bajo `cpp/apps/<name>/` cuyo `CMakeLists.txt` defina target con flags emscripten. Probada con: `engine_smoke` (issue 0072a).
|
||||
|
||||
## Errores comunes
|
||||
|
||||
- `emcc no encontrado` → instalar emsdk segun instrucciones del propio script.
|
||||
- `<app>.wasm no encontrado` → fallo de build. Re-ejecutar con `2>&1 | tee` para ver compiler errors.
|
||||
- `wasm.gz excede budget` → revisar bloat, usar `twiggy top` o `wasm-objdump -h`. Ver issue 0072d.
|
||||
Executable
+83
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
# build_wasm_cpp_app — compila app cpp/apps/<name> a WASM via emscripten.
|
||||
#
|
||||
# Uso:
|
||||
# build_wasm_cpp_app.sh <app_name> [--no-budget-check]
|
||||
#
|
||||
# Salida: build/wasm/<name>/<name>.{html,js,wasm}
|
||||
# + <name>.wasm.gz (gzip -9) y <name>.wasm.br (brotli -11 si esta).
|
||||
#
|
||||
# Requiere: emsdk activo en el shell (source emsdk/emsdk_env.sh) o que
|
||||
# exista emsdk/ en la raiz del repo y se autoactive.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
APP="${1:?Uso: $0 <app_name> [--no-budget-check]}"
|
||||
SHIFT_FLAG="${2:-}"
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../../.. && pwd)"
|
||||
SRC_DIR="$REPO_ROOT/cpp/apps/$APP"
|
||||
BUILD_DIR="$REPO_ROOT/build/wasm/$APP"
|
||||
|
||||
if [ ! -d "$SRC_DIR" ]; then
|
||||
echo "ERROR: $SRC_DIR no existe" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Activate emsdk if not already in PATH.
|
||||
if ! command -v emcc >/dev/null 2>&1; then
|
||||
if [ -f "$REPO_ROOT/emsdk/emsdk_env.sh" ]; then
|
||||
# shellcheck disable=SC1091
|
||||
source "$REPO_ROOT/emsdk/emsdk_env.sh" >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
if ! command -v emcc >/dev/null 2>&1; then
|
||||
echo "ERROR: emcc no encontrado. Instala emsdk:" >&2
|
||||
echo " git clone https://github.com/emscripten-core/emsdk.git" >&2
|
||||
echo " cd emsdk && ./emsdk install latest && ./emsdk activate latest" >&2
|
||||
echo " source ./emsdk_env.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "── emcc: $(emcc --version | head -n1)"
|
||||
echo "── source: $SRC_DIR"
|
||||
echo "── build: $BUILD_DIR"
|
||||
|
||||
mkdir -p "$BUILD_DIR"
|
||||
# Build the app directly (NOT the full cpp/ tree). Each app's CMakeLists.txt
|
||||
# is expected to be self-sufficient as top-level (issue 0072a pattern).
|
||||
emcmake cmake -S "$SRC_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
cmake --build "$BUILD_DIR" --target "$APP" -j
|
||||
|
||||
WASM_DIR=$(find "$BUILD_DIR" -name "$APP.wasm" -printf '%h\n' -quit 2>/dev/null || true)
|
||||
if [ -z "$WASM_DIR" ]; then
|
||||
echo "ERROR: no se encontro $APP.wasm en $BUILD_DIR" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
cd "$WASM_DIR"
|
||||
gzip -9 -k -f "$APP.wasm"
|
||||
if command -v brotli >/dev/null 2>&1; then
|
||||
brotli -q 11 -k -f "$APP.wasm"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "── Sizes (in $WASM_DIR) ──"
|
||||
for f in "$APP".html "$APP".js "$APP".wasm "$APP".wasm.gz "$APP".wasm.br; do
|
||||
[ -f "$f" ] && printf "%-32s %10d bytes\n" "$f" "$(stat -c%s "$f")"
|
||||
done
|
||||
|
||||
# Budget check (1.5 MB gzip soft, 2 MB hard)
|
||||
if [ "$SHIFT_FLAG" != "--no-budget-check" ]; then
|
||||
SIZE_GZ=$(stat -c%s "$APP.wasm.gz")
|
||||
HARD=$((2 * 1024 * 1024))
|
||||
SOFT=$((1572864)) # 1.5 MB
|
||||
if [ "$SIZE_GZ" -gt "$HARD" ]; then
|
||||
echo "❌ $APP.wasm.gz = $SIZE_GZ bytes > $HARD (2 MB hard limit)" >&2
|
||||
exit 3
|
||||
elif [ "$SIZE_GZ" -gt "$SOFT" ]; then
|
||||
echo "⚠ $APP.wasm.gz = $SIZE_GZ bytes > $SOFT (1.5 MB soft limit)"
|
||||
else
|
||||
echo "✓ $APP.wasm.gz = $SIZE_GZ bytes within soft limit (1.5 MB)"
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
name: gradle_assemble_debug
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "gradle_assemble_debug(project_dir: string, module: string) -> string"
|
||||
description: "Build APK debug de un modulo Android via gradlew assembleDebug."
|
||||
tags: ["android", "gradle", "build", "apk"]
|
||||
params:
|
||||
- name: project_dir
|
||||
desc: "Raiz del proyecto Gradle Android"
|
||||
- name: module
|
||||
desc: "Nombre del modulo Gradle. Default: app"
|
||||
output: "Stdout con build log + ultima linea 'APK: <path>'. Exit 0 = build OK. Exit !=0 si fallo."
|
||||
uses_functions: ["gradle_run_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/gradle_assemble_debug.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
gradle_assemble_debug /path/to/MyApp
|
||||
# APK: /path/to/MyApp/app/build/outputs/apk/debug/app-debug.apk
|
||||
|
||||
gradle_assemble_debug /path/to/MyApp mylibrary
|
||||
# APK: /path/to/MyApp/mylibrary/build/outputs/apk/debug/mylibrary-debug.apk
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
APK queda en <project>/<module>/build/outputs/apk/debug/. Variants flavor no soportados aun (anadir arg si surge).
|
||||
|
||||
Depende de `gradle_run_bash_infra` (`gradle_run.sh` en el mismo directorio), que debe existir y estar indexado antes de hacer `fn index` de esta funcion.
|
||||
---
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# gradle_assemble_debug — Build APK debug de un modulo Android via gradlew assembleDebug.
|
||||
set -euo pipefail
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/gradle_run.sh"
|
||||
|
||||
gradle_assemble_debug() {
|
||||
local project_dir="$1"
|
||||
local module="${2:-app}"
|
||||
|
||||
gradle_run "$project_dir" ":$module:assembleDebug"
|
||||
|
||||
local apk
|
||||
apk=$(find "$project_dir/$module/build/outputs/apk/debug" -name "*.apk" | head -1)
|
||||
|
||||
echo "APK: $apk"
|
||||
}
|
||||
|
||||
gradle_assemble_debug "$@"
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: gradle_clean
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "gradle_clean(project_dir: string) -> int"
|
||||
description: "Limpia build artifacts de un proyecto Android (gradle clean + rm .gradle + rm build)."
|
||||
tags: [android, gradle, clean, build]
|
||||
params:
|
||||
- name: project_dir
|
||||
desc: "Raiz del proyecto Gradle"
|
||||
output: "Stdout build log de gradle clean. Exit code = exit gradlew."
|
||||
uses_functions: [gradle_run_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/gradle_clean.sh"
|
||||
notes: "Util cuando builds incrementales se corrompen. NO borra .idea ni gradle.properties. Para reset total usar `rm -rf $project_dir/{.gradle,build,app/build}`."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Como libreria
|
||||
source bash/functions/infra/gradle_clean.sh
|
||||
gradle_clean /path/to/MyApp
|
||||
|
||||
# Directo
|
||||
bash bash/functions/infra/gradle_clean.sh /path/to/MyApp
|
||||
```
|
||||
|
||||
## Comportamiento
|
||||
|
||||
1. Invoca `gradle_run "$project_dir" "clean"` — si falla, propaga su exit code y para.
|
||||
2. `rm -rf "$project_dir/.gradle"` — best-effort (ignora si no existe).
|
||||
3. `rm -rf "$project_dir/build"` — best-effort (ignora si no existe).
|
||||
4. Retorna 0 siempre que gradle clean haya terminado OK.
|
||||
|
||||
## Notas
|
||||
|
||||
Source-able y ejecutable directo. Sourcear `gradle_run.sh` al inicio garantiza
|
||||
que `JAVA_HOME` y `ANDROID_HOME` se resuelven con la misma logica que el resto
|
||||
de las funciones gradle_*.
|
||||
|
||||
Los directorios `.gradle` (cache de dependencias y metadata del daemon) y
|
||||
`build` (outputs compilados) son los principales responsables de builds
|
||||
corrompidos. Su eliminacion fuerza una descarga/recompilacion completa en el
|
||||
siguiente build.
|
||||
---
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# gradle_clean — Limpia build artifacts de un proyecto Android.
|
||||
#
|
||||
# Uso como libreria: source bash/functions/infra/gradle_clean.sh
|
||||
# Uso directo: bash bash/functions/infra/gradle_clean.sh <project_dir>
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=./gradle_run.sh
|
||||
source "$SCRIPT_DIR/gradle_run.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# gradle_clean <project_dir>
|
||||
#
|
||||
# Ejecuta `gradlew clean` en el proyecto y luego elimina los directorios
|
||||
# de cache .gradle y build (best-effort).
|
||||
#
|
||||
# Exits:
|
||||
# 0 — gradle clean exitoso (los rm son best-effort, no afectan exit code)
|
||||
# * — exit code propagado de gradle_run / gradlew
|
||||
# ---------------------------------------------------------------------------
|
||||
gradle_clean() {
|
||||
local project_dir="$1"
|
||||
|
||||
gradle_run "$project_dir" "clean" || return $?
|
||||
|
||||
# Best-effort: eliminar caches locales; ignorar errores si no existen
|
||||
rm -rf "${project_dir}/.gradle" 2>/dev/null || true
|
||||
rm -rf "${project_dir}/build" 2>/dev/null || true
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Ejecucion directa
|
||||
# ---------------------------------------------------------------------------
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
gradle_clean "$@"
|
||||
fi
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
name: gradle_instrumented_test
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "gradle_instrumented_test(project_dir: string, module: string) -> int"
|
||||
description: "Corre instrumented tests Compose en emulador/device Android conectado."
|
||||
tags: ["android", "gradle", "test", "compose", "emulator"]
|
||||
uses_functions: ["gradle_run_bash_infra", "adb_wsl_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/gradle_instrumented_test.sh"
|
||||
params:
|
||||
- name: project_dir
|
||||
desc: "Raiz del proyecto Gradle"
|
||||
- name: module
|
||||
desc: "Modulo. Default app"
|
||||
output: "Stdout con resultados. Linea final 'REPORT: <path>'. Exit: 0=OK, 3=no device, otro=fallos tests."
|
||||
notes: "Requiere emulador corriendo. Lanzar antes con android_emulator_start. connectedAndroidTest corre en TODOS los devices conectados."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Correr instrumented tests del modulo app
|
||||
gradle_instrumented_test /home/user/MyAndroidProject
|
||||
|
||||
# Correr instrumented tests de un modulo especifico
|
||||
gradle_instrumented_test /home/user/MyAndroidProject feature_login
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Requiere emulador corriendo. Lanzar antes con android_emulator_start. connectedAndroidTest corre en TODOS los devices conectados.
|
||||
|
||||
El script verifica que haya al menos un emulador o device conectado antes de lanzar Gradle. Si no hay ninguno, imprime un mensaje descriptivo a stderr y sale con exit code 3, permitiendo al llamador distinguir "no device" de "tests fallaron".
|
||||
|
||||
La linea `REPORT: <path>` se imprime siempre al final (incluso si los tests fallan), para que el llamador pueda abrir el reporte HTML independientemente del resultado.
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# gradle_instrumented_test — corre instrumented tests Compose en emulador/device Android conectado
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/gradle_run.sh"
|
||||
source "$SCRIPT_DIR/adb_wsl.sh"
|
||||
|
||||
gradle_instrumented_test() {
|
||||
local project_dir="${1:?project_dir required}"
|
||||
local module="${2:-app}"
|
||||
|
||||
# Verificar device o emulador conectado
|
||||
local devices
|
||||
devices=$(adb_run devices | tail -n +2 | grep -E "(emulator|device)$" || true)
|
||||
if [[ -z "$devices" ]]; then
|
||||
echo "no Android device/emulator connected. Run android_emulator_start first." >&2
|
||||
return 3
|
||||
fi
|
||||
|
||||
local exit_code=0
|
||||
gradle_run "$project_dir" ":${module}:connectedDebugAndroidTest" || exit_code=$?
|
||||
|
||||
echo "REPORT: ${project_dir}/${module}/build/reports/androidTests/connected/index.html"
|
||||
|
||||
return "$exit_code"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
gradle_instrumented_test "$@"
|
||||
fi
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
name: gradle_run
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "gradle_run(project_dir: string, task...: string) -> int"
|
||||
description: "Wrapper canonico para invocar gradlew Android en WSL2 con JDK 17 + ANDROID_HOME validados."
|
||||
tags: [android, gradle, kotlin, build]
|
||||
params:
|
||||
- name: project_dir
|
||||
desc: "Path absoluto al proyecto Gradle (debe contener gradlew)"
|
||||
- name: task
|
||||
desc: "Tarea(s) Gradle a ejecutar (ej. assembleDebug, :app:test). Variadic"
|
||||
output: "Stdout/stderr del build Gradle. Exit code = exit code de gradlew. Exit 1 si JDK17 missing, exit 2 si no hay gradlew."
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/gradle_run.sh"
|
||||
notes: "Las demas funciones gradle_* lo sourcean. Reutiliza patron de adb_wsl_bash_infra para ser source-able+ejecutable. Cubre tanto SDK Linux (~/Android/Sdk via install_android_sdk) como SDK Windows (/mnt/c/...) montado en WSL."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Como libreria (en otro script gradle_*)
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/gradle_run.sh"
|
||||
gradle_run "$project_dir" assembleDebug
|
||||
|
||||
# Directo
|
||||
bash bash/functions/infra/gradle_run.sh /path/to/MyApp assembleDebug
|
||||
bash bash/functions/infra/gradle_run.sh /path/to/MyApp :app:test :app:lint
|
||||
```
|
||||
|
||||
## Comportamiento de resolucion
|
||||
|
||||
### JAVA_HOME
|
||||
Si no esta fijado en el entorno, busca en orden:
|
||||
1. `/usr/lib/jvm/java-17-openjdk-amd64`
|
||||
2. `/usr/lib/jvm/temurin-17-jdk-amd64`
|
||||
3. `/opt/android-studio-jbr/jbr`
|
||||
|
||||
Si ninguno existe → error en stderr y `return 1`.
|
||||
|
||||
### ANDROID_HOME
|
||||
Si no esta fijado:
|
||||
1. Intenta `$HOME/Android/Sdk` (SDK Linux via `install_android_sdk_bash_infra`)
|
||||
2. Si no existe, intenta `$ANDROID_SDK_WIN` (SDK Windows montado en `/mnt/c/...`)
|
||||
3. Si ninguno, lo deja vacio — gradle mostrara el error adecuado para builds JVM puros
|
||||
|
||||
## Exit codes
|
||||
|
||||
| Codigo | Significado |
|
||||
|--------|-------------|
|
||||
| 0 | Build exitoso |
|
||||
| 1 | JDK 17 no encontrado |
|
||||
| 2 | `./gradlew` no existe en `project_dir` |
|
||||
| * | Exit code propagado de gradlew |
|
||||
|
||||
## Notas
|
||||
|
||||
Source-able y ejecutable directo. Al sourcear, el caller importa la funcion `gradle_run` sin ejecutarla. Al ejecutar directamente, delega `"$@"` a `gradle_run`.
|
||||
|
||||
No exporta `JAVA_HOME`/`ANDROID_HOME` al entorno del shell padre — los variables se pasan solo al subshell de gradlew para evitar contaminar el entorno.
|
||||
---
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
# gradle_run — Wrapper canonico para invocar gradlew Android en WSL2.
|
||||
# Valida JDK 17 + ANDROID_HOME antes de delegar al wrapper del proyecto.
|
||||
#
|
||||
# Uso como libreria: source bash/functions/infra/gradle_run.sh
|
||||
# Uso directo: bash bash/functions/infra/gradle_run.sh <project_dir> <task...>
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# gradle_run <project_dir> <task...>
|
||||
#
|
||||
# Resuelve JAVA_HOME y ANDROID_HOME si no estan fijados, luego invoca
|
||||
# ./gradlew con las tareas indicadas en el directorio del proyecto.
|
||||
#
|
||||
# Exits:
|
||||
# 0 — gradlew completado con exito
|
||||
# 1 — JDK 17 no encontrado
|
||||
# 2 — ./gradlew no existe en project_dir
|
||||
# * — exit code propagado de gradlew
|
||||
# ---------------------------------------------------------------------------
|
||||
gradle_run() {
|
||||
local project_dir="$1"
|
||||
shift || true
|
||||
|
||||
# ---- Resolver JAVA_HOME ------------------------------------------------
|
||||
local java_home="${JAVA_HOME:-}"
|
||||
if [[ -z "$java_home" ]]; then
|
||||
local _jdk_candidates=(
|
||||
"/usr/lib/jvm/java-17-openjdk-amd64"
|
||||
"/usr/lib/jvm/temurin-17-jdk-amd64"
|
||||
"/opt/android-studio-jbr/jbr"
|
||||
)
|
||||
for _candidate in "${_jdk_candidates[@]}"; do
|
||||
if [[ -d "$_candidate" ]]; then
|
||||
java_home="$_candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset _jdk_candidates _candidate
|
||||
fi
|
||||
|
||||
if [[ -z "$java_home" ]]; then
|
||||
echo "gradle_run: JDK 17 not found, install via install_android_sdk" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# ---- Resolver ANDROID_HOME ---------------------------------------------
|
||||
local android_home="${ANDROID_HOME:-}"
|
||||
if [[ -z "$android_home" ]]; then
|
||||
local _default_linux="$HOME/Android/Sdk"
|
||||
if [[ -d "$_default_linux" ]]; then
|
||||
android_home="$_default_linux"
|
||||
elif [[ -n "${ANDROID_SDK_WIN:-}" && -d "${ANDROID_SDK_WIN}" ]]; then
|
||||
# SDK Windows montado en WSL via /mnt/c/...
|
||||
android_home="${ANDROID_SDK_WIN}"
|
||||
fi
|
||||
unset _default_linux
|
||||
fi
|
||||
|
||||
# ANDROID_HOME puede quedar vacio si no hay SDK instalado; gradle mostrara
|
||||
# el error adecuado. No bloqueamos aqui para permitir builds puros JVM.
|
||||
|
||||
# ---- Verificar gradlew -------------------------------------------------
|
||||
if [[ ! -f "${project_dir}/gradlew" ]]; then
|
||||
echo "gradle_run: no gradlew in ${project_dir}" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
# ---- Invocar gradlew ----------------------------------------------------
|
||||
(
|
||||
cd "$project_dir" || return 1
|
||||
JAVA_HOME="$java_home" ANDROID_HOME="${android_home:-}" ./gradlew "$@"
|
||||
)
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Ejecucion directa
|
||||
# ---------------------------------------------------------------------------
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
gradle_run "$@"
|
||||
fi
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
name: gradle_screenshot_test
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "gradle_screenshot_test(project_dir: string, module: string, flag: string) -> int"
|
||||
description: "Corre screenshot tests Roborazzi de Composables (JVM, no necesita emulador)."
|
||||
tags: [android, gradle, test, compose, roborazzi, screenshot]
|
||||
params:
|
||||
- name: project_dir
|
||||
desc: "Raiz del proyecto Android (debe contener gradlew)"
|
||||
- name: module
|
||||
desc: "Modulo Gradle a testear. Default: app"
|
||||
- name: --record
|
||||
desc: "Re-grabar goldens en lugar de verificar"
|
||||
output: "Stdout build log. Si verify y diff: linea 'DIFF: <path>'. Si record: linea 'RECORDED: <path>'. Exit 0 OK, 1 mismatch."
|
||||
uses_functions: [gradle_run_bash_infra]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/gradle_screenshot_test.sh"
|
||||
notes: "Roborazzi corre en JVM (Robolectric) — rapido, no necesita emulador. Goldens viven en src/test/snapshots/ y se commitean al repo. App debe declarar plugin io.github.takahirom.roborazzi en build.gradle.kts."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Verificar screenshots (modo CI)
|
||||
bash bash/functions/infra/gradle_screenshot_test.sh /path/to/MyApp
|
||||
|
||||
# Modulo no-default
|
||||
bash bash/functions/infra/gradle_screenshot_test.sh /path/to/MyApp feature_login
|
||||
|
||||
# Re-grabar goldens tras cambio de UI intencional
|
||||
bash bash/functions/infra/gradle_screenshot_test.sh /path/to/MyApp app --record
|
||||
```
|
||||
|
||||
## Salida
|
||||
|
||||
| Situacion | Salida |
|
||||
|-----------|--------|
|
||||
| Verify OK | log de Gradle, exit 0 |
|
||||
| Verify FAIL | log + `DIFF: <project>/<module>/build/outputs/roborazzi/`, exit 1 |
|
||||
| Record OK | log + `RECORDED: <project>/<module>/src/test/snapshots/`, exit 0 |
|
||||
|
||||
## Notas
|
||||
|
||||
Source-able y ejecutable directo. Sourcear `gradle_run.sh` resuelve JAVA_HOME y ANDROID_HOME de forma identica al resto de funciones `gradle_*`.
|
||||
|
||||
Los diffs en `build/outputs/roborazzi/` muestran imagen original, imagen actual e imagen de diferencia. Util para revisar regresiones visuales antes de hacer `--record`.
|
||||
---
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# gradle_screenshot_test — Corre screenshot tests Roborazzi (JVM, no necesita emulador)
|
||||
|
||||
gradle_screenshot_test() {
|
||||
local project_dir="${1:?project_dir requerido}"
|
||||
local module="${2:-app}"
|
||||
local record_flag="${3:-}"
|
||||
|
||||
local SCRIPT_DIR
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/gradle_run.sh"
|
||||
|
||||
local task
|
||||
if [[ "$record_flag" == "--record" ]]; then
|
||||
task=":${module}:recordRoborazziDebug"
|
||||
else
|
||||
task=":${module}:verifyRoborazziDebug"
|
||||
fi
|
||||
|
||||
local goldens_dir="${project_dir}/${module}/src/test/snapshots"
|
||||
local diff_dir="${project_dir}/${module}/build/outputs/roborazzi"
|
||||
|
||||
gradle_run "$project_dir" "$task"
|
||||
local exit_code=$?
|
||||
|
||||
if [[ "$record_flag" == "--record" ]]; then
|
||||
echo "RECORDED: ${goldens_dir}"
|
||||
elif [[ $exit_code -ne 0 ]]; then
|
||||
echo "DIFF: ${diff_dir}"
|
||||
fi
|
||||
|
||||
return $exit_code
|
||||
}
|
||||
|
||||
# Source-able y ejecutable directo
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
gradle_screenshot_test "$@"
|
||||
fi
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
name: gradle_unit_test
|
||||
kind: function
|
||||
lang: bash
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "gradle_unit_test(project_dir: string, module: string, --variant <name>: string) -> int"
|
||||
description: "Corre unit tests JVM de un modulo Android (no requiere emulador)."
|
||||
tags: ["android", "gradle", "kotlin", "test", "junit"]
|
||||
uses_functions: ["gradle_run_bash_infra"]
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/infra/gradle_unit_test.sh"
|
||||
params:
|
||||
- name: project_dir
|
||||
desc: "Raiz del proyecto Android con settings.gradle[.kts]."
|
||||
- name: module
|
||||
desc: "Modulo Gradle. Default: app"
|
||||
- name: "--variant <name>"
|
||||
desc: "Build variant (Debug|Release). Default Debug"
|
||||
output: "Stdout con resultados JUnit. Linea final 'REPORT: <path_html>'. Exit code = test runner exit (0 OK, 1 fallos)."
|
||||
notes: |
|
||||
JVM only — Compose Composables que necesitan device se testean con
|
||||
gradle_instrumented_test. Para tests Compose en JVM usar Roborazzi
|
||||
(gradle_screenshot_test).
|
||||
|
||||
La funcion hace source de gradle_run.sh desde el mismo directorio
|
||||
(bash/functions/infra/). La dependencia gradle_run_bash_infra debe
|
||||
existir junto a este archivo.
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
source bash/functions/infra/gradle_unit_test.sh
|
||||
|
||||
# Tests del modulo app con variante Debug (por defecto)
|
||||
gradle_unit_test /home/lucas/projects/myapp
|
||||
|
||||
# Tests del modulo :core con variante Release
|
||||
gradle_unit_test /home/lucas/projects/myapp core --variant Release
|
||||
|
||||
# Verificar que paso
|
||||
if gradle_unit_test /home/lucas/projects/myapp; then
|
||||
echo "Todos los tests pasaron"
|
||||
else
|
||||
echo "Hay tests fallidos — revisar el report HTML"
|
||||
fi
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
JVM only — Compose Composables que necesitan device se testean con
|
||||
`gradle_instrumented_test`. Para tests Compose en JVM usar Roborazzi
|
||||
(`gradle_screenshot_test`).
|
||||
|
||||
El task ejecutado es `:$module:test${variant}UnitTest` (ej.
|
||||
`:app:testDebugUnitTest`). El report HTML se imprime al final como
|
||||
`REPORT: <path>` para facilitar parseo por agentes o scripts upstream.
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# gradle_unit_test — Corre unit tests JVM de un modulo Android (no requiere emulador)
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/gradle_run.sh"
|
||||
|
||||
gradle_unit_test() {
|
||||
local project_dir="$1"
|
||||
local module="${2:-app}"
|
||||
local variant="Debug"
|
||||
|
||||
# Parsear flag opcional --variant (consumir project_dir y module primero)
|
||||
local nshift=$(( $# < 2 ? $# : 2 ))
|
||||
shift "$nshift"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--variant)
|
||||
variant="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$project_dir" ]]; then
|
||||
echo "gradle_unit_test: project_dir es obligatorio" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local task=":${module}:test${variant}UnitTest"
|
||||
local report="${project_dir}/${module}/build/reports/tests/test${variant}UnitTest/index.html"
|
||||
|
||||
gradle_run "$project_dir" "$task"
|
||||
local exit_code=$?
|
||||
|
||||
echo "REPORT: $report"
|
||||
return $exit_code
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
name: deploy_capacitor_to_emulator
|
||||
kind: pipeline
|
||||
lang: bash
|
||||
domain: pipelines
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "deploy_capacitor_to_emulator(app_dir: string, avd_name?: string, package_name?: string) -> void"
|
||||
description: "Pipeline end-to-end: build Capacitor APK + arranca AVD + instala + opcionalmente lanza la app. Valida que el AVD existe, construye el APK con capacitor_build_apk, arranca el emulador de forma idempotente, instala el APK y lanza la app si se da package_name. Imprime comando logcat sugerido al final."
|
||||
tags: [android, capacitor, emulator, deploy, launcher]
|
||||
uses_functions:
|
||||
- capacitor_build_apk_bash_pipelines
|
||||
- android_emulator_list_bash_infra
|
||||
- android_emulator_start_bash_infra
|
||||
- android_apk_install_bash_infra
|
||||
- android_logcat_bash_infra
|
||||
- adb_wsl_bash_infra
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/pipelines/deploy_capacitor_to_emulator.sh"
|
||||
params:
|
||||
- name: app_dir
|
||||
desc: "Path al directorio de la app Capacitor. Debe contener package.json y ser un proyecto web compatible con Capacitor. Puede ser relativo al cwd o absoluto."
|
||||
- name: avd_name
|
||||
desc: "Nombre del AVD Android a usar como destino de deploy. Default: Medium_Phone_API_35. Debe existir en la lista de AVDs del sistema."
|
||||
- name: package_name
|
||||
desc: "Package id Android de la app (ej: com.fnregistry.voiceguide). Opcional. Si se provee, lanza la app tras instalarla y muestra comando logcat sugerido."
|
||||
output: "Stdout con pasos de cada fase. Exit 0 = APK instalado (y lanzado si se dio package_name) en el emulador. Exit != 0 si alguna fase falló (AVD no existe, build falla, emulador no arranca, install falla)."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Build + deploy en AVD por defecto, sin lanzar app
|
||||
bash bash/functions/pipelines/deploy_capacitor_to_emulator.sh apps/voice_guide
|
||||
|
||||
# Build + deploy + lanzar app
|
||||
bash bash/functions/pipelines/deploy_capacitor_to_emulator.sh \
|
||||
apps/voice_guide \
|
||||
Medium_Phone_API_35 \
|
||||
com.fnregistry.voiceguide
|
||||
|
||||
# Con AVD personalizado
|
||||
bash bash/functions/pipelines/deploy_capacitor_to_emulator.sh \
|
||||
apps/voice_guide \
|
||||
Pixel_7_API_34 \
|
||||
com.fnregistry.voiceguide
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- El APK se busca como `*.apk` en la raiz de `app_dir` tras el build (patron de `capacitor_build_apk`).
|
||||
- El arranque del emulador es idempotente via `android_emulator_start`: si ya hay un emulador corriendo no lanza otro.
|
||||
- El logcat no se sigue automaticamente (no bloqueante). Se imprime el comando para que el usuario lo ejecute si quiere.
|
||||
- Requiere WSL2 + Android SDK instalado en Windows (usa `adb_wsl` para resolver `adb.exe`).
|
||||
- La fase de build puede tardar varios minutos en la primera ejecucion (descarga de Gradle, Capacitor, etc.).
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
#!/usr/bin/env bash
|
||||
# deploy_capacitor_to_emulator — Pipeline end-to-end: build Capacitor APK + arranca AVD + instala + lanza app.
|
||||
#
|
||||
# USO:
|
||||
# deploy_capacitor_to_emulator.sh <app_dir> [avd_name] [package_name]
|
||||
#
|
||||
# ARGUMENTOS:
|
||||
# app_dir Path al directorio de la app Capacitor (debe contener package.json). Obligatorio.
|
||||
# avd_name Nombre del AVD a usar (default: Medium_Phone_API_35). Opcional.
|
||||
# package_name Package id de la app Android (ej: com.fnregistry.voiceguide).
|
||||
# Si se da, lanza la app tras instalar. Opcional.
|
||||
#
|
||||
# EJEMPLO:
|
||||
# bash deploy_capacitor_to_emulator.sh apps/voice_guide Medium_Phone_API_35 com.fnregistry.voiceguide
|
||||
#
|
||||
# REQUISITOS:
|
||||
# - Node.js + pnpm en PATH
|
||||
# - Java 17+ en PATH
|
||||
# - ANDROID_HOME seteado o ~/android-sdk/env.sh disponible
|
||||
# - Emulator Windows accesible desde WSL2 (adb_wsl)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REGISTRY_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Parseo de argumentos
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
APP_DIR="${1:-}"
|
||||
AVD_NAME="${2:-Medium_Phone_API_35}"
|
||||
PACKAGE_NAME="${3:-}"
|
||||
|
||||
if [[ -z "$APP_DIR" ]]; then
|
||||
echo "[deploy_capacitor_to_emulator] ERROR: app_dir es obligatorio." >&2
|
||||
echo "USO: $0 <app_dir> [avd_name] [package_name]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Resolver path absoluto de APP_DIR (puede venir relativo al cwd)
|
||||
if [[ "$APP_DIR" != /* ]]; then
|
||||
APP_DIR="$(pwd)/$APP_DIR"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$APP_DIR" ]]; then
|
||||
echo "[deploy_capacitor_to_emulator] ERROR: directorio no existe: $APP_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$APP_DIR/package.json" ]]; then
|
||||
echo "[deploy_capacitor_to_emulator] ERROR: no se encontró package.json en $APP_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo " deploy_capacitor_to_emulator"
|
||||
echo "======================================================================"
|
||||
echo " app_dir : $APP_DIR"
|
||||
echo " avd_name : $AVD_NAME"
|
||||
echo " package_name : ${PACKAGE_NAME:-(no lanzar)}"
|
||||
echo "======================================================================"
|
||||
echo ""
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Source adb_wsl para tener helpers ADB y resolver $ADB
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# shellcheck source=../infra/adb_wsl.sh
|
||||
source "$REGISTRY_ROOT/bash/functions/infra/adb_wsl.sh"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Fase 1: Verificar que el AVD existe
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo "[deploy_capacitor_to_emulator] [1/4] Verificando AVD '$AVD_NAME'..."
|
||||
|
||||
if ! bash "$REGISTRY_ROOT/bash/functions/infra/android_emulator_list.sh" | grep -qx "$AVD_NAME"; then
|
||||
echo "[deploy_capacitor_to_emulator] ERROR: AVD '$AVD_NAME' no encontrado." >&2
|
||||
echo " AVDs disponibles:" >&2
|
||||
bash "$REGISTRY_ROOT/bash/functions/infra/android_emulator_list.sh" | sed 's/^/ /' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[deploy_capacitor_to_emulator] AVD '$AVD_NAME' existe."
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Fase 2: Build APK
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo ""
|
||||
echo "[deploy_capacitor_to_emulator] [2/4] Construyendo APK desde $APP_DIR ..."
|
||||
|
||||
bash "$REGISTRY_ROOT/bash/functions/pipelines/capacitor_build_apk.sh" "$APP_DIR"
|
||||
|
||||
# Localizar APK generado: capacitor_build_apk copia el APK a $APP_DIR/<app_name>.apk
|
||||
APK_PATH=""
|
||||
while IFS= read -r -d '' candidate; do
|
||||
APK_PATH="$candidate"
|
||||
break
|
||||
done < <(find "$APP_DIR" -maxdepth 1 -name "*.apk" -print0 2>/dev/null)
|
||||
|
||||
if [[ -z "$APK_PATH" ]]; then
|
||||
echo "[deploy_capacitor_to_emulator] ERROR: No se encontró ningún .apk en $APP_DIR tras el build." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[deploy_capacitor_to_emulator] APK localizado: $APK_PATH"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Fase 3: Arrancar emulador (idempotente)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo ""
|
||||
echo "[deploy_capacitor_to_emulator] [3/4] Arrancando emulador '$AVD_NAME' (idempotente)..."
|
||||
|
||||
bash "$REGISTRY_ROOT/bash/functions/infra/android_emulator_start.sh" "$AVD_NAME"
|
||||
|
||||
echo "[deploy_capacitor_to_emulator] Emulador listo."
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Fase 4: Instalar APK (y lanzar si se dio package_name)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo ""
|
||||
echo "[deploy_capacitor_to_emulator] [4/4] Instalando APK..."
|
||||
|
||||
# Source android_apk_install para usar su función
|
||||
# shellcheck source=../infra/android_apk_install.sh
|
||||
source "$REGISTRY_ROOT/bash/functions/infra/android_apk_install.sh"
|
||||
|
||||
android_apk_install "$APK_PATH" "$PACKAGE_NAME"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Diagnóstico no-bloqueante: hint logcat
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
if [[ -n "$PACKAGE_NAME" ]]; then
|
||||
echo ""
|
||||
echo "[deploy_capacitor_to_emulator] Para seguir los logs de la app en tiempo real:"
|
||||
echo " bash $REGISTRY_ROOT/bash/functions/infra/android_logcat.sh --package '$PACKAGE_NAME'"
|
||||
echo ""
|
||||
echo " O los últimos 50 mensajes:"
|
||||
echo " bash $REGISTRY_ROOT/bash/functions/infra/android_logcat.sh --package '$PACKAGE_NAME' --lines 50"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Resumen
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo " DEPLOY COMPLETADO"
|
||||
echo "======================================================================"
|
||||
echo " APK instalado : $APK_PATH"
|
||||
echo " Emulador : $AVD_NAME"
|
||||
if [[ -n "$PACKAGE_NAME" ]]; then
|
||||
echo " App lanzada : $PACKAGE_NAME"
|
||||
fi
|
||||
echo "======================================================================"
|
||||
echo ""
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
name: init_cpp_app
|
||||
kind: pipeline
|
||||
lang: bash
|
||||
domain: pipelines
|
||||
version: "0.1.0"
|
||||
purity: impure
|
||||
signature: "init_cpp_app(name: string, [--project <p>] [--domain <d>] [--desc <s>] [--tags <csv>]) -> void"
|
||||
description: "Scaffolder estandar de apps C++ del registry. Genera main.cpp + CMakeLists.txt + app.md siguiendo el patron canonico (cfg.about/log/panels, sin app_menubar manual, dockspace via framework), registra la app en cpp/CMakeLists.txt, inicializa repo Gitea dataforge/<name> y ejecuta fn index."
|
||||
tags: [cpp, imgui, scaffold, pipeline, bash, launcher]
|
||||
uses_functions:
|
||||
- ensure_repo_synced_bash_infra
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: name
|
||||
desc: "nombre de la app (snake_case). Sera el id en registry.db y el repo dataforge/<name>"
|
||||
- name: "--project"
|
||||
desc: "proyecto bajo projects/ donde crear la app (opcional). Si se omite va a cpp/apps/<name>/"
|
||||
- name: "--domain"
|
||||
desc: "dominio del registry (default: tools)"
|
||||
- name: "--desc"
|
||||
desc: "descripcion breve (frontmatter description + cfg.about/cfg.title)"
|
||||
- name: "--tags"
|
||||
desc: "tags CSV adicionales para el frontmatter (siempre se anade 'imgui')"
|
||||
output: "estructura completa de la app + entry registrada en cpp/CMakeLists.txt + repo Gitea + fn index"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/pipelines/init_cpp_app.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# App suelta en cpp/apps/<name>/
|
||||
fn run init_cpp_app my_tool --desc "Herramienta para X"
|
||||
|
||||
# App dentro de un proyecto
|
||||
fn run init_cpp_app finance_panel --project budget --desc "Panel de finanzas" --tags "finance,dashboard"
|
||||
```
|
||||
|
||||
## Que genera
|
||||
|
||||
```
|
||||
<dir>/
|
||||
main.cpp # Plantilla canonica: panels[] + cfg.about + cfg.log + run_app(cfg, render)
|
||||
CMakeLists.txt # add_imgui_app(<name> main.cpp)
|
||||
app.md # Frontmatter completo (lang:cpp, framework:imgui, dir_path, repo_url)
|
||||
```
|
||||
|
||||
Y ademas:
|
||||
|
||||
- Registra `add_subdirectory(apps/<name>)` (o el bloque `_DIR` para projects) en `cpp/CMakeLists.txt`.
|
||||
- Crea repo Gitea `dataforge/<name>` con master + commit inicial via `ensure_repo_synced_bash_infra` (requiere `GITEA_URL` y `GITEA_TOKEN`).
|
||||
- Ejecuta `fn index` para registrar la app en `registry.db`.
|
||||
|
||||
## Plantilla `main.cpp`
|
||||
|
||||
La plantilla cumple `cpp/PATTERNS.md`:
|
||||
|
||||
- NO llama `app_menubar` manual (lo dibuja el framework).
|
||||
- NO llama `DockSpaceOverViewport` (auto_dockspace=true por defecto).
|
||||
- Declara `panels[]` con un panel "Main" toggleable.
|
||||
- Setea `cfg.about` (window About) y `cfg.log` (logger + ventana Logs).
|
||||
|
||||
## Despues de crear
|
||||
|
||||
1. Editar `app.md` y completar `uses_functions` cuando la app consuma funciones del registry.
|
||||
2. Anadir las funciones del registry al `CMakeLists.txt` como paths absolutos: `${CMAKE_SOURCE_DIR}/functions/<dom>/<func>.cpp`.
|
||||
3. Build: `cd cpp && cmake --build build --target <name> -j`.
|
||||
Executable
+211
@@ -0,0 +1,211 @@
|
||||
#!/usr/bin/env bash
|
||||
# init_cpp_app — Scaffolder estandar de apps C++ del registry.
|
||||
#
|
||||
# Genera la estructura canonica (main.cpp, CMakeLists.txt, app.md), registra
|
||||
# la app en cpp/CMakeLists.txt, inicializa git + repo Gitea dataforge/<name>,
|
||||
# y ejecuta fn index. La plantilla cumple cpp/PATTERNS.md y .claude/rules/cpp_apps.md.
|
||||
#
|
||||
# Uso:
|
||||
# init_cpp_app <name> [--project <p>] [--domain <d>] [--desc "..."] [--tags "a,b"]
|
||||
#
|
||||
# Por defecto domain=tools, sin proyecto (cpp/apps/<name>/).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Carga helpers del registry
|
||||
FN_ROOT="${FN_REGISTRY_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
||||
# shellcheck source=/dev/null
|
||||
source "$FN_ROOT/bash/functions/infra/ensure_repo_synced.sh"
|
||||
|
||||
init_cpp_app() {
|
||||
local name=""
|
||||
local project=""
|
||||
local domain="tools"
|
||||
local desc=""
|
||||
local tags=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--project) project="$2"; shift 2 ;;
|
||||
--domain) domain="$2"; shift 2 ;;
|
||||
--desc) desc="$2"; shift 2 ;;
|
||||
--tags) tags="$2"; shift 2 ;;
|
||||
-*) echo "init_cpp_app: flag desconocido: $1" >&2; return 2 ;;
|
||||
*) if [[ -z "$name" ]]; then name="$1"; else
|
||||
echo "init_cpp_app: argumento extra: $1" >&2; return 2
|
||||
fi
|
||||
shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$name" ]]; then
|
||||
echo "init_cpp_app: se requiere <name>" >&2
|
||||
echo "Uso: init_cpp_app <name> [--project <p>] [--domain <d>] [--desc \"...\"] [--tags \"a,b\"]" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
[[ -z "$desc" ]] && desc="App C++ del registry"
|
||||
|
||||
# Resolver dir destino
|
||||
local rel_dir abs_dir
|
||||
if [[ -n "$project" ]]; then
|
||||
if [[ ! -f "$FN_ROOT/projects/$project/project.md" ]]; then
|
||||
echo "init_cpp_app: proyecto '$project' no existe (falta projects/$project/project.md)" >&2
|
||||
return 1
|
||||
fi
|
||||
rel_dir="projects/$project/apps/$name"
|
||||
else
|
||||
rel_dir="cpp/apps/$name"
|
||||
fi
|
||||
abs_dir="$FN_ROOT/$rel_dir"
|
||||
|
||||
if [[ -e "$abs_dir" ]]; then
|
||||
echo "init_cpp_app: $rel_dir ya existe" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "$abs_dir"
|
||||
|
||||
# ---------- main.cpp ----------
|
||||
cat > "$abs_dir/main.cpp" <<EOF
|
||||
#include <imgui.h>
|
||||
#include "framework/app_base.h"
|
||||
#include "core/icons_tabler.h"
|
||||
#include "core/logger.h"
|
||||
|
||||
// Toggles de paneles (visibles desde el menu View del menubar canonico)
|
||||
static bool g_show_main = true;
|
||||
|
||||
static void draw_main() {
|
||||
if (!ImGui::Begin(TI_HOME " Main", &g_show_main)) {
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
ImGui::TextUnformatted("Hello from $name");
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
static void render() {
|
||||
// El framework dibuja menubar (View/Layouts/Settings/About) y un
|
||||
// DockSpaceOverViewport central (auto_dockspace=true por defecto).
|
||||
// Aqui solo se dibujan los paneles propios de la app.
|
||||
if (g_show_main) draw_main();
|
||||
}
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/) {
|
||||
static fn_ui::PanelToggle panels[] = {
|
||||
{ "Main", nullptr, &g_show_main },
|
||||
};
|
||||
|
||||
fn::AppConfig cfg;
|
||||
cfg.title = "$name — $desc";
|
||||
cfg.about = { "$name", "0.1.0", "$desc" };
|
||||
cfg.log = { "$name.log", 1 };
|
||||
cfg.panels = panels;
|
||||
cfg.panel_count = sizeof(panels) / sizeof(panels[0]);
|
||||
|
||||
return fn::run_app(cfg, render);
|
||||
}
|
||||
EOF
|
||||
|
||||
# ---------- CMakeLists.txt ----------
|
||||
cat > "$abs_dir/CMakeLists.txt" <<EOF
|
||||
add_imgui_app($name
|
||||
main.cpp
|
||||
)
|
||||
target_include_directories($name PRIVATE \${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties($name PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||
endif()
|
||||
EOF
|
||||
|
||||
# ---------- app.md ----------
|
||||
local repo_url="https://gitea.organic-machine.com/dataforge/$name"
|
||||
local tags_yaml="[imgui]"
|
||||
if [[ -n "$tags" ]]; then
|
||||
# Convierte "a,b,c" -> "[a, b, c]"
|
||||
tags_yaml="[$(echo "$tags" | sed 's/,/, /g'), imgui]"
|
||||
fi
|
||||
|
||||
cat > "$abs_dir/app.md" <<EOF
|
||||
---
|
||||
name: $name
|
||||
lang: cpp
|
||||
domain: $domain
|
||||
description: "$desc"
|
||||
tags: $tags_yaml
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
framework: "imgui"
|
||||
entry_point: "main.cpp"
|
||||
dir_path: "$rel_dir"
|
||||
repo_url: "$repo_url"
|
||||
---
|
||||
|
||||
# $name
|
||||
|
||||
$desc
|
||||
|
||||
## Build
|
||||
|
||||
\`\`\`bash
|
||||
cd cpp && cmake --build build --target $name -j
|
||||
\`\`\`
|
||||
|
||||
## Run
|
||||
|
||||
\`\`\`bash
|
||||
./cpp/build/$name
|
||||
\`\`\`
|
||||
EOF
|
||||
|
||||
# ---------- Registrar en cpp/CMakeLists.txt ----------
|
||||
local cpp_cmake="$FN_ROOT/cpp/CMakeLists.txt"
|
||||
if ! grep -q "# --- $name ---" "$cpp_cmake"; then
|
||||
if [[ -n "$project" ]]; then
|
||||
local upper
|
||||
upper="$(echo "$name" | tr '[:lower:]' '[:upper:]')"
|
||||
cat >> "$cpp_cmake" <<EOF
|
||||
|
||||
# --- $name (lives in projects/$project/apps/) ---
|
||||
set(_${upper}_DIR \${CMAKE_SOURCE_DIR}/../projects/$project/apps/$name)
|
||||
if(EXISTS \${_${upper}_DIR}/CMakeLists.txt)
|
||||
add_subdirectory(\${_${upper}_DIR} \${CMAKE_BINARY_DIR}/apps/$name)
|
||||
endif()
|
||||
EOF
|
||||
else
|
||||
cat >> "$cpp_cmake" <<EOF
|
||||
|
||||
# --- $name ---
|
||||
if(EXISTS \${CMAKE_CURRENT_SOURCE_DIR}/apps/$name/CMakeLists.txt)
|
||||
add_subdirectory(apps/$name)
|
||||
endif()
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---------- Git + Gitea ----------
|
||||
if [[ -n "${GITEA_URL:-}" && -n "${GITEA_TOKEN:-}" ]]; then
|
||||
ensure_repo_synced "$abs_dir" "dataforge" "$name" "master" "feat: scaffold $name via init_cpp_app" || \
|
||||
echo "init_cpp_app: warning — ensure_repo_synced fallo, repo no creado" >&2
|
||||
else
|
||||
echo "init_cpp_app: GITEA_URL/GITEA_TOKEN no seteados, omitiendo creacion de repo Gitea" >&2
|
||||
(cd "$abs_dir" && git init -b master >/dev/null 2>&1 || git init >/dev/null 2>&1)
|
||||
fi
|
||||
|
||||
# ---------- fn index ----------
|
||||
if [[ -x "$FN_ROOT/fn" ]]; then
|
||||
(cd "$FN_ROOT" && ./fn index >/dev/null 2>&1) || \
|
||||
echo "init_cpp_app: warning — fn index fallo" >&2
|
||||
fi
|
||||
|
||||
echo "init_cpp_app: $rel_dir creada"
|
||||
echo " - Build: cd $FN_ROOT/cpp && cmake --build build --target $name -j"
|
||||
echo " - app.md: $rel_dir/app.md (rellena uses_functions cuando uses funciones del registry)"
|
||||
}
|
||||
|
||||
# Permitir invocacion directa via 'fn run init_cpp_app ...'
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
init_cpp_app "$@"
|
||||
fi
|
||||
@@ -0,0 +1,117 @@
|
||||
---
|
||||
name: init_kotlin_app
|
||||
kind: pipeline
|
||||
lang: bash
|
||||
domain: pipelines
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "init_kotlin_app(name: string, [--project <p>] [--desc <s>] [--tags <csv>] [--package <id>]) -> void"
|
||||
description: "Scaffolder canonico de app Android Kotlin Compose con FnTheme + Roborazzi tests + e2e_checks declarados. Mirror exacto del patron init_cpp_app para el stack Kotlin."
|
||||
tags: [android, kotlin, compose, scaffolder, launcher]
|
||||
uses_functions:
|
||||
- ensure_repo_synced_bash_infra
|
||||
- gradle_run_bash_infra
|
||||
- gradle_assemble_debug_bash_infra
|
||||
- gradle_unit_test_bash_infra
|
||||
- gradle_screenshot_test_bash_infra
|
||||
- fn_theme_kt_ui
|
||||
- fn_tokens_kt_ui
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: name
|
||||
desc: "nombre de la app en snake_case. Sera el id en registry.db y el repo dataforge/<name>"
|
||||
- name: "--project"
|
||||
desc: "proyecto bajo projects/ donde crear la app (opcional). Si se omite va a apps/<name>/. El project.md debe existir"
|
||||
- name: "--desc"
|
||||
desc: "descripcion breve para el frontmatter app.md (default: 'App Android Kotlin Compose')"
|
||||
- name: "--tags"
|
||||
desc: "tags CSV adicionales para el frontmatter (siempre se anaden kotlin, compose, android)"
|
||||
- name: "--package"
|
||||
desc: "application id Android (default: com.fnregistry.<name>). Ej: com.aurgi.scanner"
|
||||
output: "Stdout con pasos y archivos creados. Exit 0 = scaffold completo y ready para build. Exit !=0 si falla validacion (nombre invalido, destino existe, proyecto inexistente) o git init."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/pipelines/init_kotlin_app.sh"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# App suelta en apps/<name>/
|
||||
fn run init_kotlin_app my_scanner --desc "Escaner de documentos" --package "com.aurgi.scanner"
|
||||
|
||||
# App dentro de un proyecto
|
||||
fn run init_kotlin_app expense_tracker --project budget --desc "Tracker de gastos" --tags "finance,mobile"
|
||||
|
||||
# Con package id personalizado
|
||||
fn run init_kotlin_app pos_terminal --package "com.aurgi.pos" --desc "Terminal de punto de venta"
|
||||
```
|
||||
|
||||
## Que genera
|
||||
|
||||
```
|
||||
apps/<name>/ (o projects/<p>/apps/<name>/)
|
||||
├── settings.gradle.kts # rootProject + include(:app) + composite build ui
|
||||
├── build.gradle.kts # top-level (apply false)
|
||||
├── app/build.gradle.kts # Compose + Material3 + Roborazzi + tests
|
||||
├── gradle.properties
|
||||
├── gradlew # stub ejecutable
|
||||
├── gradle/wrapper/gradle-wrapper.properties # Gradle 8.6
|
||||
├── app/
|
||||
│ └── src/
|
||||
│ ├── main/
|
||||
│ │ ├── AndroidManifest.xml # activity con LAUNCHER intent
|
||||
│ │ ├── kotlin/<pkg_path>/
|
||||
│ │ │ └── MainActivity.kt # FnTheme + Surface + Text("<name> ready")
|
||||
│ │ └── res/values/strings.xml
|
||||
│ ├── test/kotlin/<pkg_path>/
|
||||
│ │ └── ExampleScreenshotTest.kt # Roborazzi: captura FnTheme + Surface
|
||||
│ └── androidTest/kotlin/<pkg_path>/
|
||||
│ └── MainActivityTest.kt # Compose ui-test: assertIsDisplayed("<name> ready")
|
||||
├── app.md # frontmatter registry (lang:kt, framework:compose)
|
||||
├── .gitignore
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Composite build
|
||||
|
||||
La app apunta via `includeBuild` a `kotlin/functions/ui` del registry (FnTheme + FnTokens).
|
||||
El path relativo se calcula automaticamente:
|
||||
|
||||
| Ubicacion | Path al composite |
|
||||
|---|---|
|
||||
| `apps/<name>/` | `../../kotlin/functions/ui` |
|
||||
| `projects/<p>/apps/<name>/` | `../../../../kotlin/functions/ui` |
|
||||
|
||||
La dependencia se declara como `implementation("fn.compose:ui")` en `app/build.gradle.kts`.
|
||||
|
||||
## e2e_checks generados
|
||||
|
||||
| id | cmd | timeout |
|
||||
|---|---|---|
|
||||
| `unit` | `fn run gradle_unit_test_bash_infra <dir>` | 240s |
|
||||
| `screenshot` | `fn run gradle_screenshot_test_bash_infra <dir>` | 240s |
|
||||
| `build` | `fn run gradle_assemble_debug_bash_infra <dir>` | 360s |
|
||||
| `emu_start` | `fn run android_emulator_start_bash_infra Medium_Phone_API_35` | 240s |
|
||||
| `instrumented` | `fn run gradle_instrumented_test_bash_infra <dir>` | 600s |
|
||||
| `emu_stop` | `fn run android_emulator_stop_bash_infra` | 30s (warning) |
|
||||
|
||||
## Despues de crear
|
||||
|
||||
1. Completar `uses_functions` en `app.md` cuando la app consuma funciones adicionales del registry.
|
||||
2. Para tests Roborazzi: los snapshots se generan en `app/src/test/snapshots/images/` (gitignored).
|
||||
Para actualizar golden images: `./gradlew recordRoborazziDebug`.
|
||||
3. Para tests instrumentados se necesita un AVD creado con `avdmanager create avd -n Medium_Phone_API_35 ...`.
|
||||
|
||||
## Notas
|
||||
|
||||
- `fn_theme_kt_ui` y `fn_tokens_kt_ui` se referencian en `uses_functions` del `app.md` generado
|
||||
aunque todavia no esten indexados en registry.db — son los modulos del composite build.
|
||||
- `ensure_repo_synced_bash_infra` requiere `GITEA_URL` y `GITEA_TOKEN`. Sin ellos se hace
|
||||
`git init + git commit` local y se avisa al usuario.
|
||||
- Si `--project <p>` se especifica, se ejecuta `fn index` al final para registrar la nueva app.
|
||||
Executable
+531
@@ -0,0 +1,531 @@
|
||||
#!/usr/bin/env bash
|
||||
# init_kotlin_app — Scaffolder canonico de apps Android Kotlin Compose del registry.
|
||||
#
|
||||
# Genera la estructura canonica (MainActivity.kt, build.gradle.kts, app.md,
|
||||
# Roborazzi screenshot tests), apuntando al composite build kotlin/functions/ui
|
||||
# para FnTheme + FnTokens, inicializa git + repo Gitea dataforge/<name>.
|
||||
#
|
||||
# Uso:
|
||||
# init_kotlin_app <name> [--project <p>] [--desc "..."] [--tags "a,b"] [--package <com.foo.bar>]
|
||||
#
|
||||
# Por defecto sin proyecto (apps/<name>/), package = com.fnregistry.<name>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Carga helpers del registry
|
||||
FN_ROOT="${FN_REGISTRY_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
||||
# shellcheck source=/dev/null
|
||||
source "$FN_ROOT/bash/functions/infra/ensure_repo_synced.sh"
|
||||
|
||||
init_kotlin_app() {
|
||||
local name=""
|
||||
local project=""
|
||||
local desc=""
|
||||
local tags=""
|
||||
local pkg_id=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--project) project="$2"; shift 2 ;;
|
||||
--desc) desc="$2"; shift 2 ;;
|
||||
--tags) tags="$2"; shift 2 ;;
|
||||
--package) pkg_id="$2"; shift 2 ;;
|
||||
-*) echo "init_kotlin_app: flag desconocido: $1" >&2; return 2 ;;
|
||||
*) if [[ -z "$name" ]]; then name="$1"; else
|
||||
echo "init_kotlin_app: argumento extra: $1" >&2; return 2
|
||||
fi
|
||||
shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$name" ]]; then
|
||||
echo "init_kotlin_app: se requiere <name>" >&2
|
||||
echo "Uso: init_kotlin_app <name> [--project <p>] [--desc \"...\"] [--tags \"a,b\"] [--package <com.foo.bar>]" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Validar snake_case
|
||||
if [[ ! "$name" =~ ^[a-z][a-z0-9_]*$ ]]; then
|
||||
echo "init_kotlin_app: nombre '$name' debe ser snake_case (solo letras minusculas, digitos y _)" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
[[ -z "$desc" ]] && desc="App Android Kotlin Compose"
|
||||
[[ -z "$pkg_id" ]] && pkg_id="com.fnregistry.$name"
|
||||
|
||||
# Resolver dir destino
|
||||
local rel_dir abs_dir
|
||||
if [[ -n "$project" ]]; then
|
||||
if [[ ! -f "$FN_ROOT/projects/$project/project.md" ]]; then
|
||||
echo "init_kotlin_app: proyecto '$project' no existe (falta projects/$project/project.md)" >&2
|
||||
return 1
|
||||
fi
|
||||
rel_dir="projects/$project/apps/$name"
|
||||
else
|
||||
rel_dir="apps/$name"
|
||||
fi
|
||||
abs_dir="$FN_ROOT/$rel_dir"
|
||||
|
||||
if [[ -e "$abs_dir" ]]; then
|
||||
echo "init_kotlin_app: $rel_dir ya existe" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Convertir package id a path (com.fnregistry.my_app -> com/fnregistry/my_app)
|
||||
local pkg_path
|
||||
pkg_path="$(echo "$pkg_id" | tr '.' '/')"
|
||||
|
||||
# Calcular path relativo al composite build de kotlin/functions/ui
|
||||
# Desde apps/<name>/ -> ../../kotlin/functions/ui
|
||||
# Desde projects/<p>/apps/<n> -> ../../../../kotlin/functions/ui
|
||||
local ui_rel_path
|
||||
if [[ -n "$project" ]]; then
|
||||
ui_rel_path="../../../../kotlin/functions/ui"
|
||||
else
|
||||
ui_rel_path="../../kotlin/functions/ui"
|
||||
fi
|
||||
|
||||
# ---- Crear estructura de directorios ----
|
||||
mkdir -p "$abs_dir/app/src/main/kotlin/$pkg_path"
|
||||
mkdir -p "$abs_dir/app/src/main/res/values"
|
||||
mkdir -p "$abs_dir/app/src/test/kotlin/$pkg_path"
|
||||
mkdir -p "$abs_dir/app/src/androidTest/kotlin/$pkg_path"
|
||||
mkdir -p "$abs_dir/gradle/wrapper"
|
||||
|
||||
echo "init_kotlin_app: creando $rel_dir ..."
|
||||
|
||||
# ---- settings.gradle.kts ----
|
||||
cat > "$abs_dir/settings.gradle.kts" <<EOF
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
rootProject.name = "$name"
|
||||
include(":app")
|
||||
|
||||
// Composite build: FnTheme + FnTokens desde el registry
|
||||
includeBuild("$ui_rel_path") {
|
||||
dependencySubstitution {
|
||||
substitute(module("fn.compose:ui")).using(project(":"))
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# ---- build.gradle.kts (raiz) ----
|
||||
cat > "$abs_dir/build.gradle.kts" <<'EOF'
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.4.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
|
||||
}
|
||||
EOF
|
||||
|
||||
# ---- app/build.gradle.kts ----
|
||||
cat > "$abs_dir/app/build.gradle.kts" <<EOF
|
||||
plugins {
|
||||
id("com.android.application") version "8.4.0"
|
||||
id("org.jetbrains.kotlin.android") version "1.9.22"
|
||||
id("io.github.takahirom.roborazzi") version "1.20.0"
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "$pkg_id"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "$pkg_id"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "0.1.0"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.8"
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
testOptions {
|
||||
unitTests {
|
||||
isIncludeAndroidResources = true
|
||||
all {
|
||||
it.systemProperty("robolectric.graphicsMode", "NATIVE")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.activity:activity-compose:1.8.2")
|
||||
implementation(platform("androidx.compose:compose-bom:2024.02.00"))
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.material3:material3")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
// FnTheme + FnTokens via composite build
|
||||
implementation("fn.compose:ui")
|
||||
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("org.robolectric:robolectric:4.11.1")
|
||||
testImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
testImplementation("io.github.takahirom.roborazzi:roborazzi:1.20.0")
|
||||
testImplementation("io.github.takahirom.roborazzi:roborazzi-compose:1.20.0")
|
||||
testImplementation("io.github.takahirom.roborazzi:roborazzi-junit-rule:1.20.0")
|
||||
androidTestImplementation(platform("androidx.compose:compose-bom:2024.02.00"))
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||
}
|
||||
EOF
|
||||
|
||||
# ---- gradle.properties ----
|
||||
cat > "$abs_dir/gradle.properties" <<'EOF'
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
android.useAndroidX=true
|
||||
kotlin.code.style=official
|
||||
android.nonTransitiveRClass=true
|
||||
EOF
|
||||
|
||||
# ---- gradle/wrapper/gradle-wrapper.properties ----
|
||||
cat > "$abs_dir/gradle/wrapper/gradle-wrapper.properties" <<'EOF'
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
EOF
|
||||
|
||||
# ---- gradlew + wrapper jar (vendored real wrapper) ----
|
||||
local tmpl_wrapper="$FN_ROOT/bash/functions/pipelines/templates/kotlin/wrapper"
|
||||
if [[ -f "$tmpl_wrapper/gradlew" && -f "$tmpl_wrapper/gradle-wrapper.jar" ]]; then
|
||||
cp "$tmpl_wrapper/gradlew" "$abs_dir/gradlew"
|
||||
cp "$tmpl_wrapper/gradle-wrapper.jar" "$abs_dir/gradle/wrapper/gradle-wrapper.jar"
|
||||
chmod +x "$abs_dir/gradlew"
|
||||
else
|
||||
echo "init_kotlin_app: WARN templates/kotlin/wrapper missing, fallback gradlew stub"
|
||||
cat > "$abs_dir/gradlew" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "gradlew stub — install gradle wrapper or replace with real one" >&2
|
||||
exit 2
|
||||
EOF
|
||||
chmod +x "$abs_dir/gradlew"
|
||||
fi
|
||||
|
||||
# ---- local.properties (Android SDK location, gitignored, per-machine) ----
|
||||
local sdk_path="${ANDROID_SDK_DIR:-$HOME/android-sdk}"
|
||||
if [[ ! -d "$sdk_path" ]] && [[ -d "$HOME/Android/Sdk" ]]; then
|
||||
sdk_path="$HOME/Android/Sdk"
|
||||
fi
|
||||
cat > "$abs_dir/local.properties" <<EOF
|
||||
# Auto-generated by init_kotlin_app. Per-machine, gitignored.
|
||||
sdk.dir=$sdk_path
|
||||
EOF
|
||||
|
||||
# ---- AndroidManifest.xml ----
|
||||
cat > "$abs_dir/app/src/main/AndroidManifest.xml" <<EOF
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@android:style/Theme.Material.Light.NoActionBar">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
EOF
|
||||
|
||||
# ---- res/values/strings.xml ----
|
||||
cat > "$abs_dir/app/src/main/res/values/strings.xml" <<EOF
|
||||
<resources>
|
||||
<string name="app_name">$name</string>
|
||||
</resources>
|
||||
EOF
|
||||
|
||||
# ---- MainActivity.kt ----
|
||||
cat > "$abs_dir/app/src/main/kotlin/$pkg_path/MainActivity.kt" <<EOF
|
||||
package $pkg_id
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import fn.compose.theme.FnTheme
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
FnTheme {
|
||||
Surface(modifier = Modifier.fillMaxSize()) {
|
||||
Text("$name ready")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# ---- ExampleScreenshotTest.kt (Roborazzi) ----
|
||||
cat > "$abs_dir/app/src/test/kotlin/$pkg_path/ExampleScreenshotTest.kt" <<EOF
|
||||
package $pkg_id
|
||||
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.ui.test.junit4.createComposeRule
|
||||
import androidx.compose.ui.test.onRoot
|
||||
import com.github.takahirom.roborazzi.captureRoboImage
|
||||
import fn.compose.theme.FnTheme
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.GraphicsMode
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@GraphicsMode(GraphicsMode.Mode.NATIVE)
|
||||
class ExampleScreenshotTest {
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = createComposeRule()
|
||||
|
||||
@Test
|
||||
fun screenshotFnThemeSurface() {
|
||||
composeTestRule.setContent {
|
||||
FnTheme {
|
||||
Surface {
|
||||
Text("$name screenshot")
|
||||
}
|
||||
}
|
||||
}
|
||||
composeTestRule.onRoot().captureRoboImage("src/test/snapshots/images/${name}_smoke.png")
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# ---- MainActivityTest.kt (instrumented) ----
|
||||
cat > "$abs_dir/app/src/androidTest/kotlin/$pkg_path/MainActivityTest.kt" <<EOF
|
||||
package $pkg_id
|
||||
|
||||
import androidx.compose.ui.test.assertIsDisplayed
|
||||
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
||||
import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class MainActivityTest {
|
||||
|
||||
@get:Rule
|
||||
val composeTestRule = createAndroidComposeRule<MainActivity>()
|
||||
|
||||
@Test
|
||||
fun appLaunchesAndShowsReadyText() {
|
||||
composeTestRule
|
||||
.onNodeWithText("$name ready")
|
||||
.assertIsDisplayed()
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# ---- app.md frontmatter ----
|
||||
local repo_url="https://gitea.organic-machine.com/dataforge/$name"
|
||||
local tags_yaml="[kotlin, compose, android]"
|
||||
if [[ -n "$tags" ]]; then
|
||||
tags_yaml="[$(echo "$tags" | sed 's/,/, /g'), kotlin, compose, android]"
|
||||
fi
|
||||
|
||||
cat > "$abs_dir/app.md" <<EOF
|
||||
---
|
||||
name: $name
|
||||
domain: tools
|
||||
description: "$desc"
|
||||
tags: $tags_yaml
|
||||
lang: kt
|
||||
framework: compose
|
||||
entry_point: "app/src/main/kotlin/$pkg_path/MainActivity.kt"
|
||||
dir_path: "$rel_dir"
|
||||
repo_url: "$repo_url"
|
||||
uses_functions:
|
||||
- fn_theme_kt_ui
|
||||
- fn_tokens_kt_ui
|
||||
uses_types: []
|
||||
e2e_checks:
|
||||
- id: unit
|
||||
cmd: "fn run gradle_unit_test_bash_infra $rel_dir"
|
||||
timeout_s: 240
|
||||
- id: screenshot
|
||||
cmd: "fn run gradle_screenshot_test_bash_infra $rel_dir"
|
||||
timeout_s: 240
|
||||
- id: build
|
||||
cmd: "fn run gradle_assemble_debug_bash_infra $rel_dir"
|
||||
timeout_s: 360
|
||||
- id: emu_start
|
||||
cmd: "fn run android_emulator_start_bash_infra Medium_Phone_API_35"
|
||||
timeout_s: 240
|
||||
- id: instrumented
|
||||
cmd: "fn run gradle_instrumented_test_bash_infra $rel_dir"
|
||||
timeout_s: 600
|
||||
- id: emu_stop
|
||||
cmd: "fn run android_emulator_stop_bash_infra"
|
||||
severity: warning
|
||||
timeout_s: 30
|
||||
---
|
||||
|
||||
# $name
|
||||
|
||||
$desc
|
||||
|
||||
## Build
|
||||
|
||||
\`\`\`bash
|
||||
fn run gradle_assemble_debug_bash_infra $rel_dir
|
||||
\`\`\`
|
||||
|
||||
## Tests unitarios + Roborazzi screenshots
|
||||
|
||||
\`\`\`bash
|
||||
fn run gradle_unit_test_bash_infra $rel_dir
|
||||
fn run gradle_screenshot_test_bash_infra $rel_dir
|
||||
\`\`\`
|
||||
|
||||
## Tests instrumentados (requiere emulador)
|
||||
|
||||
\`\`\`bash
|
||||
fn run android_emulator_start_bash_infra Medium_Phone_API_35
|
||||
fn run gradle_instrumented_test_bash_infra $rel_dir
|
||||
fn run android_emulator_stop_bash_infra
|
||||
\`\`\`
|
||||
|
||||
## Package
|
||||
|
||||
\`$pkg_id\`
|
||||
|
||||
## FnTheme
|
||||
|
||||
La app usa FnTheme y FnTokens via composite build en \`kotlin/functions/ui\`.
|
||||
Para cambiar colores o tipografia, editar el modulo del registry.
|
||||
EOF
|
||||
|
||||
# ---- .gitignore ----
|
||||
cat > "$abs_dir/.gitignore" <<'EOF'
|
||||
.gradle/
|
||||
build/
|
||||
local.properties
|
||||
*.iml
|
||||
.idea/
|
||||
captures/
|
||||
.externalNativeBuild/
|
||||
.cxx/
|
||||
*.apk
|
||||
*.aab
|
||||
# NOTE: app/src/test/snapshots/ is committed (Roborazzi goldens are test refs).
|
||||
EOF
|
||||
|
||||
# ---- README.md ----
|
||||
cat > "$abs_dir/README.md" <<EOF
|
||||
# $name
|
||||
|
||||
$desc
|
||||
|
||||
Generado con \`init_kotlin_app\` del registry fn_registry.
|
||||
|
||||
## Requisitos
|
||||
|
||||
- Android SDK 34
|
||||
- JDK 17
|
||||
- Gradle 8.6 (via wrapper)
|
||||
- \`kotlin/functions/ui\` modulo del registry (composite build)
|
||||
|
||||
## Build rapido
|
||||
|
||||
\`\`\`bash
|
||||
fn run gradle_assemble_debug_bash_infra $rel_dir
|
||||
\`\`\`
|
||||
EOF
|
||||
|
||||
# ---- Git + Gitea ----
|
||||
if [[ -n "${GITEA_URL:-}" && -n "${GITEA_TOKEN:-}" ]]; then
|
||||
ensure_repo_synced "$abs_dir" "dataforge" "$name" "master" \
|
||||
"feat: scaffold $name via init_kotlin_app" || \
|
||||
echo "init_kotlin_app: warning — ensure_repo_synced fallo, repo no creado" >&2
|
||||
else
|
||||
echo "init_kotlin_app: GITEA_URL/GITEA_TOKEN no seteados, omitiendo creacion de repo Gitea" >&2
|
||||
(cd "$abs_dir" && git init -b master >/dev/null 2>&1 || git init >/dev/null 2>&1 \
|
||||
&& git add -A \
|
||||
&& git commit -m "feat: scaffold $name via init_kotlin_app" --quiet)
|
||||
fi
|
||||
|
||||
# ---- fn index si hay proyecto ----
|
||||
if [[ -n "$project" && -x "$FN_ROOT/fn" ]]; then
|
||||
(cd "$FN_ROOT" && ./fn index >/dev/null 2>&1) || \
|
||||
echo "init_kotlin_app: warning — fn index fallo" >&2
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "init_kotlin_app: $rel_dir creada"
|
||||
echo ""
|
||||
echo " Archivos:"
|
||||
echo " $rel_dir/settings.gradle.kts"
|
||||
echo " $rel_dir/app/build.gradle.kts"
|
||||
echo " $rel_dir/app/src/main/kotlin/$pkg_path/MainActivity.kt"
|
||||
echo " $rel_dir/app/src/test/kotlin/$pkg_path/ExampleScreenshotTest.kt"
|
||||
echo " $rel_dir/app/src/androidTest/kotlin/$pkg_path/MainActivityTest.kt"
|
||||
echo " $rel_dir/app.md"
|
||||
echo ""
|
||||
echo " Pasos siguientes:"
|
||||
echo " fn run gradle_unit_test_bash_infra $rel_dir"
|
||||
echo " fn run gradle_screenshot_test_bash_infra $rel_dir"
|
||||
echo " fn run gradle_assemble_debug_bash_infra $rel_dir"
|
||||
echo ""
|
||||
echo " Para tests instrumentados (emulador):"
|
||||
echo " fn run android_emulator_start_bash_infra Medium_Phone_API_35"
|
||||
echo " fn run gradle_instrumented_test_bash_infra $rel_dir"
|
||||
echo " fn run android_emulator_stop_bash_infra"
|
||||
echo ""
|
||||
echo " Package: $pkg_id"
|
||||
echo " FnTheme composite: $ui_rel_path"
|
||||
}
|
||||
|
||||
# Permitir invocacion directa via 'fn run init_kotlin_app ...'
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
init_kotlin_app "$@"
|
||||
fi
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
name: run_kotlin_app_tests
|
||||
kind: pipeline
|
||||
lang: bash
|
||||
domain: pipelines
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "run_kotlin_app_tests(project_dir: string, avd_name?: string, --skip-emulator?, --no-stop?) -> int"
|
||||
description: "Pipeline e2e completo de testing app Kotlin: unit JVM + screenshot Roborazzi + build APK + instrumented Compose en emulador."
|
||||
tags: [android, kotlin, compose, test, e2e, launcher]
|
||||
uses_functions:
|
||||
- gradle_unit_test_bash_infra
|
||||
- gradle_screenshot_test_bash_infra
|
||||
- gradle_assemble_debug_bash_infra
|
||||
- gradle_instrumented_test_bash_infra
|
||||
- android_emulator_list_bash_infra
|
||||
- android_emulator_start_bash_infra
|
||||
- android_emulator_stop_bash_infra
|
||||
- adb_wsl_bash_infra
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "bash/functions/pipelines/run_kotlin_app_tests.sh"
|
||||
params:
|
||||
- name: project_dir
|
||||
desc: "Raiz del proyecto Android. Debe contener gradlew. Puede ser relativo al cwd o absoluto."
|
||||
- name: avd_name
|
||||
desc: "AVD para instrumented tests. Default: Medium_Phone_API_35. Debe existir en la lista de AVDs del sistema. Ignorado si se pasa --skip-emulator."
|
||||
- name: --skip-emulator
|
||||
desc: "Saltar instrumented tests. El pipeline solo ejecuta unit tests, screenshot tests y build APK, luego sale con exit 0."
|
||||
- name: --no-stop
|
||||
desc: "No parar el emulador al finalizar los instrumented tests. Util en desarrollo iterativo para no esperar el arranque en la siguiente ejecucion."
|
||||
output: "Stdout con tabla resumen de cada step (nombre, OK/FAIL/SKIP, tiempo). Exit 0 = todos los tests pasan. Exit codes: 1=unit tests fallaron, 2=screenshot tests fallaron, 3=build APK fallado, 4=emulador no encontrado o no arranca, 5=instrumented tests fallaron."
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```bash
|
||||
# Suite completa con AVD por defecto
|
||||
bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_kotlin_app
|
||||
|
||||
# Suite completa con AVD especifico
|
||||
bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_kotlin_app Pixel_7_API_34
|
||||
|
||||
# Solo tests JVM (unit + screenshot + build), sin emulador
|
||||
bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_kotlin_app --skip-emulator
|
||||
|
||||
# Suite completa, dejar emulador corriendo al final
|
||||
bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_kotlin_app Medium_Phone_API_35 --no-stop
|
||||
|
||||
# Desde el launcher (fn run)
|
||||
fn run run_kotlin_app_tests apps/my_kotlin_app
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
- Fail-fast: si un paso falla, el pipeline imprime el resumen parcial y sale con el exit code del paso fallido. No continua al siguiente.
|
||||
- El orden de los flags tras `project_dir` es libre: `avd_name` es el primer argumento no-flag; `--skip-emulator` y `--no-stop` pueden aparecer en cualquier posicion.
|
||||
- El arranque del emulador usa `android_emulator_start` que es idempotente: si ya hay un emulador corriendo con ese AVD, no lanza otro.
|
||||
- `adb_wsl` se sourcea para resolver `$ADB` apuntando a `adb.exe` en Windows desde WSL2.
|
||||
- El paso `emulator_stop` se registra como SKIP en la tabla resumen cuando se pasa `--no-stop`.
|
||||
- Requiere WSL2 + Android SDK instalado en Windows. `ANDROID_HOME` o `~/android-sdk/env.sh` deben estar disponibles.
|
||||
@@ -0,0 +1,242 @@
|
||||
#!/usr/bin/env bash
|
||||
# run_kotlin_app_tests — Pipeline e2e completo de testing app Kotlin:
|
||||
# unit JVM + screenshot Roborazzi + build APK + instrumented Compose en emulador.
|
||||
#
|
||||
# USO:
|
||||
# bash run_kotlin_app_tests.sh <project_dir> [avd_name] [--skip-emulator] [--no-stop]
|
||||
#
|
||||
# ARGUMENTOS:
|
||||
# project_dir Raiz del proyecto Android (debe contener gradlew). Obligatorio.
|
||||
# avd_name Nombre del AVD para instrumented tests. Default: Medium_Phone_API_35.
|
||||
# --skip-emulator Saltar instrumented tests (solo unit + screenshot + build).
|
||||
# --no-stop No parar el emulador al finalizar (util en desarrollo iterativo).
|
||||
#
|
||||
# EXIT CODES:
|
||||
# 0 Todos los tests pasan.
|
||||
# 1 Unit tests fallaron.
|
||||
# 2 Screenshot tests fallaron.
|
||||
# 3 Build APK fallado.
|
||||
# 4 AVD no encontrado.
|
||||
# 5 Instrumented tests fallaron.
|
||||
#
|
||||
# EJEMPLO:
|
||||
# bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_app
|
||||
# bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_app Pixel_7_API_34
|
||||
# bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_app --skip-emulator
|
||||
# bash bash/functions/pipelines/run_kotlin_app_tests.sh apps/my_app Medium_Phone_API_35 --no-stop
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REGISTRY_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Parseo de argumentos
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
PROJECT_DIR="${1:-}"
|
||||
AVD_NAME="Medium_Phone_API_35"
|
||||
SKIP_EMULATOR=false
|
||||
NO_STOP=false
|
||||
|
||||
# Primer argumento posicional es project_dir; el resto puede ser flags o avd_name.
|
||||
shift || true
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--skip-emulator) SKIP_EMULATOR=true ;;
|
||||
--no-stop) NO_STOP=true ;;
|
||||
--*)
|
||||
echo "[run_kotlin_app_tests] ERROR: flag desconocido: $arg" >&2
|
||||
echo "USO: $0 <project_dir> [avd_name] [--skip-emulator] [--no-stop]" >&2
|
||||
exit 1
|
||||
;;
|
||||
*) AVD_NAME="$arg" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$PROJECT_DIR" ]]; then
|
||||
echo "[run_kotlin_app_tests] ERROR: project_dir es obligatorio." >&2
|
||||
echo "USO: $0 <project_dir> [avd_name] [--skip-emulator] [--no-stop]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Resolver path absoluto
|
||||
if [[ "$PROJECT_DIR" != /* ]]; then
|
||||
PROJECT_DIR="$(pwd)/$PROJECT_DIR"
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Validacion inicial
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
if [[ ! -f "$PROJECT_DIR/gradlew" ]]; then
|
||||
echo "[run_kotlin_app_tests] ERROR: no se encontro gradlew en $PROJECT_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo " run_kotlin_app_tests"
|
||||
echo "======================================================================"
|
||||
echo " project_dir : $PROJECT_DIR"
|
||||
echo " avd_name : $AVD_NAME"
|
||||
echo " skip_emulator : $SKIP_EMULATOR"
|
||||
echo " no_stop : $NO_STOP"
|
||||
echo "======================================================================"
|
||||
echo ""
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tabla de resultados acumulada
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Arrays paralelos: nombre, status, tiempo
|
||||
STEP_NAMES=()
|
||||
STEP_STATUS=()
|
||||
STEP_TIMES=()
|
||||
|
||||
record_step() {
|
||||
local name="$1" status="$2" elapsed="$3"
|
||||
STEP_NAMES+=("$name")
|
||||
STEP_STATUS+=("$status")
|
||||
STEP_TIMES+=("${elapsed}s")
|
||||
}
|
||||
|
||||
print_summary() {
|
||||
echo ""
|
||||
echo "======================================================================"
|
||||
echo " RESUMEN"
|
||||
printf " %-30s %-6s %s\n" "STEP" "STATUS" "TIEMPO"
|
||||
echo " ------------------------------ ------ ------"
|
||||
for i in "${!STEP_NAMES[@]}"; do
|
||||
printf " %-30s %-6s %s\n" "${STEP_NAMES[$i]}" "${STEP_STATUS[$i]}" "${STEP_TIMES[$i]}"
|
||||
done
|
||||
echo "======================================================================"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Paso 1: Unit tests (JVM)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo "[run_kotlin_app_tests] [1/4] Unit tests (JVM)..."
|
||||
T_START=$SECONDS
|
||||
if bash "$REGISTRY_ROOT/bash/functions/infra/gradle_unit_test.sh" "$PROJECT_DIR"; then
|
||||
record_step "unit_tests" "OK" $((SECONDS - T_START))
|
||||
echo "[run_kotlin_app_tests] Unit tests: OK"
|
||||
else
|
||||
record_step "unit_tests" "FAIL" $((SECONDS - T_START))
|
||||
print_summary
|
||||
echo "[run_kotlin_app_tests] ERROR: unit tests fallaron." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Paso 2: Screenshot tests (Roborazzi, JVM)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo ""
|
||||
echo "[run_kotlin_app_tests] [2/4] Screenshot tests (Roborazzi, JVM)..."
|
||||
T_START=$SECONDS
|
||||
if bash "$REGISTRY_ROOT/bash/functions/infra/gradle_screenshot_test.sh" "$PROJECT_DIR"; then
|
||||
record_step "screenshot_tests" "OK" $((SECONDS - T_START))
|
||||
echo "[run_kotlin_app_tests] Screenshot tests: OK"
|
||||
else
|
||||
record_step "screenshot_tests" "FAIL" $((SECONDS - T_START))
|
||||
print_summary
|
||||
echo "[run_kotlin_app_tests] ERROR: screenshot tests fallaron." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Paso 3: Build APK debug
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo ""
|
||||
echo "[run_kotlin_app_tests] [3/4] Build APK debug..."
|
||||
T_START=$SECONDS
|
||||
if bash "$REGISTRY_ROOT/bash/functions/infra/gradle_assemble_debug.sh" "$PROJECT_DIR"; then
|
||||
record_step "assemble_debug" "OK" $((SECONDS - T_START))
|
||||
echo "[run_kotlin_app_tests] Build APK: OK"
|
||||
else
|
||||
record_step "assemble_debug" "FAIL" $((SECONDS - T_START))
|
||||
print_summary
|
||||
echo "[run_kotlin_app_tests] ERROR: build APK fallado." >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Paso 4: Instrumented tests (emulador)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
if [[ "$SKIP_EMULATOR" == "true" ]]; then
|
||||
record_step "instrumented_tests" "SKIP" 0
|
||||
print_summary
|
||||
echo "[run_kotlin_app_tests] --skip-emulator activo. Pipeline completo (sin instrumented)."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "[run_kotlin_app_tests] [4/4] Instrumented tests en emulador '$AVD_NAME'..."
|
||||
|
||||
# Source adb_wsl para resolver $ADB y helpers de dispositivo
|
||||
# shellcheck source=../infra/adb_wsl.sh
|
||||
source "$REGISTRY_ROOT/bash/functions/infra/adb_wsl.sh"
|
||||
|
||||
# Verificar que el AVD existe
|
||||
echo "[run_kotlin_app_tests] Verificando AVD '$AVD_NAME'..."
|
||||
if ! bash "$REGISTRY_ROOT/bash/functions/infra/android_emulator_list.sh" | grep -qx "$AVD_NAME"; then
|
||||
record_step "emulator_check" "FAIL" 0
|
||||
record_step "instrumented_tests" "SKIP" 0
|
||||
print_summary
|
||||
echo "[run_kotlin_app_tests] ERROR: AVD '$AVD_NAME' no encontrado." >&2
|
||||
echo " AVDs disponibles:" >&2
|
||||
bash "$REGISTRY_ROOT/bash/functions/infra/android_emulator_list.sh" | sed 's/^/ /' >&2
|
||||
exit 4
|
||||
fi
|
||||
record_step "emulator_check" "OK" 0
|
||||
|
||||
# Arrancar emulador (idempotente)
|
||||
echo "[run_kotlin_app_tests] Arrancando emulador '$AVD_NAME' (idempotente)..."
|
||||
T_START=$SECONDS
|
||||
if ! bash "$REGISTRY_ROOT/bash/functions/infra/android_emulator_start.sh" "$AVD_NAME"; then
|
||||
record_step "emulator_start" "FAIL" $((SECONDS - T_START))
|
||||
print_summary
|
||||
echo "[run_kotlin_app_tests] ERROR: no se pudo arrancar el emulador." >&2
|
||||
exit 4
|
||||
fi
|
||||
record_step "emulator_start" "OK" $((SECONDS - T_START))
|
||||
|
||||
# Correr instrumented tests
|
||||
echo "[run_kotlin_app_tests] Corriendo instrumented tests..."
|
||||
T_START=$SECONDS
|
||||
INSTRUMENTED_EXIT=0
|
||||
bash "$REGISTRY_ROOT/bash/functions/infra/gradle_instrumented_test.sh" "$PROJECT_DIR" || INSTRUMENTED_EXIT=$?
|
||||
|
||||
if [[ $INSTRUMENTED_EXIT -eq 0 ]]; then
|
||||
record_step "instrumented_tests" "OK" $((SECONDS - T_START))
|
||||
echo "[run_kotlin_app_tests] Instrumented tests: OK"
|
||||
else
|
||||
record_step "instrumented_tests" "FAIL" $((SECONDS - T_START))
|
||||
fi
|
||||
|
||||
# Parar emulador (salvo --no-stop)
|
||||
if [[ "$NO_STOP" == "false" ]]; then
|
||||
echo "[run_kotlin_app_tests] Parando emulador..."
|
||||
T_START=$SECONDS
|
||||
bash "$REGISTRY_ROOT/bash/functions/infra/android_emulator_stop.sh" || true
|
||||
record_step "emulator_stop" "OK" $((SECONDS - T_START))
|
||||
else
|
||||
record_step "emulator_stop" "SKIP" 0
|
||||
echo "[run_kotlin_app_tests] --no-stop activo: emulador sigue corriendo."
|
||||
fi
|
||||
|
||||
print_summary
|
||||
|
||||
if [[ $INSTRUMENTED_EXIT -ne 0 ]]; then
|
||||
echo "[run_kotlin_app_tests] ERROR: instrumented tests fallaron." >&2
|
||||
exit 5
|
||||
fi
|
||||
|
||||
echo "[run_kotlin_app_tests] Pipeline e2e completado con exito."
|
||||
exit 0
|
||||
Binary file not shown.
+251
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,72 @@
|
||||
set(CMAKE_C_COMPILER "/usr/bin/cc")
|
||||
set(CMAKE_C_COMPILER_ARG1 "")
|
||||
set(CMAKE_C_COMPILER_ID "GNU")
|
||||
set(CMAKE_C_COMPILER_VERSION "11.4.0")
|
||||
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
|
||||
set(CMAKE_C_COMPILER_WRAPPER "")
|
||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17")
|
||||
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON")
|
||||
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23")
|
||||
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
|
||||
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
|
||||
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
|
||||
set(CMAKE_C17_COMPILE_FEATURES "c_std_17")
|
||||
set(CMAKE_C23_COMPILE_FEATURES "c_std_23")
|
||||
|
||||
set(CMAKE_C_PLATFORM_ID "Linux")
|
||||
set(CMAKE_C_SIMULATE_ID "")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "")
|
||||
set(CMAKE_C_SIMULATE_VERSION "")
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_AR "/usr/bin/ar")
|
||||
set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-11")
|
||||
set(CMAKE_RANLIB "/usr/bin/ranlib")
|
||||
set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11")
|
||||
set(CMAKE_LINKER "/usr/bin/ld")
|
||||
set(CMAKE_MT "")
|
||||
set(CMAKE_COMPILER_IS_GNUCC 1)
|
||||
set(CMAKE_C_COMPILER_LOADED 1)
|
||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_C_ABI_COMPILED TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
||||
|
||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
|
||||
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_C_LINKER_PREFERENCE 10)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_C_SIZEOF_DATA_PTR "8")
|
||||
set(CMAKE_C_COMPILER_ABI "ELF")
|
||||
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
|
||||
set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
|
||||
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include")
|
||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
|
||||
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
|
||||
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
||||
@@ -0,0 +1,83 @@
|
||||
set(CMAKE_CXX_COMPILER "/usr/bin/c++")
|
||||
set(CMAKE_CXX_COMPILER_ARG1 "")
|
||||
set(CMAKE_CXX_COMPILER_ID "GNU")
|
||||
set(CMAKE_CXX_COMPILER_VERSION "11.4.0")
|
||||
set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
|
||||
set(CMAKE_CXX_COMPILER_WRAPPER "")
|
||||
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17")
|
||||
set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON")
|
||||
set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23")
|
||||
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
|
||||
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
|
||||
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
|
||||
set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
|
||||
set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20")
|
||||
set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23")
|
||||
|
||||
set(CMAKE_CXX_PLATFORM_ID "Linux")
|
||||
set(CMAKE_CXX_SIMULATE_ID "")
|
||||
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "")
|
||||
set(CMAKE_CXX_SIMULATE_VERSION "")
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_AR "/usr/bin/ar")
|
||||
set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-11")
|
||||
set(CMAKE_RANLIB "/usr/bin/ranlib")
|
||||
set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-11")
|
||||
set(CMAKE_LINKER "/usr/bin/ld")
|
||||
set(CMAKE_MT "")
|
||||
set(CMAKE_COMPILER_IS_GNUCXX 1)
|
||||
set(CMAKE_CXX_COMPILER_LOADED 1)
|
||||
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_CXX_ABI_COMPILED TRUE)
|
||||
|
||||
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
|
||||
|
||||
set(CMAKE_CXX_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm)
|
||||
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
|
||||
foreach (lang C OBJC OBJCXX)
|
||||
if (CMAKE_${lang}_COMPILER_ID_RUN)
|
||||
foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
|
||||
list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(CMAKE_CXX_LINKER_PREFERENCE 30)
|
||||
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
|
||||
set(CMAKE_CXX_COMPILER_ABI "ELF")
|
||||
set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN")
|
||||
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
|
||||
if(CMAKE_CXX_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
|
||||
if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/11;/usr/include/x86_64-linux-gnu/c++/11;/usr/include/c++/11/backward;/usr/lib/gcc/x86_64-linux-gnu/11/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/11;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
|
||||
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
||||
BIN
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
set(CMAKE_HOST_SYSTEM "Linux-5.15.167.4-microsoft-standard-WSL2")
|
||||
set(CMAKE_HOST_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_HOST_SYSTEM_VERSION "5.15.167.4-microsoft-standard-WSL2")
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
|
||||
|
||||
set(CMAKE_SYSTEM "Linux-5.15.167.4-microsoft-standard-WSL2")
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_VERSION "5.15.167.4-microsoft-standard-WSL2")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
|
||||
set(CMAKE_SYSTEM_LOADED 1)
|
||||
@@ -0,0 +1,803 @@
|
||||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for C."
|
||||
#endif
|
||||
|
||||
#if defined(__18CXX)
|
||||
# define ID_VOID_MAIN
|
||||
#endif
|
||||
#if defined(__CLASSIC_C__)
|
||||
/* cv-qualifiers did not exist in K&R C */
|
||||
# define const
|
||||
# define volatile
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
/* If the compiler does not have __has_include, pretend the answer is
|
||||
always no. */
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
# define COMPILER_ID "Intel"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
|
||||
except that a few beta releases use the old format with V=2021. */
|
||||
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
|
||||
/* The third version component from --version is an update index,
|
||||
but no macro is provided for it. */
|
||||
# define COMPILER_VERSION_PATCH DEC(0)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
|
||||
# define COMPILER_ID "IntelLLVM"
|
||||
#if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
#endif
|
||||
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
|
||||
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
|
||||
* VVVV is no smaller than the current year when a version is released.
|
||||
*/
|
||||
#if __INTEL_LLVM_COMPILER < 1000000L
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
|
||||
#else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
#elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
#endif
|
||||
#if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
#endif
|
||||
#if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#elif defined(__PATHCC__)
|
||||
# define COMPILER_ID "PathScale"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
||||
# define COMPILER_ID "Embarcadero"
|
||||
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
||||
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define COMPILER_ID "Borland"
|
||||
/* __BORLANDC__ = 0xVRR */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
||||
|
||||
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
|
||||
# define COMPILER_ID "Watcom"
|
||||
/* __WATCOMC__ = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define COMPILER_ID "OpenWatcom"
|
||||
/* __WATCOMC__ = VVRP + 1100 */
|
||||
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_C)
|
||||
# define COMPILER_ID "SunPro"
|
||||
# if __SUNPRO_C >= 0x5100
|
||||
/* __SUNPRO_C = 0xVRRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# else
|
||||
/* __SUNPRO_CC = 0xVRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_cc)
|
||||
# define COMPILER_ID "HP"
|
||||
/* __HP_cc = VVRRPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
|
||||
|
||||
#elif defined(__DECC)
|
||||
# define COMPILER_ID "Compaq"
|
||||
/* __DECC_VER = VVRRTPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
|
||||
|
||||
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
|
||||
# define COMPILER_ID "zOS"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__ibmxl__) && defined(__clang__)
|
||||
# define COMPILER_ID "XLClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
|
||||
# define COMPILER_ID "XL"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
|
||||
# define COMPILER_ID "VisualAge"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__NVCOMPILER)
|
||||
# define COMPILER_ID "NVHPC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
|
||||
# if defined(__NVCOMPILER_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__PGI)
|
||||
# define COMPILER_ID "PGI"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
# define COMPILER_ID "Cray"
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# define COMPILER_ID "TI"
|
||||
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
||||
|
||||
#elif defined(__CLANG_FUJITSU)
|
||||
# define COMPILER_ID "FujitsuClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(__FUJITSU)
|
||||
# define COMPILER_ID "Fujitsu"
|
||||
# if defined(__FCC_version__)
|
||||
# define COMPILER_VERSION __FCC_version__
|
||||
# elif defined(__FCC_major__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# endif
|
||||
# if defined(__fcc_version)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
|
||||
# elif defined(__FCC_VERSION)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
|
||||
# endif
|
||||
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# define COMPILER_ID "GHS"
|
||||
/* __GHS_VERSION_NUMBER = VVVVRP */
|
||||
# ifdef __GHS_VERSION_NUMBER
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__TINYC__)
|
||||
# define COMPILER_ID "TinyCC"
|
||||
|
||||
#elif defined(__BCC__)
|
||||
# define COMPILER_ID "Bruce"
|
||||
|
||||
#elif defined(__SCO_VERSION__)
|
||||
# define COMPILER_ID "SCO"
|
||||
|
||||
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
|
||||
# define COMPILER_ID "ARMCC"
|
||||
#if __ARMCC_VERSION >= 1000000
|
||||
/* __ARMCC_VERSION = VRRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#else
|
||||
/* __ARMCC_VERSION = VRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(__clang__) && defined(__apple_build_version__)
|
||||
# define COMPILER_ID "AppleClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
||||
|
||||
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
|
||||
# define COMPILER_ID "ARMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
|
||||
|
||||
#elif defined(__clang__)
|
||||
# define COMPILER_ID "Clang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# define COMPILER_ID "GNU"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define COMPILER_ID "MSVC"
|
||||
/* _MSC_VER = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# if defined(_MSC_FULL_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
/* _MSC_FULL_VER = VVRRPPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
||||
# else
|
||||
/* _MSC_FULL_VER = VVRRPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_MSC_BUILD)
|
||||
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
||||
# endif
|
||||
|
||||
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
||||
# define COMPILER_ID "ADSP"
|
||||
#if defined(__VISUALDSPVERSION__)
|
||||
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
|
||||
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
|
||||
#endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# define COMPILER_ID "IAR"
|
||||
# if defined(__VER__) && defined(__ICCARM__)
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
|
||||
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# endif
|
||||
|
||||
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
|
||||
# define COMPILER_ID "SDCC"
|
||||
# if defined(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
|
||||
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
|
||||
# else
|
||||
/* SDCC = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
|
||||
# endif
|
||||
|
||||
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define COMPILER_ID "HP"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define COMPILER_ID ""
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
|
||||
/* Identify known platforms by name. */
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
#elif defined(__MSYS__)
|
||||
# define PLATFORM_ID "MSYS"
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define PLATFORM_ID "Cygwin"
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define PLATFORM_ID "MinGW"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define PLATFORM_ID "Darwin"
|
||||
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
# define PLATFORM_ID "Windows"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
# define PLATFORM_ID "FreeBSD"
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
# define PLATFORM_ID "NetBSD"
|
||||
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
# define PLATFORM_ID "OpenBSD"
|
||||
|
||||
#elif defined(__sun) || defined(sun)
|
||||
# define PLATFORM_ID "SunOS"
|
||||
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
# define PLATFORM_ID "AIX"
|
||||
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
# define PLATFORM_ID "HP-UX"
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
# define PLATFORM_ID "Haiku"
|
||||
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
# define PLATFORM_ID "BeOS"
|
||||
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define PLATFORM_ID "QNX"
|
||||
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
# define PLATFORM_ID "Tru64"
|
||||
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
# define PLATFORM_ID "RISCos"
|
||||
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
# define PLATFORM_ID "SINIX"
|
||||
|
||||
#elif defined(__UNIX_SV__)
|
||||
# define PLATFORM_ID "UNIX_SV"
|
||||
|
||||
#elif defined(__bsdos__)
|
||||
# define PLATFORM_ID "BSDOS"
|
||||
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
# define PLATFORM_ID "MP-RAS"
|
||||
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
# define PLATFORM_ID "OSF1"
|
||||
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
# define PLATFORM_ID "SCO_SV"
|
||||
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
# define PLATFORM_ID "ULTRIX"
|
||||
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
# define PLATFORM_ID "Xenix"
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__LINUX__)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
# elif defined(__DOS__)
|
||||
# define PLATFORM_ID "DOS"
|
||||
|
||||
# elif defined(__OS2__)
|
||||
# define PLATFORM_ID "OS2"
|
||||
|
||||
# elif defined(__WINDOWS__)
|
||||
# define PLATFORM_ID "Windows3x"
|
||||
|
||||
# elif defined(__VXWORKS__)
|
||||
# define PLATFORM_ID "VxWorks"
|
||||
|
||||
# else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEGRITY)
|
||||
# if defined(INT_178B)
|
||||
# define PLATFORM_ID "Integrity178"
|
||||
|
||||
# else /* regular Integrity */
|
||||
# define PLATFORM_ID "Integrity"
|
||||
# endif
|
||||
|
||||
#else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
|
||||
#endif
|
||||
|
||||
/* For windows compilers MSVC and Intel we can determine
|
||||
the architecture of the compiler being used. This is because
|
||||
the compilers do not have flags that can change the architecture,
|
||||
but rather depend on which compiler is being used
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_M_IA64)
|
||||
# define ARCHITECTURE_ID "IA64"
|
||||
|
||||
# elif defined(_M_ARM64EC)
|
||||
# define ARCHITECTURE_ID "ARM64EC"
|
||||
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# elif defined(_M_ARM64)
|
||||
# define ARCHITECTURE_ID "ARM64"
|
||||
|
||||
# elif defined(_M_ARM)
|
||||
# if _M_ARM == 4
|
||||
# define ARCHITECTURE_ID "ARMV4I"
|
||||
# elif _M_ARM == 5
|
||||
# define ARCHITECTURE_ID "ARMV5I"
|
||||
# else
|
||||
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
|
||||
# endif
|
||||
|
||||
# elif defined(_M_MIPS)
|
||||
# define ARCHITECTURE_ID "MIPS"
|
||||
|
||||
# elif defined(_M_SH)
|
||||
# define ARCHITECTURE_ID "SHx"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(_M_I86)
|
||||
# define ARCHITECTURE_ID "I86"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# if defined(__ICCARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__ICCRX__)
|
||||
# define ARCHITECTURE_ID "RX"
|
||||
|
||||
# elif defined(__ICCRH850__)
|
||||
# define ARCHITECTURE_ID "RH850"
|
||||
|
||||
# elif defined(__ICCRL78__)
|
||||
# define ARCHITECTURE_ID "RL78"
|
||||
|
||||
# elif defined(__ICCRISCV__)
|
||||
# define ARCHITECTURE_ID "RISCV"
|
||||
|
||||
# elif defined(__ICCAVR__)
|
||||
# define ARCHITECTURE_ID "AVR"
|
||||
|
||||
# elif defined(__ICC430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__ICCV850__)
|
||||
# define ARCHITECTURE_ID "V850"
|
||||
|
||||
# elif defined(__ICC8051__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__ICCSTM8__)
|
||||
# define ARCHITECTURE_ID "STM8"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# if defined(__PPC64__)
|
||||
# define ARCHITECTURE_ID "PPC64"
|
||||
|
||||
# elif defined(__ppc__)
|
||||
# define ARCHITECTURE_ID "PPC"
|
||||
|
||||
# elif defined(__ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__x86_64__)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(__i386__)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# if defined(__TI_ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__MSP430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__TMS320C28XX__)
|
||||
# define ARCHITECTURE_ID "TMS320C28x"
|
||||
|
||||
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
|
||||
# define ARCHITECTURE_ID "TMS320C6x"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define ARCHITECTURE_ID
|
||||
#endif
|
||||
|
||||
/* Convert integer to decimal digit literals. */
|
||||
#define DEC(n) \
|
||||
('0' + (((n) / 10000000)%10)), \
|
||||
('0' + (((n) / 1000000)%10)), \
|
||||
('0' + (((n) / 100000)%10)), \
|
||||
('0' + (((n) / 10000)%10)), \
|
||||
('0' + (((n) / 1000)%10)), \
|
||||
('0' + (((n) / 100)%10)), \
|
||||
('0' + (((n) / 10)%10)), \
|
||||
('0' + ((n) % 10))
|
||||
|
||||
/* Convert integer to hex digit literals. */
|
||||
#define HEX(n) \
|
||||
('0' + ((n)>>28 & 0xF)), \
|
||||
('0' + ((n)>>24 & 0xF)), \
|
||||
('0' + ((n)>>20 & 0xF)), \
|
||||
('0' + ((n)>>16 & 0xF)), \
|
||||
('0' + ((n)>>12 & 0xF)), \
|
||||
('0' + ((n)>>8 & 0xF)), \
|
||||
('0' + ((n)>>4 & 0xF)), \
|
||||
('0' + ((n) & 0xF))
|
||||
|
||||
/* Construct a string literal encoding the version number. */
|
||||
#ifdef COMPILER_VERSION
|
||||
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#elif defined(COMPILER_VERSION_MAJOR)
|
||||
char const info_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
COMPILER_VERSION_MAJOR,
|
||||
# ifdef COMPILER_VERSION_MINOR
|
||||
'.', COMPILER_VERSION_MINOR,
|
||||
# ifdef COMPILER_VERSION_PATCH
|
||||
'.', COMPILER_VERSION_PATCH,
|
||||
# ifdef COMPILER_VERSION_TWEAK
|
||||
'.', COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the internal version number. */
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
char const info_version_internal[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
|
||||
'i','n','t','e','r','n','a','l','[',
|
||||
COMPILER_VERSION_INTERNAL,']','\0'};
|
||||
#elif defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
char const info_simulate_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
|
||||
SIMULATE_VERSION_MAJOR,
|
||||
# ifdef SIMULATE_VERSION_MINOR
|
||||
'.', SIMULATE_VERSION_MINOR,
|
||||
# ifdef SIMULATE_VERSION_PATCH
|
||||
'.', SIMULATE_VERSION_PATCH,
|
||||
# ifdef SIMULATE_VERSION_TWEAK
|
||||
'.', SIMULATE_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
|
||||
|
||||
|
||||
|
||||
#if !defined(__STDC__) && !defined(__clang__)
|
||||
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
|
||||
# define C_VERSION "90"
|
||||
# else
|
||||
# define C_VERSION
|
||||
# endif
|
||||
#elif __STDC_VERSION__ > 201710L
|
||||
# define C_VERSION "23"
|
||||
#elif __STDC_VERSION__ >= 201710L
|
||||
# define C_VERSION "17"
|
||||
#elif __STDC_VERSION__ >= 201000L
|
||||
# define C_VERSION "11"
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
# define C_VERSION "99"
|
||||
#else
|
||||
# define C_VERSION "90"
|
||||
#endif
|
||||
const char* info_language_standard_default =
|
||||
"INFO" ":" "standard_default[" C_VERSION "]";
|
||||
|
||||
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
|
||||
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
|
||||
#if (defined(__clang__) || defined(__GNUC__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
|
||||
"ON"
|
||||
#else
|
||||
"OFF"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ID_VOID_MAIN
|
||||
void main() {}
|
||||
#else
|
||||
# if defined(__CLASSIC_C__)
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
# else
|
||||
int main(int argc, char* argv[])
|
||||
# endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_standard_default[argc];
|
||||
require += info_language_extensions_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,791 @@
|
||||
/* This source file must have a .cpp extension so that all C++ compilers
|
||||
recognize the extension without flags. Borland does not know .cxx for
|
||||
example. */
|
||||
#ifndef __cplusplus
|
||||
# error "A C compiler has been selected for C++."
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
/* If the compiler does not have __has_include, pretend the answer is
|
||||
always no. */
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */
|
||||
|
||||
#if defined(__COMO__)
|
||||
# define COMPILER_ID "Comeau"
|
||||
/* __COMO_VERSION__ = VRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
|
||||
|
||||
#elif defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
# define COMPILER_ID "Intel"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
|
||||
except that a few beta releases use the old format with V=2021. */
|
||||
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
|
||||
/* The third version component from --version is an update index,
|
||||
but no macro is provided for it. */
|
||||
# define COMPILER_VERSION_PATCH DEC(0)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
|
||||
# define COMPILER_ID "IntelLLVM"
|
||||
#if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
#endif
|
||||
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
|
||||
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
|
||||
* VVVV is no smaller than the current year when a version is released.
|
||||
*/
|
||||
#if __INTEL_LLVM_COMPILER < 1000000L
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
|
||||
#else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
#elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
#endif
|
||||
#if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
#endif
|
||||
#if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#elif defined(__PATHCC__)
|
||||
# define COMPILER_ID "PathScale"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
||||
# define COMPILER_ID "Embarcadero"
|
||||
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
||||
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define COMPILER_ID "Borland"
|
||||
/* __BORLANDC__ = 0xVRR */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
||||
|
||||
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
|
||||
# define COMPILER_ID "Watcom"
|
||||
/* __WATCOMC__ = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define COMPILER_ID "OpenWatcom"
|
||||
/* __WATCOMC__ = VVRP + 1100 */
|
||||
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_CC)
|
||||
# define COMPILER_ID "SunPro"
|
||||
# if __SUNPRO_CC >= 0x5100
|
||||
/* __SUNPRO_CC = 0xVRRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
|
||||
# else
|
||||
/* __SUNPRO_CC = 0xVRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_aCC)
|
||||
# define COMPILER_ID "HP"
|
||||
/* __HP_aCC = VVRRPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
|
||||
|
||||
#elif defined(__DECCXX)
|
||||
# define COMPILER_ID "Compaq"
|
||||
/* __DECCXX_VER = VVRRTPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
|
||||
|
||||
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
|
||||
# define COMPILER_ID "zOS"
|
||||
/* __IBMCPP__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
|
||||
|
||||
#elif defined(__ibmxl__) && defined(__clang__)
|
||||
# define COMPILER_ID "XLClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
|
||||
# define COMPILER_ID "XL"
|
||||
/* __IBMCPP__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
|
||||
|
||||
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
|
||||
# define COMPILER_ID "VisualAge"
|
||||
/* __IBMCPP__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
|
||||
|
||||
#elif defined(__NVCOMPILER)
|
||||
# define COMPILER_ID "NVHPC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
|
||||
# if defined(__NVCOMPILER_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__PGI)
|
||||
# define COMPILER_ID "PGI"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
# define COMPILER_ID "Cray"
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# define COMPILER_ID "TI"
|
||||
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
||||
|
||||
#elif defined(__CLANG_FUJITSU)
|
||||
# define COMPILER_ID "FujitsuClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(__FUJITSU)
|
||||
# define COMPILER_ID "Fujitsu"
|
||||
# if defined(__FCC_version__)
|
||||
# define COMPILER_VERSION __FCC_version__
|
||||
# elif defined(__FCC_major__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# endif
|
||||
# if defined(__fcc_version)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
|
||||
# elif defined(__FCC_VERSION)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
|
||||
# endif
|
||||
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# define COMPILER_ID "GHS"
|
||||
/* __GHS_VERSION_NUMBER = VVVVRP */
|
||||
# ifdef __GHS_VERSION_NUMBER
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SCO_VERSION__)
|
||||
# define COMPILER_ID "SCO"
|
||||
|
||||
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
|
||||
# define COMPILER_ID "ARMCC"
|
||||
#if __ARMCC_VERSION >= 1000000
|
||||
/* __ARMCC_VERSION = VRRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#else
|
||||
/* __ARMCC_VERSION = VRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(__clang__) && defined(__apple_build_version__)
|
||||
# define COMPILER_ID "AppleClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
||||
|
||||
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
|
||||
# define COMPILER_ID "ARMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
|
||||
|
||||
#elif defined(__clang__)
|
||||
# define COMPILER_ID "Clang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||
# define COMPILER_ID "GNU"
|
||||
# if defined(__GNUC__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define COMPILER_ID "MSVC"
|
||||
/* _MSC_VER = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# if defined(_MSC_FULL_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
/* _MSC_FULL_VER = VVRRPPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
||||
# else
|
||||
/* _MSC_FULL_VER = VVRRPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_MSC_BUILD)
|
||||
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
||||
# endif
|
||||
|
||||
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
|
||||
# define COMPILER_ID "ADSP"
|
||||
#if defined(__VISUALDSPVERSION__)
|
||||
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
|
||||
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
|
||||
#endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# define COMPILER_ID "IAR"
|
||||
# if defined(__VER__) && defined(__ICCARM__)
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
|
||||
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# endif
|
||||
|
||||
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define COMPILER_ID "HP"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define COMPILER_ID ""
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
|
||||
/* Identify known platforms by name. */
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
#elif defined(__MSYS__)
|
||||
# define PLATFORM_ID "MSYS"
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define PLATFORM_ID "Cygwin"
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define PLATFORM_ID "MinGW"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define PLATFORM_ID "Darwin"
|
||||
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
# define PLATFORM_ID "Windows"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
# define PLATFORM_ID "FreeBSD"
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
# define PLATFORM_ID "NetBSD"
|
||||
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
# define PLATFORM_ID "OpenBSD"
|
||||
|
||||
#elif defined(__sun) || defined(sun)
|
||||
# define PLATFORM_ID "SunOS"
|
||||
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
# define PLATFORM_ID "AIX"
|
||||
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
# define PLATFORM_ID "HP-UX"
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
# define PLATFORM_ID "Haiku"
|
||||
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
# define PLATFORM_ID "BeOS"
|
||||
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define PLATFORM_ID "QNX"
|
||||
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
# define PLATFORM_ID "Tru64"
|
||||
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
# define PLATFORM_ID "RISCos"
|
||||
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
# define PLATFORM_ID "SINIX"
|
||||
|
||||
#elif defined(__UNIX_SV__)
|
||||
# define PLATFORM_ID "UNIX_SV"
|
||||
|
||||
#elif defined(__bsdos__)
|
||||
# define PLATFORM_ID "BSDOS"
|
||||
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
# define PLATFORM_ID "MP-RAS"
|
||||
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
# define PLATFORM_ID "OSF1"
|
||||
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
# define PLATFORM_ID "SCO_SV"
|
||||
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
# define PLATFORM_ID "ULTRIX"
|
||||
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
# define PLATFORM_ID "Xenix"
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__LINUX__)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
# elif defined(__DOS__)
|
||||
# define PLATFORM_ID "DOS"
|
||||
|
||||
# elif defined(__OS2__)
|
||||
# define PLATFORM_ID "OS2"
|
||||
|
||||
# elif defined(__WINDOWS__)
|
||||
# define PLATFORM_ID "Windows3x"
|
||||
|
||||
# elif defined(__VXWORKS__)
|
||||
# define PLATFORM_ID "VxWorks"
|
||||
|
||||
# else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEGRITY)
|
||||
# if defined(INT_178B)
|
||||
# define PLATFORM_ID "Integrity178"
|
||||
|
||||
# else /* regular Integrity */
|
||||
# define PLATFORM_ID "Integrity"
|
||||
# endif
|
||||
|
||||
#else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
|
||||
#endif
|
||||
|
||||
/* For windows compilers MSVC and Intel we can determine
|
||||
the architecture of the compiler being used. This is because
|
||||
the compilers do not have flags that can change the architecture,
|
||||
but rather depend on which compiler is being used
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_M_IA64)
|
||||
# define ARCHITECTURE_ID "IA64"
|
||||
|
||||
# elif defined(_M_ARM64EC)
|
||||
# define ARCHITECTURE_ID "ARM64EC"
|
||||
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# elif defined(_M_ARM64)
|
||||
# define ARCHITECTURE_ID "ARM64"
|
||||
|
||||
# elif defined(_M_ARM)
|
||||
# if _M_ARM == 4
|
||||
# define ARCHITECTURE_ID "ARMV4I"
|
||||
# elif _M_ARM == 5
|
||||
# define ARCHITECTURE_ID "ARMV5I"
|
||||
# else
|
||||
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
|
||||
# endif
|
||||
|
||||
# elif defined(_M_MIPS)
|
||||
# define ARCHITECTURE_ID "MIPS"
|
||||
|
||||
# elif defined(_M_SH)
|
||||
# define ARCHITECTURE_ID "SHx"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(_M_I86)
|
||||
# define ARCHITECTURE_ID "I86"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# if defined(__ICCARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__ICCRX__)
|
||||
# define ARCHITECTURE_ID "RX"
|
||||
|
||||
# elif defined(__ICCRH850__)
|
||||
# define ARCHITECTURE_ID "RH850"
|
||||
|
||||
# elif defined(__ICCRL78__)
|
||||
# define ARCHITECTURE_ID "RL78"
|
||||
|
||||
# elif defined(__ICCRISCV__)
|
||||
# define ARCHITECTURE_ID "RISCV"
|
||||
|
||||
# elif defined(__ICCAVR__)
|
||||
# define ARCHITECTURE_ID "AVR"
|
||||
|
||||
# elif defined(__ICC430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__ICCV850__)
|
||||
# define ARCHITECTURE_ID "V850"
|
||||
|
||||
# elif defined(__ICC8051__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__ICCSTM8__)
|
||||
# define ARCHITECTURE_ID "STM8"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# if defined(__PPC64__)
|
||||
# define ARCHITECTURE_ID "PPC64"
|
||||
|
||||
# elif defined(__ppc__)
|
||||
# define ARCHITECTURE_ID "PPC"
|
||||
|
||||
# elif defined(__ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__x86_64__)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(__i386__)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# if defined(__TI_ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__MSP430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__TMS320C28XX__)
|
||||
# define ARCHITECTURE_ID "TMS320C28x"
|
||||
|
||||
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
|
||||
# define ARCHITECTURE_ID "TMS320C6x"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define ARCHITECTURE_ID
|
||||
#endif
|
||||
|
||||
/* Convert integer to decimal digit literals. */
|
||||
#define DEC(n) \
|
||||
('0' + (((n) / 10000000)%10)), \
|
||||
('0' + (((n) / 1000000)%10)), \
|
||||
('0' + (((n) / 100000)%10)), \
|
||||
('0' + (((n) / 10000)%10)), \
|
||||
('0' + (((n) / 1000)%10)), \
|
||||
('0' + (((n) / 100)%10)), \
|
||||
('0' + (((n) / 10)%10)), \
|
||||
('0' + ((n) % 10))
|
||||
|
||||
/* Convert integer to hex digit literals. */
|
||||
#define HEX(n) \
|
||||
('0' + ((n)>>28 & 0xF)), \
|
||||
('0' + ((n)>>24 & 0xF)), \
|
||||
('0' + ((n)>>20 & 0xF)), \
|
||||
('0' + ((n)>>16 & 0xF)), \
|
||||
('0' + ((n)>>12 & 0xF)), \
|
||||
('0' + ((n)>>8 & 0xF)), \
|
||||
('0' + ((n)>>4 & 0xF)), \
|
||||
('0' + ((n) & 0xF))
|
||||
|
||||
/* Construct a string literal encoding the version number. */
|
||||
#ifdef COMPILER_VERSION
|
||||
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#elif defined(COMPILER_VERSION_MAJOR)
|
||||
char const info_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
COMPILER_VERSION_MAJOR,
|
||||
# ifdef COMPILER_VERSION_MINOR
|
||||
'.', COMPILER_VERSION_MINOR,
|
||||
# ifdef COMPILER_VERSION_PATCH
|
||||
'.', COMPILER_VERSION_PATCH,
|
||||
# ifdef COMPILER_VERSION_TWEAK
|
||||
'.', COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the internal version number. */
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
char const info_version_internal[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
|
||||
'i','n','t','e','r','n','a','l','[',
|
||||
COMPILER_VERSION_INTERNAL,']','\0'};
|
||||
#elif defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
char const info_simulate_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
|
||||
SIMULATE_VERSION_MAJOR,
|
||||
# ifdef SIMULATE_VERSION_MINOR
|
||||
'.', SIMULATE_VERSION_MINOR,
|
||||
# ifdef SIMULATE_VERSION_PATCH
|
||||
'.', SIMULATE_VERSION_PATCH,
|
||||
# ifdef SIMULATE_VERSION_TWEAK
|
||||
'.', SIMULATE_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
|
||||
|
||||
|
||||
|
||||
#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
|
||||
# if defined(__INTEL_CXX11_MODE__)
|
||||
# if defined(__cpp_aggregate_nsdmi)
|
||||
# define CXX_STD 201402L
|
||||
# else
|
||||
# define CXX_STD 201103L
|
||||
# endif
|
||||
# else
|
||||
# define CXX_STD 199711L
|
||||
# endif
|
||||
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
|
||||
# define CXX_STD _MSVC_LANG
|
||||
#else
|
||||
# define CXX_STD __cplusplus
|
||||
#endif
|
||||
|
||||
const char* info_language_standard_default = "INFO" ":" "standard_default["
|
||||
#if CXX_STD > 202002L
|
||||
"23"
|
||||
#elif CXX_STD > 201703L
|
||||
"20"
|
||||
#elif CXX_STD >= 201703L
|
||||
"17"
|
||||
#elif CXX_STD >= 201402L
|
||||
"14"
|
||||
#elif CXX_STD >= 201103L
|
||||
"11"
|
||||
#else
|
||||
"98"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
|
||||
/* !defined(_MSC_VER) to exclude Clang's MSVC compatibility mode. */
|
||||
#if (defined(__clang__) || defined(__GNUC__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(__STRICT_ANSI__) && !defined(_MSC_VER)
|
||||
"ON"
|
||||
#else
|
||||
"OFF"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_standard_default[argc];
|
||||
require += info_language_extensions_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.22
|
||||
|
||||
# Relative path conversion top directories.
|
||||
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/lucas/fn_registry/cpp")
|
||||
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/lucas/fn_registry/build")
|
||||
|
||||
# Force unix paths in dependencies.
|
||||
set(CMAKE_FORCE_UNIX_PATHS 1)
|
||||
|
||||
|
||||
# The C and CXX include file regular expressions for this directory.
|
||||
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
|
||||
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
|
||||
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
|
||||
@@ -0,0 +1,661 @@
|
||||
Performing C SOURCE FILE Test HAVE_GCC_WDOCUMENTATION failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_50439/fast && /usr/bin/gmake -f CMakeFiles/cmTC_50439.dir/build.make CMakeFiles/cmTC_50439.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_50439.dir/src.c.o
|
||||
/usr/bin/cc -DHAVE_GCC_WDOCUMENTATION -D_GNU_SOURCE=1 -Wdocumentation -o CMakeFiles/cmTC_50439.dir/src.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/src.c
|
||||
cc: error: unrecognized command-line option '-Wdocumentation'
|
||||
gmake[1]: *** [CMakeFiles/cmTC_50439.dir/build.make:78: CMakeFiles/cmTC_50439.dir/src.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_50439/fast] Error 2
|
||||
|
||||
|
||||
Source file was:
|
||||
int main(void) { return 0; }
|
||||
Performing C SOURCE FILE Test HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_1f170/fast && /usr/bin/gmake -f CMakeFiles/cmTC_1f170.dir/build.make CMakeFiles/cmTC_1f170.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_1f170.dir/src.c.o
|
||||
/usr/bin/cc -DHAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND -D_GNU_SOURCE=1 -Wdocumentation-unknown-command -o CMakeFiles/cmTC_1f170.dir/src.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/src.c
|
||||
cc: error: unrecognized command-line option '-Wdocumentation-unknown-command'
|
||||
gmake[1]: *** [CMakeFiles/cmTC_1f170.dir/build.make:78: CMakeFiles/cmTC_1f170.dir/src.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_1f170/fast] Error 2
|
||||
|
||||
|
||||
Source file was:
|
||||
int main(void) { return 0; }
|
||||
Performing C SOURCE FILE Test HAVE_GCC_COMMENT_BLOCK_COMMANDS failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_56df6/fast && /usr/bin/gmake -f CMakeFiles/cmTC_56df6.dir/build.make CMakeFiles/cmTC_56df6.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_56df6.dir/src.c.o
|
||||
/usr/bin/cc -DHAVE_GCC_COMMENT_BLOCK_COMMANDS -D_GNU_SOURCE=1 -fcomment-block-commands=threadsafety -o CMakeFiles/cmTC_56df6.dir/src.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/src.c
|
||||
cc: error: unrecognized command-line option '-fcomment-block-commands=threadsafety'
|
||||
gmake[1]: *** [CMakeFiles/cmTC_56df6.dir/build.make:78: CMakeFiles/cmTC_56df6.dir/src.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_56df6/fast] Error 2
|
||||
|
||||
|
||||
Source file was:
|
||||
int main(void) { return 0; }
|
||||
Performing C SOURCE FILE Test HAVE_CLANG_COMMENT_BLOCK_COMMANDS failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_bc9eb/fast && /usr/bin/gmake -f CMakeFiles/cmTC_bc9eb.dir/build.make CMakeFiles/cmTC_bc9eb.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_bc9eb.dir/src.c.o
|
||||
/usr/bin/cc -DHAVE_CLANG_COMMENT_BLOCK_COMMANDS -D_GNU_SOURCE=1 /clang:-fcomment-block-commands=threadsafety -o CMakeFiles/cmTC_bc9eb.dir/src.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/src.c
|
||||
cc: warning: /clang:-fcomment-block-commands=threadsafety: linker input file unused because linking not done
|
||||
cc: error: /clang:-fcomment-block-commands=threadsafety: linker input file not found: No such file or directory
|
||||
gmake[1]: *** [CMakeFiles/cmTC_bc9eb.dir/build.make:78: CMakeFiles/cmTC_bc9eb.dir/src.c.o] Error 1
|
||||
gmake[1]: *** Deleting file 'CMakeFiles/cmTC_bc9eb.dir/src.c.o'
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_bc9eb/fast] Error 2
|
||||
|
||||
|
||||
Source file was:
|
||||
int main(void) { return 0; }
|
||||
Determining if the _i64toa exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_53e2c/fast && /usr/bin/gmake -f CMakeFiles/cmTC_53e2c.dir/build.make CMakeFiles/cmTC_53e2c.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_53e2c.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_53e2c.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘_i64toa’ undeclared (first use in this function)
|
||||
26 | return ((int*)(&_i64toa))[argc];
|
||||
| ^~~~~~~
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_53e2c.dir/build.make:78: CMakeFiles/cmTC_53e2c.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_53e2c/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef _i64toa
|
||||
return ((int*)(&_i64toa))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the itoa exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_103cb/fast && /usr/bin/gmake -f CMakeFiles/cmTC_103cb.dir/build.make CMakeFiles/cmTC_103cb.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_103cb.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_103cb.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘itoa’ undeclared (first use in this function)
|
||||
26 | return ((int*)(&itoa))[argc];
|
||||
| ^~~~
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_103cb.dir/build.make:78: CMakeFiles/cmTC_103cb.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_103cb/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef itoa
|
||||
return ((int*)(&itoa))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the _ltoa exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_47017/fast && /usr/bin/gmake -f CMakeFiles/cmTC_47017.dir/build.make CMakeFiles/cmTC_47017.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_47017.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_47017.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘_ltoa’ undeclared (first use in this function)
|
||||
26 | return ((int*)(&_ltoa))[argc];
|
||||
| ^~~~~
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_47017.dir/build.make:78: CMakeFiles/cmTC_47017.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_47017/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef _ltoa
|
||||
return ((int*)(&_ltoa))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the sqr exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_207e9/fast && /usr/bin/gmake -f CMakeFiles/cmTC_207e9.dir/build.make CMakeFiles/cmTC_207e9.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_207e9.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_207e9.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘sqr’ undeclared (first use in this function); did you mean ‘sqrt’?
|
||||
26 | return ((int*)(&sqr))[argc];
|
||||
| ^~~
|
||||
| sqrt
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_207e9.dir/build.make:78: CMakeFiles/cmTC_207e9.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_207e9/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef sqr
|
||||
return ((int*)(&sqr))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the strlcat exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_e0186/fast && /usr/bin/gmake -f CMakeFiles/cmTC_e0186.dir/build.make CMakeFiles/cmTC_e0186.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_e0186.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_e0186.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘strlcat’ undeclared (first use in this function); did you mean ‘strncat’?
|
||||
26 | return ((int*)(&strlcat))[argc];
|
||||
| ^~~~~~~
|
||||
| strncat
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_e0186.dir/build.make:78: CMakeFiles/cmTC_e0186.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_e0186/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef strlcat
|
||||
return ((int*)(&strlcat))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the strlcpy exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_aeb26/fast && /usr/bin/gmake -f CMakeFiles/cmTC_aeb26.dir/build.make CMakeFiles/cmTC_aeb26.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_aeb26.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_aeb26.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘strlcpy’ undeclared (first use in this function); did you mean ‘strncpy’?
|
||||
26 | return ((int*)(&strlcpy))[argc];
|
||||
| ^~~~~~~
|
||||
| strncpy
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_aeb26.dir/build.make:78: CMakeFiles/cmTC_aeb26.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_aeb26/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef strlcpy
|
||||
return ((int*)(&strlcpy))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the strnstr exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_1add8/fast && /usr/bin/gmake -f CMakeFiles/cmTC_1add8.dir/build.make CMakeFiles/cmTC_1add8.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_1add8.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_1add8.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘strnstr’ undeclared (first use in this function); did you mean ‘strstr’?
|
||||
26 | return ((int*)(&strnstr))[argc];
|
||||
| ^~~~~~~
|
||||
| strstr
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_1add8.dir/build.make:78: CMakeFiles/cmTC_1add8.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_1add8/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef strnstr
|
||||
return ((int*)(&strnstr))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the wcslcat exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_64ff6/fast && /usr/bin/gmake -f CMakeFiles/cmTC_64ff6.dir/build.make CMakeFiles/cmTC_64ff6.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_64ff6.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_64ff6.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘wcslcat’ undeclared (first use in this function); did you mean ‘wcsncat’?
|
||||
26 | return ((int*)(&wcslcat))[argc];
|
||||
| ^~~~~~~
|
||||
| wcsncat
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_64ff6.dir/build.make:78: CMakeFiles/cmTC_64ff6.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_64ff6/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef wcslcat
|
||||
return ((int*)(&wcslcat))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the wcslcpy exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_6e8f8/fast && /usr/bin/gmake -f CMakeFiles/cmTC_6e8f8.dir/build.make CMakeFiles/cmTC_6e8f8.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_6e8f8.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_6e8f8.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: error: ‘wcslcpy’ undeclared (first use in this function); did you mean ‘wcsncpy’?
|
||||
26 | return ((int*)(&wcslcpy))[argc];
|
||||
| ^~~~~~~
|
||||
| wcsncpy
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:26:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_6e8f8.dir/build.make:78: CMakeFiles/cmTC_6e8f8.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_6e8f8/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <float.h>
|
||||
#include <iconv.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <memory.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <wchar.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef wcslcpy
|
||||
return ((int*)(&wcslcpy))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the sysctlbyname exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_fd655/fast && /usr/bin/gmake -f CMakeFiles/cmTC_fd655.dir/build.make CMakeFiles/cmTC_fd655.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_fd655.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_fd655.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:3:10: fatal error: sys/sysctl.h: No such file or directory
|
||||
3 | #include <sys/sysctl.h>
|
||||
| ^~~~~~~~~~~~~~
|
||||
compilation terminated.
|
||||
gmake[1]: *** [CMakeFiles/cmTC_fd655.dir/build.make:78: CMakeFiles/cmTC_fd655.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_fd655/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef sysctlbyname
|
||||
return ((int*)(&sysctlbyname))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the elf_aux_info exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_49c79/fast && /usr/bin/gmake -f CMakeFiles/cmTC_49c79.dir/build.make CMakeFiles/cmTC_49c79.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_49c79.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_49c79.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘elf_aux_info’ undeclared (first use in this function)
|
||||
8 | return ((int*)(&elf_aux_info))[argc];
|
||||
| ^~~~~~~~~~~~
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_49c79.dir/build.make:78: CMakeFiles/cmTC_49c79.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_49c79/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <sys/auxv.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef elf_aux_info
|
||||
return ((int*)(&elf_aux_info))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Determining if the posix_spawn_file_actions_addchdir exist failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_833c5/fast && /usr/bin/gmake -f CMakeFiles/cmTC_833c5.dir/build.make CMakeFiles/cmTC_833c5.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_833c5.dir/CheckSymbolExists.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_833c5.dir/CheckSymbolExists.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: In function ‘main’:
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: error: ‘posix_spawn_file_actions_addchdir’ undeclared (first use in this function); did you mean ‘posix_spawn_file_actions_addchdir_np’?
|
||||
8 | return ((int*)(&posix_spawn_file_actions_addchdir))[argc];
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| posix_spawn_file_actions_addchdir_np
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:8:19: note: each undeclared identifier is reported only once for each function it appears in
|
||||
gmake[1]: *** [CMakeFiles/cmTC_833c5.dir/build.make:78: CMakeFiles/cmTC_833c5.dir/CheckSymbolExists.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_833c5/fast] Error 2
|
||||
|
||||
|
||||
File /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
|
||||
/* */
|
||||
#include <spawn.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
(void)argv;
|
||||
#ifndef posix_spawn_file_actions_addchdir
|
||||
return ((int*)(&posix_spawn_file_actions_addchdir))[argc];
|
||||
#else
|
||||
(void)argc;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
Performing C SOURCE FILE Test ICONV_IN_LIBICONV failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_e3fa4/fast && /usr/bin/gmake -f CMakeFiles/cmTC_e3fa4.dir/build.make CMakeFiles/cmTC_e3fa4.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_e3fa4.dir/src.c.o
|
||||
/usr/bin/cc -DICONV_IN_LIBICONV -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_e3fa4.dir/src.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/src.c
|
||||
Linking C executable cmTC_e3fa4
|
||||
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e3fa4.dir/link.txt --verbose=1
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 CMakeFiles/cmTC_e3fa4.dir/src.c.o -o cmTC_e3fa4 -liconv
|
||||
/usr/bin/ld: cannot find -liconv: No such file or directory
|
||||
collect2: error: ld returned 1 exit status
|
||||
gmake[1]: *** [CMakeFiles/cmTC_e3fa4.dir/build.make:99: cmTC_e3fa4] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_e3fa4/fast] Error 2
|
||||
|
||||
|
||||
Source file was:
|
||||
|
||||
#include <stddef.h>
|
||||
#include <iconv.h>
|
||||
int main(int argc, char **argv) {
|
||||
return !iconv_open(NULL,NULL);
|
||||
}
|
||||
Determining if the include file libudev.h exists failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_2819f/fast && /usr/bin/gmake -f CMakeFiles/cmTC_2819f.dir/build.make CMakeFiles/cmTC_2819f.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_2819f.dir/CheckIncludeFile.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -o CMakeFiles/cmTC_2819f.dir/CheckIncludeFile.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: libudev.h: No such file or directory
|
||||
1 | #include <libudev.h>
|
||||
| ^~~~~~~~~~~
|
||||
compilation terminated.
|
||||
gmake[1]: *** [CMakeFiles/cmTC_2819f.dir/build.make:78: CMakeFiles/cmTC_2819f.dir/CheckIncludeFile.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_2819f/fast] Error 2
|
||||
|
||||
|
||||
|
||||
Determining if the include file pthread_np.h exists failed with the following output:
|
||||
Change Dir: /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp
|
||||
|
||||
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_df4b7/fast && /usr/bin/gmake -f CMakeFiles/cmTC_df4b7.dir/build.make CMakeFiles/cmTC_df4b7.dir/build
|
||||
gmake[1]: Entering directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
Building C object CMakeFiles/cmTC_df4b7.dir/CheckIncludeFile.c.o
|
||||
/usr/bin/cc -D_GNU_SOURCE=1 -D_REENTRANT -pthread -o CMakeFiles/cmTC_df4b7.dir/CheckIncludeFile.c.o -c /home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
|
||||
/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: pthread_np.h: No such file or directory
|
||||
1 | #include <pthread_np.h>
|
||||
| ^~~~~~~~~~~~~~
|
||||
compilation terminated.
|
||||
gmake[1]: *** [CMakeFiles/cmTC_df4b7.dir/build.make:78: CMakeFiles/cmTC_df4b7.dir/CheckIncludeFile.c.o] Error 1
|
||||
gmake[1]: Leaving directory '/home/lucas/fn_registry/build/CMakeFiles/CMakeTmp'
|
||||
gmake: *** [Makefile:127: cmTC_df4b7/fast] Error 2
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,49 @@
|
||||
# Hashes of file build rules.
|
||||
c96ccbf2b9d7564af5dff20cac53012f vendor/sdl3/wayland-generated-protocols/alpha-modifier-v1-client-protocol.h
|
||||
e16a8e34315165ffc2b0e4765e2e07c0 vendor/sdl3/wayland-generated-protocols/alpha-modifier-v1-protocol.c
|
||||
a4e3cdf43f281430892f2789cc0beb8e vendor/sdl3/wayland-generated-protocols/color-management-v1-client-protocol.h
|
||||
871c6550a8f8ea0dce3770bbf576b520 vendor/sdl3/wayland-generated-protocols/color-management-v1-protocol.c
|
||||
f7ee29deb576629bfe14920ef8238a57 vendor/sdl3/wayland-generated-protocols/cursor-shape-v1-client-protocol.h
|
||||
7d0dd38758e5e35cc82135ca278c77da vendor/sdl3/wayland-generated-protocols/cursor-shape-v1-protocol.c
|
||||
ee84f4a93e024bebe2c5f507d96888d3 vendor/sdl3/wayland-generated-protocols/fractional-scale-v1-client-protocol.h
|
||||
79517cebe1813abd3ad43764b0942ed8 vendor/sdl3/wayland-generated-protocols/fractional-scale-v1-protocol.c
|
||||
7ff64b6efc4ec5e15d66ad6818f082a8 vendor/sdl3/wayland-generated-protocols/frog-color-management-v1-client-protocol.h
|
||||
8eca897095a09f1f0649b91c8f19cca5 vendor/sdl3/wayland-generated-protocols/frog-color-management-v1-protocol.c
|
||||
37d6d14956566228b568c8c20668a50c vendor/sdl3/wayland-generated-protocols/idle-inhibit-unstable-v1-client-protocol.h
|
||||
bba52fafe1ca3501cfbd4c34a1ac118b vendor/sdl3/wayland-generated-protocols/idle-inhibit-unstable-v1-protocol.c
|
||||
acddc05167234cf207d341a47008d822 vendor/sdl3/wayland-generated-protocols/input-timestamps-unstable-v1-client-protocol.h
|
||||
c0f9ec6f4d145a2d28854b072856fdac vendor/sdl3/wayland-generated-protocols/input-timestamps-unstable-v1-protocol.c
|
||||
d4bccda3513e1d826dd17ef366aa5927 vendor/sdl3/wayland-generated-protocols/keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h
|
||||
fdd6b29108b58ac5c3f98b55aa5e19c4 vendor/sdl3/wayland-generated-protocols/keyboard-shortcuts-inhibit-unstable-v1-protocol.c
|
||||
a21218c64cd9380aa0aedb2e689c1378 vendor/sdl3/wayland-generated-protocols/pointer-constraints-unstable-v1-client-protocol.h
|
||||
3cbac752f3f512a79ab15e1884e18001 vendor/sdl3/wayland-generated-protocols/pointer-constraints-unstable-v1-protocol.c
|
||||
aaf00bc4044eb265d3ac6e130019868e vendor/sdl3/wayland-generated-protocols/pointer-gestures-unstable-v1-client-protocol.h
|
||||
1baebafb8451da519f2b17e2e1382c8c vendor/sdl3/wayland-generated-protocols/pointer-gestures-unstable-v1-protocol.c
|
||||
1fad3c3c6aaf474057b970514ad070d7 vendor/sdl3/wayland-generated-protocols/pointer-warp-v1-client-protocol.h
|
||||
b528a81d00a82dbee4517de089495be0 vendor/sdl3/wayland-generated-protocols/pointer-warp-v1-protocol.c
|
||||
1ada2dd2afb0ab666c0bb59d6d18438d vendor/sdl3/wayland-generated-protocols/primary-selection-unstable-v1-client-protocol.h
|
||||
d4d5ac1a698a81edb78424e084bccf56 vendor/sdl3/wayland-generated-protocols/primary-selection-unstable-v1-protocol.c
|
||||
0e8b0e9eb5b2edc5a7f3baf75377ab07 vendor/sdl3/wayland-generated-protocols/relative-pointer-unstable-v1-client-protocol.h
|
||||
f23909e02b8f33cd26852fbb047199a8 vendor/sdl3/wayland-generated-protocols/relative-pointer-unstable-v1-protocol.c
|
||||
0cd95699c5aff59523563c54c0701edd vendor/sdl3/wayland-generated-protocols/tablet-v2-client-protocol.h
|
||||
d82f63372c8d449896417fa5c9e65c56 vendor/sdl3/wayland-generated-protocols/tablet-v2-protocol.c
|
||||
125ac9a47bdd809c8f4b6c81fb9fbf6c vendor/sdl3/wayland-generated-protocols/text-input-unstable-v3-client-protocol.h
|
||||
4a826de966f8964e8cd5a90204b97a78 vendor/sdl3/wayland-generated-protocols/text-input-unstable-v3-protocol.c
|
||||
812be7036d79cddc40ed0b4b7d43f57e vendor/sdl3/wayland-generated-protocols/viewporter-client-protocol.h
|
||||
f085a1cb6d17ce4c6486056f64454624 vendor/sdl3/wayland-generated-protocols/viewporter-protocol.c
|
||||
d6894dbf4a81eadb3294bfe49e20401e vendor/sdl3/wayland-generated-protocols/wayland-client-protocol.h
|
||||
aac93939e72a7850259c64b837cd8a81 vendor/sdl3/wayland-generated-protocols/wayland-protocol.c
|
||||
d4158f4c1239179cb9426b31ae43fdbe vendor/sdl3/wayland-generated-protocols/xdg-activation-v1-client-protocol.h
|
||||
80a8e814955edb1c20c96dae64997045 vendor/sdl3/wayland-generated-protocols/xdg-activation-v1-protocol.c
|
||||
b017421949c200196cdbe4845b129f33 vendor/sdl3/wayland-generated-protocols/xdg-decoration-unstable-v1-client-protocol.h
|
||||
5cf5387faa3dec0849c61bb6a263d331 vendor/sdl3/wayland-generated-protocols/xdg-decoration-unstable-v1-protocol.c
|
||||
c0caa0c1aa298321d52f2cdc4485f313 vendor/sdl3/wayland-generated-protocols/xdg-dialog-v1-client-protocol.h
|
||||
01cd9400d96b62f50b04529d92ebd5b7 vendor/sdl3/wayland-generated-protocols/xdg-dialog-v1-protocol.c
|
||||
2c6158bbe4053897bc8315a85685ac62 vendor/sdl3/wayland-generated-protocols/xdg-foreign-unstable-v2-client-protocol.h
|
||||
64bd23823cbabe3bf6d23aec47de1199 vendor/sdl3/wayland-generated-protocols/xdg-foreign-unstable-v2-protocol.c
|
||||
c00506fecfad56d4d3f11f176f72fcc8 vendor/sdl3/wayland-generated-protocols/xdg-output-unstable-v1-client-protocol.h
|
||||
b7cee41cf41b1fc092ae33eb1b3d26f8 vendor/sdl3/wayland-generated-protocols/xdg-output-unstable-v1-protocol.c
|
||||
ba0db564b119fc132da2de12673f1850 vendor/sdl3/wayland-generated-protocols/xdg-shell-client-protocol.h
|
||||
6822d3d673e2ad3de304a6f272fe3c4a vendor/sdl3/wayland-generated-protocols/xdg-shell-protocol.c
|
||||
fe4f0e2777032b09c9a6999128ae54e1 vendor/sdl3/wayland-generated-protocols/xdg-toplevel-icon-v1-client-protocol.h
|
||||
030ea30fff3013d76352bf5e8efdede7 vendor/sdl3/wayland-generated-protocols/xdg-toplevel-icon-v1-protocol.c
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <omp.h>
|
||||
const char ompver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'M',
|
||||
'P', '-', 'd', 'a', 't', 'e', '[',
|
||||
('0' + ((_OPENMP/100000)%10)),
|
||||
('0' + ((_OPENMP/10000)%10)),
|
||||
('0' + ((_OPENMP/1000)%10)),
|
||||
('0' + ((_OPENMP/100)%10)),
|
||||
('0' + ((_OPENMP/10)%10)),
|
||||
('0' + ((_OPENMP/1)%10)),
|
||||
']', '\0' };
|
||||
int main(void)
|
||||
{
|
||||
puts(ompver_str);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <omp.h>
|
||||
const char ompver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'M',
|
||||
'P', '-', 'd', 'a', 't', 'e', '[',
|
||||
('0' + ((_OPENMP/100000)%10)),
|
||||
('0' + ((_OPENMP/10000)%10)),
|
||||
('0' + ((_OPENMP/1000)%10)),
|
||||
('0' + ((_OPENMP/100)%10)),
|
||||
('0' + ((_OPENMP/10)%10)),
|
||||
('0' + ((_OPENMP/1)%10)),
|
||||
']', '\0' };
|
||||
int main(void)
|
||||
{
|
||||
puts(ompver_str);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
#include <omp.h>
|
||||
int main(void) {
|
||||
#ifdef _OPENMP
|
||||
omp_get_max_threads();
|
||||
return 0;
|
||||
#elif defined(__HIP_DEVICE_COMPILE__)
|
||||
return 0;
|
||||
#else
|
||||
breaks_on_purpose
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
#include <omp.h>
|
||||
int main(void) {
|
||||
#ifdef _OPENMP
|
||||
omp_get_max_threads();
|
||||
return 0;
|
||||
#elif defined(__HIP_DEVICE_COMPILE__)
|
||||
return 0;
|
||||
#else
|
||||
breaks_on_purpose
|
||||
#endif
|
||||
}
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,200 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.22
|
||||
|
||||
# The generator used is:
|
||||
set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles")
|
||||
|
||||
# The top level Makefile was generated from the following files:
|
||||
set(CMAKE_MAKEFILE_DEPENDS
|
||||
"CMakeCache.txt"
|
||||
"CMakeFiles/3.22.1/CMakeCCompiler.cmake"
|
||||
"CMakeFiles/3.22.1/CMakeCXXCompiler.cmake"
|
||||
"CMakeFiles/3.22.1/CMakeSystem.cmake"
|
||||
"CMakeFiles/VerifyGlobs.cmake"
|
||||
"CMakeFiles/cmake.verify_globs"
|
||||
"vendor/sdl3/CMakeFiles/SDL_build_config.h.intermediate"
|
||||
"vendor/sdl3/CMakeFiles/git-data/grabRef.cmake"
|
||||
"/home/lucas/fn_registry/cpp/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/apps/altsnap_jitter_test/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/apps/chart_demo/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/apps/engine_smoke/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/apps/primitives_gallery/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/apps/runtime_test/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/apps/shaders_lab/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/apps/text_editor_smoke/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/tests/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/.git/HEAD"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/3rdparty.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/FindLibUSB.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/GetGitRevisionDescription.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/GetGitRevisionDescription.cmake.in"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/PreseedEmscriptenCache.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/PreseedMSVCCache.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/PreseedNokiaNGageCache.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/SDL3Config.cmake.in"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/macros.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/sdlchecks.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/sdlcommands.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/sdlcompilers.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/sdlcpu.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/sdlmanpages.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/cmake/sdlplatform.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/include/build_config/SDL_build_config.h.cmake"
|
||||
"/home/lucas/fn_registry/cpp/vendor/sdl3/include/build_config/SDL_revision.h.cmake"
|
||||
"/home/lucas/fn_registry/projects/fn_monitoring/apps/registry_dashboard/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/projects/navegator/apps/navegator_dashboard/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/projects/online_data_recopilation/apps/odr_console/CMakeLists.txt"
|
||||
"/home/lucas/fn_registry/projects/osint_graph/apps/graph_explorer/CMakeLists.txt"
|
||||
"/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Config.cmake"
|
||||
"/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3ConfigVersion.cmake"
|
||||
"/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets-none.cmake"
|
||||
"/usr/lib/x86_64-linux-gnu/cmake/glfw3/glfw3Targets.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeCInformation.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeCXXInformation.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeCommonLanguageInclude.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeDependentOption.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeGenericSystem.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeInitializeConfigs.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeLanguageInformation.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakePackageConfigHelpers.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeParseArguments.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeParseImplicitLinkInfo.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakePushCheckState.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeSystemSpecificInformation.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CMakeSystemSpecificInitialize.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckCCompilerFlag.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckCSourceCompiles.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckCSourceRuns.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckCXXCompilerFlag.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckCXXSourceCompiles.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckFunctionExists.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckIncludeFile.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckIncludeFiles.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckLanguage.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckLibraryExists.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckLinkerFlag.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckSourceCompiles.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckStructHasMember.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/CheckSymbolExists.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Compiler/GNU-C.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Compiler/GNU-CXX.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Compiler/GNU.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindALSA.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindFontconfig.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindFreetype.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindGit.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindOpenGL.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindOpenMP.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindPackageMessage.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindSQLite3.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindThreads.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/FindX11.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/GNUInstallDirs.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Internal/CheckCompilerFlag.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Internal/CheckSourceCompiles.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Internal/CheckSourceRuns.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Platform/Linux-GNU-C.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Platform/Linux-GNU-CXX.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Platform/Linux-GNU.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Platform/Linux.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/Platform/UnixPaths.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/SelectLibraryConfigurations.cmake"
|
||||
"/usr/share/cmake-3.22/Modules/WriteBasicConfigVersionFile.cmake"
|
||||
)
|
||||
|
||||
# The corresponding makefile is:
|
||||
set(CMAKE_MAKEFILE_OUTPUTS
|
||||
"Makefile"
|
||||
"CMakeFiles/cmake.check_cache"
|
||||
)
|
||||
|
||||
# Byproducts of CMake generate step:
|
||||
set(CMAKE_MAKEFILE_PRODUCTS
|
||||
"CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/chart_demo/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/shaders_lab/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/primitives_gallery/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/text_editor_smoke/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/altsnap_jitter_test/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"vendor/sdl3/CMakeFiles/SDL_build_config.h.intermediate"
|
||||
"vendor/sdl3/CMakeFiles/git-data/HEAD"
|
||||
"vendor/sdl3/CMakeFiles/git-data/grabRef.cmake"
|
||||
"vendor/sdl3/CMakeFiles/git-data/head-ref"
|
||||
"vendor/sdl3/include-revision/SDL3/SDL_revision.h"
|
||||
"vendor/sdl3/SDL3Config.cmake"
|
||||
"vendor/sdl3/SDL3ConfigVersion.cmake"
|
||||
"vendor/sdl3/include-config-release/build_config/SDL_build_config.h"
|
||||
"vendor/sdl3/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/engine_smoke/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/runtime_test/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/registry_dashboard/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/graph_explorer/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/odr_console/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"apps/navegator_dashboard/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
"tests/CMakeFiles/CMakeDirectoryInformation.cmake"
|
||||
)
|
||||
|
||||
# Dependency information for all targets:
|
||||
set(CMAKE_DEPEND_INFO_FILES
|
||||
"CMakeFiles/imgui.dir/DependInfo.cmake"
|
||||
"CMakeFiles/implot.dir/DependInfo.cmake"
|
||||
"CMakeFiles/implot3d.dir/DependInfo.cmake"
|
||||
"CMakeFiles/imgui_node_editor.dir/DependInfo.cmake"
|
||||
"CMakeFiles/fn_framework.dir/DependInfo.cmake"
|
||||
"apps/chart_demo/CMakeFiles/chart_demo.dir/DependInfo.cmake"
|
||||
"apps/shaders_lab/CMakeFiles/shaders_lab.dir/DependInfo.cmake"
|
||||
"apps/primitives_gallery/CMakeFiles/primitives_gallery.dir/DependInfo.cmake"
|
||||
"apps/text_editor_smoke/CMakeFiles/text_editor_smoke.dir/DependInfo.cmake"
|
||||
"apps/altsnap_jitter_test/CMakeFiles/altsnap_jitter_test.dir/DependInfo.cmake"
|
||||
"vendor/sdl3/CMakeFiles/SDL3-static.dir/DependInfo.cmake"
|
||||
"apps/engine_smoke/CMakeFiles/engine_smoke.dir/DependInfo.cmake"
|
||||
"apps/runtime_test/CMakeFiles/runtime_test.dir/DependInfo.cmake"
|
||||
"apps/registry_dashboard/CMakeFiles/registry_dashboard.dir/DependInfo.cmake"
|
||||
"apps/graph_explorer/CMakeFiles/graph_explorer.dir/DependInfo.cmake"
|
||||
"apps/odr_console/CMakeFiles/odr_console.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/catch2.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_tween_curves.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_pie_chart_math.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_kpi_card_math.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_bar_chart_math.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_sql_parse.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_process_state_machine.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_file_poll_diff.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_tokens.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_button.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_select.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_text_input.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_badge.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_kpi_card.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_pie_chart.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_bar_chart.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_tree_view.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_modal_dialog.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_toolbar.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_toast.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_empty_state.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_page_header.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_dashboard_panel.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_dashboard_grid.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_sparkline.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_table_view.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_icon_button.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_pack_rgba8.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_should_pause.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_edge_static.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_types.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_sources.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_layouts.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_labels.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_viewport.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_force_layout_gpu.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_graph_icons.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_layout_storage.dir/DependInfo.cmake"
|
||||
"tests/CMakeFiles/test_visual.dir/DependInfo.cmake"
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
||||
/home/lucas/fn_registry/build/CMakeFiles/imgui.dir
|
||||
/home/lucas/fn_registry/build/CMakeFiles/implot.dir
|
||||
/home/lucas/fn_registry/build/CMakeFiles/implot3d.dir
|
||||
/home/lucas/fn_registry/build/CMakeFiles/imgui_node_editor.dir
|
||||
/home/lucas/fn_registry/build/CMakeFiles/fn_framework.dir
|
||||
/home/lucas/fn_registry/build/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/chart_demo/CMakeFiles/chart_demo.dir
|
||||
/home/lucas/fn_registry/build/apps/chart_demo/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/chart_demo/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/chart_demo/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/shaders_lab/CMakeFiles/shaders_lab.dir
|
||||
/home/lucas/fn_registry/build/apps/shaders_lab/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/shaders_lab/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/shaders_lab/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/primitives_gallery/CMakeFiles/primitives_gallery.dir
|
||||
/home/lucas/fn_registry/build/apps/primitives_gallery/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/primitives_gallery/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/primitives_gallery/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/text_editor_smoke/CMakeFiles/text_editor_smoke.dir
|
||||
/home/lucas/fn_registry/build/apps/text_editor_smoke/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/text_editor_smoke/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/text_editor_smoke/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/altsnap_jitter_test/CMakeFiles/altsnap_jitter_test.dir
|
||||
/home/lucas/fn_registry/build/apps/altsnap_jitter_test/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/altsnap_jitter_test/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/altsnap_jitter_test/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/vendor/sdl3/CMakeFiles/SDL3-static.dir
|
||||
/home/lucas/fn_registry/build/vendor/sdl3/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/vendor/sdl3/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/vendor/sdl3/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/engine_smoke/CMakeFiles/engine_smoke.dir
|
||||
/home/lucas/fn_registry/build/apps/engine_smoke/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/engine_smoke/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/engine_smoke/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/runtime_test/CMakeFiles/runtime_test.dir
|
||||
/home/lucas/fn_registry/build/apps/runtime_test/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/runtime_test/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/runtime_test/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/registry_dashboard/CMakeFiles/registry_dashboard.dir
|
||||
/home/lucas/fn_registry/build/apps/registry_dashboard/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/registry_dashboard/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/registry_dashboard/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/graph_explorer/CMakeFiles/graph_explorer.dir
|
||||
/home/lucas/fn_registry/build/apps/graph_explorer/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/graph_explorer/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/graph_explorer/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/odr_console/CMakeFiles/odr_console.dir
|
||||
/home/lucas/fn_registry/build/apps/odr_console/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/odr_console/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/odr_console/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/navegator_dashboard/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/apps/navegator_dashboard/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/apps/navegator_dashboard/CMakeFiles/rebuild_cache.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/catch2.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_tween_curves.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_pie_chart_math.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_kpi_card_math.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_bar_chart_math.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_sql_parse.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_process_state_machine.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_file_poll_diff.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_tokens.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_button.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_select.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_text_input.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_badge.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_kpi_card.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_pie_chart.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_bar_chart.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_tree_view.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_modal_dialog.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_toolbar.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_toast.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_empty_state.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_page_header.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_dashboard_panel.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_dashboard_grid.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_sparkline.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_table_view.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_icon_button.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_pack_rgba8.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_should_pause.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_edge_static.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_types.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_sources.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_layouts.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_labels.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_viewport.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_force_layout_gpu.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_graph_icons.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_layout_storage.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test_visual.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/test.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/edit_cache.dir
|
||||
/home/lucas/fn_registry/build/tests/CMakeFiles/rebuild_cache.dir
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
||||
@@ -0,0 +1 @@
|
||||
# This file is generated by CMake for checking of the VerifyGlobs.cmake file
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user