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

Unity 2018 .NET 4.5+ Support #833

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ if not %2.==. (
set Target=%2
)

set FrameworkVersion=v3.5
if not %3.==. (
set FrameworkVersion=%3
)

if %Target%==Rebuild (
del /Q unity\PackageProject\Assets\Plugins\GitHub\Editor\*.dll
del /Q unity\PackageProject\Assets\Plugins\GitHub\Editor\*.mdb
Expand All @@ -25,8 +30,8 @@ if %Target%==Rebuild (

call common\nuget.exe restore GitHub.Unity.sln

echo xbuild GitHub.Unity.sln /verbosity:normal /property:Configuration=%Configuration% /target:%Target%
call xbuild GitHub.Unity.sln /verbosity:normal /property:Configuration=%Configuration% /target:%Target%
echo xbuild GitHub.Unity.sln /verbosity:normal /property:Configuration=%Configuration% /property:TargetFrameworkVersion=%FrameworkVersion% /target:%Target%
call xbuild GitHub.Unity.sln /verbosity:normal /property:Configuration=%Configuration% /property:TargetFrameworkVersion=%FrameworkVersion% /target:%Target%

del /Q unity\PackageProject\Assets\Plugins\GitHub\Editor\deleteme*
del /Q unity\PackageProject\Assets\Plugins\GitHub\Editor\deleteme*
Expand Down
7 changes: 6 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ if [ $# -gt 1 ]; then
Target=$2
fi

FrameworkVersion="v3.5"
if [ $# -gt 2 ]; then
FrameworkVersion=$3
fi

if [ x"$Target" == x"Rebuild" ]; then
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.dll
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.mdb
Expand All @@ -32,7 +37,7 @@ else
mono common/nuget.exe restore GitHub.Unity.sln
fi

xbuild GitHub.Unity.sln /verbosity:minimal /property:Configuration=$Configuration /target:$Target || true
xbuild GitHub.Unity.sln /verbosity:minimal /property:Configuration=$Configuration /property:TargetFrameworkVersion=$FrameworkVersion /target:$Target || true

rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/deleteme*
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/deleteme*
Expand Down
1 change: 1 addition & 0 deletions common/properties.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<BuildType Condition="Exists('$(SolutionDir)script\src\MetricsService.cs')">Internal</BuildType>
<BuildDefs Condition="$(Buildtype) == 'Internal'">ENABLE_METRICS</BuildDefs>
<BuildDefs>$(BuildDefs);ENABLE_MONO</BuildDefs>
<BuildDefs Condition=" '$(TargetFrameworkVersion)' == 'v3.5' ">NET35</BuildDefs>

<UnityDir Condition="$(UnityDir) == '' and Exists('$(SolutionDir)\script\lib\Managed\UnityEditor.dll')">$(SolutionDir)script\lib\</UnityDir>
<UnityDir Condition="$(UnityDir) == '' and Exists('$(SolutionDir)\lib\Managed\UnityEditor.dll')">$(SolutionDir)lib\</UnityDir>
Expand Down
12 changes: 10 additions & 2 deletions package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ if %ChangeConfigurationToDebug%==1 (
set Configuration=Debug
)

set FrameworkVersion=v3.5
if not %3.==. (
set FrameworkVersion=%3
)

set Unity=%UnityPath%\Editor\Unity.exe
if not exist "%Unity%" (
echo Cannot find Unity at %Unity%
Expand All @@ -39,8 +44,8 @@ if not exist "%Unity%" (
cd ..

call common\nuget.exe restore GitHub.Unity.sln
echo xbuild GitHub.Unity.sln /property:Configuration=%Configuration%
call xbuild GitHub.Unity.sln /property:Configuration=%Configuration%
echo xbuild GitHub.Unity.sln /property:Configuration=%Configuration% property:TargetFrameworkVersion=%FrameworkVersion%
call xbuild GitHub.Unity.sln /property:Configuration=%Configuration% property:TargetFrameworkVersion=%FrameworkVersion%

del /Q unity\PackageProject\Assets\Plugins\GitHub\Editor\deleteme*
del /Q unity\PackageProject\Assets\Plugins\GitHub\Editor\*.pdb
Expand All @@ -50,6 +55,9 @@ if not exist "%Unity%" (
for /f tokens^=^2^ usebackq^ delims^=^" %%G in (`find "const string Version" common\SolutionInfo.cs`) do call :Package %%G

goto End

rem TODO: Put FrameworkVersion into unitypackage name
rem TODO: Remove AsyncBridge related metas

:Package
set Version=%1
Expand Down
29 changes: 27 additions & 2 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ if [ $# -gt 1 ]; then
esac
fi

FrameworkVersion="v3.5"
if [ $# -gt 2 ]; then
FrameworkVersion=$3
fi

pushd unity/PackageProject/Assets
git clean -xdf
popd
Expand Down Expand Up @@ -51,17 +56,37 @@ else
nuget restore GitHub.Unity.sln
fi

xbuild GitHub.Unity.sln /property:Configuration=$Configuration
xbuild GitHub.Unity.sln /property:Configuration=$Configuration /property:TargetFrameworkVersion=$FrameworkVersion

rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/deleteme*
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.pdb
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.pdb.meta
rm -f unity/PackageProject/Assets/Plugins/GitHub/Editor/*.xml

# There should be a better way to deal with these
if [ x"$FrameworkVersion" != x"v3.5" ]; then
mv unity/PackageProject/Assets/Plugins/GitHub/Editor/AsyncBridge.Net35.dll.meta ./
mv unity/PackageProject/Assets/Plugins/GitHub/Editor/ReadOnlyCollectionsInterfaces.dll.meta ./
mv unity/PackageProject/Assets/Plugins/GitHub/Editor/System.Threading.dll.meta ./

rm -f ../github-unity-test/GitHubExtensionProject/Assets/Plugins/GitHub/Editor/AsyncBridge.Net35.dll.meta
rm -f ../github-unity-test/GitHubExtensionProject/Assets/Plugins/GitHub/Editor/ReadOnlyCollectionsInterfaces.dll.meta
rm -f ../github-unity-test/GitHubExtensionProject/Assets/Plugins/GitHub/Editor/System.Threading.dll.meta
fi

Version=`sed -En 's,.*Version = "(.*)".*,\1,p' common/SolutionInfo.cs`
commitcount=`git rev-list --count HEAD`
commit=`git log -n1 --pretty=format:%h`
Version="${Version}.${commitcount}-${commit}"
DotNetVersion=${FrameworkVersion:1}
DotNetVersion="$(echo $DotNetVersion | tr -d .)"
Version="${Version}.${commitcount}-${commit}.net${DotNetVersion}"
Version=$Version

export GITHUB_UNITY_DISABLE=1
"$Unity" -batchmode -projectPath "`pwd`/unity/PackageProject" -exportPackage Assets/Plugins/GitHub/Editor github-for-unity-$Version.unitypackage -force-free -quit

if [ x"$FrameworkVersion" != x"v3.5" ]; then
mv ./AsyncBridge.Net35.dll.meta unity/PackageProject/Assets/Plugins/GitHub/Editor/
mv ./ReadOnlyCollectionsInterfaces.dll.meta unity/PackageProject/Assets/Plugins/GitHub/Editor/
mv ./System.Threading.dll.meta unity/PackageProject/Assets/Plugins/GitHub/Editor/
fi
21 changes: 12 additions & 9 deletions src/GitHub.Api/GitHub.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,33 @@
<PropertyGroup>
<BuildConfig Condition=" '$(BuildConfig)' == '' ">Debug</BuildConfig>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkVersion)' == 'v3.5' ">
<Reference Include="AsyncBridge.Net35, Version=0.2.3333.0, Culture=neutral, PublicKeyToken=b3b1c0202c0d6a87, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\AsyncBridge.Net35.0.2.3333.0\lib\net35-Client\AsyncBridge.Net35.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="sfw.net">
<HintPath>$(SolutionDir)\lib\sfw\sfw.net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir).\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>$(SolutionDir)lib\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Mono.Posix">
<HintPath>$(SolutionDir)lib\Mono.Posix.dll</HintPath>
</Reference>
<Reference Include="ReadOnlyCollectionsInterfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\ReadOnlyCollectionInterfaces.1.0.0\lib\NET20\ReadOnlyCollectionsInterfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="sfw.net">
<HintPath>$(SolutionDir)\lib\sfw\sfw.net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir).\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Application\ApplicationInfo.cs" />
Expand Down Expand Up @@ -236,6 +238,7 @@
<Compile Include="Platform\Platform.cs" />
<Compile Include="Git\GitCredentialManager.cs" />
<Compile Include="UI\TreeBase.cs" />
<Compile Include="Tasks\TaskEx.cs" />
</ItemGroup>
<Choose>
<When Condition="$(Buildtype) == 'Internal'">
Expand Down
57 changes: 57 additions & 0 deletions src/GitHub.Api/Tasks/TaskEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#if !NET35
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace GitHub.Unity
{
public static class TaskEx
{
public static Task<TResult> FromResult<TResult>(TResult result)
{
return Task.FromResult(result);
}

public static Task<Task> WhenAny(System.Collections.Generic.IEnumerable<Task> tasks)
{
return Task.WhenAny(tasks);
}

public static Task<Task> WhenAny(params Task[] tasks)
{
return Task.WhenAny(tasks);
}

public static Task<Task<TResult>> WhenAny<TResult>(IEnumerable<Task<TResult>> tasks)
{
return Task.WhenAny(tasks);
}

public static Task<Task<TResult>> WhenAny<TResult>(params Task<TResult>[] tasks)
{
return Task.WhenAny(tasks);
}

public static Task Delay(int millisecondsDelay)
{
return Task.Delay(millisecondsDelay);
}

public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken)
{
return Task.Delay(millisecondsDelay, cancellationToken);
}

public static Task Delay(TimeSpan delay)
{
return Task.Delay(delay);
}

public static Task Delay(TimeSpan delay, CancellationToken cancellationToken)
{
return Task.Delay(delay, cancellationToken);
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<ItemGroup Condition=" '$(TargetFrameworkVersion)' == 'v3.5' ">
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="UnityEditor">
<HintPath>$(UnityDir)Managed\UnityEditor.dll</HintPath>
<Private>False</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFrameworkVersion)' == 'v3.5' ">
<Reference Include="AsyncBridge.Net35, Version=0.2.3333.0, Culture=neutral, PublicKeyToken=b3b1c0202c0d6a87, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\AsyncBridge.Net35.0.2.3333.0\lib\net35-Client\AsyncBridge.Net35.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ReadOnlyCollectionsInterfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\ReadOnlyCollectionInterfaces.1.0.0\lib\NET20\ReadOnlyCollectionsInterfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\GitHub.Api\GitHub.Api.csproj">
<Project>{b389adaf-62cc-486e-85b4-2d8b078df763}</Project>
Expand All @@ -43,23 +57,11 @@
<Name>GitHub.Unity</Name>
<Private>True</Private>
</ProjectReference>
<Reference Include="AsyncBridge.Net35, Version=0.2.3333.0, Culture=neutral, PublicKeyToken=b3b1c0202c0d6a87, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\AsyncBridge.Net35.0.2.3333.0\lib\net35-Client\AsyncBridge.Net35.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ReadOnlyCollectionsInterfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\ReadOnlyCollectionInterfaces.1.0.0\lib\NET20\ReadOnlyCollectionsInterfaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="sfw.net">
<HintPath>$(SolutionDir)\lib\sfw\sfw.net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
12 changes: 7 additions & 5 deletions src/tests/IntegrationTests/IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,17 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkVersion)' == 'v3.5' ">
<Reference Include="AsyncBridge.Net35, Version=0.2.3333.0, Culture=neutral, PublicKeyToken=b3b1c0202c0d6a87, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\AsyncBridge.Net35.0.2.3333.0\lib\net35-Client\AsyncBridge.Net35.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)packages\FluentAssertions.2.2.0.0\lib\net35\FluentAssertions.dll</HintPath>
<Private>True</Private>
Expand All @@ -58,10 +64,6 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
Expand Down
6 changes: 5 additions & 1 deletion src/tests/IntegrationTests/Metrics/MetricsTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using GitHub.Unity;
#if ENABLE_METRICS

using GitHub.Unity;
using NSubstitute;
using NUnit.Framework;
using System;
Expand Down Expand Up @@ -119,3 +121,5 @@ public void SubmissionWorks()
}
}
}

#endif
12 changes: 7 additions & 5 deletions src/tests/TaskSystemIntegrationTests/TaskSystem.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<ItemGroup Condition=" '$(TargetFrameworkVersion)' == 'v3.5' ">
<Reference Include="AsyncBridge.Net35, Version=0.2.3333.0, Culture=neutral, PublicKeyToken=b3b1c0202c0d6a87, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\AsyncBridge.Net35.0.2.3333.0\lib\net35-Client\AsyncBridge.Net35.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\FluentAssertions.2.2.0.0\lib\net35\FluentAssertions.dll</HintPath>
<Private>True</Private>
Expand All @@ -52,10 +58,6 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Threading, Version=1.0.3333.0, Culture=neutral, PublicKeyToken=402899b480e6f383, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\TaskParallelLibrary.1.0.3333.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
Expand Down
Loading