Lara-4 migration (WeaverGen2 + TS toolchain) - #64
Open
lm-sousa wants to merge 4 commits into
Open
Conversation
Open
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8537a59c7c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Replace the XML weaver specification (joinPointModel.xml, artifacts.xml, actionModel.xml) with the Java DSL spec class FortranSpec (new src-spec source set), and generate the abstract joinpoint classes with WeaverGen2 instead of the old WeaverGenerator. - FortranSpec: prefix 'Fortran', root join point 'program', all 53 join points from the XML model, keeping the LARA-visible names identical. Concrete joinpoints renamed to the WeaverGen2 convention <Prefix><JpName> (F* -> Fortran*, e.g. FProgram -> FortranProgram; FDoConstruct -> FortranDoStatement). BinaryOperatorKind and DoKind enums now carry the values the old implementation actually produced (enum names such as ADD, instead of the stale lowercase XML list). - New editable base FortranJoinpoint holds the implementation shared by all join points (code, children, descendants, scopeNodes, parent, root, leftJp/rightJp, getAncestor, contains, indexOfSelf, insert, insertBefore/After, replaceWith, detach, copy/deepCopy); the generic fallback join point is now FortranJoinpoint itself. - FortranWeaver: drop buildLanguageSpecification/buildLangSpecs and the static getFactory()/getContext() helpers (weaver is threaded through join points and AstFactory), use setData in begin(), typed getRootJp(), add getAstMethods() bridge backed by the new FortranAstMethods. - AstFactory methods take the weaver as first argument, mirroring the clava importable factory; callers in LARA pass Weaver.getWeaverEngine(). - Boxed types per conventions: indexOfSelf/contains are primitive (INT/BOOLEAN), line/column stay boxed (INTEGER) but return null (the Fortran AST has no source locations). - Gradle: LangSpec2/WeaverGen2 includeBuilds, generateWeaver JavaExec running WeaverGen2Cli, spec source set, syncFortranJsJavaBinaries task finalizing installDist to refresh Fortran-JS/java-binaries. - Delete committed generated abstracts, old XML resources and FortranWeaverException; gitignore the new generated paths. Also fixed in passing: insertBefore(joinpoint) used to insert AFTER (copied-over bug from the old generator stubs); getDescendants and other internal factories were still calling the removed 1-arg FortranJoinpoints.create; FortranFile/FInitialization/FSpecification/ FMainProgram getNode returned null; the unused FortranMainProgram join point is now reachable from the factory.
- Move sources src-api -> api and src-code -> code; drop the transpile step (build is now a single tsc noEmit typecheck over a root tsconfig with NodeNext, strict, verbatimModuleSyntax, erasableSyntaxOnly). - package.json: version 4.0.0 (aligning with the lara-4 major, replaces 22.2.1), @specs-feup/lara ^4.0.0, package exports map, bin entry pointing at ./code/index.ts, oxlint/oxfmt/vitest scripts and prepack java-binaries validation; remove jest/ts-jest/eslint tooling. - jest -> vitest: single vitest.config.ts using createWeaverVitestConfig with the weaver configuration; port Query.test.ts to the lara-4 test helpers from @specs-feup/lara/vitest. - eslint -> oxlint: oxlint.config.ts extending @specs-feup/lara's config; delete the eslint config. - WeaverConfiguration: weaverFileName and the new api/Joinpoints.ts side effects import; remove the obsolete sideEffects.ts. - Regenerate api/Joinpoints.ts with lara-build-interfaces from the WeaverGen2-generated FortranWeaver.json; update imports to .ts extensions; enum attributes (DoKind, BinaryOperatorKind) are now typed const-object enums. - FortranJoinPoints.ts: thread the weaver engine into the Java AstFactory (Weaver.getWeaverEngine()), mirroring clava's importable-AstFactory API. - Parameter properties in the loop passes replaced with explicit fields (erasableSyntaxOnly); remove unused import and unnecessary spreads flagged by oxlint. - Update the node versions in the nightly workflow to match the lara-4 toolchain (25.x/24.x).
The lara-4 pull requests are stacked on multi-weaver; without this the PR pushes run no CI at all.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Note
omen-alpha responding on behalf of @lm-sousa
Problem
The repo's
multi-weaverbranch (weaver-instance refactor: removal ofTHREAD_LOCAL_WEAVER, Weaver engine threading through the joinpoints, CI fixes) was 600+ commits behindmain, and the whole weaver stack needs to move to lara-4 (@specs-feup/lara4.0.0) to stay in lockstep with clava and lara-framework.Solution
Rebased
multi-weaverontomain(#65, incl. theFortranWeaver.jsonconflict resolution in favor of main's regeneration, which already contained all multi-weaver attribute additions) and migrated both halves to the lara-4 stack, mirroring what was done in clava:Java (
FortranWeaver): the three XML specs (joinPointModel.xml,artifacts.xml,actionModel.xml) are replaced by the Java DSL spec classFortranSpec(newsrc-specsource set); the build now usesLangSpec2/WeaverGen2(LanguageSpecification/WeaverGeneratorno longer exist in lara-framework). Abstract joinpoints are generated by WeaverGen2 (CRTP zig-zag hierarchy) instead of being committed; all concrete joinpoints were converted to the new API (getNodeImpl(),*Implmethods, typedInsertPosition). A GradleSynctask now refreshesFortran-JS/java-binariesoninstallDist.JS (
Fortran-JS): sources movedsrc-api→api,src-code→code(no transpilation step anymore — the package ships raw.ts); version 4.0.0 with@specs-feup/lara ^4.0.0; single noEmittsconfig(TS7,erasableSyntaxOnly,verbatimModuleSyntax); jest→vitest viacreateWeaverVitestConfigfrom lara-4; eslint→oxlint/oxfmt;api/Joinpoints.tsregenerated withlara-build-interfacesfrom the generatedFortranWeaver.json; nightly CI bumped to Node 24/25 (Java CI stays on 21).Depends on the
lara-4branches ofspecs-feup/lara-frameworkandspecs-feup/specs-java-libs(CI's branch-resolver resolves them by branch name).Stack
main←multi-weaver(#65) ← this PR (lara-4).Migration notes / judgment calls
main's ~55 newF*joinpoint classes andimportable/AstFactorystill used 1-arg constructors predating the weaver-threading refactor — all threaded with theFortranWeaverinstance as part of the CRTP conversion.FortranWeaver.getContext()/getFactory()statics (which called the removedgetFortranWeaver()) became instance methods, andAstFactorynow takes the weaver as first parameter.insertBefore(jp)actually inserted after;FortranMainProgramwas never registered in the joinpoint factory;getNode()returnednullinFortranFile/FInitialization/FSpecification/FMainProgram.F<X>→Fortran<X>(e.g.FProgram→FortranProgram;FDoConstruct→FortranDoStatementfor joinpointdoStatement) — WeaverGen2 validates that concrete classes are named<Prefix><CapitalizedJpName>. PrefixFortran(notF) keeps the weaver class/JSON namedFortranWeaver/FortranWeaver.json. LARA-visible joinpoint names are byte-identical to the XMLs.BinaryOperatorKindenum carries the real runtime values (ADD,SUBTRACT, ...) — the old XML's inline{add, sub, ...}values were stale; the old implementation already returned the AST enum names.line/column(INTEGER, impl returnsnull— the Fortran AST has no source locations), following clava's conventions.scopeNodesnow returns the children (the old implementation threwNotImplementedException).Verification
gradle clean installDist(includesgenerateWeaver): BUILD SUCCESSFUL. (Gradle test suite needs flang, not available in the verification environment.)tscclean,oxlintclean, vitest: 2/2 passed (same as the main-line baseline — the weaver actually executes and weaves Fortran).