|
|
@ -1,19 +1,25 @@ |
|
|
|
# read SelfConfig, remove wierd bits, load it, load Newtonsoft, and turn it into a schema |
|
|
|
$newtonsoftLoc = "$(Get-Location)/nuget/Newtonsoft.Json.12.0.2/lib/netstandard2.0/Newtonsoft.Json.dll" |
|
|
|
$newtonsoftSchemaLoc = "$(Get-Location)/nuget/Newtonsoft.Json.Schema.3.0.11/lib/netstandard2.0/Newtonsoft.Json.Schema.dll" |
|
|
|
$roslynCodeDomBase = "$(Get-Location)/nuget/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1" |
|
|
|
$roslynCodeDom = "$roslynCodeDomBase/lib/net45/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll" |
|
|
|
$selfConfigLoc = "../IPA.Loader/Config/SelfConfig.cs" |
|
|
|
$ipaRoot = "../IPA" |
|
|
|
|
|
|
|
if (!(Test-Path "nuget" -PathType Container)) { |
|
|
|
nuget install Newtonsoft.Json -Version 12.0.2 -source https://api.nuget.org/v3/index.json -o "$(Get-Location)/nuget" |
|
|
|
nuget install Newtonsoft.Json.Schema -Version 3.0.11 -source https://api.nuget.org/v3/index.json -o "$(Get-Location)/nuget" |
|
|
|
nuget install Microsoft.CodeDom.Providers.DotNetCompilerPlatform -Version 2.0.1 -source https://api.nuget.org/v3/index.json -o "$(Get-Location)/nuget" |
|
|
|
} |
|
|
|
|
|
|
|
& docfx metadata |
|
|
|
|
|
|
|
if ((Test-Path $newtonsoftLoc -PathType Leaf) -and (Test-Path $selfConfigLoc -PathType Leaf)) { |
|
|
|
if ((Test-Path $newtonsoftLoc -PathType Leaf) -and (Test-Path $selfConfigLoc -PathType Leaf) -and (Test-Path $roslynCodeDom -PathType Leaf)) { |
|
|
|
# The files we need exist, lets do this! |
|
|
|
|
|
|
|
# Add the Roslyn CodeDom |
|
|
|
Add-Type -Path $roslynCodeDom |
|
|
|
|
|
|
|
# First load Newtonsoft |
|
|
|
Add-Type -Path $newtonsoftLoc |
|
|
|
Add-Type -Path $newtonsoftSchemaLoc |
|
|
@ -56,7 +62,23 @@ if ((Test-Path $newtonsoftLoc -PathType Leaf) -and (Test-Path $selfConfigLoc -Pa |
|
|
|
process { $_ -replace "internal", "public" } |
|
|
|
} |
|
|
|
|
|
|
|
Add-Type -TypeDefinition (Get-Content $selfConfigLoc | ProcessLines | Merge-Lines | FilterDef) -ReferencedAssemblies $newtonsoftLoc,"netstandard" |
|
|
|
# set up the compiler settings |
|
|
|
Invoke-Expression -Command @" |
|
|
|
class RoslynCompilerSettings : Microsoft.CodeDom.Providers.DotNetCompilerPlatform.ICompilerSettings |
|
|
|
{ |
|
|
|
[string] get_CompilerFullPath() |
|
|
|
{ |
|
|
|
return "$roslynCodeDomBase\tools\RoslynLatest\csc.exe" |
|
|
|
} |
|
|
|
[int] get_CompilerServerTimeToLive() |
|
|
|
{ |
|
|
|
return 10 |
|
|
|
} |
|
|
|
} |
|
|
|
"@ |
|
|
|
$codeDomProvider = [Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider]::new([RoslynCompilerSettings]::new()) |
|
|
|
|
|
|
|
Add-Type -CodeDomProvider $codeDomProvider -TypeDefinition (Get-Content $selfConfigLoc | ProcessLines | Merge-Lines | FilterDef) -ReferencedAssemblies $newtonsoftLoc,"netstandard" |
|
|
|
|
|
|
|
# type will be [IPA.Config.SelfConfig] |
|
|
|
|
|
|
|