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

オープン
#5,229 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
fsharp, javascript
領域
compilers

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
F#
スター
3.2k
フォーク
335
平均マージ
18時間 57分
マージ済み PR(30日)
154

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fable-compiler/Fable のほかの issue

fable-compiler/Fable の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。