Skip to content

Conversation

@hvitved
Copy link
Contributor

@hvitved hvitved commented Dec 4, 2018

This commit fixes a few issues that were identified during the last dist upgrade, and which were introduced/revealed on 836daaf.

  • Expand environment variables that are passed from lgtm.yml to the autobuilder, for example solution: $LGTM_SRC/mysolution.sln.
  • Distinguish between when a build rule is applied automatically and when it is applied manually via lgtm.yml.
  • Catch FileNotFoundExceptions when parsing project files and solution files.

This commit fixes a few issues that were identified during the last dist upgrade,
and which were introduced/revealed on 836daaf.

- Expand environment variables that are passed from `lgtm.yml` to the autobuilder,
  for example `solution: $LGTM_SRC/mysolution.sln`.
- Distinguish between when a build rule is applied automatically and when it is applied
  manually via `lgtm.yml`.
- Catch `FileNotFoundException`s when parsing project files and solution files.
@hvitved hvitved added C# depends on internal PR This PR should only be merged in sync with an internal Semmle PR labels Dec 4, 2018
@hvitved hvitved added this to the 1.19 milestone Dec 4, 2018
@hvitved hvitved requested a review from calumgrant December 4, 2018 13:07
@hvitved hvitved requested a review from a team as a code owner December 4, 2018 13:07
Copy link
Contributor

@calumgrant calumgrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small things. My main question is whether we should be supporting $ on Windows, or just use $ on all platforms.

Select(s => AsStringWithExpandedEnvVars(s, actions)).ToArray();
}

static readonly Regex linuxEnvRegEx = new Regex(@"\$([A-Z_][A-Z_0-9]*)", RegexOptions.Compiled);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Select(s => AsStringWithExpandedEnvVars(s, actions)).ToArray();
}

static readonly Regex linuxEnvRegEx = new Regex(@"\$([A-Z_][A-Z_0-9]*)", RegexOptions.Compiled);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps also lowercase letters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.


// `Environment.ExpandEnvironmentVariables` only works with Windows-style
// environment variables
var windowsStyle = actions.IsWindows()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably support both expansion styles on all platforms. In particular, the documentation doesn't even mention the Windows-style at all, and users may expect it to work using $ even on Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM_SRC is introduced as an environment variable here, so I think we should use the syntax for environment variables on the given platform. In the same way, if LGTM_SRC is used in a build_command, it is interpreted as a command script on Windows, so will have to use %LGTM_SRC% instead of $LGTM_SRC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good argument.

@hvitved hvitved force-pushed the csharp/autobuilder/fixes branch from 7e999f7 to 1e9fe00 Compare December 10, 2018 14:32
@adityasharad adityasharad merged commit d94e14d into github:rc/1.19 Dec 10, 2018
@hvitved hvitved deleted the csharp/autobuilder/fixes branch December 10, 2018 18:15
cklin pushed a commit that referenced this pull request May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C# depends on internal PR This PR should only be merged in sync with an internal Semmle PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants