Skip to content

Commit 4104b50

Browse files
authored
Merge pull request #913 from aws-powertools/fix/kafka-dependencies
chore: Fix kafka dependencies
2 parents cbbe17a + 5baf321 commit 4104b50

27 files changed

+362
-426
lines changed

examples/Kafka/Protobuf/src/Protobuf.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
1010
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1111
<!-- Generate ready to run images during publishing to improve cold start time. -->
12-
<PublishReadyToRun>true</PublishReadyToRun>
12+
<PublishReadyToRun>true</PublishReadyToRun>
1313
</PropertyGroup>
1414
<ItemGroup>
1515
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.12.0" />
@@ -31,6 +31,7 @@
3131
<GrpcServices>Client</GrpcServices>
3232
<Access>Public</Access>
3333
<ProtoCompile>True</ProtoCompile>
34+
3435
<CompileOutputs>True</CompileOutputs>
3536
<OutputDir>obj\Debug/net8.0/</OutputDir>
3637
<Generator>MSBuild:Compile</Generator>

libraries/src/AWS.Lambda.Powertools.Kafka.Avro/AWS.Lambda.Powertools.Kafka.Avro.csproj

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--suppress MsbuildTargetFrameworkTagInspection -->
2-
32
<Project Sdk="Microsoft.NET.Sdk">
3+
<Import Project="../KafkaDependencies.props" />
44

55
<PropertyGroup>
66
<PackageId>AWS.Lambda.Powertools.Kafka.Avro</PackageId>
@@ -12,10 +12,20 @@
1212
<ImplicitUsings>enable</ImplicitUsings>
1313
<Nullable>enable</Nullable>
1414
</PropertyGroup>
15+
16+
<!-- Release: Use source file inclusion -->
17+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
18+
<IncludeKafkaFiles>true</IncludeKafkaFiles>
19+
<DefineConstants>$(DefineConstants);KAFKA_AVRO</DefineConstants>
20+
</PropertyGroup>
21+
1522
<ItemGroup>
1623
<PackageReference Include="Apache.Avro"/>
1724
</ItemGroup>
18-
<ItemGroup>
25+
26+
<!-- Debug: Use project references -->
27+
<ItemGroup Condition="'$(Configuration)'=='Debug'">
1928
<ProjectReference Include="..\AWS.Lambda.Powertools.Kafka\AWS.Lambda.Powertools.Kafka.csproj"/>
29+
<ProjectReference Include="..\AWS.Lambda.Powertools.Common\AWS.Lambda.Powertools.Common.csproj"/>
2030
</ItemGroup>
21-
</Project>
31+
</Project>

