Skip to content

Commit c01c584

Browse files
Bump dependencies
1 parent eed6b0f commit c01c584

6 files changed

Lines changed: 136 additions & 136 deletions

File tree

JavaToCSharp.Tests/JavaToCSharp.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
14-
<PackageReference Include="xunit" Version="2.6.6" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
14+
<PackageReference Include="xunit" Version="2.9.3" />
15+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
<PrivateAssets>all</PrivateAssets>
1818
</PackageReference>
19-
<PackageReference Include="coverlet.collector" Version="6.0.0">
19+
<PackageReference Include="coverlet.collector" Version="6.0.4">
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
<PrivateAssets>all</PrivateAssets>
2222
</PackageReference>
23-
<PackageReference Include="IKVM" Version="8.7.1" />
23+
<PackageReference Include="IKVM" Version="8.15.0" />
2424
</ItemGroup>
2525

2626
<ItemGroup>

JavaToCSharp/JavaToCSharp.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
<None Include="..\.editorconfig" Link=".editorconfig" />
1717
</ItemGroup>
1818
<ItemGroup>
19-
<PackageReference Include="IKVM" Version="8.7.1" />
20-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
21-
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
22-
<PackageReference Include="YamlDotNet" Version="16.0.0" />
19+
<PackageReference Include="IKVM" Version="8.15.0" />
20+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
21+
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.0" />
22+
<PackageReference Include="YamlDotNet" Version="16.3.0" />
2323
</ItemGroup>
2424
<ItemGroup>
2525
<IkvmReference Include="../Lib/javaparser-core-3.25.4.jar" />

JavaToCSharpCli/JavaToCSharpCli.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<WarningsAsErrors>nullable</WarningsAsErrors>
1010
</PropertyGroup>
1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
13-
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
12+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />
13+
<PackageReference Include="System.CommandLine" Version="2.0.0" />
1414
</ItemGroup>
1515
<ItemGroup>
1616
<ProjectReference Include="..\JavaToCSharp\JavaToCSharp.csproj" />

JavaToCSharpCli/Program.cs

Lines changed: 109 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -13,66 +13,64 @@ public class Program
1313
private static readonly ILoggerFactory _loggerFactory;
1414
private static readonly ILogger _logger;
1515

