forked from yoheimuta/protolint
-
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.
The grpc tools add-on will be built with this package. By adding this package, grpc.tools will automatically be added to protoc. Should work with any other protoc compiler package as well, but is untested. Global Tool is disabled in solution for now Second contribution for yoheimuta#337
- Loading branch information
1 parent
7e9cbac
commit 8a01676
Showing
7 changed files
with
187 additions
and
2 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 @@ | ||
# Protolint Plug-in Compiler |
Empty file.
88 changes: 88 additions & 0 deletions
88
bdist/dotnet/ProtocGenPlugin/protolint-ProtocGenPlugin.msbuildproj
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,88 @@ | ||
<Project Sdk="Microsoft.Build.NoTargets/3.7.56"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<DefaultProjectTypeGuid>{2F08BC15-189B-4804-B644-653F34C968A8}</DefaultProjectTypeGuid> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<PackageId>yoheimuta.protolint.protoc-plugin</PackageId> | ||
<PackageVersion></PackageVersion> | ||
<Authors>yoheimuta; carstencodes</Authors> | ||
<Title>Protolint Protoc plug-in</Title> | ||
<Description>A pluggable linter and fixer to enforce Protocol Buffer style and conventions.</Description> | ||
<Copyright>Copyright (c) 2018 yohei yoshimuta</Copyright> | ||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<!--<PackageLicenseFile>$(MsBuildThisFileDirectory)../../../LICENSE</PackageLicenseFile>--> | ||
<PackageProjectUrl>https://github.com/yoheimuta/protolint</PackageProjectUrl> | ||
<PackageReadmeFile>ReadMe.md</PackageReadmeFile> | ||
<PackageTags>protolint;protocol-buffers;protobuf;linter</PackageTags> | ||
<PackageType>Dependency</PackageType> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<DevelopmentDependency>true</DevelopmentDependency> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.9.1"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None | ||
Include="ReadMe.md" | ||
Pack="true" | ||
PackagePath="" /> | ||
<None | ||
Include="$(PackageId).props" | ||
Pack="true" | ||
PackagePath="build" /> | ||
<None | ||
Include="$(PackageId).targets" | ||
Pack="true" | ||
PackagePath="build" /> | ||
<None | ||
Include="_._" | ||
Pack="true" | ||
PackagePath="lib/netstandard2.0" /> | ||
<None | ||
Include="$(ProtolintGoReleaserDistDir)protoc-gen-protolint_darwin_amd64_v1/protoc-gen-protolint" | ||
Pack="true" | ||
PackagePath="tools/osx-x64/" /> | ||
<None | ||
Include="$(ProtolintGoReleaserDistDir)protoc-gen-protolint_darwin_arm64/protoc-gen-protolint" | ||
Pack="true" | ||
PackagePath="tools/osx-arm64/" /> | ||
<None | ||
Include="$(ProtolintGoReleaserDistDir)protoc-gen-protolint_linux_amd64_v1/protoc-gen-protolint" | ||
Pack="true" | ||
PackagePath="tools/linux-x64/" /> | ||
<None | ||
Include="$(ProtolintGoReleaserDistDir)protoc-gen-protolint_linux_arm_7/protoc-gen-protolint" | ||
Pack="true" | ||
PackagePath="tools/linux-arm/" /> | ||
<None | ||
Include="$(ProtolintGoReleaserDistDir)protoc-gen-protolint_linux_arm64/protoc-gen-protolint" | ||
Pack="true" | ||
PackagePath="tools/linux-arm64/" /> | ||
<None | ||
Include="$(ProtolintGoReleaserDistDir)protoc-gen-protolint_windows_amd64_v1/protoc-gen-protolint.exe" | ||
Pack="true" | ||
PackagePath="tools/win-x64/" /> | ||
<None | ||
Include="$(ProtolintGoReleaserDistDir)protoc-gen-protolint_windows_arm64/protoc-gen-protolint.exe" | ||
Pack="true" | ||
PackagePath="tools/win-arm64/" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<_FilesToRename Include="$(ProtolintGoReleaserDistDir)/protolint*/protolint" /> | ||
<_FilesToRename Include="$(ProtolintGoReleaserDistDir)/protolint*/protolint.exe" /> | ||
</ItemGroup> | ||
|
||
</Project> |
7 changes: 7 additions & 0 deletions
7
bdist/dotnet/ProtocGenPlugin/yoheimuta.protolint.protoc-plugin.props
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,7 @@ | ||
<?xml version="1.0"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
<ProtocGenProtolintOptions></ProtocGenProtolintOptions> | ||
</PropertyGroup> | ||
</Project> |
77 changes: 77 additions & 0 deletions
77
bdist/dotnet/ProtocGenPlugin/yoheimuta.protolint.protoc-plugin.targets
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,77 @@ | ||
<?xml version="1.0"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<_SystemPlatform>$( [System.Environment]::OSVersion.PlatformId )</_SystemPlatform> | ||
<_SystemPlatform>$(_SystemPlatform.ToLowerInvariant())</_SystemPlatform> | ||
<_SystemArchitecture>$( [System.Runtime.InteropServices]::Architecture )<_SystemArchitecture> | ||
<ProtocGenProtolintToolPath>$( [System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../tools) )</ProtocGenProtolintToolPath> | ||
<ProtocGenProtolintOs Condition="'$(ProtocGenProtolintOs)' == '' AND '$( _SystemPlatform.StartsWith('win') )'">win</ProtocGenProtolintOs> | ||
<ProtocGenProtolintOs Condition="'$(ProtocGenProtolintOs)' == '' AND '$( _SystemPlatform.StartsWith('unix') )'">linux</ProtocGenProtolintOs> | ||
<ProtocGenProtolintOs Condition="'$(ProtocGenProtolintOs)' == ''">$(_SystemPlatform)</ProtocGenProtolintOs> | ||
<ProtocGenProtolintCpuArch>$( _SystemArchitecture.ToLowerInvariant() )</ProtocGenProtolintCpuArch> | ||
<ProtocGenProtolintRid>$(ProtocGenProtolintOs)-$(ProtocGenProtolintCpuArch)</ProtocGenProtolintRid> | ||
<ProtocGenProtolintExtension Condition="'$(ProtocGenProtolintOs)' == 'win'">.exe</ProtocGenProtolintExtension> | ||
<ProtocGenProtolintExecutableName>protoc-gen-protolint</ProtocGenProtolintExecutableName> | ||
<ProtocGenProtolintExecutuableFileDir>$(ProtocGenProtolintToolPath)$(ProtocGenProtolintRid)/</ProtocGenProtolintExecutuableFileDir> | ||
<ProtocGenProtolintExecutable>$(ProtocGenProtolintExecutuableFileDir)$(ProtocGenProtolintExecutableName)$(ProtocGenProtolintExtension)</ProtocGenProtolintExecutable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<ProtocGenProtolintEffectiveOptions Condition="'$(ProtocGenProtolintOptions)' != ''">,$(ProtocGenProtolintOptions)</ProtocGenProtolintEffectiveOptions> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="Exists('$(ProtocGenProtolintExecutable)')"> | ||
<ProtoBuf Update="@(Protobuf->WithMetadata('ProtoRoot',''))"> | ||
<AdditionalProtocArguments>--protolint_out=.;--protolint_opt=proto_root=$([System.IO.Path]::GetFullPath(%(RelativeDir))$(ProtocGenProtolintEffectiveOptions)</AdditionalProtocArguments> | ||
<AdditionalProtocArguments Condition=" '$(Protobuf_ProtoRoot)' != '' ">--protolint_out=.;--protolint_opt=proto_root=$(Protobuf_ProtoRoot)$(ProtocGenProtolintEffectiveOptions)</AdditionalProtocArguments> | ||
</ProtoBuf> | ||
<ProtoBuf Update="@(Protobuf->HasMetadata('ProtoRoot'))"> | ||
<AdditionalProtocArguments>--protolint_out=.;--protolint_opt=proto_root=%(ProtoRoot)$(ProtocGenProtolintEffectiveOptions)</AdditionalProtocArguments> | ||
</ProtoBuf> | ||
</ItemGroup> | ||
|
||
<Target | ||
Name="ProtocGenProtolintVerifyToolExists" | ||
BeforeTargets="Protobuf_PrepareCompile" | ||
Condition="'@(Protobuf)' != ''"> | ||
<Error | ||
Text="Cannot locate protoc-gen-protolint executable file at '$(ProtocGenProtolintExecutable)'" | ||
Condition="!Exists('$(ProtocGenProtolintExecutable)')"/> | ||
</Target> | ||
|
||
<Target | ||
Name="ProtocGenProtolintUpdatePath" | ||
BeforeTargets="Protobuf_BeforeCompile" | ||
Condition="'@(Protobuf)' != ''"> | ||
<PropertyGroup> | ||
<_SystemPath>$( [System.Environment.GetEnvironmentVariable('PATH')] )</_SystemPath> | ||
<_NewSystemPath>$(_SystemPath);$(ProtocGenProtolintExecutuableFileDir)</_NewSystemPath> | ||
</PropertyGroup> | ||
|
||
<UpdatePathToProtocGenExecutable Value="$(_NewSystemPath)" /> | ||
</Target> | ||
|
||
<UsingTask | ||
TaskName="UpdatePathToProtocGenExecutable" | ||
TaskFactory="RoslynCodeTaskFactory" | ||
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" > | ||
|
||
<ParameterGroup> | ||
<Value ParameterType="System.String" Required="true" /> | ||
</ParameterGroup> | ||
|
||
<Task> | ||
<Using Namespace="System" /> | ||
<Code Type="Fragment" Language="cs"> | ||
<![CDATA[ | ||
Environment.SetEnvironmentVariable("PATH", Value); | ||
]]> | ||
</Code> | ||
</Task> | ||
|
||
</UsingTask> | ||
</Project> |
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,8 @@ | ||
# protolint dotnet port | ||
|
||
The .NET port for protolint consists of | ||
|
||
- a .NET global tool. This cannot be fulfilled by .NET SDK yet, | ||
refer to [this issue](https://github.com/dotnet/sdk/issues/9503) for details. | ||
- a simple MsBuild task, that will be added to .NET project and that will validate all items in the `ProtoBuf` item group. | ||
- an MsBuild Task collections that registers protoc-gen-protolint as protoc-plugin for all `ProtoBuf` items. |
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