Skip to content
Merged
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
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19352.7">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19353.19">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>b8c190d95371e658d95a5731f4778bd3da2fa42d</Sha>
<Sha>733f8297b68dd824044a77d955e62305b9dc43d5</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
8 changes: 5 additions & 3 deletions eng/common/sdl/execute-all-sdl-tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Param(
[string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs.
[string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs.
[string] $GuardianLoggerLevel="Standard" # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error
[string] $GuardianLoggerLevel="Standard", # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error
[string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1")
[string[]] $PoliCheckAdditionalRunConfigParams # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1")
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -69,10 +71,10 @@ if ($TsaOnboard) {
}

if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) {
& $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel
& $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams
}
if ($SourceToolsList -and $SourceToolsList.Count -gt 0) {
& $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel
& $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams
}

if ($UpdateBaseline) {
Expand Down
12 changes: 7 additions & 5 deletions eng/common/sdl/run-sdl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ Param(
[string] $GdnFolder,
[string[]] $ToolsList,
[string] $UpdateBaseline,
[string] $GuardianLoggerLevel="Standard"
[string] $GuardianLoggerLevel="Standard",
[string[]] $CrScanAdditionalRunConfigParams,
[string[]] $PoliCheckAdditionalRunConfigParams
)

$ErrorActionPreference = "Stop"
Expand All @@ -29,17 +31,17 @@ foreach ($tool in $ToolsList) {
Write-Host $tool
# We have to manually configure tools that run on source to look at the source directory only
if ($tool -eq "credscan") {
Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `""
& $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory "
Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})"
& $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
}
$config = $True
}
if ($tool -eq "policheck") {
Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `""
& $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory "
Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})"
& $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})
if ($LASTEXITCODE -ne 0) {
Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE."
exit $LASTEXITCODE
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19352.7",
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19353.19",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
11 changes: 11 additions & 0 deletions src/fsharp/service/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
return res
}

member bc.ParseFileNoCache(filename, sourceText, options, userOpName) =
async {
let parseErrors, parseTreeOpt, anyErrors = ParseAndCheckFile.parseFile(sourceText, filename, options, userOpName, false)
return FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, options.SourceFiles)
}

/// Fetch the parse information from the background compiler (which checks w.r.t. the FileSystem API)
member __.GetBackgroundParseResultsForFileInProject(filename, options, userOpName) =
reactor.EnqueueAndAwaitOpAsync(userOpName, "GetBackgroundParseResultsForFileInProject ", filename, fun ctok ->
Expand Down Expand Up @@ -961,6 +967,11 @@ type FSharpChecker(legacyReferenceResolver,
ic.CheckMaxMemoryReached()
backgroundCompiler.ParseFile(filename, sourceText, options, userOpName)

member ic.ParseFileNoCache(filename, sourceText, options, ?userOpName) =
let userOpName = defaultArg userOpName "Unknown"
ic.CheckMaxMemoryReached()
backgroundCompiler.ParseFileNoCache(filename, sourceText, options, userOpName)

member ic.ParseFileInProject(filename, source: string, options, ?userOpName: string) =
let userOpName = defaultArg userOpName "Unknown"
let parsingOptions, _ = ic.GetParsingOptionsFromProjectOptions(options)
Expand Down
27 changes: 17 additions & 10 deletions src/fsharp/service/service.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,32 @@ type public FSharpChecker =
member MatchBraces: filename: string * source: string * options: FSharpProjectOptions * ?userOpName: string -> Async<(range * range)[]>

/// <summary>
/// <para>Parse a source code file, returning a handle that can be used for obtaining navigation bar information
/// To get the full information, call 'CheckFileInProject' method on the result</para>
/// Parses a source code for a file and caches the results. Returns an AST that can be traversed for various features.
/// </summary>
///
/// <param name="filename">The filename for the file.</param>
/// <param name="sourceText">The full source for the file.</param>
/// <param name="filename">The path for the file. The file name is used as a module name for implicit top level modules (e.g. in scripts).</param>
/// <param name="sourceText">The source to be parsed.</param>
/// <param name="options">Parsing options for the project or script.</param>
/// <param name="userOpName">An optional string used for tracing compiler operations associated with this request.</param>
member ParseFile: filename: string * sourceText: ISourceText * options: FSharpParsingOptions * ?userOpName: string -> Async<FSharpParseFileResults>

/// <summary>
/// <para>Parse a source code file, returning a handle that can be used for obtaining navigation bar information
/// To get the full information, call 'CheckFileInProject' method on the result</para>
/// <para>All files except the one being checked are read from the FileSystem API</para>
/// Parses a source code for a file. Returns an AST that can be traversed for various features.
/// </summary>
///
/// <param name="filename">The filename for the file.</param>
/// <param name="source">The full source for the file.</param>
/// <param name="options">The options for the project or script, used to determine active --define conditionals and other options relevant to parsing.</param>
/// <param name="filename">The path for the file. The file name is also as a module name for implicit top level modules (e.g. in scripts).</param>
/// <param name="sourceText">The source to be parsed.</param>
/// <param name="options">Parsing options for the project or script.</param>
/// <param name="userOpName">An optional string used for tracing compiler operations associated with this request.</param>
member ParseFileNoCache: filename: string * sourceText: ISourceText * options: FSharpParsingOptions * ?userOpName: string -> Async<FSharpParseFileResults>

/// <summary>
/// Parses a source code for a file. Returns an AST that can be traversed for various features.
/// </summary>
///
/// <param name="filename">The path for the file. The file name is also as a module name for implicit top level modules (e.g. in scripts).</param>
/// <param name="sourceText">The source to be parsed.</param>
/// <param name="options">Parsing options for the project or script.</param>
/// <param name="userOpName">An optional string used for tracing compiler operations associated with this request.</param>
[<Obsolete("Please call checker.ParseFile instead. To do this, you must also pass FSharpParsingOptions instead of FSharpProjectOptions. If necessary generate FSharpParsingOptions from FSharpProjectOptions by calling checker.GetParsingOptionsFromProjectOptions(options)")>]
member ParseFileInProject: filename: string * source: string * options: FSharpProjectOptions * ?userOpName: string -> Async<FSharpParseFileResults>
Expand Down