16-
private static readonly Option<bool> _includeSubdirectoriesOption = new(
17-
name: "--include-subdirectories",
18-
description: "When the command is dir, converts files in all subdirectories",
19-
getDefaultValue: () => true);
20-
21-
private static readonly Option<bool> _includeUsingsOption = new(
22-
name: "--include-usings",
23-
description: "Include using directives in output",
24-
getDefaultValue: () => true);
25-
26-
private static readonly Option<bool> _includeNamespaceOption = new(
27-
name: "--include-namespace",
28-
description: "Include namespace in output",
29-
getDefaultValue: () => true);
30-
31-
private static readonly Option<bool> _includeCommentsOption = new(
32-
name: "--include-comments",
33-
description: "Include comments in output",
34-
getDefaultValue: () => true);
35-
36-
private static readonly Option<bool> _useDebugAssertOption = new(
37-
name: "--use-debug-assert",
38-
description: "Use Debug.Assert for asserts",
39-
getDefaultValue: () => false);
40-
41-
private static readonly Option<bool> _startInterfaceNamesWithIOption = new(
42-
name: "--start-interface-names-with-i",
43-
description: "Prefix interface names with the letter I",
44-
getDefaultValue: () => true);
45-
46-
private static readonly Option<bool> _commentUnrecognizedCodeOption = new(
47-
name: "--comment-unrecognized-code",
48-
description: "Include unrecognized code in output as commented-out code",
49-
getDefaultValue: () => true);
50-
51-
private static readonly Option<bool> _systemOutToConsoleOption = new(
52-
name: "--system-out-to-console",
53-
description: "Convert System.out calls to Console",
54-
getDefaultValue: () => false);
55-
56-
private static readonly Option<bool> _fileScopedNamespacesOption = new(
57-
name: "--file-scoped-namespaces",
58-
description: "Use file-scoped namespaces in C# output",
59-
getDefaultValue: () => false);
60-
61-
private static readonly Option<bool> _clearDefaultUsingsOption = new(
62-
name: "--clear-usings",
63-
description: "Remove all default usings provided by this app",
64-
getDefaultValue: () => false);
65-
66-
private static readonly Option<List<string>> _addUsingsOption = new(
67-
name: "--add-using",
68-
description: "Adds a using directive to the collection of usings")
69-
{
70-
ArgumentHelpName = "namespace"
16+
private static readonly Option<bool> _includeSubdirectoriesOption = new("--include-subdirectories") {
17+
Description = "When the command is dir, converts files in all subdirectories",
18+
DefaultValueFactory = _ => true,
19+
};
20+
21+
private static readonly Option<bool> _includeUsingsOption = new("--include-usings") {
22+
Description = "Include using directives in output",
23+
DefaultValueFactory = _ => true,
24+
};
25+
26+
private static readonly Option<bool> _includeNamespaceOption = new("--include-namespace") {
27+
Description = "Include namespace in output",
28+
DefaultValueFactory = _ => true
29+
};
30+
31+
private static readonly Option<bool> _includeCommentsOption = new("--include-comments") {
32+
Description = "Include comments in output",
33+
DefaultValueFactory = _ => true
34+
};
35+
36+
private static readonly Option<bool> _useDebugAssertOption = new("--use-debug-assert") {
37+
Description = "Use Debug.Assert for asserts",
38+
DefaultValueFactory = _ => false
39+
};
40+
41+
private static readonly Option<bool> _startInterfaceNamesWithIOption = new("--start-interface-names-with-i") {
42+
Description = "Prefix interface names with the letter I",
43+
DefaultValueFactory = _ => true
44+
};
45+
46+
private static readonly Option<bool> _commentUnrecognizedCodeOption = new("--comment-unrecognized-code") {
47+
Description = "Include unrecognized code in output as commented-out code",
48+
DefaultValueFactory = _ => true
7149
};
7250

73-
private static readonly Option<string> _mappingsFileNameOption = new(
74-
name: "--mappings-file",
75-
description: "A yaml file with syntax mappings from imports, methods and annotations");
51+
private static readonly Option<bool> _systemOutToConsoleOption = new("--system-out-to-console") {
52+
Description = "Convert System.out calls to Console",
53+
DefaultValueFactory = _ => false
54+
};
55+
56+
private static readonly Option<bool> _fileScopedNamespacesOption = new("--file-scoped-namespaces") {
57+
Description = "Use file-scoped namespaces in C# output",
58+
DefaultValueFactory = _ => false
59+
};
60+
61+
private static readonly Option<bool> _clearDefaultUsingsOption = new("--clear-usings") {
62+
Description = "Remove all default usings provided by this app",
63+
DefaultValueFactory = _ => false
64+
};
65+
66+
private static readonly Option<List<string>> _addUsingsOption = new("--add-using") {
67+
Description = "Adds a using directive to the collection of usings",
68+
HelpName = "namespace"
69+
};
70+
71+
private static readonly Option<string> _mappingsFileNameOption = new("--mappings-file") {
72+
Description = "A yaml file with syntax mappings from imports, methods and annotations"
73+
};
7674

7775
static Program()
7876
{
@@ -88,72 +86,72 @@ public static async Task Main(string[] args)
8886
Description = "A syntactic transformer of source code from Java to C#."
8987
};
9088

91-
rootCommand.AddCommand(CreateFileCommand());
92-
rootCommand.AddCommand(CreateDirectoryCommand());
89+
rootCommand.Subcommands.Add(CreateFileCommand());
90+
rootCommand.Subcommands.Add(CreateDirectoryCommand());
9391

94-
rootCommand.AddGlobalOption(_includeSubdirectoriesOption);
95-
rootCommand.AddGlobalOption(_includeUsingsOption);
96-
rootCommand.AddGlobalOption(_includeNamespaceOption);
97-
rootCommand.AddGlobalOption(_includeCommentsOption);
98-
rootCommand.AddGlobalOption(_useDebugAssertOption);
99-
rootCommand.AddGlobalOption(_startInterfaceNamesWithIOption);
100-
rootCommand.AddGlobalOption(_commentUnrecognizedCodeOption);
101-
rootCommand.AddGlobalOption(_systemOutToConsoleOption);
102-
rootCommand.AddGlobalOption(_fileScopedNamespacesOption);
103-
rootCommand.AddGlobalOption(_clearDefaultUsingsOption);
104-
rootCommand.AddGlobalOption(_addUsingsOption);
105-
rootCommand.AddGlobalOption(_mappingsFileNameOption);
92+
rootCommand.Options.Add(_includeSubdirectoriesOption);
93+
rootCommand.Options.Add(_includeUsingsOption);
94+
rootCommand.Options.Add(_includeNamespaceOption);
95+
rootCommand.Options.Add(_includeCommentsOption);
96+
rootCommand.Options.Add(_useDebugAssertOption);
97+
rootCommand.Options.Add(_startInterfaceNamesWithIOption);
98+
rootCommand.Options.Add(_commentUnrecognizedCodeOption);
99+
rootCommand.Options.Add(_systemOutToConsoleOption);
100+
rootCommand.Options.Add(_fileScopedNamespacesOption);
101+
rootCommand.Options.Add(_clearDefaultUsingsOption);
102+
rootCommand.Options.Add(_addUsingsOption);
103+
rootCommand.Options.Add(_mappingsFileNameOption);
106104

107-
await rootCommand.InvokeAsync(args);
105+
await rootCommand.Parse(args).InvokeAsync();
108106

109107
// flush logs
110108
_loggerFactory.Dispose();
111109
}
112110

