Skip to content

Commit

Permalink
Resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Mar 3, 2021
2 parents 68983e6 + bc0f263 commit 477a542
Show file tree
Hide file tree
Showing 16 changed files with 334 additions and 172 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ trim_trailing_whitespace = false
[*.sh]
end_of_line = lf

###########################
# Diagnsotic customizations
###########################
[*.{cs,csx,cake}]
dotnet_diagnostic.RS0030.severity = error

###########################
# .NET Language Conventions
# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#language-conventions
Expand Down
1 change: 1 addition & 0 deletions AudioAnalysis.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
src\AssemblyMetadata.cs.template = src\AssemblyMetadata.cs.template
src\AssemblyMetadata.Generated.targets = src\AssemblyMetadata.Generated.targets
azure-pipelines.yml = azure-pipelines.yml
BannedSymbols.txt = BannedSymbols.txt
Directory.Build.props = Directory.Build.props
build\download_ap.ps1 = build\download_ap.ps1
src\git_version.ps1 = src\git_version.ps1
Expand Down
2 changes: 2 additions & 0 deletions BannedSymbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
T:CsvHelper.CsvReader; You must not use CsvReader. Use The Acoustics.Shared.Csv.Read methods which properly construct the reader.
T:CsvHelper.CsvWriter; You must not use CsvWriter. Use The Acoustics.Shared.Csv.Write methods which properly construct the writer.
14 changes: 13 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Deterministic>true</Deterministic>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)style.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)\style.ruleset</CodeAnalysisRuleSet>
<!--<DotnetFscCompilerPath></DotnetFscCompilerPath>-->
<!-- all of these are 64 bit except for linux-arm -->
<RuntimeIdentifiers>win-x64;win-arm64;linux-x64;linux-musl-x64;linux-arm;linux-arm64;osx-x64</RuntimeIdentifiers>
Expand Down Expand Up @@ -48,5 +48,17 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>

