Skip to content

Commit 222ec4d

Browse files
committed
Use BuildLib 0.2.7
1 parent 17a209d commit 222ec4d

File tree

4 files changed

+62
-69
lines changed

4 files changed

+62
-69
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Visit [Release](https://github.com/SaladLab/Json.Net.Unity3D/releases)
1212
page to get latest Json.NET unity-package.
1313

1414
To use this library in IL2CPP build settings, you need to add
15-
[link.xml](https://github.com/SaladLab/Json.Net.Unity3D/blob/master/src/UnityPackage/Assets/link.xml) to your project's asset folder.
15+
[link.xml](https://github.com/SaladLab/Json.Net.Unity3D/blob/master/src/UnityTest/Assets/link.xml) to your project's asset folder.
1616
For detailed information about link.xml, read unity [manual](http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html) about this.
1717

1818
## What's the deal?

appveyor.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
version: 8.0.2.{build}
1+
version: 8.0.3.{build}
22
os: Visual Studio 2015
3-
configuration: Release
43
init:
54
- git config --global core.autocrlf true
6-
before_build:
7-
- cmd: nuget restore
8-
build:
9-
project: Json.Net.Unity3D.sln
10-
verbosity: minimal
5+
test: off
6+
build_script:
7+
- cmd: build.cmd ci
8+
artifacts:
9+
- path: './bin/unity/*.unitypackage'
10+
name: UnityPackage
11+
cache:
12+
- packages -> **\packages.config

build.cmd

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
pushd %~dp0
44

5-
tools\nuget\NuGet.exe update -self
6-
tools\nuget\NuGet.exe install FAKE -ConfigFile tools\nuget\Nuget.Config -OutputDirectory packages -ExcludeVersion -Version 4.7.3
7-
tools\nuget\NuGet.exe install nunit.runners -ConfigFile tools\nuget\Nuget.Config -OutputDirectory packages\FAKE -ExcludeVersion -Version 2.6.4
5+
SET PACKAGEPATH=.\packages\
6+
SET NUGET=.\tools\nuget\NuGet.exe
7+
SET NUGETOPTIONS=-ConfigFile .\tools\nuget\NuGet.Config -OutputDirectory %PACKAGEPATH% -ExcludeVersion
8+
9+
IF NOT EXIST %PACKAGEPATH%FAKE\Ver_4.25.4 (
10+
RD /S/Q %PACKAGEPATH%FAKE
11+
%NUGET% install FAKE -Version 4.25.4 %NUGETOPTIONS%
12+
COPY NUL %PACKAGEPATH%FAKE\Ver_4.25.4
13+
)
14+
15+
IF NOT EXIST %PACKAGEPATH%FAKE.BuildLib\Ver_0.2.7 (
16+
RD /S/Q %PACKAGEPATH%FAKE.BuildLib
17+
%NUGET% install FAKE.BuildLib -Version 0.2.7 %NUGETOPTIONS%
18+
COPY NUL %PACKAGEPATH%FAKE.BuildLib\Ver_0.2.7
19+
)
820

921
set encoding=utf-8
10-
packages\FAKE\tools\FAKE.exe build.fsx %*
22+
"%PACKAGEPATH%FAKE\tools\FAKE.exe" build.fsx %*
1123

1224
popd

build.fsx

Lines changed: 36 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,59 @@
11
#I @"packages/FAKE/tools"
2+
#I @"packages/FAKE.BuildLib/lib/net451"
23
#r "FakeLib.dll"
4+
#r "BuildLib.dll"
35

46
open Fake
57
open Fake.FileHelper
8+
open BuildLib
69
open System.IO
710

8-
// ---------------------------------------------------------------------------- Variables
11+
let solution =
12+
initSolution
13+
"./Json.Net.Unity3D.sln" "Release" []
914

10-
let buildSolutionFile = "./Json.Net.Unity3D.sln"
11-
let buildConfiguration = "Release"
12-
let binDir = "bin"
13-
let testDir = binDir @@ "test"
15+
Target "Clean" <| fun _ -> cleanBin
1416

15-
// ------------------------------------------------------------------------- Unity Helper
17+
Target "Restore" <| fun _ -> restoreNugetPackages solution
1618

17-
let UnityPath =
18-
@"C:\Program Files\Unity\Editor\Unity.exe"
19-
20-
let Unity projectPath args =
21-
let result = Shell.Exec(UnityPath, "-quit -batchmode -logFile -projectPath \"" + projectPath + "\" " + args)
22-
if result < 0 then failwithf "Unity exited with error %d" result
23-
24-
// ------------------------------------------------------------------------------ Targets
25-
26-
Target "Clean" (fun _ ->
27-
CleanDirs [binDir]
28-
)
29-
30-
Target "Build" (fun _ ->
19+
Target "Build" <| fun _ ->
3120
// Regular
32-
!! buildSolutionFile
33-
|> MSBuild "" "Rebuild" [ "Configuration", buildConfiguration ]
34-
|> Log "Build-Output: "
21+
buildSolution solution
3522
// Lite
36-
!! buildSolutionFile
37-
|> MSBuild "" "Rebuild" [ "Configuration", buildConfiguration + "Lite" ]
38-
|> Log "Build-Output: "
39-
)
23+
!!solution.SolutionFile
24+
|> MSBuild "" "Rebuild" [ "Configuration", solution.Configuration + "Lite" ]
25+
|> Log "Build-Output: "
26+
4027

41-
Target "Test" (fun _ ->
28+
Target "Test" <| fun _ ->
29+
let nunitRunnerDir = lazy ((getNugetPackage "NUnit.Runners" "2.6.4") @@ "tools")
4230
ensureDirectory testDir
43-
!! ("./src/**/bin/" + buildConfiguration + "/*.Tests.dll")
31+
!! ("./src/**/bin/" + solution.Configuration + "/*.Tests.dll")
4432
|> NUnit (fun p ->
45-
{p with
46-
DisableShadowCopy = true;
47-
OutputFile = testDir @@ "TestResult.xml" })
48-
)
33+
{p with ToolPath = nunitRunnerDir.Force()
34+
DisableShadowCopy = true;
35+
OutputFile = testDir @@ "test.xml" })
36+
37+
Target "PackUnity" <| fun _ ->
38+
packUnityPackage "./src/UnityPackage/JsonNet.unitypackage.json"
39+
packUnityPackage "./src/UnityPackage/JsonNet-Lite.unitypackage.json"
4940

50-
Target "Package" (fun _ ->
51-
(!! ("src/Newtonsoft.Json/bin/" + buildConfiguration + "/Newtonsoft.Json.dll*")) |> Copy "src/UnityPackage/Assets/Middlewares/JsonNet"
52-
(!! ("src/Newtonsoft.Json/bin/" + buildConfiguration + "Lite/Newtonsoft.Json.dll*")) |> Copy "src/UnityPackageLite/Assets/Middlewares/JsonNet"
53-
(!! ("src/Newtonsoft.Json.Tests/bin/" + buildConfiguration + "/Newtonsoft.Json.Tests.dll*")) |> Copy "src/UnityPackage/Assets/Editor"
54-
Unity (Path.GetFullPath "src/UnityPackage") "-executeMethod PackageBuilder.BuildPackage"
55-
Unity (Path.GetFullPath "src/UnityPackageLite") "-executeMethod PackageBuilder.BuildPackage"
56-
(!! "src/UnityPackage/*.unitypackage") |> Seq.iter (fun p -> MoveFile binDir p)
57-
(!! "src/UnityPackageLite/*.unitypackage") |> Seq.iter (fun p -> MoveFile binDir p)
58-
)
41+
Target "Pack" <| fun _ -> ()
5942

60-
Target "Help" (fun _ ->
61-
List.iter printfn [
62-
"usage:"
63-
"build [target]"
64-
""
65-
" Targets for building:"
66-
" * Build Build"
67-
" * Test Test"
68-
" * Package Build Unity Package"
69-
""]
70-
)
43+
Target "CI" <| fun _ -> ()
7144

72-
// --------------------------------------------------------------------------- Dependency
45+
Target "Help" <| fun _ ->
46+
showUsage solution (fun _ -> None)
7347

74-
// Build order
7548
"Clean"
49+
==> "Restore"
7650
==> "Build"
7751
==> "Test"
78-
==> "Package"
7952

80-
RunTargetOrDefault "Package"
53+
"Build" ==> "PackUnity"
54+
"PackUnity" ==> "Pack"
55+
56+
"Test" ==> "CI"
57+
"Pack" ==> "CI"
58+
59+
RunTargetOrDefault "Help"

0 commit comments

Comments
 (0)