diff --git a/build.sh b/build.sh index 40b13ae3c..ce85413c5 100755 --- a/build.sh +++ b/build.sh @@ -12,6 +12,8 @@ sourceFolder='./src' slnFile=$sourceFolder/Sonarr.sln updateSubFolder=Sonarr.Update +sqlitePackageDir="$HOME/.nuget/packages/system.data.sqlite.core.lidarr/1.0.111-5" + nuget='tools/nuget/nuget.exe'; vswhere='tools/vswhere/vswhere.exe'; @@ -88,16 +90,17 @@ CleanFolder() BuildWithMSBuild() { - installationPath=`$vswhere -latest -products \* -requires Microsoft.Component.MSBuild -property installationPath` - installationPath=${installationPath/C:\\/\/c\/} - installationPath=${installationPath//\\/\/} - msBuild="$installationPath/MSBuild/$msBuildVersion/Bin" - echo $msBuild + msBuildPath=`$vswhere -latest -products \* -requires Microsoft.Component.MSBuild -find MSBuild\\\\\*\*\\\\Bin\\\\MSBuild.exe` + msBuildPath=${msBuildPath/C:\\/\/c\/} + msBuildPath=${msBuildPath//\\/\/} + msBuildDir=$(dirname "$msBuildPath") - export PATH=$msBuild:$PATH - CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x86 //t:Clean //m + echo $msBuildDir + + export PATH=$msBuildDir:$PATH + CheckExitCode MSBuild.exe $slnFile //p:Configuration=Release //p:Platform=x64 //t:Clean //m $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() @@ -134,9 +137,6 @@ Build() CleanFolder $outputFolder false - echo "Removing Mono.Posix.dll" - rm $outputFolder/Mono.Posix.dll - ProgressEnd 'Build' } @@ -170,48 +170,6 @@ CreateMdbs() 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() { ProgressStart 'Creating Mono Package' @@ -235,15 +193,9 @@ PackageMono() rm -f $outputFolderLinux/sqlite3.* rm -f $outputFolderLinux/MediaInfo.* - PatchMono $outputFolderLinux - echo "Adding Sonarr.Core.dll.config (for dllmap)" 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" rm $outputFolderLinux/Sonarr.exe* for file in $outputFolderLinux/Sonarr.Console.exe*; do @@ -273,11 +225,11 @@ PackageMacOS() echo "Copying Binaries" cp -r $outputFolderLinux/* $outputFolderMacOS - echo "Adding sqlite dylibs" - cp $sourceFolder/Libraries/Sqlite/*.dylib $outputFolderMacOS + echo "Adding sqlite dylib" + cp "$sqlitePackageDir/runtimes/osx-x64/native/net46"/* $outputFolderMacOS echo "Adding MediaInfo dylib" - cp $sourceFolder/Libraries/MediaInfo/*.dylib $outputFolderMacOS + cp $sourceFolder/Libraries/MediaInfo/x64/*.dylib $outputFolderMacOS ProgressEnd 'Creating MacOS Package' } @@ -298,11 +250,11 @@ PackageMacOSApp() echo "Copying Binaries" cp -r $outputFolderLinux/* $outputFolderMacOSApp/Sonarr.app/Contents/MacOS - echo "Adding sqlite dylibs" - cp $sourceFolder/Libraries/Sqlite/*.dylib $outputFolderMacOSApp/Sonarr.app/Contents/MacOS + echo "Adding sqlite dylib" + cp "$sqlitePackageDir/runtimes/osx-x64/native/net46"/* $outputFolderMacOS 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" rm -r $outputFolderMacOSApp/Sonarr.app/Contents/MacOS/Sonarr.Update @@ -331,15 +283,9 @@ PackageTestsMono() echo "Removing PDBs" find $testPackageFolderLinux -name "*.pdb" -exec rm "{}" \; - PatchMono $testPackageFolderLinux - echo "Adding Sonarr.Core.dll.config (for dllmap)" 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/ dos2unix $testPackageFolderLinux/test.sh diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b45f9f3f7..54dcaef19 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,6 +3,17 @@ $(MSBuildThisFileDirectory)..\ + + false + + false + false + + net472 + $(TargetFrameworks);net48 + $(TargetFrameworks);netcoreapp3.0 + win-x64;osx-x64;linux-x64 + Library Test @@ -19,24 +30,41 @@ true + + + + win-x64 + + net472 + + Release + + $(TargetFramework)\ + $(TargetFrameworkPath)$(Platform)\ + $(TargetFrameworkPath)$(Configuration)\ + $(SonarrRootDir)_temp\obj\$(MSBuildProjectName)\ - $(SonarrRootDir)_temp\obj\$(MSBuildProjectName)\$(Configuration)\ - $(SonarrRootDir)_temp\bin\$(Configuration)\$(MSBuildProjectName)\ + $(SonarrRootDir)_temp\obj\$(MSBuildProjectName)\$(TargetFrameworkPath) + $(SonarrRootDir)_temp\bin\$(TargetFrameworkPath)$(MSBuildProjectName)\ + + + $(TargetFrameworkPath) + - $(SonarrRootDir)_output\ - $(SonarrRootDir)_tests\ - $(SonarrRootDir)_output\Sonarr.Update\ + $(SonarrRootDir)_output\$(OutputTargetFrameworkPath) + $(SonarrRootDir)_tests\$(OutputTargetFrameworkPath) + $(OutputPath)Sonarr.Update\ $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(BaseIntermediateOutputPath)')) $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(IntermediateOutputPath)')) $([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(OutputPath)')) - + full true @@ -73,6 +101,7 @@ false + false $(MSBuildProjectName.Replace('Sonarr','NzbDrone')) diff --git a/src/Libraries/Mono/System.Globalization.Extensions.dll b/src/Libraries/Mono/System.Globalization.Extensions.dll deleted file mode 100644 index 8c0861579..000000000 Binary files a/src/Libraries/Mono/System.Globalization.Extensions.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll b/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll deleted file mode 100644 index e55b5eb23..000000000 Binary files a/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Text.Encoding.CodePages.dll b/src/Libraries/Mono/System.Text.Encoding.CodePages.dll deleted file mode 100644 index 414770bc0..000000000 Binary files a/src/Libraries/Mono/System.Text.Encoding.CodePages.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Threading.Overlapped.dll b/src/Libraries/Mono/System.Threading.Overlapped.dll deleted file mode 100644 index c06475843..000000000 Binary files a/src/Libraries/Mono/System.Threading.Overlapped.dll and /dev/null differ diff --git a/src/Libraries/Mono/readme.txt b/src/Libraries/Mono/readme.txt deleted file mode 100644 index f1251a98f..000000000 --- a/src/Libraries/Mono/readme.txt +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj b/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj index 0897f23f0..81cd5ebe3 100644 --- a/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/Sonarr.Mono.Test.csproj @@ -10,6 +10,7 @@ ..\Libraries\Mono.Posix.dll + false diff --git a/tools/vswhere/vswhere.exe b/tools/vswhere/vswhere.exe index e1b511803..582e82868 100644 Binary files a/tools/vswhere/vswhere.exe and b/tools/vswhere/vswhere.exe differ