Skip to content

Commit

Permalink
Fix wrong package initialization (#13)
Browse files Browse the repository at this point in the history
* Version upgrade

* Fix critical bug in previous version

* Version fix

* #10: fix on self contained package

* #10: update for containing data during publish

* #10: tag update
  • Loading branch information
masesdevelopers authored Jan 3, 2022
1 parent c5ccfd6 commit 962c09d
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/java/kafkabridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<name>mases.kafkabridge</name>
<description>Apache Kafka interface bridging implementation</description>
<url>https://github.com/masesgroup/KafkaBridge</url>
<version>1.1.2.0</version>
<version>1.1.3.0</version>

<licenses>
<license>
Expand Down
9 changes: 7 additions & 2 deletions src/net/KafkaBridge/InternalConst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

using System;
using System.IO;

namespace MASES.KafkaBridge
{
Expand All @@ -34,18 +35,22 @@ class CLIParam
/// </summary>
public class Const
{
/// <summary>
/// The location of this assembly
/// </summary>
public static readonly string AssemblyLocation = Path.GetDirectoryName(typeof(Const).Assembly.Location);
/// <summary>
/// Default Scala version
/// </summary>
public const string DefaultScalaVersion = "2.13.6";
/// <summary>
/// Default root path, i.e. consider installation within bin folder
/// </summary>
public const string DefaultRootPath = "./jars";
public static readonly string DefaultRootPath = Path.Combine(AssemblyLocation, "jars") + Path.DirectorySeparatorChar;
/// <summary>
/// Default log4j path, i.e. consider installation within bin folder
/// </summary>
public const string DefaultLog4JPath = "./config/log4j.properties";
public static readonly string DefaultLog4JPath = Path.Combine(AssemblyLocation, "config", "log4j.properties");
}

class InternalConst
Expand Down
6 changes: 3 additions & 3 deletions src/net/KafkaBridge/KafkaBridge.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Owners>MASES s.r.l.</Owners>
<Authors>MASES s.r.l.</Authors>
<Company>MASES s.r.l.</Company>
<Version>1.1.2.0</Version>
<Version>1.1.3.0</Version>
<Product>KafkaBridge</Product>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net5.0-windows;net6.0;net6.0-windows</TargetFrameworks>
Expand All @@ -20,7 +20,7 @@
<PackageReleaseNotes>https://github.com/masesgroup/KafkaBridge/releases</PackageReleaseNotes>
<PackageLicense>LICENSE</PackageLicense>
<PackageIcon>JCOB128x128.png</PackageIcon>
<PackageTags>kafka apache-kafka dotnet clr netcore net5 net6</PackageTags>
<PackageTags>kafka apache-kafka dotnet clr netcore net5 net6 kafka connect streams producer consumer providers streamprovider confluent</PackageTags>
<PackageId>MASES.KafkaBridge</PackageId>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down Expand Up @@ -54,7 +54,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MASES.CLIParser" Version="2.2.0" />
<PackageReference Include="MASES.JCOBridge" Version="2.4.3" />
<PackageReference Include="MASES.JCOBridge" Version="2.4.4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>
19 changes: 14 additions & 5 deletions src/net/KafkaBridge/KafkaBridgeCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,9 @@ protected virtual IDictionary<string, string> Options
{ "-Dcom.sun.management.jmxremote", null },
{ "com.sun.management.jmxremote.authenticate", "false" },
{ "com.sun.management.jmxremote.ssl", "false" },
{ "log4j.configuration", Log4JOpts},
{ "log4j.configuration", string.IsNullOrEmpty(GlobalLog4JPath) ? ((GlobalRootPath == Const.DefaultRootPath) ? Log4JOpts : null) : $"file:{GlobalLog4JPath}"},
{ "kafka.logs.dir", LogDir},
{ "-Xmx" + GlobalHeapSize, null},
{ "log4j.configuration", $"file:{GlobalLog4JPath}"},
};

if (!string.IsNullOrEmpty(InitialHeapSize))
Expand Down Expand Up @@ -349,8 +348,12 @@ protected virtual IDictionary<string, string> Options

string buildClassPath()
{
#if DEBUG
Console.WriteLine("RootPath is: {0}", RootPath);
#endif

classPath = string.Empty;
buildClassPath(GlobalRootPath);
buildClassPath(RootPath, "*.jar");
buildClassPath(CoreDependenciesPath);
buildClassPath(ExamplesPath);
buildClassPath(ClientsPath);
Expand All @@ -374,13 +377,19 @@ string buildClassPath()

classPath += !string.IsNullOrEmpty(ExtraClassPath) ? InternalConst.PathSeparator + ExtraClassPath : string.Empty;

#if DEBUG
Console.WriteLine("ClassPath is: {0}", classPath);
#endif
return classPath;
}

string buildClassPath(string path)
string buildClassPath(string path, string pattern = null)
{
var folder = Path.GetDirectoryName(path);
var pattern = Path.GetFileName(path);
if (pattern == null) pattern = Path.GetFileName(path);
#if DEBUG
Console.WriteLine("Search on {0} with pattern {1}", folder, pattern);
#endif
if (Directory.Exists(folder))
{
foreach (var item in Directory.GetFiles(folder, pattern, SearchOption.TopDirectoryOnly))
Expand Down
8 changes: 7 additions & 1 deletion src/net/KafkaBridge/mases.kafkabridge.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@
<Copy SourceFiles="@(config)" DestinationFolder="$(TargetDir)/config" />
<Copy SourceFiles="@(configKraft)" DestinationFolder="$(TargetDir)/config/kraft" />
</Target>
</Project>

<Target Name="CopyFilesNativePublish" BeforeTargets="Publish">
<Copy SourceFiles="@(jars)" DestinationFolder="$(PublishDir)/jars" />
<Copy SourceFiles="@(config)" DestinationFolder="$(PublishDir)/config" />
<Copy SourceFiles="@(configKraft)" DestinationFolder="$(PublishDir)/config/kraft" />
</Target>
</Project>
4 changes: 2 additions & 2 deletions src/net/KafkaBridgeCLI/KafkaBridgeCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Owners>MASES s.r.l.</Owners>
<Authors>MASES s.r.l.</Authors>
<Company>MASES s.r.l.</Company>
<Version>1.1.2.0</Version>
<Version>1.1.3.0</Version>
<Product>KafkaBridgeCLI</Product>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<TargetFrameworks>net461;netcoreapp3.1;net5.0;net5.0-windows;net6.0;net6.0-windows</TargetFrameworks>
Expand All @@ -21,7 +21,7 @@
<PackageReleaseNotes>https://github.com/masesgroup/KafkaBridge/releases</PackageReleaseNotes>
<PackageLicense>LICENSE</PackageLicense>
<PackageIcon>JCOB128x128.png</PackageIcon>
<PackageTags>kafka apache-kafka dotnet clr netcore net5 net6</PackageTags>
<PackageTags>kafka apache-kafka dotnet clr netcore net5 net6 kafka connect streams producer consumer providers streamprovider confluent</PackageTags>
<PackageId>MASES.KafkaBridgeCLI</PackageId>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
4 changes: 2 additions & 2 deletions src/net/templates/templatepack.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageType>Template</PackageType>
<PackageVersion>1.1.2.0</PackageVersion>
<PackageVersion>1.1.3.0</PackageVersion>
<PackageId>MASES.KafkaBridge.Templates</PackageId>
<Title>KafkaBridge Templates - Templates to use the KafkaBridge</Title>
<Authors>MASES s.r.l.</Authors>
Expand All @@ -19,7 +19,7 @@
<PackageReleaseNotes>https://github.com/masesgroup/KafkaBridge/releases</PackageReleaseNotes>
<PackageLicense>LICENSE</PackageLicense>
<PackageIcon>JCOB128x128.png</PackageIcon>
<PackageTags>kafka apache-kafka dotnet clr netcore net5 net6 template</PackageTags>
<PackageTags>kafka apache-kafka dotnet clr netcore net5 net6 template kafka connect streams producer consumer providers streamprovider confluent</PackageTags>
<LangVersion>8.0</LangVersion>
<Product>KafkaBridge Templates</Product>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand Down
2 changes: 2 additions & 0 deletions src/net/templates/templates/kafkabridgeConsumerApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static void Main(string[] args)
serverToUse = args[0];
}

Console.WriteLine("Server in use {0}", serverToUse);

Properties props = new Properties();
props.Put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, serverToUse);
props.Put(ConsumerConfig.GROUP_ID_CONFIG, "test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
</ItemGroup>
<ItemGroup Condition="!Exists('..\..\..\KafkaBridge\KafkaBridge.csproj')">
<!--Outside GitHub repo-->
<PackageReference Include="MASES.KafkaBridge" Version="1.1.2" />
<PackageReference Include="MASES.KafkaBridge" Version="1.1.3" />
<PackageReference Include="MASES.CLIParser" Version="2.2.0" />
<PackageReference Include="MASES.JCOBridge" Version="2.4.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ static void Main(string[] args)
serverToUse = args[0];
}

Console.WriteLine("Server in use {0}", serverToUse);

var props = new Properties();

props.Put(StreamsConfig.APPLICATION_ID_CONFIG, "streams-pipe");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
</ItemGroup>
<ItemGroup Condition="!Exists('..\..\..\KafkaBridge\KafkaBridge.csproj')">
<!--Outside GitHub repo-->
<PackageReference Include="MASES.KafkaBridge" Version="1.1.2" />
<PackageReference Include="MASES.KafkaBridge" Version="1.1.3" />
<PackageReference Include="MASES.CLIParser" Version="2.2.0" />
<PackageReference Include="MASES.JCOBridge" Version="2.4.4" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions src/net/templates/templates/kafkabridgeProducerApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ static void Main(string[] args)
serverToUse = args[0];
}

Console.WriteLine("Server in use {0}", serverToUse);

Properties props = new Properties();
props.Put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, serverToUse);
props.Put(ProducerConfig.ACKS_CONFIG, "all");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
</ItemGroup>
<ItemGroup Condition="!Exists('..\..\..\KafkaBridge\KafkaBridge.csproj')">
<!--Outside GitHub repo-->
<PackageReference Include="MASES.KafkaBridge" Version="1.1.2" />
<PackageReference Include="MASES.KafkaBridge" Version="1.1.3" />
<PackageReference Include="MASES.CLIParser" Version="2.2.0" />
<PackageReference Include="MASES.JCOBridge" Version="2.4.4" />
</ItemGroup>
</Project>

0 comments on commit 962c09d

Please sign in to comment.