113111
private static Command CreateFileCommand()
114112
{
115-
var inputArgument = new Argument<FileInfo>(
116-
name: "input",
117-
description: "A Java source code file to convert");
113+
var inputArgument = new Argument<FileInfo>("input") {
114+
Description = "A Java source code file to convert"
115+
};
118116

119-
var outputArgument = new Argument<FileInfo?>(
120-
name: "output",
121-
description: "Path to place the C# output file, or stdout if omitted",
122-
getDefaultValue: () => null);
117+
var outputArgument = new Argument<FileInfo?>("output") {
118+
Description = "Path to place the C# output file, or stdout if omitted",
119+
DefaultValueFactory = _ => null
120+
};
123121

124122
var fileCommand = new Command("file", "Convert a Java file to C#");
125-
fileCommand.AddArgument(inputArgument);
126-
fileCommand.AddArgument(outputArgument);
123+
fileCommand.Arguments.Add(inputArgument);
124+
fileCommand.Arguments.Add(outputArgument);
127125

128-
fileCommand.SetHandler(context =>
126+
fileCommand.SetAction(context =>
129127
{
130-
var input = context.ParseResult.GetValueForArgument(inputArgument);
131-
var output = context.ParseResult.GetValueForArgument(outputArgument);
128+
var input = context.GetValue(inputArgument);
129+
var output = context.GetValue(outputArgument);
132130

133131
var options = GetJavaConversionOptions(context);
134132

135-
ConvertToCSharpFile(input, output, options);
133+
ConvertToCSharpFile(input!, output, options);
136134
});
137135

138136
return fileCommand;
139137
}
140138

141-
private static JavaConversionOptions GetJavaConversionOptions(InvocationContext context)
139+
private static JavaConversionOptions GetJavaConversionOptions(ParseResult context)
142140
{
143141
var options = new JavaConversionOptions
144142
{
145-
IncludeSubdirectories = context.ParseResult.GetValueForOption(_includeSubdirectoriesOption),
146-
IncludeUsings = context.ParseResult.GetValueForOption(_includeUsingsOption),
147-
IncludeComments = context.ParseResult.GetValueForOption(_includeCommentsOption),
148-
IncludeNamespace = context.ParseResult.GetValueForOption(_includeNamespaceOption),
149-
ConvertSystemOutToConsole = context.ParseResult.GetValueForOption(_systemOutToConsoleOption),
150-
StartInterfaceNamesWithI = context.ParseResult.GetValueForOption(_startInterfaceNamesWithIOption),
151-
UseDebugAssertForAsserts = context.ParseResult.GetValueForOption(_useDebugAssertOption),
152-
UseUnrecognizedCodeToComment = context.ParseResult.GetValueForOption(_commentUnrecognizedCodeOption),
153-
UseFileScopedNamespaces = context.ParseResult.GetValueForOption(_fileScopedNamespacesOption),
143+
IncludeSubdirectories = context.GetValue(_includeSubdirectoriesOption),
144+
IncludeUsings = context.GetValue(_includeUsingsOption),
145+
IncludeComments = context.GetValue(_includeCommentsOption),
146+
IncludeNamespace = context.GetValue(_includeNamespaceOption),
147+
ConvertSystemOutToConsole = context.GetValue(_systemOutToConsoleOption),
148+
StartInterfaceNamesWithI = context.GetValue(_startInterfaceNamesWithIOption),
149+
UseDebugAssertForAsserts = context.GetValue(_useDebugAssertOption),
150+
UseUnrecognizedCodeToComment = context.GetValue(_commentUnrecognizedCodeOption),
151+
UseFileScopedNamespaces = context.GetValue(_fileScopedNamespacesOption),
154152
};
155153

156-
if (context.ParseResult.GetValueForOption(_clearDefaultUsingsOption))
154+
if (context.GetValue(_clearDefaultUsingsOption))
157155
{
158156
options.ClearUsings();
159157
}
@@ -166,12 +164,12 @@ private static JavaConversionOptions GetJavaConversionOptions(InvocationContext
166164
options.AddUsing("System.Text");
167165
}
168166

169-
foreach (string ns in context.ParseResult.GetValueForOption(_addUsingsOption) ?? new List<string>())
167+
foreach (string ns in context.GetValue(_addUsingsOption) ?? new List<string>())
170168
{
171169
options.AddUsing(ns);
172170
}
173171

174-
var mappingsFile = context.ParseResult.GetValueForOption(_mappingsFileNameOption);
172+
var mappingsFile = context.GetValue(_mappingsFileNameOption);
175173
if (!string.IsNullOrEmpty(mappingsFile))
176174
{
177175
options.SyntaxMappings = ReadMappingsFile(mappingsFile);
@@ -189,26 +187,26 @@ private static SyntaxMapping ReadMappingsFile(string mappingsFile)
189187

190188
private static Command CreateDirectoryCommand()
191189
{
192-
var inputArgument = new Argument<DirectoryInfo>(
193-
name: "input",
194-
description: "A directory containing Java source code files to convert");
190+
var inputArgument = new Argument<DirectoryInfo>("input") {
191+
Description = "A directory containing Java source code files to convert"
192+
};
195193

196-
var outputArgument = new Argument<DirectoryInfo>(
197-
name: "output",
198-
description: "Path to place the C# output files");
194+
var outputArgument = new Argument<DirectoryInfo>("output") {
195+
Description = "Path to place the C# output files"
196+
};
199197

200198
var dirCommand = new Command("dir", "Convert a directory containing Java files to C#");
201-
dirCommand.AddArgument(inputArgument);
202-
dirCommand.AddArgument(outputArgument);
199+
dirCommand.Arguments.Add(inputArgument);
200+
dirCommand.Arguments.Add(outputArgument);
203201

204-
dirCommand.SetHandler(context =>
202+
dirCommand.SetAction(context =>
205203
{
206-
var input = context.ParseResult.GetValueForArgument(inputArgument);
207-
var output = context.ParseResult.GetValueForArgument(outputArgument);
204+
var input = context.GetValue(inputArgument);
205+
var output = context.GetValue(outputArgument);
208206

209207
var options = GetJavaConversionOptions(context);
210208

211-
ConvertToCSharpDir(input, output, options);
209+
ConvertToCSharpDir(input!, output!, options);
212210
});
213211

214212
return dirCommand;

JavaToCSharpGui/App.axaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<Application xmlns="https://github.com/avaloniaui"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:semi="https://irihi.tech/semi"
34
x:Class="JavaToCSharpGui.App"
45
Name="Java to C#"
56
RequestedThemeVariant="Default">
@@ -9,7 +10,7 @@
910
</Application.Resources>
1011
<Application.Styles>
1112
<FluentTheme /> <!-- FluentTheme will get overridden by the StyleInclude below but is needed for AvaloniaEdit -->
12-
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
13-
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />
13+
<semi:SemiTheme />
14+
<semi:AvaloniaEditSemiTheme />
1415
</Application.Styles>
1516
</Application>

JavaToCSharpGui/JavaToCSharpGui.csproj

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,22 @@
1616
</ItemGroup>
1717
<ItemGroup>
1818
<!-- Removes version conflict error -->
19-
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.0.6" />
20-
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.0.6" />
21-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
19+
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.3.0" />
20+
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.3.0" />
21+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
2222

23-
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
23+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
2424

25-
<PackageReference Include="Avalonia" Version="11.0.9" />
26-
<PackageReference Include="Avalonia.Desktop" Version="11.0.9" />
27-
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.9" />
28-
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.9" />
25+
<PackageReference Include="Avalonia" Version="11.3.9" />
26+
<PackageReference Include="Avalonia.Desktop" Version="11.3.9" />
27+
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.9" />
28+
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.9" />
2929
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
30-
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.9" />
31-
<PackageReference Include="Projektanker.Icons.Avalonia.FontAwesome" Version="9.0.1" />
32-
<PackageReference Include="Semi.Avalonia" Version="11.0.7" />
33-
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.56" />
30+
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.9" />
31+
<PackageReference Include="Projektanker.Icons.Avalonia.FontAwesome" Version="9.6.2" />
32+
<PackageReference Include="Semi.Avalonia" Version="11.3.7.1" />
33+
<PackageReference Include="Semi.Avalonia.AvaloniaEdit" Version="11.2.0.1" />
34+
<PackageReference Include="TextMateSharp.Grammars" Version="1.0.70" />
3435
</ItemGroup>
3536
<ItemGroup>
3637
<ProjectReference Include="..\JavaToCSharp\JavaToCSharp.csproj" />

0 commit comments

Comments
 (0)