Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit e8ff209

Browse files
committed
Consolidate custom build targets into separate files
VS loves to screw around with the csproj format, so move all the custom rules into separate files that it can't screw around with. This also gives the added benefit of shutting up the warning about duplicate AssemblyVersionInformation types, because apparently VS doesn't show files that are included for compilation from external targets files but it still includes them in the compilation (bug? feature? shrug) Add instructions for the GitHub.Unity.OctokitDebugging solution Add mono-built versions of octokit and dotnet-http. Octokit: 0.23.0.1 dotnet-httpClient35: 3.5.0.0 (3.5.22000.1-gfu)
1 parent 91d7618 commit e8ff209

30 files changed

+182
-338
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ _NCrunch_GitHub.Unity
44
*.user
55
.DS_Store
66
build/
7-
TestResult.xml
7+
TestResult.xml
8+
submodules/

GitHub.Unity.Internal.sln renamed to GitHub.Unity.OctokitDebugging.sln

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "octokit", "octokit", "{5C9C
3333
EndProject
3434
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit-35", "..\octokit.net\Octokit\Octokit-35.csproj", "{49EF16A2-5ED1-480F-80A1-D1D05D6C1BE4}"
3535
EndProject
36-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit-Extensions35", "..\octokit.net\Octokit-Extensions35\Octokit-Extensions35.csproj", "{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236}"
37-
EndProject
3836
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Http-net_3_5", "..\dotnet-httpclient35\System.Net.Http\System.Net.Http-net_3_5.csproj", "{9862694D-E4FA-418B-8692-A0280FEDDF36}"
3937
EndProject
4038
Global
@@ -110,12 +108,6 @@ Global
110108
{49EF16A2-5ED1-480F-80A1-D1D05D6C1BE4}.dev|Any CPU.Build.0 = Debug|Any CPU
111109
{49EF16A2-5ED1-480F-80A1-D1D05D6C1BE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
112110
{49EF16A2-5ED1-480F-80A1-D1D05D6C1BE4}.Release|Any CPU.Build.0 = Release|Any CPU
113-
{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114-
{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236}.Debug|Any CPU.Build.0 = Debug|Any CPU
115-
{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236}.dev|Any CPU.ActiveCfg = Debug|Any CPU
116-
{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236}.dev|Any CPU.Build.0 = Debug|Any CPU
117-
{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236}.Release|Any CPU.ActiveCfg = Release|Any CPU
118-
{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236}.Release|Any CPU.Build.0 = Release|Any CPU
119111
{9862694D-E4FA-418B-8692-A0280FEDDF36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
120112
{9862694D-E4FA-418B-8692-A0280FEDDF36}.Debug|Any CPU.Build.0 = Debug|Any CPU
121113
{9862694D-E4FA-418B-8692-A0280FEDDF36}.dev|Any CPU.ActiveCfg = Debug|Any CPU
@@ -135,7 +127,6 @@ Global
135127
{1A382F40-FD9E-43E1-89C1-320073F35CE9} = {D17F1B4C-42DC-4E78-BCEF-9F239A084C4D}
136128
{08B87D2A-8CF1-4211-B7AA-5209F00F72F8} = {D17F1B4C-42DC-4E78-BCEF-9F239A084C4D}
137129
{49EF16A2-5ED1-480F-80A1-D1D05D6C1BE4} = {5C9C1D3B-0740-4EF3-A374-CCCD67FB6E48}
138-
{EB4B074E-62A7-4F1D-8F95-E64B7AEA0236} = {5C9C1D3B-0740-4EF3-A374-CCCD67FB6E48}
139130
{9862694D-E4FA-418B-8692-A0280FEDDF36} = {C6854BB9-D594-46B0-9E10-72607CC97E77}
140131
EndGlobalSection
141132
EndGlobal

GitHub.Unity.v3.ncrunchsolution

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<AllowParallelTestExecution>True</AllowParallelTestExecution>
44
<MetricsExclusionList>
55
<Value>submodules\octokit.net\Octokit\Octokit-35.csproj</Value>
6-
<Value>submodules\octokit.net\Octokit-Extensions35\Octokit-Extensions35.csproj</Value>
76
<Value>src\UnitTests\UnitTests.csproj</Value>
87
<Value>src\IntegrationTests\IntegrationTests.csproj</Value>
98
<Value>submodules\dotnet-httpClient35\System.Net.Http\System.Net.Http-net_3_5.csproj</Value>

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ if [ -e "/c/" ]; then
2727
fi
2828

2929
if [ x"$OS" == x"Windows" ]; then
30-
common/nuget restore
30+
common/nuget restore GitHub.Unity.sln
3131
else
32-
nuget restore
32+
nuget restore GitHub.Unity.sln
3333
fi
3434

3535
xbuild GitHub.Unity.sln /verbosity:normal /property:Configuration=$Configuration /target:$Target || true

common/build.targets

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<!-- Build flags -->
4+
<PropertyGroup>
5+
<SolutionType Condition="'$(SolutionName)' == 'GitHub.Unity.OctokitDebugging'">OctokitDebugging</SolutionType>
6+
<BuildType Condition="Exists('$(SolutionDir)\script\src\MetricsService.cs')">Internal</BuildType>
7+
8+
<UnityDir Condition="$(UnityDir) == '' and Exists('$(SolutionDir)\script\lib\UnityEditor.dll')">$(SolutionDir)\script\lib\</UnityDir>
9+
<UnityDir Condition="$(UnityDir) == '' and Exists('$(SolutionDir)\lib\UnityEditor.dll')">$(SolutionDir)\lib\</UnityDir>
10+
<UnityDir Condition="$(UnityDir) == '' and Exists('C:\Program Files (x86)\Unity\Editor\Data\Managed\UnityEditor.dll')">C:\Program Files (x86)\Unity\Editor\Data\Managed\</UnityDir>
11+
<UnityDir Condition="$(UnityDir) == '' and Exists('\Applications\Unity\Unity.app\Contents\Managed\UnityEditor.dll')">\Applications\Unity\Unity.app\Contents\Managed\</UnityDir>
12+
<BuildConfig Condition=" '$(BuildConfig)' == '' ">Debug</BuildConfig>
13+
</PropertyGroup>
14+
15+
<!-- Common assembly properties (versioning) -->
16+
<ItemGroup>
17+
<Compile Include="$(SolutionDir)common\SolutionInfo.cs">
18+
<Link>Properties\SolutionInfo.cs</Link>
19+
</Compile>
20+
<None Include="$(SolutionDir)common\GitHub.ruleset">
21+
<Link>Properties\GitHub.ruleset</Link>
22+
</None>
23+
</ItemGroup>
24+
25+
<!-- Common includes and references -->
26+
<Choose>
27+
<When Condition="$(SolutionType) == 'OctokitDebugging'">
28+
<ItemGroup>
29+
<ProjectReference Include="$(SolutionDir)..\dotnet-httpclient35\System.Net.Http\System.Net.Http-net_3_5.csproj">
30+
<Project>{9862694d-e4fa-418b-8692-a0280feddf36}</Project>
31+
<Name>System.Net.Http-net_3_5</Name>
32+
</ProjectReference>
33+
<ProjectReference Include="$(SolutionDir)..\octokit.net\Octokit\Octokit-35.csproj">
34+
<Project>{49ef16a2-5ed1-480f-80a1-d1d05d6c1be4}</Project>
35+
<Name>Octokit-35</Name>
36+
</ProjectReference>
37+
</ItemGroup>
38+
</When>
39+
<Otherwise>
40+
<ItemGroup>
41+
<Reference Include="Octokit">
42+
<HintPath>$(SolutionDir)lib\octokit.net\Octokit.dll</HintPath>
43+
</Reference>
44+
<Reference Include="System.Net.Http">
45+
<HintPath>$(SolutionDir)lib\system.net.http_35\System.Net.Http.dll</HintPath>
46+
</Reference>
47+
</ItemGroup>
48+
</Otherwise>
49+
</Choose>
50+
51+
<Target Name="BeforeBuild">
52+
<PropertyGroup>
53+
<ErrorText>Location of Unity dlls is not set. You'll need to install Unity in a known location (the default installation directory for your system), or copy UnityEngine.dll and UnityEditor.dll to the {0}lib folder</ErrorText>
54+
</PropertyGroup>
55+
<Error Condition="'$(UnityDir)' == ''" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)'))" />
56+
</Target>
57+
</Project>

common/packaging.targets

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<PropertyGroup>
5+
<PublishTo Condition="'$(PublishTo)' == '' ">$(SolutionDir)\unity\PackageProject\Assets\Editor\GitHub</PublishTo>
6+
<ExternalPublishTo>$(SolutionDir)..\github-unity-test\GitHubExtensionProject\Assets\Editor\GitHub</ExternalPublishTo>
7+
</PropertyGroup>
8+
9+
<!-- After the build is done, we copy all the artifacts into two locations:
10+
..\github-unity-test\GitHubExtensionProject - an empty unity project for testing
11+
unity\PackageProject - the project we use for packaging
12+
-->
13+
<Target Name="AfterBuild">
14+
15+
<Delete Files="$(OutputPath)\$(AssemblyName).dll;$(OutputPath)\$(AssemblyName).pdb;$(OutputPath)\$(AssemblyName).dll.mdb" TreatErrorsAsWarnings="true" />
16+
17+
<CreateItem Include="$(OutputPath)\**\*.*">
18+
<Output TaskParameter="Include" ItemName="ToCopy" />
19+
</CreateItem>
20+
21+
<!-- Copy all the DLLs to the unity\PackageProject folder for later packaging -->
22+
<Copy
23+
SourceFiles="@(ToCopy)"
24+
DestinationFiles="@(ToCopy->'$(PublishTo)\%(RecursiveDir)%(Filename)%(Extension)')"
25+
Condition="!$([System.String]::Copy('%(Filename)').Contains('deleteme')) and !$([System.String]::Copy('%(Extension)').Contains('xml')) and !$([System.String]::Copy('%(Extension)').Contains('pdb')) and !$([System.String]::Copy('%(Extension)').Contains('dll.mdb'))" />
26+
27+
<CreateItem Include="$(PublishTo)\**\*.*">
28+
<Output TaskParameter="Include" ItemName="ToMoreCopy" />
29+
</CreateItem>
30+
31+
<!-- Copy all the DLLs to the ..\github-unity-test folder, creating an empty Unity project with the extension ready for testing -->
32+
<Copy
33+
SourceFiles="@(ToMoreCopy)"
34+
DestinationFiles="@(ToMoreCopy->'$(ExternalPublishTo)\%(RecursiveDir)%(Filename)%(Extension)')"
35+
Retries="0"
36+
ContinueOnError="WarnAndContinue" />
37+
38+
</Target>
39+
40+
<Target Name="CopyMainAssembly" DependsOnTargets="DetectMainAssembly">
41+
42+
<Copy
43+
Condition="'%(IndirectDependency.FullPath)'!=''"
44+
SourceFiles="%(IndirectDependency.FullPath)"
45+
DestinationFolder="$(OutputPath)"
46+
SkipUnchangedFiles="true">
47+
<Output TaskParameter="CopiedFiles" ItemName="IndirectDependencyCopied" />
48+
</Copy>
49+
50+
<Message Importance="high"
51+
Condition="'%(IndirectDependencyCopied.FullPath)'!='' and '%(IndirectDependencyCopied.Extension)'!='.pdb' and '%(IndirectDependencyCopied.Extension)'!='.xml'"
52+
Text="Dependency copied: %(IndirectDependencyCopied.FullPath)" />
53+
54+
</Target>
55+
56+
<Target Name="DetectMainAssembly" DependsOnTargets="ResolveAssemblyReferences">
57+
58+
<Message Importance="low" Text="Dependency: %(ReferencePath.Filename)%(ReferencePath.Extension) %(ReferencePath.CopyLocal)" />
59+
60+
<!-- Creating indirect dependency list -->
61+
<CreateItem Include="%(ReferencePath.FullPath)" Condition="$([System.String]::Copy('%(ReferencePath.Filename)').Contains('GitHub.Unity'))">
62+
<Output TaskParameter="Include" ItemName="IndirectDependency" />
63+
</CreateItem>
64+
</Target>
65+
66+
<PropertyGroup>
67+
<CoreBuildDependsOn>
68+
$(CoreBuildDependsOn);
69+
CopyMainAssembly
70+
</CoreBuildDependsOn>
71+
</PropertyGroup>
72+
</Project>

common/unitylocation.props

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/contributing/how-to-build.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ The `GitHub.Unity.sln` solution includes several projects:
6161
- GitHub.Logging: A logging helper library
6262
- GitHub.Api: The core of the extension. This project is C#6 and includes async/await threading and other features that Unity cannot currently compile.
6363
- GitHub.Unity: Unity-specific code. This project is compilable by Unity
64+
65+
## Other solutions
66+
67+
Octokit is normally included as a prebuilt DLL (in the `lib` directory), but when updating Octokit or debugging issues with the 3.5 backport, it can sometimes be handy to reference the project directly. The `GitHub.Unity.OctokitDebugging.sln` solution is a helper solution that includes Octokit and dotnet-httpclient35 as referenced projects instead of prebuilt dlls.
68+
69+
This solution requires a clone of [https://github.com/github-for-unity/octokit.net](https://github.com/github-for-unity/octokit.net) and [https://github.com/github-for-unity/dotnet-httpclient35](https://github.com/github-for-unity/dotnet-httpclient35) to exist next to your GitHub for Unity checkout.

lib/octokit.net/Octokit-Extensions35.dll

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/octokit.net/Octokit-Extensions35.pdb

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)