Skip to content

Commit

Permalink
Enable building on Linux
Browse files Browse the repository at this point in the history
This commit adds a new build.sh file (based on the Build.cmd file) to
allow building roslyn-analzysers on Linux.

This repositories likes to use $(MSBuildProjectFullPath) as the
PackageId.  This has a problem on Linux because the file path separator
(`/`) is also used the version separator when the package id is placed
in the assets.json file. This breaks the build with an error like

roslyn-analyzers/.dotnet/sdk/5.0.100-rc.2.20479.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1060: Error reading assets file: Error loading lock file 'roslyn-analyzers/artifacts/obj/Microsoft.CodeQuality.CSharp.Analyzers/project.assets.json': 'roslyn-analyzers/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/Microsoft.CodeQuality.Analyzers.csproj*/3.3.2-dev' is not a valid version string. (Parameter 'value')
[roslyn-analyzers/src/NetAnalyzers/CSharp/Microsoft.CodeQuality.Analyzers/Microsoft.CodeQuality.CSharp.Analyzers.csproj]

Fix that by just using the file name (including exetension such as
.csproj) to skip the path mess.

The build also complains about a bunch of missing
AnalyzerReleases.Shipped.md and AnalyzerReleases.Unshipped.md files for
various *.Setup projects. Fix that by explicitly opting out of release
tracking for those projects.
  • Loading branch information
omajid committed Nov 11, 2020
1 parent c2ebde6 commit c0f21b4
Show file tree
Hide file tree
Showing 28 changed files with 58 additions and 30 deletions.
16 changes: 16 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

source="${BASH_SOURCE[0]}"

# resolve $SOURCE until the file is no longer a symlink
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"

# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
"$scriptroot/eng/common/build.sh" --restore --build $@
Empty file modified eng/common/dotnet-install.sh
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.AnalyzerUtilities
Restore would conclude that there is a cyclic dependency between Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.AnalyzerUtilities.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<DevelopmentDependency>false</DevelopmentDependency>

<!-- Override the version prefix for this package to allow more frequent stable releases -->
Expand All @@ -31,4 +31,4 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.AnalyzerUtilities\Microsoft.CodeAnalysis.AnalyzerUtilities.csproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.Analyzers
Restore would conclude that there is a cyclic dependency between Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.Analyzers.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,4 +28,4 @@
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Analyzers\CSharp\Microsoft.CodeAnalysis.CSharp.Analyzers.csproj" />
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Analyzers\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.Analyzers.vbproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.AnalyzerUtilities,
Restore would conclude that there is a cyclic dependency between us and the Microsoft.CodeAnalysis.AnalyzerUtilities package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<ExcludeInternalFlowAnalyses>true</ExcludeInternalFlowAnalyses>
<ExcludeCodeMetricsUtilities>true</ExcludeCodeMetricsUtilities>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>

<!--
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.Analyzers
Restore would conclude that there is a cyclic dependency between Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.Analyzers.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.Analyzers" />
Expand All @@ -18,4 +19,4 @@
</ItemGroup>
<Import Project="..\..\Utilities\Compiler\Analyzer.Utilities.projitems" Label="Shared" />
<Import Project="..\..\Utilities\Workspaces\Workspaces.Utilities.projitems" Label="Shared" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.Analyzers
Restore would conclude that there is a cyclic dependency between Microsoft.CodeAnalysis and Microsoft.CodeAnalysis.Analyzers.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>

