-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#: CI check. #20839
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
Closed
+76
−9
Closed
C#: CI check. #20839
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2bdf456
C#: Read from dependency directory from extractor option.
michaelnebel 8d75a19
C#: Add extractor option for buildless dependency directory.
michaelnebel d274a4a
C#: Try with Path.Combine instead.
michaelnebel 9126705
REMOVE AGAIN.
michaelnebel 53be3bb
Rever to TempDir.
michaelnebel 6b62b9a
C#: try again.
michaelnebel 9d62b3a
C#: Add directory override.
michaelnebel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/DependencyDirectory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| using System; | ||
| using System.IO; | ||
| using Semmle.Util; | ||
| using Semmle.Util.Logging; | ||
|
|
||
| namespace Semmle.Extraction.CSharp.DependencyFetching | ||
| { | ||
| /// <summary> | ||
| /// A directory used for storing fetched dependencies. | ||
| /// When a specific directory is set via the dependency directory extractor option, | ||
| /// we store dependencies in that directory for caching purposes. | ||
| /// Otherwise, we create a temporary directory that is deleted upon disposal. | ||
| /// </summary> | ||
| public sealed class DependencyDirectory : IDisposable | ||
| { | ||
| private readonly string userReportedDirectoryPurpose; | ||
| private readonly ILogger logger; | ||
| private readonly bool attemptCleanup; | ||
|
|
||
| public DirectoryInfo DirInfo { get; } | ||
|
|
||
| public DependencyDirectory(string subfolderName, string userReportedDirectoryPurpose, ILogger logger) | ||
| { | ||
| this.logger = logger; | ||
| this.userReportedDirectoryPurpose = userReportedDirectoryPurpose; | ||
|
|
||
| attemptCleanup = true; | ||
| DirInfo = new DirectoryInfo(Path.Combine(FileUtils.GetTemporaryWorkingDirectory(out _), subfolderName)); | ||
| DirInfo.Create(); | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| if (!attemptCleanup) | ||
| { | ||
| logger.LogInfo($"Keeping {userReportedDirectoryPurpose} directory {DirInfo.FullName} for possible caching purposes."); | ||
| return; | ||
| } | ||
|
|
||
| try | ||
| { | ||
| DirInfo.Delete(true); | ||
| } | ||
| catch (Exception exc) | ||
| { | ||
| logger.LogInfo($"Couldn't delete {userReportedDirectoryPurpose} directory {exc.Message}"); | ||
| } | ||
|
||
| } | ||
|
|
||
| public override string ToString() => DirInfo.FullName.ToString(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / CodeQL
Call to System.IO.Path.Combine Note