diff --git a/Adaptify.sln b/Adaptify.sln
index e1d7ab2..b722569 100644
--- a/Adaptify.sln
+++ b/Adaptify.sln
@@ -10,7 +10,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "adaptify", "src\Adaptify.Co
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compiler", "Compiler", "{F28EFCED-51C1-4D6E-94CA-BA7C84247CFC}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder1", "SolutionFolder1", "{5354664B-13B9-431C-83EB-A1F74FD82C2F}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5354664B-13B9-431C-83EB-A1F74FD82C2F}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
LICENSE = LICENSE
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index cb79a68..61729d1 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,3 +1,6 @@
+### 1.3.0
+* passing args via JSON (avoiding command line length problems)
+
### 1.3.0-prerelease6
* pure XML msbuild integration 5/N
diff --git a/src/Adaptify.Compiler/Program.fs b/src/Adaptify.Compiler/Program.fs
index 30147d9..caeefc1 100644
--- a/src/Adaptify.Compiler/Program.fs
+++ b/src/Adaptify.Compiler/Program.fs
@@ -1,5 +1,6 @@
open System
open System.IO
+open System.Text.Json
open FSharp.Compiler.Symbols
open FSharp.Compiler.Text
open FSharp.Core
@@ -160,7 +161,7 @@ type Path with
let msbuild (argv : string[]) =
-
+
let mutable lenses = false
let mutable debugHate = false
let mutable touchFiles = false
@@ -173,50 +174,93 @@ let msbuild (argv : string[]) =
let mutable files = [||]
let mutable references = [||]
let mutable verbose = false
+
+ let mutable argv = argv
+ if argv.Length = 2 && File.Exists argv.[1] then
+ let args = File.ReadAllText(argv.[1]).Replace("\\", "\\\\")
+ let doc = System.Text.Json.JsonDocument.Parse args
+ let root = doc.RootElement
+
+ let inline stringArr (e : JsonElement) =
+ let cnt = e.GetArrayLength()
+ Array.init cnt (fun i -> e.[i].GetString())
+
+ lenses <- root.GetProperty("lenses").GetString().ToLower() = "true"
+ debugHate <- root.GetProperty("debugHate").GetString().ToLower() = "true"
+ touchFiles <- root.GetProperty("touchFiles").GetString().ToLower() = "true"
+ designTime <- root.GetProperty("designTime").GetString().ToLower() = "true"
+ targetFramework <- root.GetProperty("targetFramework").GetString()
+ projectFile <- root.GetProperty("projectFile").GetString()
+ defines <- root.GetProperty("defines").GetString()
+ outputPath <- root.GetProperty("outputPath").GetString()
+ outputType <- root.GetProperty("outputType").GetString()
+ files <- stringArr(root.GetProperty("files"))
+ references <- stringArr(root.GetProperty("references"))
+ verbose <- root.GetProperty("verbose").GetString().ToLower() = "true"
+ else
- for i in 0 .. argv.Length - 1 do
- match argv.[i].ToLower().Trim() with
- | "--verbose" | "-v" ->
- verbose <- true
- | "--lenses" ->
- if i + 1 < argv.Length && argv.[i+1].Trim().ToLower() = "true" then
- lenses <- true
- | "--designtime" ->
- if i + 1 < argv.Length then
- designTime <- argv.[i+1].Trim().ToLower() = "true"
- | "--debughate" ->
- if i + 1 < argv.Length then
- debugHate <- argv.[i+1].Trim().ToLower() = "true"
- | "--touchfiles" ->
- if i + 1 < argv.Length then
- touchFiles <- argv.[i+1].Trim().ToLower() = "true"
- | "--projectfile" ->
- if i + 1 < argv.Length then
- projectFile <- argv.[i+1].Trim()
- | "--defines" ->
- if i + 1 < argv.Length then
- defines <- argv.[i+1].Trim()
- | "--outputpath" ->
- if i + 1 < argv.Length then
- outputPath <- argv.[i+1].Trim()
- | "--outputtype" ->
- if i + 1 < argv.Length then
- outputType <- argv.[i+1].Trim()
- | "--files" ->
- if i + 1 < argv.Length then
- let refs = argv.[i+1].Split([|';'|], StringSplitOptions.RemoveEmptyEntries)
- files <- refs
-
- | "--targetframework" ->
- if i + 1 < argv.Length then
- targetFramework <- argv.[i+1].Trim()
- | "--references" ->
- if i + 1 < argv.Length then
- let refs = argv.[i+1].Split([|';'|], StringSplitOptions.RemoveEmptyEntries)
- references <- refs
- | _ ->
- ()
-
+ for i in 0 .. argv.Length - 1 do
+ match argv.[i].ToLower().Trim() with
+ | "--verbose" | "-v" ->
+ verbose <- true
+ | "--lenses" ->
+ if i + 1 < argv.Length && argv.[i+1].Trim().ToLower() = "true" then
+ lenses <- true
+ | "--designtime" ->
+ if i + 1 < argv.Length then
+ designTime <- argv.[i+1].Trim().ToLower() = "true"
+ | "--debughate" ->
+ if i + 1 < argv.Length then
+ debugHate <- argv.[i+1].Trim().ToLower() = "true"
+ | "--touchfiles" ->
+ if i + 1 < argv.Length then
+ touchFiles <- argv.[i+1].Trim().ToLower() = "true"
+ | "--projectfile" ->
+ if i + 1 < argv.Length then
+ projectFile <- argv.[i+1].Trim()
+ | "--defines" ->
+ if i + 1 < argv.Length then
+ defines <- argv.[i+1].Trim()
+ | "--outputpath" ->
+ if i + 1 < argv.Length then
+ outputPath <- argv.[i+1].Trim()
+ | "--outputtype" ->
+ if i + 1 < argv.Length then
+ outputType <- argv.[i+1].Trim()
+ | "--files" ->
+ if i + 1 < argv.Length then
+ let refs = argv.[i+1].Split([|';'|], StringSplitOptions.RemoveEmptyEntries)
+ files <- refs
+
+ | "--targetframework" ->
+ if i + 1 < argv.Length then
+ targetFramework <- argv.[i+1].Trim()
+ | "--references" ->
+ if i + 1 < argv.Length then
+ let refs = argv.[i+1].Split([|';'|], StringSplitOptions.RemoveEmptyEntries)
+ references <- refs
+ | _ ->
+ ()
+
+
+ let outputPath =
+ Path.Combine(Path.GetDirectoryName(projectFile), outputPath) |> Path.GetFullPath
+ //
+ // if verbose then
+ // printfn "lenses: %A" lenses
+ // printfn "debugHate: %A" debugHate
+ // printfn "touchFiles: %A" touchFiles
+ // printfn "designTime: %A" designTime
+ // printfn "targetFramework: %s" targetFramework
+ // printfn "projectFile: %s" projectFile
+ // printfn "defines: %s" defines
+ // printfn "outputPath: %s" outputPath
+ // printfn "outputType: %s" outputType
+ // printfn "files: %A" files
+ // printfn "references: %A" references
+ //
+
+
let targetType =
match outputType.ToLower() with
| "winexe" -> Target.WinExe
diff --git a/src/Adaptify.Core/Adaptify.Core.fsproj b/src/Adaptify.Core/Adaptify.Core.fsproj
index 00c2055..9b66b0b 100644
--- a/src/Adaptify.Core/Adaptify.Core.fsproj
+++ b/src/Adaptify.Core/Adaptify.Core.fsproj
@@ -15,5 +15,11 @@
+
+
+
+ Adaptify.Core.paket.template
+
+
\ No newline at end of file
diff --git a/src/Adaptify.MSBuild/Adaptify.MSBuild.targets b/src/Adaptify.MSBuild/Adaptify.MSBuild.targets
index e7ec736..a75bd72 100644
--- a/src/Adaptify.MSBuild/Adaptify.MSBuild.targets
+++ b/src/Adaptify.MSBuild/Adaptify.MSBuild.targets
@@ -9,10 +9,28 @@
dotnet adaptify
--verbose
+
+{
+ "lenses": "$(GenerateLenses)",
+ "targetFramework": "$(TargetFramework)",
+ "debugHate": "$(DebugHate)",
+ "touchFiles": "$(TouchFiles)",
+ "projectFile": "$(MSBuildProjectFullPath)",
+ "designTime": "$(DesignTimeBuild)",
+ "defines": "$(DefineConstants.Replace("\n", ""))",
+ "outputPath": "$(IntermediateOutputPath)",
+ "outputType": "$(OutputType)",
+ "files": [ @(OldItems->'"%(FullPath)"', ', ') ],
+ "references": [ @(_ResolveAssemblyReferenceResolvedFiles->'"%(FullPath)"', ', ') ],
+ "verbose": "$(AdaptifyVerbose)"
+}
+
+
+
+ $(AdaptifyCommand) msbuild $(IntermediateOutputPath)\adaptify.args" Condition="$(MSBuildProjectFullPath.EndsWith('.fsproj'))" />
diff --git a/src/Examples/Net6/Net6.fsproj b/src/Examples/Net6/Net6.fsproj
index 5be28d6..457533a 100644
--- a/src/Examples/Net6/Net6.fsproj
+++ b/src/Examples/Net6/Net6.fsproj
@@ -5,7 +5,9 @@
Exe
net6.0
True
- True
+ true
+
+
@@ -37,6 +39,6 @@
-
+