Deleted generated file is not regenerated while the project cache is valid

Abierto
#5,229 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
fsharp, javascript
Área
compilers

Línea de trabajo

Start by reading getFilesToCompile and areCompiledFilesUpToDate in src/Fable.Cli/Main.fs, then trace how the project cache is written and read. The fix is done when a deleted output is regenerated without repeatedly recompiling sources that legitimately produce no output; the issue suggests tracking those sources alongside the cache.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

With a warm cache, deleting one generated file and running Fable again reports Skipped compilation because all generated files are up-to-date!, exits 0, and the file stays missing.

  1. Create a project with two files, Lib.fs and Main.fs, and compile it once: dotnet fable Test.fsproj --outDir out
  2. rm out/Lib.js
  3. dotnet fable Test.fsproj --outDir out

Expected: out/Lib.js is regenerated. Actual: the run is skipped and out/Lib.js is still missing. Reproduced on Linux with Fable built from main, JavaScript target; the logic is target independent.

Cause: getFilesToCompile in src/Fable.Cli/Main.fs selects a source whose output is missing, then areCompiledFilesUpToDate treats a missing output as up to date and skips the compilation it was just asked for. The --noCache flag forces a re-crack, which disables the skip, so that is the workaround.

The obvious fix, returning false for a missing output, was tried in #4870 and dropped. Fable never writes an output file when the generated code is empty, and erased bindings generate nothing, so a missing output cannot be told apart from a never-written one. With that change every project depending on a bindings package recompiles on every run: Feliz has 29 sources and 9 outputs, Fable.ReactDom.Types has one source and none.

A fix needs Fable to remember which sources compiled to empty output, for example a list written next to the project cache after each compilation, so a missing output is treated as up to date only for a source in that list that is older than the list. Other approaches welcome.

Related: #4870.

Lenguaje dominante
F#
Estrellas
3.2k
Forks
335
Merge medio
18 h 57 min
PR fusionados (30 d)
154

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

  • Sin Dockerfile ni archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de fable-compiler/Fable

Todos los issues de fable-compiler/Fable

Issues similares

Más issues de Compilers

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.