Rebuild source dependencies when package output settings change
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- ocaml
- Bereich
- build-system, compilers
Rechercherichtung
Beginne damit, die bestehende Ungültigmachung von Abhängigkeiten für Root-Source-Map-Argumente während der Initialisierung nachzuverfolgen, und untersuche compiler-info.json zusammen mit den generierten .cmj-Artefakten. Untersuche anschließend das Setup des Integrationstests für die beiden Projekte, die eine Quellabhängigkeit gemeinsam nutzen. Als abgeschlossen gilt die Aufgabe, wenn Änderungen an den Paket-Ausgabeeinstellungen dazu führen, dass Rewatch die Abhängigkeit neu erstellt und beide Szenarien zur Modulreihenfolge erfolgreich kompiliert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
Rewatch can reuse stale dependency build artifacts when projects with different package-specs build the same source dependency.
We encountered this while working on moving Belt into the separate @rescript/belt package in the ReScript compiler repository:
- The regular analysis tests build
@rescript/beltthrough a CommonJS test project. - The reanalyze tests subsequently use the same package through an ES module test project.
- Both projects reference the same source dependency and therefore share its build artifacts.
- Rewatch considers the existing Belt artifacts current and does not rebuild them for the second project.
- The reanalyze tests fail with a misleading
Missing dependency Belt_*error.
This is not a particularly common project setup, but the compiler repository exposes the underlying invalidation problem because multiple test projects with different output formats build the same source dependency in sequence.
Dependencies are compiled using the consuming root project's package output settings. However, these settings are not recorded in lib/bs/compiler-info.json. Belt's .cmj files therefore still contain only the CommonJS package-output metadata when the ES module project is built.
The dependency files and compiler search path are present; it is the package-output metadata inside the .cmj files that is stale.
Proposed solution
Include the effective root package output settings in each package's compiler-info.json.
The stored value should contain a normalized representation of every effective package spec, including:
- Module format
in-source- Resolved suffix, including the root-level suffix fallback
During initialization, compare the current package output settings with those stored in compiler-info.json. If they differ, clean and rebuild the affected dependency.
This follows the existing mechanism that invalidates dependency builds when root source-map arguments change.
Testing
Add an integration test with two projects sharing a source dependency:
- Build the dependency through a CommonJS project.
- Build it through an ES module project without explicitly cleaning the dependency.
- Verify that Rewatch rebuilds the dependency and that the second project compiles successfully.
Ideally, test the reverse order as well.
- Vorherrschende Sprache
- OCaml
- Sterne
- 7.5k
- Forks
- 485
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 55
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus rescript-lang/rescript
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
rescript-lang/rescript#8659 · 2 Kommentare · 2 Reaktionen ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
rescript-lang/rescript#8647 ·
-
rescript-lang/rescript#8632 · 1 zugewiesene Person ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 28/100
rescript-lang/rescript#8624 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
rescript-lang/rescript#8596 · 2 Kommentare ·
Alle Issues in rescript-lang/rescript
Ähnliche Issues
-
core dependencies
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 80/100
-
bug github_actions
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
registrystack/registry-stack#1393 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Name consistency Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
eellak/triplestore#65 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100