Skip to content

Add Agnostic importer - #159

Merged
jecisc merged 19 commits into
v3from
importer
Nov 16, 2026
Merged

jecisc merged 19 commits into
v3from
importer

Conversation

@jecisc

@jecisc jecisc commented Nov 16, 2026

Copy link
Copy Markdown
Member

This PR moves the importer API into FAST, so that a language importer and its users share one entry point.

  • FASTTImporter trait, used on the instance side and the class side of each importer. A language importer implements parse:into: and may override extensions.
  • FASTAgnosticImporter imports files and folders without choosing the importer. It groups the files by importer, one model per language, and answers a dictionary from each model to its files, with the files that no importer handles under nil.
  • Missing projects are loaded through a strategy set on the instance side: FASTAskOrLoadStrategy (default), FASTAlwaysLoadStrategy or FASTNeverLoadStrategy.
  • Importer descriptions answer isWorking and isProjectLoaded, and loadAll skips the descriptions that do not work. FAST-Pharo and FAST-Fortran are flagged for now.
  • The importer section of the README links to resources/doc/importers.md, and AGENTS.md describes the rules.

jecisc added 19 commits October 27, 2026 18:46
FASTAgnosticImporter finds the classes that use the FASTTImporter class trait, and picks the importer whose extensions match the file. Two importers for the same extension raise FASTAmbiguousImporterError. The trait's extensions default to none, and its isAbstract answers false, so abstract importers can be skipped
…aded

A description is loaded when an importer handling one of its extensions is present in the image. Checking the baseline name was not reliable, since a baseline can be loaded without its importer. Descriptions no longer name their importer class, so renaming a class does not require any change in them.
loadMissingImporterFor: finds a working description that handles the file's extension and whose importer is not present. In an interactive image the user is asked first, with a Spec confirmation dialog. Otherwise the project is loaded directly. The decision is a parameter, so the two paths can be tested without a UI or the network.
The importer section now describes the FASTTImporter trait on both sides, FASTAgnosticImporter with its class-side helpers, the loading of missing projects, and the working flag of the descriptions. The tools group now contains the importer packages, and All is core, tools and deprecated.
…ow to import a file without choosing its importer, what happens when no loaded importer handles it or several do, how to write an importer with the FASTTImporter trait, and which importers are listed but not loaded.
FASTAgnosticImporter parseFolder: and parseFiles: group the files by importer, and each importer fills one model. The answer is a dictionary from each model to the files that filled it, with the files that no importer handles under nil. Whether a missing project may be loaded is decided by a strategy set on the instance side: FASTAskOrLoadStrategy (the default), FASTAlwaysLoadStrategy or FASTNeverLoadStrategy. The README has a quickstart, and the full guide is in resources/doc/importers.md.
The tests used the Java and CSS importers, which are not loaded in the CI, so they failed there. They now use FASTExampleLoneImporter and FASTLoneImporterDescription from the test package.
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 43892867334

Coverage increased (+1.9%) to 26.132%

Details

  • Coverage increased (+1.9%) from the base build.
  • Patch coverage: 271 uncovered changes across 14 files (147 of 418 lines covered, 35.17%).
  • No coverage regressions found.

Uncovered Changes

Top 10 Files by Coverage Impact Changed Covered %
src/FAST-Importer/FASTImporterDescription.class.st 68 10 14.71%
src/FAST-Importer/FASTAgnosticImporter.class.st 107 82 76.64%
src/FAST-Importer/FASTCSSImporterDescription.class.st 24 4 16.67%
src/FAST-Importer/FASTHTMLImporterDescription.class.st 24 4 16.67%
src/FAST-Importer/FASTSCSSImporterDescription.class.st 24 4 16.67%
src/FAST-Importer/FASTXMLImporterDescription.class.st 24 4 16.67%
src/FAST-Importer/FASTYAMLImporterDescription.class.st 24 4 16.67%
src/FAST-Importer/FASTJavaImporterDescription.class.st 20 4 20.0%
src/FAST-Importer/FASTPharoImporterDescription.class.st 21 5 23.81%
src/FAST-Importer/FASTTypeScriptImporterDescription.class.st 20 4 20.0%
Total (16 files) 418 147 35.17%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2231
Covered Lines: 583
Line Coverage: 26.13%
Coverage Strength: 0.52 hits per line

💛 - Coveralls

@jecisc
jecisc merged commit 1258095 into v3 Nov 16, 2026
6 checks passed
@jecisc
jecisc deleted the importer branch November 16, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants