Skip to content

Commit

Permalink
Fix #529 and copyright embedded in the tool to avoid external file (#531
Browse files Browse the repository at this point in the history
)

* Fix #529

* Default copyright embedded in the tool to avoid external file
  • Loading branch information
masesdevelopers authored Sep 19, 2024
1 parent 5ab9f91 commit 5713321
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/configuration.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"CopyrightFile": "copyright.txt",
"RelativeDestinationCSharpClassPath": "net\\JNet\\Generated",
"RelativeDestinationJavaListenerPath": "jvm\\jnet\\src\\main\\java",
"JavaListenerBasePackage": "org.mases.jnet.generated",
Expand Down
2 changes: 1 addition & 1 deletion src/net/JNetReflector/InternalMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ static void AnalyzeSubItems(string package, IDictionary<string, IDictionary<stri
}
}

var path = Path.Combine(JNetReflectorCore.DestinationCSharpClassPath, package.Replace(SpecialNames.NamespaceSeparator, Path.DirectorySeparatorChar), "AllPackageClasses.cs");
var path = Path.Combine(JNetReflectorCore.DestinationCSharpClassPath, package.Replace(SpecialNames.NamespaceSeparator, Path.DirectorySeparatorChar), FileNameAndDirectory.AllPackageClassesFileName);
if (JNetReflectorCore.JarsToAnalyze != null)
{
sb.AppendLine(AllPackageClasses.CLASSES);
Expand Down
2 changes: 2 additions & 0 deletions src/net/JNetReflector/JNetReflector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<None Remove="AllPackageClasses.template" />
<None Remove="AllPackageClassesStubClass.template" />
<None Remove="AllPackageClassesStubNestedClass.template" />
<None Remove="copyright.txt" />
<None Remove="SingleClass.template" />
<None Remove="Templates\AllPackageClassesStubClassInterfaceOrAbstract.template" />
<None Remove="Templates\AllPackageClassesStubClassListener.template" />
Expand Down Expand Up @@ -84,6 +85,7 @@
<Compile Include="..\JNet\Specific\AsyncEnumerable.cs" Link="Specific\AsyncEnumerable.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="copyright.txt" />
<EmbeddedResource Include="Templates\AllPackageClassesStubClassInterfaceOrAbstract.template" />
<EmbeddedResource Include="Templates\AllPackageClassesStubClassMainClass.template" />
<EmbeddedResource Include="Templates\AllPackageClassesStubClassListener.template" />
Expand Down
11 changes: 11 additions & 0 deletions src/net/JNetReflector/JNetReflectorCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using MASES.CLIParser;
using MASES.JNet;
using MASES.JNetReflector.Templates;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -807,6 +808,16 @@ protected override string[] ProcessCommandLine()
CopyrightFileContent = File.ReadAllText(path);
}
}
else
{
using (var stream = typeof(JNetReflectorCore).Assembly.GetManifestResourceStream(typeof(JNetReflectorCore).Namespace + "." + "copyright.txt"))
{
using (var sr = new StreamReader(stream))
{
CopyrightFileContent = sr.ReadToEnd();
}
}
}

return result;
}
Expand Down
File renamed without changes.

0 comments on commit 5713321

Please sign in to comment.