Adds C# builds and namespaces (#100)

Co-authored-by: Max Reble <max.reble@aco.com>
This commit is contained in:
Max Reble 2023-01-31 19:29:21 +01:00 committed by GitHub
parent 81ce56a9a0
commit 837e13a586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 86 additions and 1 deletions

11
api/Dockerfile-csharp vendored Normal file
View File

@ -0,0 +1,11 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ENV PROJECT_PATH=/chirpstack/api
RUN apt update && apt install -y make git
RUN git clone --depth=1 --branch=master https://github.com/googleapis/googleapis.git /googleapis
RUN mkdir -p /googleproto/google/api/
RUN mv /googleapis/google/api/http.proto /googleproto/google/api/ && mv /googleapis/google/api/annotations.proto /googleproto/google/api/
RUN rm -rf /googleapis
WORKDIR $PROJECT_PATH

5
api/Makefile vendored
View File

@ -1,4 +1,4 @@
.PHONY: rust grpc-web go js python md java kotlin
.PHONY: rust grpc-web go js python md java kotlin csharp
all:
docker-compose up
@ -26,3 +26,6 @@ java:
kotlin:
docker-compose run --rm chirpstack-api-kotlin
csharp:
docker-compose run --rm chirpstack-csharp

37
api/csharp/Chirpstack.Api.csproj vendored Normal file
View File

@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Protobuf Include="../proto/common/common.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/gw/gw.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/internal.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/user.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/tenant.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/application.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/device_profile.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/device_profile_template.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/device.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/gateway.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/frame_log.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/multicast_group.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/api/request_log.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/integration/integration.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="../proto/meta/meta.proto" ProtoRoot="../proto/" OutputDir="Chirpstack/" CompileOutputs="false" AdditionalImportDirs="/googleproto" />
<Protobuf Include="/googleproto/google/api/*.proto" ProtoRoot="/googleproto" OutputDir="Chirpstack/" CompileOutputs="false" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.21.12" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
<PackageReference Include="Grpc.Tools" Version="2.51.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

12
api/csharp/Makefile vendored Normal file
View File

@ -0,0 +1,12 @@
.PHONY: requirements
all: requirements install clean-after
requirements:
rm -rf Chirpstack
dotnet clean
install:
dotnet build -c Release -o /app/build
clean-after:
rm -rf obj
rm -rf bin

View File

@ -56,3 +56,10 @@ services:
command: bash -c "cd kotlin && make all"
volumes:
- ./:/chirpstack/api
chirpstack-csharp:
build:
context: .
dockerfile: Dockerfile-csharp
command: bash -c "cd csharp && make all"
volumes:
- ./:/chirpstack/api

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "ApplicationProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProto";
option csharp_namespace = "Chirpstack.Api";
import "common/common.proto";
import "google/api/annotations.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "DeviceProfileTemplateProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "FrameLogProto";
option csharp_namespace = "Chirpstack.Api";
import "google/protobuf/timestamp.proto";
import "common/common.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "InternalProto";
option csharp_namespace = "Chirpstack.Api";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "MulticastGroupProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "RequestLogProto";
option csharp_namespace = "Chirpstack.Api";
import "google/protobuf/timestamp.proto";
import "common/common.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "TenantProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "UserProto";
option csharp_namespace = "Chirpstack.Api";
import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/common";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option csharp_namespace = "Chirpstack.Common";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/gw";
option java_package = "io.chirpstack.api.gw";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
option csharp_namespace = "Chirpstack.Gateway";
import "common/common.proto";
import "google/protobuf/timestamp.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/brocaar/chirpstack/api/go/v4/integration";
option java_package = "io.chirpstack.api.integration";
option java_multiple_files = true;
option java_outer_classname = "IntegrationProto";
option csharp_namespace = "Chirpstack.Integration";
import "common/common.proto";
import "gw/gw.proto";

View File

@ -6,6 +6,7 @@ option go_package = "github.com/chirpstack/chirpstack/api/go/v4/meta";
option java_package = "io.chirpstack.api.meta";
option java_multiple_files = true;
option java_outer_classname = "MetaProto";
option csharp_namespace = "Chirpstack.Meta";
import "common/common.proto";
import "gw/gw.proto";