Skip to content

Commit

Permalink
Use ExtDir property in Build target.
Browse files Browse the repository at this point in the history
  • Loading branch information
allisterb committed Nov 20, 2024
1 parent dc561ae commit 9716e21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Stratis.VS.SolidityProjectBuildTasks/CompileContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ namespace Stratis.VS
{
public class CompileContracts : Task
{
[Required]
public string ExtDir { get; set; }

[Required]
public ITaskItem[] Contracts { get; set; }

public override bool Execute()
{
Log.LogMessage(MessageImportance.High, "{0}", Contracts.Select(c => c.ItemSpec).ToArray());
Log.LogMessage(MessageImportance.High, "{0}:{1}", ExtDir, Contracts.Select(c => c.ItemSpec).ToArray());
return true;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/Stratis.VS.StratisEVM/BuildSystem/Solidity.targets
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@
<Exec Command='$(RunCommand) "$(MSBuildProjectDirectory)\$(StartItem)" $(RunCommandArguments)' WorkingDirectory="$(RunWorkingDirectory)" />
</Target>

<PropertyGroup>
<ExtDir>$([System.IO.File]::ReadAllText("$(MSBuildThisFileDirectory)\extdir.txt"))</ExtDir>
</PropertyGroup>

<UsingTask TaskName="CompileContracts" AssemblyFile="$(LocalAppData)\CustomProjectSystems\Solidity\Tools\Stratis.VS.SolidityProjectBuildTasks.dll"/>
<Target Name="Build">
<CompileContracts Contracts="@(Contract)" />
<CompileContracts ExtDir="$(ExtDir)" Contracts="@(Contract)" />
</Target>

<Target Name="Rebuild">
Expand Down
2 changes: 2 additions & 0 deletions src/Stratis.VS.StratisEVM/StratisEVMPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ 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 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")))
{
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
Expand Down

0 comments on commit 9716e21

Please sign in to comment.