Skip to content

Commit 098582c

Browse files
committed
2 parents 801b7ef + 7d5265e commit 098582c

21 files changed

Lines changed: 209 additions & 646 deletions

File tree

.github/workflows/build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- name: Setup dotnet
18-
uses: actions/setup-dotnet@v2
18+
uses: actions/setup-dotnet@v4
1919
with:
2020
dotnet-version: ${{ matrix.dotnet }}
2121
- name: Restore tools
2222
run: dotnet tool restore
23+
- name: Restore dependencies
24+
run: dotnet paket restore
2325
- name: Run Test
2426
run: dotnet build -c Release -t:Test

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
cd docs
5151
hugo \
5252
--minify \
53-
--baseURL "${{ steps.pages.outputs.base_url }}/"
53+
--baseURL "${{ steps.pages.outputs.base_url || 'https://moiraesoftware.github.io/Myriad' }}/"
5454
env:
5555
HUGO_ENVIRONMENT: production
5656
HUGO_ENV: production

.github/workflows/publish.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,21 @@ jobs:
3434
- name: Validate version
3535
run: |
3636
VERSION="${{ steps.tag_name.outputs.current_version }}"
37-
# Require at least three numeric segments (X.Y.Z), optionally followed by a pre-release suffix.
37+
# Require exactly three numeric segments (X.Y.Z), optionally followed by a pre-release suffix.
3838
# This prevents 2-segment tags like v0.85 (which would publish as 0.85.0 instead of 0.8.5).
39-
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+'; then
39+
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
4040
echo "::error::Version '$VERSION' does not match the required X.Y.Z format. Did you mean to add a missing segment (e.g. '0.85' should be '0.8.5')?"
4141
exit 1
4242
fi
4343
# Verify the version matches VersionPrefix in Directory.Build.props so that the tag and
4444
# source code are always in sync.
4545
EXPECTED=$(sed -n 's/.*<VersionPrefix[^>]*>\([^<]*\)<\/VersionPrefix>.*/\1/p' Directory.Build.props | head -1)
46-
if [ "$VERSION" != "$EXPECTED" ] && ! echo "$VERSION" | grep -q "^${EXPECTED}-"; then
46+
if [ -z "$EXPECTED" ]; then
47+
echo "::error::Could not extract VersionPrefix from Directory.Build.props."
48+
exit 1
49+
fi
50+
EXPECTED_ESCAPED=$(printf '%s' "$EXPECTED" | sed 's/[.]/[.]/g')
51+
if [ "$VERSION" != "$EXPECTED" ] && ! echo "$VERSION" | grep -qE "^${EXPECTED_ESCAPED}-"; then
4752
echo "::error::Tag version '$VERSION' does not match VersionPrefix '$EXPECTED' in Directory.Build.props. Update Directory.Build.props before tagging."
4853
exit 1
4954
fi

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.8.6] - 2026-03-21
910
### Fixed
11+
- Build CI workflow (`build.yml`) now uses `actions/checkout@v4` and `actions/setup-dotnet@v4` (previously v3/v2) and includes an explicit `dotnet paket restore` step.
12+
- `Myriad.Sdk` `PackageDownload` is now conditional — skipped when consumers override `MyriadSdk_Generator_Exe`, preventing unnecessary network downloads and offline build failures.
13+
- Package ID casing normalised to `Myriad` in `Myriad.Sdk.props` (was `myriad`).
14+
- Publish workflow version validation hardened: regex anchored with `$`, dots escaped in grep, early failure on missing `VersionPrefix`.
15+
- Plugin loader now logs `ReflectionTypeLoadException.LoaderExceptions` to stderr in `--verbose` mode.
16+
- Removed orphaned `Quotations.fs` (dead code referencing non-existent `Microsoft.FSharp.Compiler.*` namespaces).
17+
- Sample project updated from stale NuGet v0.5.1 references to local `ProjectReference` imports.
1018
- Publish workflow now supports manual dispatch via `workflow_dispatch` input, uses `$GITHUB_OUTPUT` instead of deprecated `::set-output`, and replaces archived GitHub Actions with `softprops/action-gh-release@v2`. A missing `dotnet paket restore` step was also added before build and test steps. (#234)
1119
- `Myriad.Sdk.proj` now uses `PackageDownload` instead of `PackageReference` for the `Myriad` tool dependency, resolving **NU1102** and **NU1212** errors that caused every publish attempt to fail since v0.8.4. Consumers of `Myriad.Sdk` also get the matching `Myriad` package placed in the NuGet cache automatically via a `PackageDownload` item in `Myriad.Sdk.props`. (#236)
1220
- `build.proj` Pack target now normalises 2-segment version numbers (e.g. `0.85`) to 3-segment (`0.85.0`) before passing them to `dotnet pack`/`dotnet restore`, preventing a Paket nuspec filename mismatch that caused pack to fail when using versions like `/p:Version=0.85`. (#238)
13-
- Publish workflow now requires 3-segment version tags (e.g. `v0.8.5`, not `v0.85`) and validates that the tag version matches `VersionPrefix` in `Directory.Build.props`, preventing accidental releases under the wrong version number (e.g. `0.85.0` instead of `0.8.5`). (#239)
21+
- Publish workflow now requires 3-segment version tags (e.g. `v0.8.5`, not `v0.85`) and validates that the tag version matches `VersionPrefix` in `Directory.Build.props`, preventing accidental releases under the wrong version number (e.g. `0.85.0` instead of `0.8.5`). (#239, #252)
22+
23+
### Changed
24+
- `Ast.extractTypeDefn` and `Ast.ModuleOrNamespace.getTypeDefns` now share a single private `extractTypesFromDecls` helper, eliminating an identical nested `extractTypes` definition that was duplicated in both functions. (#262)
25+
- `resolveCaseIdent` helper extracted from `DUCasesGenerator` into `GeneratorHelpers`, eliminating duplication with `LensesGenerator`. (#253)
26+
- `generateModules` and `filterByAttribute` helpers extracted into `GeneratorHelpers`, eliminating the duplicate `Generate` pipeline boilerplate in `DUCasesGenerator` and `FieldsGenerator`. (#241, #255, #257, #258)
27+
- `createTypedNamedParen` helper extracted into `GeneratorHelpers`, eliminating thirteen identical `SynPat.CreateNamed |> SynPat.CreateTyped |> SynPat.CreateParen` expressions. (#265)
28+
- `filterTypes` helper extracted into `Ast`, eliminating five identical inline filter expressions. (#250)
29+
- Expecto test framework updated from 10.2.1 to 10.2.3 (patch). (#243)
1430

1531
## [0.8.5]
1632
### Fixed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<GitHome>https://github.com/$(gitOwner)</GitHome>
66
<GitUrl>$(gitHome)/$(gitName)</GitUrl>
77
<NupkgsDir>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)/bin/nupkg"))</NupkgsDir>
8-
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">0.8.5</VersionPrefix>
8+
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">0.8.6</VersionPrefix>
99
<Version Condition=" '$(Version)' == '' ">$(VersionPrefix)$(VersionSuffix)</Version>
1010
<!-- pack stuff -->
1111
<TargetFrameworks>net9.0</TargetFrameworks>

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ If you enjoy this repo and wanted to shown your appriciation etc then I do have
2121
To use Myriad via its MSBuild support you add the `Myriad.Core` and `Myriad.Sdk` package references:
2222
```xml
2323
<ItemGroup>
24-
<PackageReference Include="Myriad.Core" Version="0.8.4" />
25-
<PackageReference Include="Myriad.Sdk" Version="0.8.4" />
24+
<PackageReference Include="Myriad.Core" Version="0.8.6" />
25+
<PackageReference Include="Myriad.Sdk" Version="0.8.6" />
2626
</ItemGroup>
2727
```
2828

@@ -158,8 +158,8 @@ The full fsproj is detail below:
158158
</Compile>
159159
</ItemGroup>
160160
<ItemGroup>
161-
<PackageReference Include="Myriad.Core" Version="0.8.4" />
162-
<PackageReference Include="Myriad.Sdk" Version="0.8.4" />
161+
<PackageReference Include="Myriad.Core" Version="0.8.6" />
162+
<PackageReference Include="Myriad.Sdk" Version="0.8.6" />
163163
</ItemGroup>
164164
</Project>
165165
```
@@ -210,7 +210,7 @@ Then add a new folder `build` with the `Generator.props` file within:
210210
```xml
211211
<Project>
212212
<ItemGroup>
213-
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../lib/netstandard2.1/Generator.dll" />
213+
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../lib/net9.0/Generator.dll" />
214214
</ItemGroup>
215215
</Project>
216216
```
@@ -220,7 +220,7 @@ Often an additional props file (In this sample the file would be `Generator.InTe
220220
```xml
221221
<Project>
222222
<ItemGroup>
223-
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../bin/$(Configuration)/netstandard2.1/Generator.dll" />
223+
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../bin/$(Configuration)/net9.0/Generator.dll" />
224224
</ItemGroup>
225225
</Project>
226226
```
@@ -248,18 +248,18 @@ The nuget package for Myriad can be found here:
248248
[Nuget package](https://www.nuget.org/packages/myriad/).
249249

250250
## Dotnet template
251-
A dotnet template for a Myriad plugin/generator is available here:
251+
A dotnet template for a Myriad plugin/generator is available on NuGet:
252252
```
253253
#install dotnet template
254-
dotnet new -i Myriad.Templates
254+
dotnet new install Myriad.Templates
255255
256256
#create myriad generator from the template
257257
dotnet new myriadgenerator -n myMyriadPlugin
258258
```
259259

260260
## How to build and test
261261

262-
1. Make sure you have .Net Core SDK installed - check required version in [global.json](global.json)
262+
1. Make sure you have .NET SDK installed - check required version in [global.json](global.json)
263263
2. Run `dotnet tool restore`
264264
3. Run `dotnet build -c Release -t:Build`
265265

docs/.gitmodules

Whitespace-only changes.

docs/content/docs/External Resources/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ menu:
1313

1414
There is currently an introduction to Myriad and a How to guide on creating a simple generator
1515

16-
[Applied Metaprogramming with Myriad and Falanx](https://7sharp9.github.io/fsharp/2019-04-24-applied-metaprogramming-with-myriad/) - This is a video I made for my YouTube channel which covers some details on Myriad.
16+
[Applied Metaprogramming with Myriad and Falanx](https://7sharp9.dev/programming/2019-04-24-applied-metaprogramming-with-myriad/) - This is a video I made for my YouTube channel which covers some details on Myriad.
1717

1818

19-
[Myriad Intro](https://7sharp9.github.io/fsharp/2019-11-06-myriad-intro/) - This is a blog post I wrote around the time of Applied Metaprogramming with Myriad and Falanx which has details of making a generator that produces this simple module:
19+
[Myriad Intro](https://7sharp9.dev/programming/2019-11-06-myriad-intro/) - This is a blog post I wrote around the time of Applied Metaprogramming with Myriad and Falanx which has details of making a generator that produces this simple module:
2020

2121

2222
```fsharp

docs/content/docs/Tutorials/configuration.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ type GeneratorContext = {
5858
ConfigKey: string option
5959
ConfigGetter: string -> (string * obj) seq
6060
InputFilename: string
61+
ProjectContext: ProjectContext option
62+
AdditionalParameters: IDictionary<string, string>
6163
}
6264
65+
type Output =
66+
| Ast of SynModuleOrNamespace list
67+
| Source of string
68+
6369
type IMyriadGenerator =
6470
abstract member ValidInputExtensions: string seq
65-
abstract member Generate: GeneratorContext -> FsAst.AstRcd.SynModuleOrNamespaceRcd list
71+
abstract member Generate: GeneratorContext -> Output
6672
```
6773

6874
ValidInputExtensions is used so a plugin is tied to certain file types as input, if you plugin generating ast fragments from java files then you would add `.java` to the `ValidInputExtensions` implementation for example.

docs/content/docs/Tutorials/external-plugins.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Then add a new folder `build` with the `Generator.props` file within:
4343
```xml
4444
<Project>
4545
<ItemGroup>
46-
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../lib/netstandard2.1/Generator.dll" />
46+
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../lib/net9.0/Generator.dll" />
4747
</ItemGroup>
4848
</Project>
4949
```
@@ -53,7 +53,7 @@ Often an additional props file (In this smaple the file would be `Generator.InTe
5353
```xml
5454
<Project>
5555
<ItemGroup>
56-
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../bin/$(Configuration)/netstandard2.1/Generator.dll" />
56+
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)/../bin/$(Configuration)/net9.0/Generator.dll" />
5757
</ItemGroup>
5858
</Project>
5959
```

0 commit comments

Comments
 (0)