Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- master
- updates
- features/addGFilesToProject
paths:
- RELEASE_NOTES.md
- .github/workflows/publish.yml
Expand All @@ -30,6 +31,9 @@ jobs:
with:
name: packages
path: bin\*.nupkg
- name: Push Tag
shell: cmd
run: build.cmd -t PushTag
- name: NuGet
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
Expand Down
16 changes: 14 additions & 2 deletions Adaptify.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29215.179
# Visual Studio Version 17
VisualStudioVersion = 17.5.33103.201
MinimumVisualStudioVersion = 10.0.40219.1
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Adaptify.Compiler.Core", "src\Adaptify.Compiler.Core\Adaptify.Compiler.Core.fsproj", "{AB9C8BA2-30D3-43AD-A6C0-7AF49FB6BAED}"
EndProject
Expand All @@ -14,6 +14,13 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Adaptify.MSBuild.DotNet", "
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Adaptify.MSBuild.Framework", "src\Adaptify.MSBuild.Framework\Adaptify.MSBuild.Framework.fsproj", "{D6A22C39-5EC6-4D89-A5A4-69DB10BB6AAF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1341E53B-A0E2-4278-8FDB-C94B5D72A5C9}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Adaptify.PatchProjects", "src\Adaptify.PatchProjects\Adaptify.PatchProjects.fsproj", "{9DD9E764-6754-4D40-B5A6-F989DB9E0B2F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -40,6 +47,10 @@ Global
{D6A22C39-5EC6-4D89-A5A4-69DB10BB6AAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6A22C39-5EC6-4D89-A5A4-69DB10BB6AAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6A22C39-5EC6-4D89-A5A4-69DB10BB6AAF}.Release|Any CPU.Build.0 = Release|Any CPU
{9DD9E764-6754-4D40-B5A6-F989DB9E0B2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9DD9E764-6754-4D40-B5A6-F989DB9E0B2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9DD9E764-6754-4D40-B5A6-F989DB9E0B2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9DD9E764-6754-4D40-B5A6-F989DB9E0B2F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -49,6 +60,7 @@ Global
{E823BD28-CFED-486F-AED7-5EF54354E579} = {F28EFCED-51C1-4D6E-94CA-BA7C84247CFC}
{C11D497B-ACCA-4B76-8A41-71C5E7EC5E30} = {F28EFCED-51C1-4D6E-94CA-BA7C84247CFC}
{D6A22C39-5EC6-4D89-A5A4-69DB10BB6AAF} = {F28EFCED-51C1-4D6E-94CA-BA7C84247CFC}
{9DD9E764-6754-4D40-B5A6-F989DB9E0B2F} = {F28EFCED-51C1-4D6E-94CA-BA7C84247CFC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F3DF5A5D-D599-45D1-869E-4552860AF1BC}
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ Adaptify provides a MSBuild plugin for automatically *incrementalizing* F# types

### Notes

This project also contains a command line version of the generator which will be published as a dotnet tool when its done.
This project also contains a command line version of the generator which can be run in the *background* (similarly to language servers) or *locally*. The local mode allows to work with adaptify without needing to care about msbuild tasks and IDE integration.

Note that the MSBuild plugin cannot be built on Linux/MacOS currently. Nonetheless it should work on these platforms.
#### Background mode (server mode)

By using `--server` the tool runs at the background and waits for compilation requests. When using the build task (Adaptify.MSBuild), the server gets started automatically and is reused for all compilation requests.

#### Local mode

By using `--local` option and given a fsproj file (or many), the tool runs once and generates .g files for the project files.
An additional option `--addToProject` adds the generated file into the project when generated. See below for a guide on using adaptivy locally.


Note that the MSBuild plugin cannot be built on Linux/MacOS currently (ILRepack). Nonetheless it should work on these platforms.
Currently there are efforts to improve the MSBuild integration, so in case I break something for VS/VSCode let me know...

The generated files (and their base library) are fable-compatible and the generated package includes the `fable/` folder, so all of this should simply be usable in fable projects.
Expand Down Expand Up @@ -210,3 +220,13 @@ type AdaptiveModel<'T, 'T1, 'T2> =
As you see there are lots of functions in the constructor that account for inner changes of the generic values.
For more information please see the generator code or feel free to contact us on gitter/discord.
However as long as the top-level model is not generic you should never need to worry about these details.



### Tradeoffs and notes for local mode.

Using `dotnet adaptify --local --force --lenses --addToProject project.fsproj` invokes the tool an the project and performs the translation of model types. It generates .g files and adds them to the project.
Please note, that while this is WYSIWYG and good for example when using vscode, it has some drawbacks:
- people need to take care of running the tool when they change a model type.
- when renaming files, the zombie .g file needs to be deleted manually
- the addToProject option rewrites the project files
9 changes: 9 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### 1.2.0-prerelease3
* added --hideGenFiles option which hides .g files in fsproj files.

### 1.2.0-prerelease2
* lots of improvements mostly for addToProject/standalone option

### 1.2.0-prerelease1
* experimental 'addToProject' option

### 1.1.9
* fixed https://github.com/krauthaufen/Adaptify/issues/32

Expand Down
18 changes: 12 additions & 6 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ Target.create "Pack" (fun _ ->

)

let tag() =
Git.CommandHelper.directRunGitCommandAndFail "." "fetch --tags"
Git.Branches.tag "." notes.NugetVersion

let branch = Git.Information.getBranchName "."
Git.Branches.pushBranch "." "origin" branch

Target.create "PushTag" (fun _ ->
tag()
)

Target.create "Push" (fun _ ->
let packageNameRx = Regex @"^(?<name>[a-zA-Z_0-9\.-]+?)\.(?<version>([0-9]+\.)*[0-9]+.*?)\.nupkg$"

Expand Down Expand Up @@ -148,12 +159,7 @@ Target.create "Push" (fun _ ->
)
|> Map.ofArray


Git.CommandHelper.directRunGitCommandAndFail "." "fetch --tags"
Git.Branches.tag "." notes.NugetVersion

let branch = Git.Information.getBranchName "."
Git.Branches.pushBranch "." "origin" branch
tag()

if List.isEmpty packages then
failwith "no packages produced"
Expand Down
Loading