Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Mono.Cecil to .NET Standard 2.0. #542

Closed
wants to merge 1 commit 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
4 changes: 2 additions & 2 deletions Mono.Cecil.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependencies>
<group targetFramework=".NETFramework3.5" />
<group targetFramework=".NETFramework4.0" />
<group targetFramework=".NETStandard1.3">
<group targetFramework=".NETStandard2.0">
<dependency id="System.Collections" version="4.0.11" />
<dependency id="System.IO.FileSystem" version="4.0.1" />
<dependency id="System.IO.FileSystem.Primitives" version="4.0.1" />
Expand All @@ -31,6 +31,6 @@
<files>
<file src="bin\net_3_5_Release\*.dll" target="lib/net35" />
<file src="bin\net_4_0_Release\*.dll" target="lib/net40" />
<file src="bin\netstandard_Release\netstandard1.3\*.dll" target="lib/netstandard1.3" />
<file src="bin\netstandard_Release\netstandard2.0\*.dll" target="lib/netstandard2.0" />
</files>
</package>
2 changes: 1 addition & 1 deletion Mono.Cecil.props
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</PropertyGroup>
<PropertyGroup Condition="$(NetStandard)">
<TargetFramework Condition="$(IsTestProject)">netcoreapp2.0</TargetFramework>
<TargetFramework Condition="!$(IsTestProject)">netstandard1.3</TargetFramework>
<TargetFramework Condition="!$(IsTestProject)">netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="NetStandard.props" Condition="$(NetStandard)" />
<!-- Shared References -->
Expand Down
4 changes: 0 additions & 4 deletions Mono.Cecil/AssemblyWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ static void Write (ModuleDefinition module, Disposable<Stream> stream, WriterPar
if (symbol_writer_provider == null && parameters.WriteSymbols)
symbol_writer_provider = new DefaultSymbolWriterProvider ();

#if !NET_CORE
if (parameters.StrongNameKeyPair != null && name != null) {
name.PublicKey = parameters.StrongNameKeyPair.PublicKey;
module.Attributes |= ModuleAttributes.StrongNameSigned;
}
#endif

using (var symbol_writer = GetSymbolWriter (module, fq_name, symbol_writer_provider, parameters)) {
var metadata = new MetadataBuilder (module, fq_name, timestamp, symbol_writer_provider, symbol_writer);
Expand All @@ -118,10 +116,8 @@ static void Write (ModuleDefinition module, Disposable<Stream> stream, WriterPar
stream.value.SetLength (0);
writer.WriteImage ();

#if !NET_CORE
if (parameters.StrongNameKeyPair != null)
CryptoService.StrongName (stream.value, writer, parameters.StrongNameKeyPair);
#endif
}
}

Expand Down
9 changes: 3 additions & 6 deletions Mono.Cecil/BaseAssemblyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ public abstract class BaseAssemblyResolver : IAssemblyResolver {
// Maps file names of available trusted platform assemblies to their full paths.
// Internal for testing.
internal static readonly Lazy<Dictionary<string, string>> TrustedPlatformAssemblies = new Lazy<Dictionary<string, string>> (CreateTrustedPlatformAssemblyMap);
#else
Collection<string> gac_paths;
#endif
Collection<string> gac_paths;

public void AddSearchDirectory (string directory)
{
Expand Down Expand Up @@ -137,7 +136,7 @@ public virtual AssemblyDefinition Resolve (AssemblyNameReference name, ReaderPar
assembly = SearchTrustedPlatformAssemblies (name, parameters);
if (assembly != null)
return assembly;
#else
#endif
var framework_dir = Path.GetDirectoryName (typeof (object).Module.FullyQualifiedName);
var framework_dirs = on_mono
? new [] { framework_dir, Path.Combine (framework_dir, "Facades") }
Expand All @@ -162,7 +161,6 @@ public virtual AssemblyDefinition Resolve (AssemblyNameReference name, ReaderPar
assembly = SearchDirectory (name, framework_dirs, parameters);
if (assembly != null)
return assembly;
#endif
if (ResolveFailure != null) {
assembly = ResolveFailure (this, name);
if (assembly != null)
Expand Down Expand Up @@ -234,7 +232,6 @@ static bool IsZero (Version version)
return version.Major == 0 && version.Minor == 0 && version.Build == 0 && version.Revision == 0;
}

#if !NET_CORE
AssemblyDefinition GetCorlib (AssemblyNameReference reference, ReaderParameters parameters)
{
var version = reference.Version;
Expand Down Expand Up @@ -380,7 +377,7 @@ AssemblyDefinition GetAssemblyInNetGac (AssemblyNameReference reference, ReaderP

return null;
}
#endif

static string GetAssemblyFile (AssemblyNameReference reference, string prefix, string gac)
{
var gac_folder = new StringBuilder ()
Expand Down
4 changes: 0 additions & 4 deletions Mono.Cecil/ModuleDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ public sealed class WriterParameters {
Stream symbol_stream;
ISymbolWriterProvider symbol_writer_provider;
bool write_symbols;
#if !NET_CORE
SR.StrongNameKeyPair key_pair;
#endif

public uint? Timestamp {
get { return timestamp; }
Expand All @@ -235,12 +233,10 @@ public bool WriteSymbols {
set { write_symbols = value; }
}

#if !NET_CORE
public SR.StrongNameKeyPair StrongNameKeyPair {
get { return key_pair; }
set { key_pair = value; }
}
#endif
}

#endif
Expand Down
5 changes: 0 additions & 5 deletions Mono.Security.Cryptography/CryptoConvert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

#if !READ_ONLY

#if !NET_CORE

using System;
using System.Security.Cryptography;

Expand Down Expand Up @@ -248,6 +246,3 @@ static public RSA FromCapiKeyBlob (byte[] blob, int offset)
}

#endif

#endif

4 changes: 0 additions & 4 deletions Mono.Security.Cryptography/CryptoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#if !READ_ONLY

#if !NET_CORE

using System;
using System.IO;
using System.Reflection;
Expand Down Expand Up @@ -154,5 +152,3 @@ static bool TryGetKeyContainer (ISerializable key_pair, out byte [] key, out str
}

#endif

#endif