Skip to content

Commit

Permalink
Remove duplicate neo reference in Compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Feb 13, 2024
1 parent 8a7da63 commit 2ebfb55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<PropertyGroup>
<AssemblyTitle>Neo.Compiler.CSharp</AssemblyTitle>
<AssemblyName>nccs</AssemblyName>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>nccs</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>Neo.Compiler.CSharp</PackageId>
<PackAsTool>true</PackAsTool>
Expand All @@ -19,7 +20,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Neo" Version="3.6.2" />
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta4.22272.1" />
</ItemGroup>

Expand Down
16 changes: 8 additions & 8 deletions src/Neo.Compiler.CSharp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ private static int ProcessOutputs(Options options, string folder, CompilationCon
{
// Try to compile the artifacts into a dll

string coreDir = Path.GetDirectoryName(typeof(object).Assembly.Location)!;

var syntaxTree = CSharpSyntaxTree.ParseText(artifact);
var coreDir = Path.GetDirectoryName(typeof(object).Assembly.Location)!;
var references = new MetadataReference[]
{
MetadataReference.CreateFromFile(Path.Combine(coreDir, "System.Runtime.dll")),
Expand All @@ -210,16 +208,18 @@ private static int ProcessOutputs(Options options, string folder, CompilationCon
MetadataReference.CreateFromFile(typeof(DisplayNameAttribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(System.Numerics.BigInteger).Assembly.Location),
MetadataReference.CreateFromFile(typeof(NeoSystem).Assembly.Location),
MetadataReference.CreateFromFile(typeof(SmartContract.Testing.SmartContract).Assembly.Location)
MetadataReference.CreateFromFile(typeof(SmartContract.Testing.TestEngine).Assembly.Location)
};

var compilation = CSharpCompilation.Create(baseName, new[] { syntaxTree }, references,
new CSharpCompilationOptions(
CSharpCompilationOptions csOptions = new(
OutputKind.DynamicallyLinkedLibrary,
optimizationLevel: OptimizationLevel.Release,
platform: Platform.AnyCpu,
deterministic: true
));
nullableContextOptions: NullableContextOptions.Enable,
deterministic: true);

var syntaxTree = CSharpSyntaxTree.ParseText(artifact, options: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.Latest));
var compilation = CSharpCompilation.Create(baseName, new[] { syntaxTree }, references, csOptions);

using var ms = new MemoryStream();
EmitResult result = compilation.Emit(ms);
Expand Down

0 comments on commit 2ebfb55

Please sign in to comment.