-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Package Project * Add Release action * Fix README * Fix package ID
- Loading branch information
Showing
7 changed files
with
209 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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,29 @@ | ||
name: Build, Test and Release | ||
|
||
on: | ||
release: | ||
types: published | ||
|
||
jobs: | ||
test: | ||
|
||
uses: ./.github/workflows/tests.yml | ||
|
||
release: | ||
|
||
needs: test | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-dotnet@v2 | ||
name: Setup .Net | ||
with: | ||
dotnet-version: 6.x.x | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Release | ||
run: dotnet build --no-restore -c Release -p:Version=${{ github.event.release.tag_name }}.0 | ||
- name: Push | ||
run: dotnet nuget push ./package/AutoMapper.Analyzers.Common.Package/bin/Release/AutoMapper.Extensions.Analyzers.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |
This file contains 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ name: Build and Test | |
on: | ||
pull_request: | ||
branches: main | ||
workflow_call: | ||
|
||
jobs: | ||
build-and-test: | ||
|
This file contains 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 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
43 changes: 43 additions & 0 deletions
43
package/AutoMapper.Analyzers.Common.Package/AutoMapper.Analyzers.Common.Package.csproj
This file contains 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,43 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<IncludeBuildOutput>false</IncludeBuildOutput> | ||
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<PackageId>AutoMapper.Extensions.Analyzers</PackageId> | ||
<Authors>Sergey Antonov</Authors> | ||
<PackageProjectUrl>https://github.com/Scogun/AutoMapper.Analyzers</PackageProjectUrl> | ||
<PackageLicenseUrl>https://github.com/Scogun/AutoMapper.Analyzers/blob/main/LICENSE</PackageLicenseUrl> | ||
<PackageIcon>Logo.png</PackageIcon> | ||
<PackageIconUrl /> | ||
<RepositoryUrl>https://github.com/Scogun/AutoMapper.Analyzers</RepositoryUrl> | ||
<PackageTags>AutoMapper, analyzers</PackageTags> | ||
<NoPackageAnalysis>true</NoPackageAnalysis> | ||
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_OutputAnalyzers</TargetsForTfmSpecificContentInPackage> | ||
<Company>UCASoft</Company> | ||
<Product>AutoMapper Analyzers</Product> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\AutoMapper.Analyzers.Common.CodeFixes\AutoMapper.Analyzers.Common.CodeFixes.csproj" /> | ||
<ProjectReference Include="..\..\src\AutoMapper.Analyzers.Common\AutoMapper.Analyzers.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\Logo.png" Pack="true" PackagePath="" /> | ||
<None Update="tools\*.ps1" CopyToOutputDirectory="Always" Pack="true" PackagePath="" /> | ||
</ItemGroup> | ||
|
||
|
||
<Target Name="_OutputAnalyzers"> | ||
<ItemGroup> | ||
<TfmSpecificPackageFile Include="$(OutputPath)\AutoMapper.Analyzers.Common.dll" PackagePath="analyzers/dotnet/cs" /> | ||
<TfmSpecificPackageFile Include="$(OutputPath)\AutoMapper.Analyzers.Common.CodeFixes.dll" PackagePath="analyzers/dotnet/cs" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
58 changes: 58 additions & 0 deletions
58
package/AutoMapper.Analyzers.Common.Package/tools/install.ps1
This file contains 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,58 @@ | ||
param($installPath, $toolsPath, $package, $project) | ||
|
||
if($project.Object.SupportsPackageDependencyResolution) | ||
{ | ||
if($project.Object.SupportsPackageDependencyResolution()) | ||
{ | ||
# Do not install analyzers via install.ps1, instead let the project system handle it. | ||
return | ||
} | ||
} | ||
|
||
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve | ||
|
||
foreach($analyzersPath in $analyzersPaths) | ||
{ | ||
if (Test-Path $analyzersPath) | ||
{ | ||
# Install the language agnostic analyzers. | ||
foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll) | ||
{ | ||
if($project.Object.AnalyzerReferences) | ||
{ | ||
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName) | ||
} | ||
} | ||
} | ||
} | ||
|
||
# $project.Type gives the language name like (C# or VB.NET) | ||
$languageFolder = "" | ||
if($project.Type -eq "C#") | ||
{ | ||
$languageFolder = "cs" | ||
} | ||
if($project.Type -eq "VB.NET") | ||
{ | ||
$languageFolder = "vb" | ||
} | ||
if($languageFolder -eq "") | ||
{ | ||
return | ||
} | ||
|
||
foreach($analyzersPath in $analyzersPaths) | ||
{ | ||
# Install language specific analyzers. | ||
$languageAnalyzersPath = join-path $analyzersPath $languageFolder | ||
if (Test-Path $languageAnalyzersPath) | ||
{ | ||
foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll) | ||
{ | ||
if($project.Object.AnalyzerReferences) | ||
{ | ||
$project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName) | ||
} | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
package/AutoMapper.Analyzers.Common.Package/tools/uninstall.ps1
This file contains 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,65 @@ | ||
param($installPath, $toolsPath, $package, $project) | ||
|
||
if($project.Object.SupportsPackageDependencyResolution) | ||
{ | ||
if($project.Object.SupportsPackageDependencyResolution()) | ||
{ | ||
# Do not uninstall analyzers via uninstall.ps1, instead let the project system handle it. | ||
return | ||
} | ||
} | ||
|
||
$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve | ||
|
||
foreach($analyzersPath in $analyzersPaths) | ||
{ | ||
# Uninstall the language agnostic analyzers. | ||
if (Test-Path $analyzersPath) | ||
{ | ||
foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll) | ||
{ | ||
if($project.Object.AnalyzerReferences) | ||
{ | ||
$project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName) | ||
} | ||
} | ||
} | ||
} | ||
|
||
# $project.Type gives the language name like (C# or VB.NET) | ||
$languageFolder = "" | ||
if($project.Type -eq "C#") | ||
{ | ||
$languageFolder = "cs" | ||
} | ||
if($project.Type -eq "VB.NET") | ||
{ | ||
$languageFolder = "vb" | ||
} | ||
if($languageFolder -eq "") | ||
{ | ||
return | ||
} | ||
|
||
foreach($analyzersPath in $analyzersPaths) | ||
{ | ||
# Uninstall language specific analyzers. | ||
$languageAnalyzersPath = join-path $analyzersPath $languageFolder | ||
if (Test-Path $languageAnalyzersPath) | ||
{ | ||
foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll) | ||
{ | ||
if($project.Object.AnalyzerReferences) | ||
{ | ||
try | ||
{ | ||
$project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName) | ||
} | ||
catch | ||
{ | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |