forked from SaladLab/Unity3D.IncrementalCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
70 lines (61 loc) · 2.85 KB
/
build.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#I @"packages/FAKE/tools"
#I @"packages/FAKE.BuildLib/lib/net451"
#r "FakeLib.dll"
#r "BuildLib.dll"
open Fake
open BuildLib
let solution =
initSolution
"./IncrementalCompiler.sln" "Release"
[ ]
Target "Clean" <| fun _ -> cleanBin
Target "Restore" <| fun _ -> restoreNugetPackages solution
Target "Build" <| fun _ -> buildSolution solution
Target "Package" (fun _ ->
// pack IncrementalCompiler.exe with dependent module dlls to packed one
let ilrepackExe = (getNugetPackage "ILRepack" "2.0.13") @@ "tools" @@ "ILRepack.exe"
Shell.Exec(ilrepackExe,
"/wildcards /out:IncrementalCompiler.packed.exe IncrementalCompiler.exe *.dll",
"./core/IncrementalCompiler/bin/Release") |> ignore
// fix roslyn compiler to work well with UnityVS
Shell.Exec("./core/RoslynCompilerFix/bin/Release/RoslynCompilerFix.exe",
"IncrementalCompiler.packed.exe IncrementalCompiler.packed.fixed.exe",
"./core/IncrementalCompiler/bin/Release") |> ignore
// code signing
if hasBuildParam "sign" then (
let certFile = getBuildParam "sign"
let timeUrl = "http://timestamp.verisign.com/scripts/timstamp.dll"
let exeFile = "./core/IncrementalCompiler/bin/Release/IncrementalCompiler.packed.fixed.exe"
Shell.Exec(@"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe",
sprintf "sign /v /f %s /t %s %s" certFile timeUrl exeFile,
".") |> ignore
)
// let's make package
for target in ["Unity4"; "Unity5"] do
let targetDir = binDir @@ target
let editorDir = targetDir @@ "Assets" @@ "Editor"
let compilerDir = targetDir @@ "Compiler"
// create dirs
CreateDir targetDir
CreateDir editorDir
CreateDir compilerDir
// copy output files
"./core/IncrementalCompiler/bin/Release/IncrementalCompiler.packed.fixed.exe" |> CopyFile (compilerDir @@ "IncrementalCompiler.exe")
"./core/IncrementalCompiler/IncrementalCompiler.xml" |> CopyFile compilerDir
"./core/UnityPackage/Assets/Editor/CompilerSettings.cs" |> CopyFile editorDir
"./extra/CompilerPlugin." + target + "/bin/Release/Unity.PureCSharpTests.dll" |> CopyFile (editorDir @@ "CompilerPlugin.dll")
"./extra/UniversalCompiler/bin/Release/UniversalCompiler.exe" |> CopyFile compilerDir
"./extra/UniversalCompiler/UniversalCompiler.xml" |> CopyFile compilerDir
"./tools/pdb2mdb/pdb2mdb.exe" |> CopyFile compilerDir
// create zipped packages
!! (targetDir @@ "**") |> Zip targetDir (binDir @@ "IncrementalCompiler." + target + ".zip")
)
Target "Help" <| fun _ ->
showUsage solution (fun name ->
if name = "package" then Some("Build package", "sign")
else None)
"Clean"
==> "Restore"
==> "Build"
==> "Package"
RunTargetOrDefault "Help"