Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 10 additions & 6 deletions src/Microsoft.DotNet.Helix/Sdk/CreateXHarnessAndroidWorkItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private async Task<ITaskItem> PrepareWorkItem(IZipArchiveManager zipArchiveManag
if (!IsPosixShell)
{
// For windows, we need to add a .ps1 header to turn the script into a cmdlet
customCommands = GetPowerShellHeader() + customCommands;
customCommands = WrapCustomCommands(customCommands);
}

string workItemZip = await CreatePayloadArchive(
Expand Down Expand Up @@ -188,12 +188,16 @@ private string GetHelixCommand(
return xharnessRunCommand;
}

private static string GetPowerShellHeader()
private static string WrapCustomCommands(string customCommands)
{
using Stream stream = ZipArchiveManager.GetResourceFileContent<CreateXHarnessAndroidWorkItems>(
ScriptNamespace + NonPosixAndroidHeaderScript);
using StreamReader reader = new(stream);
return reader.ReadToEnd();
string templateContents;
using Stream stream = ZipArchiveManager.GetResourceFileContent<CreateXHarnessAndroidWorkItems>(ScriptNamespace + NonPosixAndroidHeaderScript);
using (StreamReader reader = new(stream))
{
templateContents = reader.ReadToEnd();
}

return templateContents.Replace("{%%USER COMMANDS%%}", customCommands);
Comment thread
premun marked this conversation as resolved.
Outdated
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
<EmbeddedResource Include="tools\xharness-runner\xharness-event-reporter.py">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\xharness-runner\xharness-helix-job.android.header.ps1">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\xharness-runner\xharness-helix-job.apple.sh">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\xharness-runner\xharness-runner.apple.sh">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\xharness-runner\xharness-runner.android.ps1">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="tools\xharness-runner\xharness-helix-job.android.sh">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ function report_infrastructure_failure($message) {
$message -replace "['\\]" | Out-File -FilePath "$Env:HELIX_WORKITEM_ROOT\.reboot"
}

{%%USER COMMANDS%%}
Comment thread
premun marked this conversation as resolved.
Outdated

exit $LASTEXITCODE