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

Append random id to log files so they get ignored during git-diff #285

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion src/cijobs/cijobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private static int Main(string[] args)
}

// Wrap CI httpClient with focused APIs for product, job, and build.
// This logic is seperate from listing/copying and just extracts data.
// This logic is separate from listing/copying and just extracts data.
private class CIClient
{
private HttpClient _client;
Expand Down
2 changes: 1 addition & 1 deletion src/jit-analyze/jit-analyze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ class ScriptResolverPolicyWrapper : ICommandResolverPolicy
// There are files with diffs. Build up a dictionary mapping base file name to net text diff count.
// Use "git diff" to do the analysis for us, then parse that output.
//
// "git diff --no-index --exit-code --numstat" output shows added/deleted lines:
// "git diff --no-index --diff-filter=M --exit-code --numstat" output shows added/deleted lines:
//
// <added> <removed> <base-path> => <diff-path>
//
Expand Down
6 changes: 5 additions & 1 deletion src/jit-dasm-pmi/jit-dasm-pmi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,13 @@ void AppendEnvironmentVariableToPmiEnv(string varName, string varValue)
// Generate path to the output file
var assemblyFileName = Path.ChangeExtension(assembly.Name, ".dasm");
var dasmPath = Path.Combine(_rootPath, assembly.OutputPath, assemblyFileName);
var logPath = Path.ChangeExtension(dasmPath, ".log");

// Create logs in separate folder so they don't get picked up by "git diff"
var logPath = Path.Combine(Path.GetDirectoryName(dasmPath) + "logs", assemblyFileName);
logPath = Path.ChangeExtension(logPath, ".log");

PathUtility.EnsureParentDirectoryExists(dasmPath);
PathUtility.EnsureParentDirectoryExists(logPath);

AppendEnvironmentVariableToPmiEnv("COMPlus_JitStdOutFile", dasmPath);

Expand Down
10 changes: 7 additions & 3 deletions src/jit-dasm/jit-dasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// tools to validate ongoing development.
//
// Scenario 1: Pass A and B compilers to jitdasm. Using the --base and --diff
// arguments pass two seperate compilers and a passed set of assemblies. This
// arguments pass two separate compilers and a passed set of assemblies. This
// is the most common scenario.
//
// Scenario 2: Iterativly call jitdasm with a series of compilers tagging
Expand Down Expand Up @@ -512,13 +512,19 @@ public void GenerateAsm()
}

string dasmPath = null;
string logPath = null;
if (_rootPath != null)
{
// Generate path to the output file
var assemblyFileName = Path.ChangeExtension(assembly.Name, ".dasm");
dasmPath = Path.Combine(_rootPath, assembly.OutputPath, assemblyFileName);

// Create logs in separate folder so they don't get picked up by "git diff"
logPath = Path.Combine(Path.GetDirectoryName(dasmPath) + "logs", assemblyFileName);
logPath = Path.ChangeExtension(logPath, ".log");

PathUtility.EnsureParentDirectoryExists(dasmPath);
PathUtility.EnsureParentDirectoryExists(logPath);

AddEnvironmentVariable("COMPlus_JitStdOutFile", dasmPath);
}
Expand All @@ -544,8 +550,6 @@ public void GenerateAsm()

if (_rootPath != null)
{
var logPath = Path.ChangeExtension(dasmPath, ".log");

// Redirect stdout/stderr to log file and run command.
using (var outputStreamWriter = File.CreateText(logPath))
{
Expand Down