Skip to content

Commit

Permalink
Use CompactJson dependency in build task. Can run build task from VS.
Browse files Browse the repository at this point in the history
  • Loading branch information
allisterb committed Nov 24, 2024
1 parent 541101f commit a7f8757
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Stratis.VS.SolidityProjectBuildTasks/CompileContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public override bool Execute()
Log.LogError("Could not start npm process", psi.FileName + " " + psi.Arguments);
return false;
}
var ser = new Newtonsoft.Json.JsonSerializer();
ser.Serialize(p.StandardInput, i);

CompactJson.Serializer.Write(i, p.StandardInput, false);
p.StandardInput.WriteLine(Environment.NewLine);
p.StandardInput.Close();
Log.LogMessage(MessageImportance.High, p.StandardOutput.ReadToEnd());
Expand Down
12 changes: 6 additions & 6 deletions src/Stratis.VS.SolidityProjectBuildTasks/SolidityCompilerIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
{
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using CompactJson;

using System.ComponentModel;


public partial class SolidityCompilerInput
{
Expand All @@ -15,12 +17,10 @@ public partial class SolidityCompilerInput
[JsonProperty("sources")]
public Dictionary<string, Source> Sources { get; set; }

[JsonProperty("settings", NullValueHandling = NullValueHandling.Ignore)]

[JsonProperty("settings")]
public Settings Settings { get; set; }
}

[JsonObject(MissingMemberHandling = MissingMemberHandling.Ignore, ItemNullValueHandling = NullValueHandling.Ignore)]
public partial class Settings
{
[JsonProperty("remappings")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.6.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\ext\CompactJson\src\CompactJson\CompactJson.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/Stratis.VS.StratisEVM/StratisEVMPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
Directory.CreateDirectory(Runtime.LocalAppDataDir.CombinePath("CustomProjectSystems", "Solidity", "Tools"));
}
await Runtime.CopyFileAsync(Runtime.AssemblyLocation.CombinePath("Stratis.VS.SolidityProjectBuildTasks.dll"), Runtime.LocalAppDataDir.CombinePath("CustomProjectSystems", "Solidity", "Tools", "Stratis.VS.SolidityProjectBuildTasks.dll"));
await Runtime.CopyFileAsync(Runtime.AssemblyLocation.CombinePath("CompactJson.dll"), Runtime.LocalAppDataDir.CombinePath("CustomProjectSystems", "Solidity", "Tools", "CompactJson.dll"));
await File.WriteAllTextAsync(Runtime.LocalAppDataDir.CombinePath("CustomProjectSystems", "Solidity", "extdir.txt"), Runtime.AssemblyLocation);

if (!Directory.Exists(Path.Combine(Runtime.AssemblyLocation, "node_modules")) || !File.Exists(Path.Combine(Runtime.AssemblyLocation, "node_modules", "solidity", "dist", "cli", "server.js")))
Expand Down

0 comments on commit a7f8757

Please sign in to comment.