</ItemGroup>
<Choose>
<When Condition="$(MSBuildProjectName)!='Acoustics.Shared'">
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)BannedSymbols.txt" />
</ItemGroup>
</When>
</Choose>
</Project>
51 changes: 42 additions & 9 deletions build/download_ap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,14 @@ function Get-Asset($asset_url) {
throw "Failed extracting $downloaded_zip using unzip"
}
}
elseif (Get-Command tar -CommandType Application -ErrorAction SilentlyContinue) {
tar --extract --xz --file $downloaded_zip --directory $Destination
if ($LASTEXITCODE -ne 0) {
throw "Failed extracting $downloaded_zip using tar"
}
}
else {
# the archive module has given us lots of problems - we try to avoid it if possible
Import-Module "Microsoft.PowerShell.Archive" -Force
Microsoft.PowerShell.Archive\Expand-Archive -LiteralPath $downloaded_zip -DestinationPath $Destination -Force

Expand Down Expand Up @@ -424,7 +431,10 @@ $actions = [ordered]@{
if($IsWindows) { return $null } chmod +x $ap_path
if ($LASTEXITCODE -ne 0) { return $false } else { return $true }
} )
"Check" = ("AP executable should have execute permission", { $(test -x $ap_path ; 0 -eq $LASTEXITCODE) } )
"Check" = ("AP executable should have execute permission", {
if($IsWindows) { return $null }
$(test -x $ap_path ; 0 -eq $LASTEXITCODE)
} )
"Uninstall" = $null
}
"Check AP runs" = @{
Expand Down Expand Up @@ -531,7 +541,18 @@ $actions = [ordered]@{
} )
}
"Symlink alias for AP" = @{
"Install" = ({"Symlink $alias_path to $ap_path"}, { if($null -eq $alias_path) { return $null } New-Item -Type SymbolicLink -Force -Path $alias_path -Target $ap_path | Out-Null ; return $true } )
"Install" = ({"Symlink $alias_path to $ap_path"}, {
if($null -eq $alias_path) { return $null }

try {
New-Item -Type SymbolicLink -Force -Path $alias_path -Target $ap_path | Out-Null ;
}
catch {
Write-Warning "Failed to symlink AP. Are you running with administrator privileges?"
$_ | Out-String | Write-Debug
}
return $true
} )
"Check" = ("$alias_path exists and points to $ap_path", {
return (Test-Path $alias_path) `
-and ((Get-Item $alias_path).LinkType -eq 'SymbolicLink') `
Expand All @@ -550,6 +571,18 @@ $actions = [ordered]@{
}
}

$success_symbol = ""
$skip_symbol = ""
$fail_symbol = ""

if ($IsWindows -and !$env:WT_SESSION) {
# we're on windows and not in Windows Terminal (but rather conhost.exe)
# conhost does not support emoji so change success indicators
$success_symbol = "+"
$skip_symbol = "~"
$fail_symbol = "!"
}

function Invoke-APInstallTask($current, $key) {
if ($null -eq $current) {
Write-Debug "${indent} no task for $key, skipped"
Expand All @@ -574,15 +607,15 @@ function Invoke-APInstallTask($current, $key) {

switch ($result) {
{ $err } {
Write-Error "${indent} [error] AP's installation has a problem: $message`n Error:$($err | Out-String)"
Write-Error "${indent}$fail_symbol [error] AP's installation has a problem: $message`n Error:$($err | Out-String)"
exit 1
}
$false {
Write-Error "${indent} [error] AP's installation has a problem: $message failed"
Write-Error "${indent}$fail_symbol [error] AP's installation has a problem: $message failed"
exit 1
}
$null { Write-Information "${indent} [skipped] $message" }
$true { Write-Information "${indent} [success] $message" }
$null { Write-Information "${indent}$skip_symbol [skipped] $message" }
$true { Write-Information "${indent}$success_symbol [success] $message" }
default {
throw "unexpected result: $result"
}
Expand Down Expand Up @@ -634,15 +667,15 @@ function Write-Metadata() {
switch -wildcard ($PsCmdlet.ParameterSetName) {
"Install-*" {
Invoke-APInstallTasks $actions "Install"
Write-Information " Installed AP $installed_version"
Write-Information "$success_symbol Installed AP $installed_version"
}
"Check" {
Invoke-APInstallTasks $actions "Check"
Write-Information " Check complete for AP version $installed_version"
Write-Information "$success_symbol Check complete for AP version $installed_version"
}
"Uninstall" {
Invoke-APInstallTasks $actions "Uninstall"
Write-Information " Uninstalled AP"
Write-Information "$success_symbol Uninstalled AP"
}
default {
Write-Output "No action selected, no action taken, exiting"
Expand Down
4 changes: 2 additions & 2 deletions build/generate_docs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ try {

Set-Location docs

log "[Disabled] Prepare API metadata for docs"
log "Prepare API metadata for docs"

exec { docfx metadata }

Expand Down Expand Up @@ -54,4 +54,4 @@ catch {
finally {
Pop-Location
finish_log
}
}
4 changes: 2 additions & 2 deletions src/Acoustics.Shared/Acoustics.Shared.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyTitle>Acoustics.Shared</AssemblyTitle>
<OutputType>Library</OutputType>
Expand All @@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ConsoleTools" Version="0.5.4" />
<PackageReference Include="CsvHelper" Version="16.2.0" />
<PackageReference Include="CsvHelper" Version="24.0.1" />
<PackageReference Include="FastMember" Version="1.5.0" />
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="log4net" Version="2.0.12" />
Expand Down
4 changes: 2 additions & 2 deletions src/Acoustics.Shared/Collections/IInterval2{TX,TY}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace Acoustics.Shared.ImageSharp
using System.Collections.Generic;

public interface IInterval2<TX, TY>
where TX : struct, IComparable<TX>
where TY : struct, IComparable<TY>
where TX : struct, IComparable<TX>, IFormattable
where TY : struct, IComparable<TY>, IFormattable
{
Interval<TX> X { get; }

Expand Down
Loading

0 comments on commit 477a542

Please sign in to comment.