libraries/src/AWS.Lambda.Powertools.Kafka.Avro/PowertoolsKafkaAvroSerializer.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
/*
2-
* Copyright JsonCons.Net authors. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
15-
161
using System.Diagnostics.CodeAnalysis;
172
using System.Reflection;
183
using System.Text.Json;
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--suppress MsbuildTargetFrameworkTagInspection -->
22
<Project Sdk="Microsoft.NET.Sdk">
3-
3+
<Import Project="../KafkaDependencies.props" />
44
<PropertyGroup>
55
<PackageId>AWS.Lambda.Powertools.Kafka.Json</PackageId>
66
<Description>Powertools for AWS Lambda (.NET) - Kafka Json consumer package.</Description>
@@ -10,10 +10,17 @@
1010
<TargetMultiFramework>false</TargetMultiFramework>
1111
<ImplicitUsings>enable</ImplicitUsings>
1212
<Nullable>enable</Nullable>
13-
</PropertyGroup>
13+
</PropertyGroup>
1414

15-
<ItemGroup>
16-
<ProjectReference Include="..\AWS.Lambda.Powertools.Kafka\AWS.Lambda.Powertools.Kafka.csproj" />
17-
</ItemGroup>
15+
<!-- Release: Use source file inclusion -->
16+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
17+
<IncludeKafkaFiles>true</IncludeKafkaFiles>
18+
<DefineConstants>$(DefineConstants);KAFKA_JSON</DefineConstants>
19+
</PropertyGroup>
1820

21+
<!-- Debug: Use project references -->
22+
<ItemGroup Condition="'$(Configuration)'=='Debug'">
23+
<ProjectReference Include="..\AWS.Lambda.Powertools.Kafka\AWS.Lambda.Powertools.Kafka.csproj"/>
24+
<ProjectReference Include="..\AWS.Lambda.Powertools.Common\AWS.Lambda.Powertools.Common.csproj"/>
25+
</ItemGroup>
1926
</Project>

libraries/src/AWS.Lambda.Powertools.Kafka.Json/PowertoolsKafkaJsonSerializer.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
/*
2-
* Copyright JsonCons.Net authors. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
15-
161
using System.Diagnostics.CodeAnalysis;
172
using System.Text;
183
using System.Text.Json;
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<!--suppress MsbuildTargetFrameworkTagInspection -->
2-
32
<Project Sdk="Microsoft.NET.Sdk">
4-
3+
<Import Project="../KafkaDependencies.props" />
54
<PropertyGroup>
65
<PackageId>AWS.Lambda.Powertools.Kafka.Protobuf</PackageId>
76
<Description>Powertools for AWS Lambda (.NET) - Kafka Protobuf consumer package.</Description>
@@ -12,13 +11,21 @@
1211
<ImplicitUsings>enable</ImplicitUsings>
1312
<Nullable>enable</Nullable>
1413
</PropertyGroup>
14+
15+
<!-- Release: Use source file inclusion -->
16+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
17+
<IncludeKafkaFiles>true</IncludeKafkaFiles>
18+
<DefineConstants>$(DefineConstants);KAFKA_PROTOBUF</DefineConstants>
19+
</PropertyGroup>
1520

1621
<ItemGroup>
1722
<PackageReference Include="Google.Protobuf" />
1823
</ItemGroup>
19-
20-
<ItemGroup>
21-
<ProjectReference Include="..\AWS.Lambda.Powertools.Kafka\AWS.Lambda.Powertools.Kafka.csproj" />
22-
</ItemGroup>
2324

25+
<!-- Debug: Use project references -->
26+
<ItemGroup Condition="'$(Configuration)'=='Debug'">
27+
<ProjectReference Include="..\AWS.Lambda.Powertools.Kafka\AWS.Lambda.Powertools.Kafka.csproj"/>
28+
<ProjectReference Include="..\AWS.Lambda.Powertools.Common\AWS.Lambda.Powertools.Common.csproj"/>
29+
</ItemGroup>
30+
2431
</Project>

libraries/src/AWS.Lambda.Powertools.Kafka.Protobuf/PowertoolsKafkaProtobufSerializer.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
/*
2-
* Copyright JsonCons.Net authors. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
15-
161
using System.Diagnostics.CodeAnalysis;
172
using System.Reflection;
183
using System.Text.Json;

libraries/src/AWS.Lambda.Powertools.Kafka/ConsumerRecord.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
/*
2-
* Copyright JsonCons.Net authors. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
15-
1+
#if KAFKA_JSON
2+
namespace AWS.Lambda.Powertools.Kafka.Json;
3+
#elif KAFKA_AVRO
4+
namespace AWS.Lambda.Powertools.Kafka.Avro;
5+
#elif KAFKA_PROTOBUF
6+
namespace AWS.Lambda.Powertools.Kafka.Protobuf;
7+
#else
168
namespace AWS.Lambda.Powertools.Kafka;
9+
#endif
1710

1811
/// <summary>
1912
/// Represents a single record consumed from a Kafka topic.

libraries/src/AWS.Lambda.Powertools.Kafka/ConsumerRecords.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
/*
2-
* Copyright JsonCons.Net authors. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
15-
161
using System.Collections;
172

3+
#if KAFKA_JSON
4+
namespace AWS.Lambda.Powertools.Kafka.Json;
5+
#elif KAFKA_AVRO
6+
namespace AWS.Lambda.Powertools.Kafka.Avro;
7+
#elif KAFKA_PROTOBUF
8+
namespace AWS.Lambda.Powertools.Kafka.Protobuf;
9+
#else
1810
namespace AWS.Lambda.Powertools.Kafka;
11+
#endif
1912

2013
/// <summary>
2114
/// Represents a collection of Kafka consumer records that can be enumerated.

libraries/src/AWS.Lambda.Powertools.Kafka/HeaderExtensions.cs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
/*
2-
* Copyright JsonCons.Net authors. All Rights Reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License").
5-
* You may not use this file except in compliance with the License.
6-
* A copy of the License is located at
7-
*
8-
* http://aws.amazon.com/apache2.0
9-
*
10-
* or in the "license" file accompanying this file. This file is distributed
11-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12-
* express or implied. See the License for the specific language governing
13-
* permissions and limitations under the License.
14-
*/
15-
161
using System.Text;
172

3+
#if KAFKA_JSON
4+
namespace AWS.Lambda.Powertools.Kafka.Json;
5+
#elif KAFKA_AVRO
6+
namespace AWS.Lambda.Powertools.Kafka.Avro;
7+
#elif KAFKA_PROTOBUF
8+
namespace AWS.Lambda.Powertools.Kafka.Protobuf;
9+
#else
1810
namespace AWS.Lambda.Powertools.Kafka;
11+
#endif
1912

2013
/// <summary>
2114
/// Extension methods for Kafka headers in ConsumerRecord.

0 commit comments

Comments
 (0)