-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Whippet #282
base: main
Are you sure you want to change the base?
Use Whippet #282
Changes from all commits
9ce061f
3d4873f
98aa030
d478afb
9d1e2de
4a3dc91
217ef13
fd1828f
b57fea6
d2ac859
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,88 +6,80 @@ | |
<OtherFlags>--reflectionfree $(OtherFlags)</OtherFlags> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<MyriadSdkGenerator Include="$(MSBuildThisFileDirectory)..\WoofWare.Myriad.Plugins\bin\$(Configuration)\net6.0\WoofWare.Myriad.Plugins.dll"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="myriad.toml"/> | ||
<Compile Include="AssemblyInfo.fs" /> | ||
<Compile Include="RecordFile.fs"/> | ||
<Compile Include="GeneratedRecord.fs"> | ||
<MyriadFile>RecordFile.fs</MyriadFile> | ||
<WhippetFile>RecordFile.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="JsonRecord.fs"/> | ||
<Compile Include="GeneratedJson.fs"> | ||
<MyriadFile>JsonRecord.fs</MyriadFile> | ||
<WhippetFile>JsonRecord.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="PureGymDto.fs"/> | ||
<Compile Include="GeneratedPureGymDto.fs"> | ||
<MyriadFile>PureGymDto.fs</MyriadFile> | ||
<WhippetFile>PureGymDto.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="RestApiExample.fs"/> | ||
<Compile Include="GeneratedRestClient.fs"> | ||
<MyriadFile>RestApiExample.fs</MyriadFile> | ||
<WhippetFile>RestApiExample.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="MockExample.fs"/> | ||
<Compile Include="GeneratedMock.fs"> | ||
<MyriadFile>MockExample.fs</MyriadFile> | ||
<WhippetFile>MockExample.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="MockExampleNoAttributes.fs" /> | ||
<Compile Include="GeneratedMockNoAttributes.fs"> | ||
<MyriadFile>MockExampleNoAttributes.fs</MyriadFile> | ||
<MyriadParams> | ||
<IPublicTypeNoAttr>GenerateMock</IPublicTypeNoAttr> | ||
<IPublicTypeInternalFalseNoAttr>GenerateMock(false)</IPublicTypeInternalFalseNoAttr> | ||
<InternalTypeNoAttr>GenerateMock</InternalTypeNoAttr> | ||
<PrivateTypeNoAttr>GenerateMock</PrivateTypeNoAttr> | ||
<PrivateTypeInternalFalseNoAttr>GenerateMock(false)</PrivateTypeInternalFalseNoAttr> | ||
<VeryPublicTypeNoAttr>GenerateMock</VeryPublicTypeNoAttr> | ||
<CurriedNoAttr>GenerateMock</CurriedNoAttr> | ||
<TypeWithInterfaceNoAttr>GenerateMock</TypeWithInterfaceNoAttr> | ||
</MyriadParams> | ||
<WhippetFile>MockExampleNoAttributes.fs</WhippetFile> | ||
<WhippetParamIPublicTypeNoAttr>GenerateMock</WhippetParamIPublicTypeNoAttr> | ||
<WhippetParamIPublicTypeNoAttr>GenerateMock</WhippetParamIPublicTypeNoAttr> | ||
<WhippetParamIPublicTypeInternalFalseNoAttr>GenerateMock(false)</WhippetParamIPublicTypeInternalFalseNoAttr> | ||
<WhippetParamInternalTypeNoAttr>GenerateMock</WhippetParamInternalTypeNoAttr> | ||
<WhippetParamPrivateTypeNoAttr>GenerateMock</WhippetParamPrivateTypeNoAttr> | ||
<WhippetParamPrivateTypeInternalFalseNoAttr>GenerateMock(false)</WhippetParamPrivateTypeInternalFalseNoAttr> | ||
<WhippetParamVeryPublicTypeNoAttr>GenerateMock</WhippetParamVeryPublicTypeNoAttr> | ||
<WhippetParamCurriedNoAttr>GenerateMock</WhippetParamCurriedNoAttr> | ||
<WhippetParamTypeWithInterfaceNoAttr>GenerateMock</WhippetParamTypeWithInterfaceNoAttr> | ||
</Compile> | ||
<Compile Include="Vault.fs" /> | ||
<Compile Include="GeneratedVault.fs"> | ||
<MyriadFile>Vault.fs</MyriadFile> | ||
<WhippetFile>Vault.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="SerializationAndDeserialization.fs" /> | ||
<Compile Include="GeneratedSerde.fs"> | ||
<MyriadFile>SerializationAndDeserialization.fs</MyriadFile> | ||
<WhippetFile>SerializationAndDeserialization.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="Catamorphism.fs" /> | ||
<Compile Include="GeneratedCatamorphism.fs"> | ||
<MyriadFile>Catamorphism.fs</MyriadFile> | ||
<WhippetFile>Catamorphism.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="FSharpForFunAndProfitCata.fs" /> | ||
<Compile Include="GeneratedFileSystem.fs"> | ||
<MyriadFile>FSharpForFunAndProfitCata.fs</MyriadFile> | ||
<WhippetFile>FSharpForFunAndProfitCata.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="List.fs" /> | ||
<Compile Include="ListCata.fs"> | ||
<MyriadFile>List.fs</MyriadFile> | ||
<WhippetFile>List.fs</WhippetFile> | ||
</Compile> | ||
<Compile Include="Args.fs" /> | ||
<Compile Include="GeneratedArgs.fs"> | ||
<MyriadFile>Args.fs</MyriadFile> | ||
<WhippetFile>Args.fs</WhippetFile> | ||
</Compile> | ||
<None Include="swagger-gitea.json" /> | ||
<Compile Include="GeneratedSwaggerGitea.fs"> | ||
<MyriadFile>swagger-gitea.json</MyriadFile> | ||
<MyriadParams> | ||
<GenerateMockInternal>true</GenerateMockInternal> | ||
<ClassName>Gitea</ClassName> | ||
</MyriadParams> | ||
<WhippetFile>swagger-gitea.json</WhippetFile> | ||
<WhippetParamGenerateMockInternal>true</WhippetParamGenerateMockInternal> | ||
<WhippetParamClassName>Gitea</WhippetParamClassName> | ||
</Compile> | ||
<Compile Include="Generated2SwaggerGitea.fs"> | ||
<MyriadFile>GeneratedSwaggerGitea.fs</MyriadFile> | ||
<WhippetFile>GeneratedSwaggerGitea.fs</WhippetFile> | ||
</Compile> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="RestEase" Version="1.6.4"/> | ||
<ProjectReference Include="..\WoofWare.Myriad.Plugins.Attributes\WoofWare.Myriad.Plugins.Attributes.fsproj" /> | ||
<ProjectReference Include="..\WoofWare.Myriad.Plugins\WoofWare.Myriad.Plugins.fsproj" PrivateAssets="all" /> | ||
<PackageReference Include="Myriad.Sdk" Version="0.8.3" PrivateAssets="all" /> | ||
<ProjectReference Include="..\WoofWare.Myriad.Plugins\WoofWare.Myriad.Plugins.fsproj" PrivateAssets="all" WhippetPlugin="true" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now all you need to do is add |
||
<PackageReference Include="WoofWare.Whippet" Version="0.1.6-gc23a25b8e0" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
|
||
<add key="Local Packages" value="/Users/patrick/Documents/GitHub/WoofWare.Whippet/WoofWare.Whippet/bin/Release/" /> | ||
</packageSources> | ||
|
||
<packageSourceMapping> | ||
<packageSource key="Local Packages"> | ||
<package pattern="WoofWare.Whippet" /> | ||
</packageSource> | ||
<packageSource key="nuget.org"> | ||
<package pattern="*" /> | ||
</packageSource> | ||
</packageSourceMapping> | ||
</configuration> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ | |
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/> | ||
<PackageReference Include="NUnit" Version="4.2.2"/> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/> | ||
<PackageReference Include="RestEase" Version="1.6.4"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dunno why this transitive reference became required. |
||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ namespace WoofWare.Myriad.Plugins | |
open System | ||
open System.Text | ||
open Fantomas.FCS.Syntax | ||
open WoofWare.Whippet.Core | ||
open WoofWare.Whippet.Fantomas | ||
open Fantomas.FCS.Text.Range | ||
open TypeEquality | ||
open WoofWare.Whippet.Fantomas | ||
|
@@ -1745,18 +1747,17 @@ module internal ArgParserGenerator = | |
] | ||
|> SynModuleOrNamespace.createNamespace ns | ||
|
||
open Myriad.Core | ||
|
||
/// Myriad generator that provides a catamorphism for an algebraic data type. | ||
[<MyriadGenerator("arg-parser")>] | ||
[<WhippetGenerator>] | ||
type ArgParserGenerator () = | ||
|
||
interface IMyriadGenerator with | ||
member _.ValidInputExtensions = [ ".fs" ] | ||
interface IGenerateRawFromRaw with | ||
member _.GenerateRawFromRaw (context : RawSourceGenerationArgs) = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the most basic API on which all other APIs are built. I intend adding optional convenience APIs on top, eventually, but this API shape is how we get the most modular design (which e.g. allows the consumer to freely upgrade Fantomas). |
||
if not (context.FilePath.EndsWith (".fs", StringComparison.Ordinal)) then | ||
null | ||
else | ||
|
||
member _.Generate (context : GeneratorContext) = | ||
let ast, _ = | ||
Ast.fromFilename context.InputFilename |> Async.RunSynchronously |> Array.head | ||
let ast = Ast.parse (Encoding.UTF8.GetString context.FileContents) | ||
|
||
let types = Ast.getTypes ast | ||
|
||
|
@@ -1816,4 +1817,4 @@ type ArgParserGenerator () = | |
ArgParserGenerator.createModule opens ns taggedType unions records | ||
) | ||
|
||
Output.Ast modules | ||
Ast.render modules |> Option.toObj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the choice to flatten these params, because the contents of this XML node are presented through msbuild only as a string, not as an XML node!