[Beam] Generate rebar3 project scaffold automatically#4387
Merged
Conversation
When compiling to Erlang/BEAM, Fable now generates a complete rebar3 project structure alongside the .erl files: - .erl files are placed in src/ (project files) and fable_modules/<dep>/src/ (library files), following rebar3 conventions - rebar.config is generated with project_app_dirs pointing to fable_modules/* so rebar3 treats each NuGet dep as a sub-app - Each dep gets src/<app>.app.src and rebar.config (idempotent, regenerated if Fable-generated marker is present) - The root project gets src/<project>.app.src The scaffold is generated after every successful BEAM compilation, making it stateless and watch-mode-safe. Existing rebar.config files without the Fable marker are left untouched (warning emitted). The test runner is updated to use `rebar3 compile` instead of manual erlc invocations, validating the scaffold end-to-end. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…README The beam test runner now uses rebar3 to compile the generated scaffold. Add rebar3-version to the erlef/setup-beam action so it is available on the CI runner, and document Erlang/OTP + rebar3 as requirements. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ctName, log rebar.config updates
- Extract `Pipeline.Beam.normalizeAppName` as single source of truth for OTP app name normalization; use it in both `deriveDepAppName` and `compilationCycle` (fixes missing `.Trim('_')` at call site)
- Compute `testProjectName` in `Test/Beam.fs` from the project filename instead of hardcoding `"fable_tests_beam"`
- Log `[BEAM] Updated rebar.config` when the generated file changes content (not just on first creation)
- Update CHANGELOG
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…language check first Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
When Fable compiles F# to Erlang/BEAM, it now generates a complete, immediately buildable rebar3 project structure as a side effect of compilation — no extra steps required.
What's generated
.erlfiles are placed insrc/(project) andfable_modules/<dep>/src/(libraries), following rebar3 conventionsrebar.configwith{project_app_dirs, [".", "fable_modules/*"]}so rebar3 treats each NuGet dep as a sub-appsrc/<project>.app.srcfor the root applicationfable_modules/<dep>/src/<app>.app.srcandrebar.configfor each dependencyDesign
%% Generated by Fable - safe to regeneratemarker are always refreshed; user-writtenrebar.configwithout the marker is left alone (warning emitted)Fable.Logging.0.10.0→fable_logging,fable-library-beam→fable_library_beamTest runner
./build.sh test beamnow usesrebar3 compileinstead of manualerlcinvocations, validating the scaffold end-to-end. All 2247 tests pass.Test plan
dotnet build src/Fable.Cli/Fable.Cli.fsproj— builds cleanly./build.sh test beam— all 2247 tests pass via rebar3🤖 Generated with Claude Code