From 4d180b9611e91aab554dc0f05dbbff862fb07772 Mon Sep 17 00:00:00 2001 From: Jeff Hostetler Date: Tue, 22 Sep 2015 17:31:41 -0400 Subject: [PATCH 1/2] Build scripts to consume local libgit2 --- CI/Developer.msbuild | 58 +++ Developer.sln | 56 +++ Developer/LibGit2Sharp.NativeBinaries.props | 30 ++ Developer/LibGit2Sharp.dll.config | 3 + Developer/README.txt | 62 +++ Developer/libgit2_filename.txt | 1 + Developer/libgit2_hash.txt | 1 + LibGit2Sharp.Tests/Developer.Tests.csproj | 170 ++++++++ LibGit2Sharp/Developer.csproj | 409 ++++++++++++++++++++ build.Developer.cmd | 35 ++ 10 files changed, 825 insertions(+) create mode 100644 CI/Developer.msbuild create mode 100644 Developer.sln create mode 100644 Developer/LibGit2Sharp.NativeBinaries.props create mode 100644 Developer/LibGit2Sharp.dll.config create mode 100644 Developer/README.txt create mode 100644 Developer/libgit2_filename.txt create mode 100644 Developer/libgit2_hash.txt create mode 100644 LibGit2Sharp.Tests/Developer.Tests.csproj create mode 100644 LibGit2Sharp/Developer.csproj create mode 100644 build.Developer.cmd diff --git a/CI/Developer.msbuild b/CI/Developer.msbuild new file mode 100644 index 000000000..9c9cdb3c2 --- /dev/null +++ b/CI/Developer.msbuild @@ -0,0 +1,58 @@ + + + Debug + $(MSBuildProjectDirectory)\.. + $(RootDir)\LibGit2Sharp.Tests\bin\$(Configuration) + $(RootDir)\Build + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Developer.sln b/Developer.sln new file mode 100644 index 000000000..ca4052321 --- /dev/null +++ b/Developer.sln @@ -0,0 +1,56 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2SharpDeveloper", "LibGit2Sharp\Developer.csproj", "{91B31384-CCEB-4F0A-B0F4-F5913658CC4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2SharpDeveloper.Tests", "LibGit2Sharp.Tests\Developer.Tests.csproj", "{7DFE89AD-BA3E-4012-A71B-BB860440BBEA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19D079A4-A273-4630-B2D2-79EADE3E7CA1}" + ProjectSection(SolutionItems) = preProject + .nuget\packages.config = .nuget\packages.config + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {91B31384-CCEB-4F0A-B0F4-F5913658CC4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91B31384-CCEB-4F0A-B0F4-F5913658CC4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91B31384-CCEB-4F0A-B0F4-F5913658CC4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91B31384-CCEB-4F0A-B0F4-F5913658CC4B}.Release|Any CPU.Build.0 = Release|Any CPU + {7DFE89AD-BA3E-4012-A71B-BB860440BBEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7DFE89AD-BA3E-4012-A71B-BB860440BBEA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7DFE89AD-BA3E-4012-A71B-BB860440BBEA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7DFE89AD-BA3E-4012-A71B-BB860440BBEA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + Policies = $0 + $0.TextStylePolicy = $1 + $1.inheritsSet = null + $1.scope = text/x-csharp + $0.CSharpFormattingPolicy = $2 + $2.IndentSwitchBody = True + $2.BeforeMethodCallParentheses = False + $2.BeforeMethodDeclarationParentheses = False + $2.BeforeConstructorDeclarationParentheses = False + $2.BeforeDelegateDeclarationParentheses = False + $2.NewParentheses = False + $2.inheritsSet = Mono + $2.inheritsScope = text/x-csharp + $2.scope = text/x-csharp + $0.StandardHeader = $3 + $3.Text = + $3.inheritsSet = Apache2License + $0.TextStylePolicy = $4 + $4.FileWidth = 120 + $4.RemoveTrailingWhitespace = True + $4.inheritsSet = VisualStudio + $4.inheritsScope = text/plain + $4.scope = text/plain + EndGlobalSection +EndGlobal diff --git a/Developer/LibGit2Sharp.NativeBinaries.props b/Developer/LibGit2Sharp.NativeBinaries.props new file mode 100644 index 000000000..91e542668 --- /dev/null +++ b/Developer/LibGit2Sharp.NativeBinaries.props @@ -0,0 +1,30 @@ + + + + + + + + + NativeBinaries\amd64\git2-developer.dll + PreserveNewest + + + NativeBinaries\amd64\git2-developer.pdb + PreserveNewest + + + NativeBinaries\x86\git2-developer.dll + PreserveNewest + + + NativeBinaries\x86\git2-developer.pdb + PreserveNewest + + + + LibGit2Sharp.dll.config + PreserveNewest + + + diff --git a/Developer/LibGit2Sharp.dll.config b/Developer/LibGit2Sharp.dll.config new file mode 100644 index 000000000..eac41404d --- /dev/null +++ b/Developer/LibGit2Sharp.dll.config @@ -0,0 +1,3 @@ + + + diff --git a/Developer/README.txt b/Developer/README.txt new file mode 100644 index 000000000..8581b00a4 --- /dev/null +++ b/Developer/README.txt @@ -0,0 +1,62 @@ +This file describes how to build and test LibGit2Sharp using a locally +build version of LibGit2 (rather than a NuGet-based version). The goal +is to facilitate development across all 3 layers of a LibGit2Sharp-based +application. + +In order to minimize the changes to LibGit2Sharp, I've created stub +files and some slightly modified versions of .sln and .csproj files +to maintain the basic build structure of LibGit2Sharp. + +LibGit2 DLL/PDB files are copied over from the local peer repo and +named "git2-developer" rather than using a hash value. + + +################################################################ +#### Clone both repos as peers and checkout whatever commit you need. + +cd +git clone https://github.com/libgit2/libgit2.git libgit2 +git clone https://github.com/libgit2/libgit2sharp.git libgit2sharp + +################################################################ +#### Build 32-bit and/or 64-bit debug version of LibGit2 into +#### libgit2/build and libgit2/build64. + +cd libgit2 +mkdir build +cd build +cmake -G "Visual Studio 14 2015" -DSTDCALL=ON .. +msbuild /m libgit2.sln + +cd .. +mkdir build64 +cd build64 +cmake -G "Visual Studio 14 2015 Win64" -DSTDCALL=ON .. +msbuild /m libgit2.sln + +################################################################ +#### Build LibGit2Sharp and run the unit tests using the above +#### local version of LibGit2. +#### [1] This will run NuGet on the .sln to fetch all required packages. +#### Per https://docs.nuget.org/consume/command-line-reference +#### (1.1) The .sln explicitly causes .\nuget\packages.config to be loaded. +#### (1.2) And $(ProjectDir)\packages.config is loaded for each referenced +#### project. (So both LibGit2Sharp and LibGit2Sharp.Tests.) +#### TODO This causes the LibGit2Sharp.NativeBinaries package to be +#### downloaded. However, we do not need/use it for developer mode. +#### See if NuGet has a conditional syntax to make this clear. +#### +#### [2] Uses a variant of the CI build script to build LibGit2Sharp and +#### run the unit tests. +#### (2.1) I'm forcing Debug mode on LibGit2Sharp, since that's the whole +#### point of this exercise. +#### (2.2) The build process will copy the local 32/64-bit debug DLL and +#### PDB files from the peer LibGit2 during test runs. + +build.Developer.cmd + + + + +Running a unit test as a 64-bit process: +https://msdn.microsoft.com/en-us/library/ee782531.aspx diff --git a/Developer/libgit2_filename.txt b/Developer/libgit2_filename.txt new file mode 100644 index 000000000..a395e8a53 --- /dev/null +++ b/Developer/libgit2_filename.txt @@ -0,0 +1 @@ +git2-developer diff --git a/Developer/libgit2_hash.txt b/Developer/libgit2_hash.txt new file mode 100644 index 000000000..6563189c5 --- /dev/null +++ b/Developer/libgit2_hash.txt @@ -0,0 +1 @@ +develop diff --git a/LibGit2Sharp.Tests/Developer.Tests.csproj b/LibGit2Sharp.Tests/Developer.Tests.csproj new file mode 100644 index 000000000..70e5ed701 --- /dev/null +++ b/LibGit2Sharp.Tests/Developer.Tests.csproj @@ -0,0 +1,170 @@ + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {7DFE89AD-BA3E-4012-A71B-BB860440BBEA} + Library + Properties + LibGit2Sharp.Tests + LibGit2Sharp.Tests + v4.0 + 512 + + + + true + full + false + bin\Debug\ + TRACE;DEBUG;NET40 + prompt + 4 + true + AnyCPU + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + + + + ..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll + + + + + + False + ..\packages\xunit.1.9.2\lib\net20\xunit.dll + + + ..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll + + + + + TestHelpers\Epoch.cs + + + TestHelpers\Platform.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {91B31384-CCEB-4F0A-B0F4-F5913658CC4B} + LibGit2Sharp + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + diff --git a/LibGit2Sharp/Developer.csproj b/LibGit2Sharp/Developer.csproj new file mode 100644 index 000000000..09fed88c8 --- /dev/null +++ b/LibGit2Sharp/Developer.csproj @@ -0,0 +1,409 @@ + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {91B31384-CCEB-4F0A-B0F4-F5913658CC4B} + Library + Properties + LibGit2Sharp + LibGit2Sharp + v4.0 + 512 + + + + true + full + false + bin\Debug\ + TRACE;DEBUG;NET40 + prompt + 4 + false + true + AllRules.ruleset + bin\Debug\LibGit2Sharp.xml + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + false + bin\Release\LibGit2Sharp.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build.Developer.cmd b/build.Developer.cmd new file mode 100644 index 000000000..65d8d13d4 --- /dev/null +++ b/build.Developer.cmd @@ -0,0 +1,35 @@ +@ECHO OFF + +REM Sample usages: +REM +REM Building and running tests +REM - build.Developer.cmd +REM +REM Building, running tests and embedding the libgit2sharp commit sha +REM - build.Developer.cmd "6a6eb81272876fd63555165beef44de2aaa78a14" +REM +REM Building and identifying potential leaks while running tests +REM - build.Developer.cmd "unknown" "LEAKS_IDENTIFYING" + + +SETLOCAL + +SET BASEDIR=%~dp0 +SET FrameworkVersion=v4.0.30319 +SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework + +if exist "%SystemRoot%\Microsoft.NET\Framework64" ( + SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework64 +) + +ECHO ON + +SET CommitSha=%~1 +SET ExtraDefine=%~2 + +"%BASEDIR%Lib/NuGet/NuGet.exe" restore "%BASEDIR%LibGit2Sharp.sln" +"%FrameworkDir%\%FrameworkVersion%\msbuild.exe" "%BASEDIR%CI\Developer.msbuild" /property:CommitSha=%CommitSha% /property:ExtraDefine="%ExtraDefine%" /property:Configuration=Debug + +ENDLOCAL + +EXIT /B %ERRORLEVEL% From 4d9bbb2afc60cd316c9481b2874217fc1142279a Mon Sep 17 00:00:00 2001 From: Jeff Hostetler Date: Wed, 23 Sep 2015 09:36:50 -0400 Subject: [PATCH 2/2] Cleanup and documentation. --- ...veloper.msbuild => build.LocalDev.msbuild} | 2 +- Developer/README.txt | 62 --------------- Developer/libgit2_filename.txt | 1 - Developer/libgit2_hash.txt | 1 - Developer.sln => LibGit2Sharp.LocalDev.sln | 4 +- ...roj => LibGit2Sharp.Tests.LocalDev.csproj} | 2 +- ...er.csproj => LibGit2Sharp.LocalDev.csproj} | 6 +- .../LibGit2Sharp.NativeBinaries.props | 8 +- .../LibGit2Sharp.dll.config | 0 LocalDev/README.txt | 78 +++++++++++++++++++ LocalDev/libgit2_filename.txt | 1 + LocalDev/libgit2_hash.txt | 1 + build.Developer.cmd | 35 --------- build.libgit2sharp.LocalDev.cmd | 32 ++++++++ 14 files changed, 123 insertions(+), 110 deletions(-) rename CI/{Developer.msbuild => build.LocalDev.msbuild} (97%) delete mode 100644 Developer/README.txt delete mode 100644 Developer/libgit2_filename.txt delete mode 100644 Developer/libgit2_hash.txt rename Developer.sln => LibGit2Sharp.LocalDev.sln (91%) rename LibGit2Sharp.Tests/{Developer.Tests.csproj => LibGit2Sharp.Tests.LocalDev.csproj} (99%) rename LibGit2Sharp/{Developer.csproj => LibGit2Sharp.LocalDev.csproj} (99%) rename {Developer => LocalDev}/LibGit2Sharp.NativeBinaries.props (86%) rename {Developer => LocalDev}/LibGit2Sharp.dll.config (100%) create mode 100644 LocalDev/README.txt create mode 100644 LocalDev/libgit2_filename.txt create mode 100644 LocalDev/libgit2_hash.txt delete mode 100644 build.Developer.cmd create mode 100644 build.libgit2sharp.LocalDev.cmd diff --git a/CI/Developer.msbuild b/CI/build.LocalDev.msbuild similarity index 97% rename from CI/Developer.msbuild rename to CI/build.LocalDev.msbuild index 9c9cdb3c2..574358bbb 100644 --- a/CI/Developer.msbuild +++ b/CI/build.LocalDev.msbuild @@ -31,7 +31,7 @@ diff --git a/Developer/README.txt b/Developer/README.txt deleted file mode 100644 index 8581b00a4..000000000 --- a/Developer/README.txt +++ /dev/null @@ -1,62 +0,0 @@ -This file describes how to build and test LibGit2Sharp using a locally -build version of LibGit2 (rather than a NuGet-based version). The goal -is to facilitate development across all 3 layers of a LibGit2Sharp-based -application. - -In order to minimize the changes to LibGit2Sharp, I've created stub -files and some slightly modified versions of .sln and .csproj files -to maintain the basic build structure of LibGit2Sharp. - -LibGit2 DLL/PDB files are copied over from the local peer repo and -named "git2-developer" rather than using a hash value. - - -################################################################ -#### Clone both repos as peers and checkout whatever commit you need. - -cd -git clone https://github.com/libgit2/libgit2.git libgit2 -git clone https://github.com/libgit2/libgit2sharp.git libgit2sharp - -################################################################ -#### Build 32-bit and/or 64-bit debug version of LibGit2 into -#### libgit2/build and libgit2/build64. - -cd libgit2 -mkdir build -cd build -cmake -G "Visual Studio 14 2015" -DSTDCALL=ON .. -msbuild /m libgit2.sln - -cd .. -mkdir build64 -cd build64 -cmake -G "Visual Studio 14 2015 Win64" -DSTDCALL=ON .. -msbuild /m libgit2.sln - -################################################################ -#### Build LibGit2Sharp and run the unit tests using the above -#### local version of LibGit2. -#### [1] This will run NuGet on the .sln to fetch all required packages. -#### Per https://docs.nuget.org/consume/command-line-reference -#### (1.1) The .sln explicitly causes .\nuget\packages.config to be loaded. -#### (1.2) And $(ProjectDir)\packages.config is loaded for each referenced -#### project. (So both LibGit2Sharp and LibGit2Sharp.Tests.) -#### TODO This causes the LibGit2Sharp.NativeBinaries package to be -#### downloaded. However, we do not need/use it for developer mode. -#### See if NuGet has a conditional syntax to make this clear. -#### -#### [2] Uses a variant of the CI build script to build LibGit2Sharp and -#### run the unit tests. -#### (2.1) I'm forcing Debug mode on LibGit2Sharp, since that's the whole -#### point of this exercise. -#### (2.2) The build process will copy the local 32/64-bit debug DLL and -#### PDB files from the peer LibGit2 during test runs. - -build.Developer.cmd - - - - -Running a unit test as a 64-bit process: -https://msdn.microsoft.com/en-us/library/ee782531.aspx diff --git a/Developer/libgit2_filename.txt b/Developer/libgit2_filename.txt deleted file mode 100644 index a395e8a53..000000000 --- a/Developer/libgit2_filename.txt +++ /dev/null @@ -1 +0,0 @@ -git2-developer diff --git a/Developer/libgit2_hash.txt b/Developer/libgit2_hash.txt deleted file mode 100644 index 6563189c5..000000000 --- a/Developer/libgit2_hash.txt +++ /dev/null @@ -1 +0,0 @@ -develop diff --git a/Developer.sln b/LibGit2Sharp.LocalDev.sln similarity index 91% rename from Developer.sln rename to LibGit2Sharp.LocalDev.sln index ca4052321..566bd984d 100644 --- a/Developer.sln +++ b/LibGit2Sharp.LocalDev.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2SharpDeveloper", "LibGit2Sharp\Developer.csproj", "{91B31384-CCEB-4F0A-B0F4-F5913658CC4B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp.LocalDev", "LibGit2Sharp\LibGit2Sharp.LocalDev.csproj", "{91B31384-CCEB-4F0A-B0F4-F5913658CC4B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2SharpDeveloper.Tests", "LibGit2Sharp.Tests\Developer.Tests.csproj", "{7DFE89AD-BA3E-4012-A71B-BB860440BBEA}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp.Tests.LocalDev", "LibGit2Sharp.Tests\LibGit2Sharp.Tests.LocalDev.csproj", "{7DFE89AD-BA3E-4012-A71B-BB860440BBEA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19D079A4-A273-4630-B2D2-79EADE3E7CA1}" ProjectSection(SolutionItems) = preProject diff --git a/LibGit2Sharp.Tests/Developer.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.LocalDev.csproj similarity index 99% rename from LibGit2Sharp.Tests/Developer.Tests.csproj rename to LibGit2Sharp.Tests/LibGit2Sharp.Tests.LocalDev.csproj index 70e5ed701..f44c2d063 100644 --- a/LibGit2Sharp.Tests/Developer.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.LocalDev.csproj @@ -138,7 +138,7 @@ - + {91B31384-CCEB-4F0A-B0F4-F5913658CC4B} LibGit2Sharp diff --git a/LibGit2Sharp/Developer.csproj b/LibGit2Sharp/LibGit2Sharp.LocalDev.csproj similarity index 99% rename from LibGit2Sharp/Developer.csproj rename to LibGit2Sharp/LibGit2Sharp.LocalDev.csproj index 09fed88c8..1d8a3b028 100644 --- a/LibGit2Sharp/Developer.csproj +++ b/LibGit2Sharp/LibGit2Sharp.LocalDev.csproj @@ -1,6 +1,6 @@ - + - + Debug AnyCPU @@ -406,4 +406,4 @@ --> - \ No newline at end of file + diff --git a/Developer/LibGit2Sharp.NativeBinaries.props b/LocalDev/LibGit2Sharp.NativeBinaries.props similarity index 86% rename from Developer/LibGit2Sharp.NativeBinaries.props rename to LocalDev/LibGit2Sharp.NativeBinaries.props index 91e542668..a3a72a10d 100644 --- a/Developer/LibGit2Sharp.NativeBinaries.props +++ b/LocalDev/LibGit2Sharp.NativeBinaries.props @@ -6,19 +6,19 @@ - NativeBinaries\amd64\git2-developer.dll + NativeBinaries\amd64\git2-localdev.dll PreserveNewest - NativeBinaries\amd64\git2-developer.pdb + NativeBinaries\amd64\git2-localdev.pdb PreserveNewest - NativeBinaries\x86\git2-developer.dll + NativeBinaries\x86\git2-localdev.dll PreserveNewest - NativeBinaries\x86\git2-developer.pdb + NativeBinaries\x86\git2-localdev.pdb PreserveNewest diff --git a/Developer/LibGit2Sharp.dll.config b/LocalDev/LibGit2Sharp.dll.config similarity index 100% rename from Developer/LibGit2Sharp.dll.config rename to LocalDev/LibGit2Sharp.dll.config diff --git a/LocalDev/README.txt b/LocalDev/README.txt new file mode 100644 index 000000000..d457dd019 --- /dev/null +++ b/LocalDev/README.txt @@ -0,0 +1,78 @@ +This file describes how to build and test LibGit2Sharp using a locally +build version of LibGit2 (rather than a NuGet-based version). The goal +is to facilitate development and debugging across all 3 layers of a +LibGit2Sharp-based application. + +In order to minimize the changes to LibGit2Sharp, I've created stub +files and some slightly modified versions of the msbuild files (*.sln, +*.csproj, and *.msbuild) to maintain the same basic build structure +of LibGit2Sharp. The new .csproj files import the .props file in this +directory rather than importing the file from the NuGet package. +(In "https://msdn.microsoft.com/en-us/library/92x05xfs.aspx" it is +stated that does support conditionals, but that they only work +from the command line, not from Visual Studio. So I copied the .csproj +files rather than include both imports with conditionals. This also +keeps the LocalDev stuff out of the main/official build scripts.) + +LibGit2 DLL/PDB files are copied over from the local peer repo and +named "git2-localdev" rather than using a hash value. + +################################################################ +#### To work using the LocalDev scripts. +#### [1] Clone both repos as peers and checkout whatever commit you need. + +> cd +> git clone https://github.com/libgit2/libgit2.git libgit2 +> git clone https://github.com/libgit2/libgit2sharp.git libgit2sharp + +#### [2] Build 32-bit and/or 64-bit debug version of LibGit2 into +#### libgit2/build and libgit2/build64. You only need to build +#### the bitness that you need, but we support both. +#### TODO add build64 to the libgit2/.gitignores. + +> cd libgit2 +> mkdir build +> cd build +> cmake -G "Visual Studio 14 2015" -DSTDCALL=ON .. +> msbuild /m libgit2.sln + +> cd .. +> mkdir build64 +> cd build64 +> cmake -G "Visual Studio 14 2015 Win64" -DSTDCALL=ON .. +> msbuild /m libgit2.sln + +#### [3] Build LibGit2Sharp and run the unit tests using the above +#### local version of LibGit2. + +> build.libgit2sharp.LocalDev.cmd + +################################################################ +#### Notes. +#### [1] The .cmd will run NuGet on the .sln to fetch all required packages. +#### Per https://docs.nuget.org/consume/command-line-reference +#### (1.1) The .sln explicitly causes .\nuget\packages.config to be loaded. +#### (1.2) And $(ProjectDir)\packages.config is loaded for each project +#### referenced by the .sln. +#### (1.2.1) LibGit2Sharp\packages.config +#### (1.2.2) LibGit2Sharp.Tests\packages.config +#### +#### TODO 1.2.1 causes the LibGit2Sharp.NativeBinaries package to be +#### downloaded. However, we do not need/use it for developer mode. +#### See if NuGet has a conditional syntax to make this clear. +#### +#### [2] The .cmd uses a variant of the CI build script to build LibGit2Sharp +#### and run the unit tests. +#### (2.1) I'm forcing Debug mode on LibGit2Sharp, since that's the whole +#### point of this exercise. +#### (2.2) The build process will copy the locally-built 32/64-bit debug +#### DLL and PDB files from the peer LibGit2 during test runs. +#### +#### ./LibGit2Sharp/bin/Debug/LibGit2Sharp.{dll,pdb} +#### ./LibGit2Sharp/bin/Debug/NativeBinaries/{amd64,x86}/git2-localdev.{dll,pdb} +#### +#### ./LibGit2Sharp.Tests/bin/Debug/LibGit2Sharp.Tests.{dll,pdb} +#### ./LibGit2Sharp.Tests/bin/Debug/NativeBinaries/{amd64,x86}/git2-localdev.{dll,pdb} +#### +#### [3] Here's a reference for running the unit tests as a 64-bit process: +#### https://msdn.microsoft.com/en-us/library/ee782531.aspx diff --git a/LocalDev/libgit2_filename.txt b/LocalDev/libgit2_filename.txt new file mode 100644 index 000000000..f8f149e92 --- /dev/null +++ b/LocalDev/libgit2_filename.txt @@ -0,0 +1 @@ +git2-localdev diff --git a/LocalDev/libgit2_hash.txt b/LocalDev/libgit2_hash.txt new file mode 100644 index 000000000..d9643cbbe --- /dev/null +++ b/LocalDev/libgit2_hash.txt @@ -0,0 +1 @@ +localdev diff --git a/build.Developer.cmd b/build.Developer.cmd deleted file mode 100644 index 65d8d13d4..000000000 --- a/build.Developer.cmd +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -REM Sample usages: -REM -REM Building and running tests -REM - build.Developer.cmd -REM -REM Building, running tests and embedding the libgit2sharp commit sha -REM - build.Developer.cmd "6a6eb81272876fd63555165beef44de2aaa78a14" -REM -REM Building and identifying potential leaks while running tests -REM - build.Developer.cmd "unknown" "LEAKS_IDENTIFYING" - - -SETLOCAL - -SET BASEDIR=%~dp0 -SET FrameworkVersion=v4.0.30319 -SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework - -if exist "%SystemRoot%\Microsoft.NET\Framework64" ( - SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework64 -) - -ECHO ON - -SET CommitSha=%~1 -SET ExtraDefine=%~2 - -"%BASEDIR%Lib/NuGet/NuGet.exe" restore "%BASEDIR%LibGit2Sharp.sln" -"%FrameworkDir%\%FrameworkVersion%\msbuild.exe" "%BASEDIR%CI\Developer.msbuild" /property:CommitSha=%CommitSha% /property:ExtraDefine="%ExtraDefine%" /property:Configuration=Debug - -ENDLOCAL - -EXIT /B %ERRORLEVEL% diff --git a/build.libgit2sharp.LocalDev.cmd b/build.libgit2sharp.LocalDev.cmd new file mode 100644 index 000000000..130795338 --- /dev/null +++ b/build.libgit2sharp.LocalDev.cmd @@ -0,0 +1,32 @@ +@ECHO OFF + +REM This is the "LocalDev" version of the build scripts. It references +REM locally-built versions of LibGit2. (The normal scripts use a LibGit2 +REM NuGet package.) +REM +REM See .\LocalDev\README.txt for full details. +REM +REM Command line usage is identical to the normal script. See it for details. + + +SETLOCAL + +SET BASEDIR=%~dp0 +SET FrameworkVersion=v4.0.30319 +SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework + +if exist "%SystemRoot%\Microsoft.NET\Framework64" ( + SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework64 +) + +ECHO ON + +SET CommitSha=%~1 +SET ExtraDefine=%~2 + +"%BASEDIR%Lib/NuGet/NuGet.exe" restore "%BASEDIR%LibGit2Sharp.sln" +"%FrameworkDir%\%FrameworkVersion%\msbuild.exe" "%BASEDIR%CI\build.LocalDev.msbuild" /property:CommitSha=%CommitSha% /property:ExtraDefine="%ExtraDefine%" /property:Configuration=Debug + +ENDLOCAL + +EXIT /B %ERRORLEVEL%