Skip to content

Commit 32e799c

Browse files
committed
runtime: perf, internalization builder
1 parent 50a0570 commit 32e799c

File tree

13 files changed

+2878
-158
lines changed

13 files changed

+2878
-158
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,4 @@ MigrationBackup/
354354
/.vscode
355355
/reference
356356
/src/reference
357+
/src/_internalization_out

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,38 @@ FastCloner's source generator is carefully engineered for zero impact on IDE res
363363
- **No Compilation Trashing**: We avoid expensive `CompilationProvider` combinations that break generator caching. Code generation only re-runs when your data models actually change, not on every keystroke or unrelated edit.
364364
- **Allocation Free**: `EquatableArray` collections ensure that change detection is instant and creates no garbage collection pressure.
365365

366+
## Internalization
367+
368+
For consumers who wish to embed FastCloner directly, without adding a dependency, use the [internalization builder project](LINK).
369+
370+
Example command:
371+
372+
```bash
373+
dotnet run --project src/FastCloner.Internalization.Builder/FastCloner.Internalization.Builder.csproj -- \
374+
--root-namespace MyLibrary.FastCloner \
375+
--output ../MyLibrary/FastCloner \
376+
--preprocessor "MODERN=true;" \
377+
--visibility internal \
378+
--public-api none \
379+
--runtime-only true \
380+
--self-check
381+
```
382+
383+
Important options:
384+
385+
- `--root-namespace <ns>`: Rewrites `FastCloner` namespaces to your target root namespace.
386+
- `--preprocessor <SYMBOL=VALUE;...>`: Per-symbol preprocessor transformation input.
387+
- `VALUE=true|false` is recognized as boolean and enables full condition resolution/removal where possible.
388+
- any other value is used as direct replacement in `#if` expressions (e.g., `SOMETHING=random_text`).
389+
- `--implicit-usings <ns1;ns2;...>`: Namespaces the target project already imports implicitly.
390+
Generated global usings for these namespaces are omitted.
391+
Default is empty, so generated code carries explicit usings.
392+
- `--visibility <public|internal>`: Top-level visibility rewrite policy.
393+
- `--public-api <none|fastcloner|extensions|behaviors|all>`: Keeps selected public surface when `--visibility internal` is used.
394+
- `--runtime-only <true|false>`: Includes only runtime clone engine files.
395+
- `--dry-run`: Prints planned output files and transform stats without writing.
396+
- `--self-check`: Compiles generated source tree and reports compile errors.
397+
366398
## Contributing
367399

368400
If you are looking to add new functionality, please open an issue first to verify your intent is aligned with the scope of the project. The library is covered by over [700 tests](https://github.com/lofcz/FastCloner/tree/next/src/FastCloner.Tests), please run them against your work before proposing changes. When reporting issues, providing a minimal reproduction we can plug in as a new test greatly reduces turnaround time.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<LangVersion>preview</LangVersion>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<SignAssembly>true</SignAssembly>
9+
<AssemblyOriginatorKeyFile>..\FastCloner.snk</AssemblyOriginatorKeyFile>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="[4.14.0, )" />
14+
</ItemGroup>
15+
</Project>

0 commit comments

Comments
 (0)