<GeneratePkgDefFile>false</GeneratePkgDefFile>
<IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
Expand All @@ -37,4 +38,4 @@
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.BannedApiAnalyzer,
Restore would conclude that there is a cyclic dependency between us and the Microsoft.CodeAnalysis.BannedApiAnalyzer package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<MicrosoftCodeAnalysisVersion>2.9.0</MicrosoftCodeAnalysisVersion>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Core\Microsoft.CodeAnalysis.BannedApiAnalyzers.csproj" />
<ProjectReference Include="..\CSharp\Microsoft.CodeAnalysis.CSharp.BannedApiAnalyzers.csproj" />
<ProjectReference Include="..\VisualBasic\Microsoft.CodeAnalysis.VisualBasic.BannedApiAnalyzers.vbproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<CreateVsixContainer>true</CreateVsixContainer>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>
<ItemGroup>
<Content Include="EULA.rtf">
Expand Down Expand Up @@ -57,4 +58,4 @@
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.VersionCheckAnalyzer,
Restore would conclude that there is a cyclic dependency between us and the Microsoft.CodeAnalysis.VersionCheckAnalyzer package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<MicrosoftCodeAnalysisVersion>2.0.0</MicrosoftCodeAnalysisVersion>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,4 +31,4 @@
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,4 +31,4 @@
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,4 +31,4 @@
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeQuality.Analyzers
Restore would conclude that there is a cyclic dependency between us and the Microsoft.CodeQuality.Analyzers nuget package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<RootNamespace></RootNamespace>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeQuality.Analyzers
Restore would conclude that there is a cyclic dependency between us and the Microsoft.CodeQuality.Analyzers nuget package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeQuality.CSharp.Analyzers" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.NetCore.Analyzers
Restore would conclude that there is a cyclic dependency between us and the Microsoft.NetCore.Analyzers nuget package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.NetCore.CSharp.Analyzers" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.NetFramework.Analyzers,
Restore would conclude that there is a cyclic dependency between us and the Microsoft.NetFramework.Analyzers nuget package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.NetFramework.CSharp.Analyzers" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,4 +31,4 @@
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.PerformanceSensitive.Analyzers,
Restore would conclude that there is a cyclic dependency between us and the Microsoft.CodeAnalysis.PerformanceSensitive.Analyzers nuget package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<MicrosoftCodeAnalysisVersion>2.9.0</MicrosoftCodeAnalysisVersion>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Core\Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.csproj" />
<ProjectReference Include="..\CSharp\Analyzers\Microsoft.CodeAnalysis.CSharp.PerformanceSensitiveAnalyzers.csproj" />
<ProjectReference Include="..\CSharp\CodeFixes\Microsoft.CodeAnalysis.CSharp.PerformanceSensitiveAnalyzers.CodeFixes.csproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Microsoft.CodeAnalysis.PublicApiAnalyzer,
Restore would conclude that there is a cyclic dependency between us and the Microsoft.CodeAnalysis.PublicApiAnalyzer package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<MicrosoftCodeAnalysisVersion>1.2.1</MicrosoftCodeAnalysisVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to DotNetAnalyzers.PublicApiAnalyzer.CodeFixes,
Restore would conclude that there is a cyclic dependency between us and the DotNetAnalyzers.PublicApiAnalyzer.CodeFixes package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<MicrosoftCodeAnalysisVersion>1.2.1</MicrosoftCodeAnalysisVersion>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Core\Analyzers\Microsoft.CodeAnalysis.PublicApiAnalyzers.csproj" />
<ProjectReference Include="..\Core\CodeFixes\Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes.csproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Roslyn.Diagnostics.Analyzers,
Restore would conclude that there is a cyclic dependency between us and the Roslyn.Diagnostics.Analyzers package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
<MicrosoftCodeAnalysisVersion>$(MicrosoftCodeAnalysisForRoslynDiagnosticsAnalyzersVersion)</MicrosoftCodeAnalysisVersion>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,4 +31,4 @@
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Text.Analyzers/Core/Text.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
PackageId is used by Restore. If we set it to Text.Analyzers,
Restore would conclude that there is a cyclic dependency between us and the Text.Analyzers nuget package.
-->
<PackageId>*$(MSBuildProjectFullPath)*</PackageId>
<PackageId>*$(MSBuildProjectFile)*</PackageId>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="Text.CSharp.Analyzers" />
Expand Down
3 changes: 2 additions & 1 deletion src/Text.Analyzers/Setup/Text.Analyzers.Setup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<ImportVSSDKTargets>true</ImportVSSDKTargets>
<PublishWindowsPdb>false</PublishWindowsPdb>
<ReleaseTrackingOptOut>true</ReleaseTrackingOptOut>
</PropertyGroup>

<ItemGroup>
Expand All @@ -30,4 +31,4 @@
<ForceIncludeInVSIX>true</ForceIncludeInVSIX>
</ProjectReference>
</ItemGroup>
</Project>
</Project>

0 comments on commit c0f21b4

Please sign in to comment.