Updated build scripts and added support for Visual Studio 2019
This commit is contained in:
parent
2ea154b863
commit
8faebc01ee
88
build.sh
88
build.sh
|
@ -12,6 +12,8 @@ sourceFolder='./src'
|
||||||
slnFile=$sourceFolder/Sonarr.sln
|
slnFile=$sourceFolder/Sonarr.sln
|
||||||
updateSubFolder=Sonarr.Update
|
updateSubFolder=Sonarr.Update
|
||||||
|
|
||||||
|
sqlitePackageDir="$HOME/.nuget/packages/system.data.sqlite.core.lidarr/1.0.111-5"
|
||||||
|
|
||||||
nuget='tools/nuget/nuget.exe';
|
nuget='tools/nuget/nuget.exe';
|
||||||
vswhere='tools/vswhere/vswhere.exe';
|
vswhere='tools/vswhere/vswhere.exe';
|
||||||
|
|
||||||
|
@ -88,16 +90,17 @@ CleanFolder()
|
||||||
|
|
||||||
BuildWithMSBuild()
|
BuildWithMSBuild()
|
||||||
{
|
{
|
||||||
installationPath=`$vswhere -latest -products \* -requires Microsoft.Component.MSBuild -property installationPath`
|
msBuildPath=`$vswhere -latest -products \* -requires Microsoft.Component.MSBuild -find MSBuild\\\\\*\*\\\\Bin\\\\MSBuild.exe`
|
||||||
installationPath=${installationPath/C:\\/\/c\/}
|
msBuildPath=${msBuildPath/C:\\/\/c\/}
|
||||||
installationPath=${installationPath//\\/\/}
|
msBuildPath=${msBuildPath//\\/\/}
|
||||||
msBuild="$installationPath/MSBuild/$msBuildVersion/Bin"
|
msBuildDir=$(dirname "$msBuildPath")
|
||||||
echo $msBuild
|
|
||||||
|
|
||||||
export PATH=$msBuild:$PATH
|
echo $msBuildDir
|
||||||
CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x86 //t:Clean //m
|
|
||||||
|
export PATH=$msBuildDir:$PATH
|
||||||
|
CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x64 //t:Clean //m
|
||||||
$nuget restore $slnFile
|
$nuget restore $slnFile
|
||||||
CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x86 //t:Build //m //p:AllowedReferenceRelatedFileExtensions=.pdb
|
CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x64 //t:Build //m //p:AllowedReferenceRelatedFileExtensions=.pdb
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildWithXbuild()
|
BuildWithXbuild()
|
||||||
|
@ -134,9 +137,6 @@ Build()
|
||||||
|
|
||||||
CleanFolder $outputFolder false
|
CleanFolder $outputFolder false
|
||||||
|
|
||||||
echo "Removing Mono.Posix.dll"
|
|
||||||
rm $outputFolder/Mono.Posix.dll
|
|
||||||
|
|
||||||
ProgressEnd 'Build'
|
ProgressEnd 'Build'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,48 +170,6 @@ CreateMdbs()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
PatchMono()
|
|
||||||
{
|
|
||||||
local path=$1
|
|
||||||
|
|
||||||
# Below we deal with some mono incompatibilities with windows-only dotnet core/standard libs
|
|
||||||
# See: https://github.com/mono/mono/blob/master/tools/nuget-hash-extractor/download.sh
|
|
||||||
# That list defines assemblies that are prohibited from being loaded from the appdir, instead loading from mono GAC.
|
|
||||||
|
|
||||||
# We have debian dependencies to get these installed or facades from mono 5.10+
|
|
||||||
for assembly in System.IO.Compression System.Runtime.InteropServices.RuntimeInformation System.Net.Http System.Globalization.Extensions System.Text.Encoding.CodePages System.Threading.Overlapped
|
|
||||||
do
|
|
||||||
if [ -e $path/$assembly.dll ]; then
|
|
||||||
if [ -e $sourceFolder/Libraries/Mono/$assembly.dll ]; then
|
|
||||||
echo "Copy Mono-specific facade $assembly.dll (uses win32 interop)"
|
|
||||||
cp $sourceFolder/Libraries/Mono/$assembly.dll $path/$assembly.dll
|
|
||||||
else
|
|
||||||
echo "Remove $assembly.dll (uses win32 interop)"
|
|
||||||
rm $path/$assembly.dll
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Copy more stable version of Vectors for mono <5.12
|
|
||||||
if [ -e $path/System.Numerics.Vectors.dll ]; then
|
|
||||||
packageDir="$HOME/.nuget/packages/system.numerics.vectors/4.5.0"
|
|
||||||
|
|
||||||
if [ ! -d "$HOME/.nuget/packages/system.numerics.vectors/4.5.0" ]; then
|
|
||||||
# May reside in the NuGetFallback folder, which is harder to find
|
|
||||||
# Download somewhere to get the real cache populated
|
|
||||||
if [ $runtime = "dotnet" ] ; then
|
|
||||||
$nuget install System.Numerics.Vectors -Version 4.5.0 -Output ./_temp/System.Numerics.Vectors
|
|
||||||
else
|
|
||||||
mono $nuget install System.Numerics.Vectors -Version 4.5.0 -Output ./_temp/System.Numerics.Vectors
|
|
||||||
fi
|
|
||||||
rm -rf ./_temp/System.Numerics.Vectors
|
|
||||||
fi
|
|
||||||
# Copy the netstandard2.0 version rather than net46
|
|
||||||
cp "$packageDir/lib/netstandard2.0/System.Numerics.Vectors.dll" $path/
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
PackageMono()
|
PackageMono()
|
||||||
{
|
{
|
||||||
ProgressStart 'Creating Mono Package'
|
ProgressStart 'Creating Mono Package'
|
||||||
|
@ -235,15 +193,9 @@ PackageMono()
|
||||||
rm -f $outputFolderLinux/sqlite3.*
|
rm -f $outputFolderLinux/sqlite3.*
|
||||||
rm -f $outputFolderLinux/MediaInfo.*
|
rm -f $outputFolderLinux/MediaInfo.*
|
||||||
|
|
||||||
PatchMono $outputFolderLinux
|
|
||||||
|
|
||||||
echo "Adding Sonarr.Core.dll.config (for dllmap)"
|
echo "Adding Sonarr.Core.dll.config (for dllmap)"
|
||||||
cp $sourceFolder/NzbDrone.Core/Sonarr.Core.dll.config $outputFolderLinux
|
cp $sourceFolder/NzbDrone.Core/Sonarr.Core.dll.config $outputFolderLinux
|
||||||
|
|
||||||
# Remove Http binding redirect by renaming it
|
|
||||||
# We don't need this anymore once our minimum mono version is 5.10
|
|
||||||
sed -i "s/System.Net.Http/System.Net.Http.Mono/g" $outputFolderLinux/Sonarr.Console.exe.config
|
|
||||||
|
|
||||||
echo "Renaming Sonarr.Console.exe to Sonarr.exe"
|
echo "Renaming Sonarr.Console.exe to Sonarr.exe"
|
||||||
rm $outputFolderLinux/Sonarr.exe*
|
rm $outputFolderLinux/Sonarr.exe*
|
||||||
for file in $outputFolderLinux/Sonarr.Console.exe*; do
|
for file in $outputFolderLinux/Sonarr.Console.exe*; do
|
||||||
|
@ -273,11 +225,11 @@ PackageMacOS()
|
||||||
echo "Copying Binaries"
|
echo "Copying Binaries"
|
||||||
cp -r $outputFolderLinux/* $outputFolderMacOS
|
cp -r $outputFolderLinux/* $outputFolderMacOS
|
||||||
|
|
||||||
echo "Adding sqlite dylibs"
|
echo "Adding sqlite dylib"
|
||||||
cp $sourceFolder/Libraries/Sqlite/*.dylib $outputFolderMacOS
|
cp "$sqlitePackageDir/runtimes/osx-x64/native/net46"/* $outputFolderMacOS
|
||||||
|
|
||||||
echo "Adding MediaInfo dylib"
|
echo "Adding MediaInfo dylib"
|
||||||
cp $sourceFolder/Libraries/MediaInfo/*.dylib $outputFolderMacOS
|
cp $sourceFolder/Libraries/MediaInfo/x64/*.dylib $outputFolderMacOS
|
||||||
|
|
||||||
ProgressEnd 'Creating MacOS Package'
|
ProgressEnd 'Creating MacOS Package'
|
||||||
}
|
}
|
||||||
|
@ -298,11 +250,11 @@ PackageMacOSApp()
|
||||||
echo "Copying Binaries"
|
echo "Copying Binaries"
|
||||||
cp -r $outputFolderLinux/* $outputFolderMacOSApp/Sonarr.app/Contents/MacOS
|
cp -r $outputFolderLinux/* $outputFolderMacOSApp/Sonarr.app/Contents/MacOS
|
||||||
|
|
||||||
echo "Adding sqlite dylibs"
|
echo "Adding sqlite dylib"
|
||||||
cp $sourceFolder/Libraries/Sqlite/*.dylib $outputFolderMacOSApp/Sonarr.app/Contents/MacOS
|
cp "$sqlitePackageDir/runtimes/osx-x64/native/net46"/* $outputFolderMacOS
|
||||||
|
|
||||||
echo "Adding MediaInfo dylib"
|
echo "Adding MediaInfo dylib"
|
||||||
cp $sourceFolder/Libraries/MediaInfo/*.dylib $outputFolderMacOSApp/Sonarr.app/Contents/MacOS
|
cp $sourceFolder/Libraries/MediaInfo/x64/*.dylib $outputFolderMacOS
|
||||||
|
|
||||||
echo "Removing Update Folder"
|
echo "Removing Update Folder"
|
||||||
rm -r $outputFolderMacOSApp/Sonarr.app/Contents/MacOS/Sonarr.Update
|
rm -r $outputFolderMacOSApp/Sonarr.app/Contents/MacOS/Sonarr.Update
|
||||||
|
@ -331,15 +283,9 @@ PackageTestsMono()
|
||||||
echo "Removing PDBs"
|
echo "Removing PDBs"
|
||||||
find $testPackageFolderLinux -name "*.pdb" -exec rm "{}" \;
|
find $testPackageFolderLinux -name "*.pdb" -exec rm "{}" \;
|
||||||
|
|
||||||
PatchMono $testPackageFolderLinux
|
|
||||||
|
|
||||||
echo "Adding Sonarr.Core.dll.config (for dllmap)"
|
echo "Adding Sonarr.Core.dll.config (for dllmap)"
|
||||||
cp $sourceFolder/NzbDrone.Core/Sonarr.Core.dll.config $testPackageFolderLinux
|
cp $sourceFolder/NzbDrone.Core/Sonarr.Core.dll.config $testPackageFolderLinux
|
||||||
|
|
||||||
# Remove Http binding redirect by renaming it
|
|
||||||
# We don't need this anymore once our minimum mono version is 5.10
|
|
||||||
sed -i "s/System.Net.Http/System.Net.Http.Mono/g" $testPackageFolderLinux/Sonarr.Common.Test.dll.config
|
|
||||||
|
|
||||||
cp ./test.sh $testPackageFolderLinux/
|
cp ./test.sh $testPackageFolderLinux/
|
||||||
dos2unix $testPackageFolderLinux/test.sh
|
dos2unix $testPackageFolderLinux/test.sh
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,17 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SonarrRootDir>$(MSBuildThisFileDirectory)..\</SonarrRootDir>
|
<SonarrRootDir>$(MSBuildThisFileDirectory)..\</SonarrRootDir>
|
||||||
|
|
||||||
|
<!-- Whether we want TargetFramework switching in Visual Studio -->
|
||||||
|
<TargetMultiple>false</TargetMultiple>
|
||||||
|
|
||||||
|
<TargetNet48>false</TargetNet48>
|
||||||
|
<TargetNetCore>false</TargetNetCore>
|
||||||
|
|
||||||
|
<TargetFrameworks>net472</TargetFrameworks>
|
||||||
|
<TargetFrameworks Condition=" '$(TargetNet48)'=='true' ">$(TargetFrameworks);net48</TargetFrameworks>
|
||||||
|
<TargetFrameworks Condition=" '$(TargetNetCore)'=='true' ">$(TargetFrameworks);netcoreapp3.0</TargetFrameworks>
|
||||||
|
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
|
||||||
|
|
||||||
<!-- Specifies the type of output -->
|
<!-- Specifies the type of output -->
|
||||||
<SonarrOutputType>Library</SonarrOutputType>
|
<SonarrOutputType>Library</SonarrOutputType>
|
||||||
<SonarrOutputType Condition="$(MSBuildProjectName.Contains('.Test'))">Test</SonarrOutputType>
|
<SonarrOutputType Condition="$(MSBuildProjectName.Contains('.Test'))">Test</SonarrOutputType>
|
||||||
|
@ -19,24 +30,41 @@
|
||||||
<SonarrProject Condition="$(MSBuildProjectName.StartsWith('ServiceUninstall'))">true</SonarrProject>
|
<SonarrProject Condition="$(MSBuildProjectName.StartsWith('ServiceUninstall'))">true</SonarrProject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Pick default RuntimeIdentifier for our compilation environment -->
|
||||||
|
<PropertyGroup Condition=" '$(TargetMultiple)'!='true' ">
|
||||||
|
<RuntimeIdentifiers></RuntimeIdentifiers>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<TargetFrameworks></TargetFrameworks>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition="'$(Configuration)'==''">Release</Configuration>
|
<Configuration Condition="'$(Configuration)'==''">Release</Configuration>
|
||||||
|
|
||||||
|
<TargetFrameworkPath>$(TargetFramework)\</TargetFrameworkPath>
|
||||||
|
<TargetFrameworkPath Condition="'$(Platform)'!='x64'">$(TargetFrameworkPath)$(Platform)\</TargetFrameworkPath>
|
||||||
|
<TargetFrameworkPath>$(TargetFrameworkPath)$(Configuration)\</TargetFrameworkPath>
|
||||||
|
|
||||||
<!-- Centralize intermediate and default outputs -->
|
<!-- Centralize intermediate and default outputs -->
|
||||||
<BaseIntermediateOutputPath>$(SonarrRootDir)_temp\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath>$(SonarrRootDir)_temp\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
||||||
<IntermediateOutputPath>$(SonarrRootDir)_temp\obj\$(MSBuildProjectName)\$(Configuration)\</IntermediateOutputPath>
|
<IntermediateOutputPath>$(SonarrRootDir)_temp\obj\$(MSBuildProjectName)\$(TargetFrameworkPath)</IntermediateOutputPath>
|
||||||
<OutputPath>$(SonarrRootDir)_temp\bin\$(Configuration)\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath>$(SonarrRootDir)_temp\bin\$(TargetFrameworkPath)$(MSBuildProjectName)\</OutputPath>
|
||||||
|
|
||||||
|
<!-- Flatten the 'real' output paths for backward compat -->
|
||||||
|
<OutputTargetFrameworkPath>$(TargetFrameworkPath)</OutputTargetFrameworkPath>
|
||||||
|
<OutputTargetFrameworkPath Condition=" '$(TargetMultiple)'!='true' "></OutputTargetFrameworkPath>
|
||||||
|
|
||||||
<!-- Output to _output and _tests respectively -->
|
<!-- Output to _output and _tests respectively -->
|
||||||
<OutputPath Condition="'$(SonarrProject)'=='true'">$(SonarrRootDir)_output\</OutputPath>
|
<OutputPath Condition="'$(SonarrProject)'=='true'">$(SonarrRootDir)_output\$(OutputTargetFrameworkPath)</OutputPath>
|
||||||
<OutputPath Condition="'$(SonarrOutputType)'=='Test'">$(SonarrRootDir)_tests\</OutputPath>
|
<OutputPath Condition="'$(SonarrOutputType)'=='Test'">$(SonarrRootDir)_tests\$(OutputTargetFrameworkPath)</OutputPath>
|
||||||
<OutputPath Condition="'$(SonarrOutputType)'=='Update'">$(SonarrRootDir)_output\Sonarr.Update\</OutputPath>
|
<OutputPath Condition="'$(SonarrOutputType)'=='Update'">$(OutputPath)Sonarr.Update\</OutputPath>
|
||||||
|
|
||||||
<!-- Paths relative to project file for better readability -->
|
<!-- Paths relative to project file for better readability -->
|
||||||
<BaseIntermediateOutputPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(BaseIntermediateOutputPath)'))</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(BaseIntermediateOutputPath)'))</BaseIntermediateOutputPath>
|
||||||
<IntermediateOutputPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)'))</IntermediateOutputPath>
|
<IntermediateOutputPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)'))</IntermediateOutputPath>
|
||||||
<OutputPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(OutputPath)'))</OutputPath>
|
<OutputPath>$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(OutputPath)'))</OutputPath>
|
||||||
|
|
||||||
<!-- below net4.7.1 the new portable pdb format has no line numbers, pdb to mdb probably doesn't like it either -->
|
<!-- Below net4.7.1 the new portable pdb format has no line numbers, pdb to mdb probably doesn't like it either -->
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -73,6 +101,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- We don't want separate framework directories till we go dotnet core -->
|
<!-- We don't want separate framework directories till we go dotnet core -->
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
|
|
||||||
<!-- For now keep the NzbDrone namespace -->
|
<!-- For now keep the NzbDrone namespace -->
|
||||||
<RootNamespace Condition="'$(SonarrProject)'=='true'">$(MSBuildProjectName.Replace('Sonarr','NzbDrone'))</RootNamespace>
|
<RootNamespace Condition="'$(SonarrProject)'=='true'">$(MSBuildProjectName.Replace('Sonarr','NzbDrone'))</RootNamespace>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +0,0 @@
|
||||||
Copied from mono/4.5/Facades of the mono 5.4 release.
|
|
||||||
These are the mono version of the dotnet Core TypeForwardedTo assemblies.
|
|
||||||
Using these assemblies is no longer necessary once we reach mono 5.18 as minimum version
|
|
|
@ -10,6 +10,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Mono.Posix">
|
<Reference Include="Mono.Posix">
|
||||||
<HintPath>..\Libraries\Mono.Posix.dll</HintPath>
|
<HintPath>..\Libraries\Mono.Posix.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue