Skip to content

Instantly share code, notes, and snippets.

@tpokorra
Last active July 15, 2019 20:38
Show Gist options
  • Save tpokorra/d733453432740af990de4064cd288b13 to your computer and use it in GitHub Desktop.
Save tpokorra/d733453432740af990de4064cd288b13 to your computer and use it in GitHub Desktop.
Build NuGet 5 with Mono and mcs compiler for Fedora
#!/bin/bash
path=`pwd`
if [ 1 -eq 1 ]; then
cd $path/build/Shared
echo "**** building `pwd`/ ****"
for f in *.cs
do
sed -i "s/internal/public/g" $f
done
csfiles=`find . -name \*.cs`
mcs $csfiles \
-target:library -out:NuGet.Shared.dll || exit -1
cd $path/src/NuGet.Core/NuGet.Frameworks
echo "**** building `pwd`/ ****"
csfiles=`find . -name \*.cs`
mcs $csfiles \
-r:../../../build/Shared/NuGet.Shared.dll \
-target:library -out:NuGet.Frameworks.dll || exit -1
cd $path/src/NuGet.Core/NuGet.Common
echo "**** building `pwd`/ ****"
#vi MsBuildStringUtility.cs and comment out function GetNuGetLogCodes
csfiles=`find . -name \*.cs`
mcs $csfiles \
-r:System.IO.Compression -resource:Strings.resx \
-target:library -out:NuGet.Common.dll || exit -1
cd $path/src/NuGet.Core/NuGet.Configuration
echo "**** building `pwd`/ ****"
csfiles=`find . -name \*.cs`
mcs $csfiles \
-resource:Resources.resx \
-r:../../../build/Shared/NuGet.Shared.dll \
-r:../NuGet.Common/NuGet.Common.dll \
-r:System.Xml \
-r:System.Xml.Linq \
-r:System.Security \
-target:library -out:NuGet.Configuration.dll || exit -1
cd $path/src/NuGet.Core/NuGet.Versioning
echo "**** building `pwd`/ ****"
csfiles=`find . -name \*.cs`
mcs $csfiles \
-r:../../../build/Shared/NuGet.Shared.dll \
-target:library -out:NuGet.Versioning.dll || exit -1
cd $path/src/NuGet.Core/NuGet.Packaging
echo "**** building `pwd`/ ****"
csfiles=`find . -name \*.cs`
resxfiles=`find . -name \*.resx`
res=""
for f in $resxfiles; do
res=$res" -resource:$f "
done
mcs $csfiles \
$res \
-r:../../../build/Shared/NuGet.Shared.dll \
-r:../NuGet.Configuration/NuGet.Configuration.dll \
-r:../NuGet.Versioning/NuGet.Versioning.dll \
-r:../NuGet.Frameworks/NuGet.Frameworks.dll \
-r:../NuGet.Common/NuGet.Common.dll \
-r:System.Xml.dll \
-r:System.Xml.Linq.dll \
-r:System.IO.Compression.dll \
-r:System.Security.dll \
-r:System.Numerics.dll \
-r:System.Dynamic \
-pkg:newtonsoft-json \
-unsafe:+ \
-define:IS_CORECLR \
-target:library -out:NuGet.Packaging.dll || exit -1
fi
cd $path/src/NuGet.Core/NuGet.Protocol
echo "**** building `pwd`/ ****"
csfiles=`find . -name \*.cs`
mcs $csfiles \
-resource:Strings.resx \
-r:System.IdentityModel \
-r:System.Net.Http \
-r:System.Net.Http.WebRequest \
-r:System.ServiceModel \
-r:System.IO.Compression \
-r:../NuGet.Packaging/NuGet.Packaging.dll \
-target:library -out:NuGet.Protocol.dll || exit -1
# TODO:
# NuGet.Credentials
# NuGet.ProjectModel
# NuGet.Commands
cd $path/src/NuGet.Core/NuGet.Commands
echo "**** building `pwd`/ ****"
csfiles=`find . -name \*.cs`
mcs $csfiles \
-resource:Strings.resx \
-target:library -out:NuGet.Commands.dll || exit -1
# TODO NuGet.Build.Tasks
# TODO probably many more dlls to build...
# TODO cd src/NuGet.Clients/NuGet.CommandLine
diff -uNr --exclude '*.dll' NuGet.Client-5.0.2.5988.orig/src/NuGet.Core/NuGet.Common/MsBuildStringUtility.cs NuGet.Client-5.0.2.5988/src/NuGet.Core/NuGet.Common/MsBuildStringUtility.cs
--- NuGet.Client-5.0.2.5988.orig/src/NuGet.Core/NuGet.Common/MsBuildStringUtility.cs 2019-04-25 22:18:39.000000000 +0200
+++ NuGet.Client-5.0.2.5988/src/NuGet.Core/NuGet.Common/MsBuildStringUtility.cs 2019-07-15 22:36:32.598281242 +0200
@@ -90,6 +90,7 @@
/// </summary>
public static IEnumerable<NuGetLogCode> GetNuGetLogCodes(string s)
{
+/*
foreach (var item in MSBuildStringUtility.Split(s, ';', ','))
{
if (item.StartsWith("NU", StringComparison.OrdinalIgnoreCase) &&
@@ -98,6 +99,8 @@
yield return result;
}
}
+*/
+ return Enumerable.Empty<NuGetLogCode>();
}
/// <summary>
diff -uNr --exclude '*.dll' NuGet.Client-5.0.2.5988.orig/src/NuGet.Core/NuGet.Packaging/Rules/DefaultManifestValuesRule.cs NuGet.Client-5.0.2.5988/src/NuGet.Core/NuGet.Packaging/Rules/DefaultManifestValuesRule.cs
--- NuGet.Client-5.0.2.5988.orig/src/NuGet.Core/NuGet.Packaging/Rules/DefaultManifestValuesRule.cs 2019-04-25 22:18:39.000000000 +0200
+++ NuGet.Client-5.0.2.5988/src/NuGet.Core/NuGet.Packaging/Rules/DefaultManifestValuesRule.cs 2019-07-15 22:13:51.771064287 +0200
@@ -35,7 +35,7 @@
throw new ArgumentNullException(nameof(builder));
}
var nuspecReader = builder.NuspecReader;
-
+/*
Uri.TryCreate(nuspecReader.GetProjectUrl(), UriKind.RelativeOrAbsolute, out var projectUrl);
if (projectUrl == SampleProjectUrl)
{
@@ -77,6 +77,8 @@
{
yield return CreateIssueFor("dependency", dependency.ToString());
}
+*/
+ return Enumerable.Empty<PackagingLogMessage>();
}
private PackagingLogMessage CreateIssueFor(string field, string value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment