Skip to content

Commit ba42aac

Browse files
committed
Merge branch 'main' into Iso.Net8
2 parents 1a8d4d6 + 02729d7 commit ba42aac

File tree

14 files changed

+335
-5
lines changed

14 files changed

+335
-5
lines changed

IsoCreator/IsoCreator.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -9,6 +9,8 @@
99
<ItemGroup>
1010
<PackageReference Include="Discutils" Version="0.16.13" />
1111
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.3.0-alpha.21216.1" />
12+
<PackageReference Include="System.Net.Http" Version="4.3.4" />
13+
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
1214
</ItemGroup>
1315

1416
</Project>

WPILibInstaller-Avalonia/Interfaces/IConfigurationProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public interface IConfigurationProvider
1818

1919
ChoreoConfig ChoreoConfig { get; }
2020

21+
ElasticConfig ElasticConfig { get; }
22+
2123
VsCodeConfig VsCodeConfig { get; }
2224

2325
string InstallDirectory { get; }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#nullable disable
2+
3+
using Newtonsoft.Json;
4+
5+
namespace WPILibInstaller.Models
6+
{
7+
public class ElasticConfig
8+
{
9+
[JsonProperty("zipFile")]
10+
public string ZipFile { get; set; }
11+
[JsonProperty("folder")]
12+
public string Folder { get; set; }
13+
}
14+
}

WPILibInstaller-Avalonia/ViewModels/InstallPageViewModel.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ await ExtractArchive(token, new[] {
9696
configurationProvider.UpgradeConfig.Tools.Folder + "/",
9797
configurationProvider.AdvantageScopeConfig.Folder + "/",
9898
configurationProvider.ChoreoConfig.Folder + "/",
99+
configurationProvider.ElasticConfig.Folder + "/",
99100
"installUtils/"});
100101
}
101102

@@ -363,6 +364,52 @@ private async Task ConfigureVsCodeSettings()
363364
}
364365
}
365366

367+
if (settingsJson.ContainsKey("java.configuration.runtimes"))
368+
{
369+
JArray javaConfigEnv = (JArray)settingsJson["java.configuration.runtimes"]!;
370+
Boolean javaFound = false;
371+
foreach (JToken result in javaConfigEnv)
372+
{
373+
JToken? name = result["name"];
374+
if (name != null)
375+
{
376+
if (name.ToString().Equals("JavaSE-17"))
377+
{
378+
result["path"] = Path.Combine(homePath, "jdk");
379+
result["default"] = true;
380+
javaFound = true;
381+
}
382+
else
383+
{
384+
result["default"] = false;
385+
}
386+
}
387+
}
388+
if (!javaFound)
389+
{
390+
JObject javaConfigProp = new JObject
391+
{
392+
["name"] = "JavaSE-17",
393+
["path"] = Path.Combine(homePath, "jdk"),
394+
["default"] = true
395+
};
396+
javaConfigEnv.Add(javaConfigProp);
397+
settingsJson["java.configuration.runtimes"] = javaConfigEnv;
398+
}
399+
}
400+
else
401+
{
402+
JArray javaConfigProps = new JArray();
403+
JObject javaConfigProp = new JObject
404+
{
405+
["name"] = "JavaSE-17",
406+
["path"] = Path.Combine(homePath, "jdk"),
407+
["default"] = "true"
408+
};
409+
javaConfigProps.Add(javaConfigProp);
410+
settingsJson["java.configuration.runtimes"] = javaConfigProps;
411+
}
412+
366413
var serialized = JsonConvert.SerializeObject(settingsJson, Formatting.Indented);
367414
await File.WriteAllTextAsync(settingsFile, serialized);
368415
}
@@ -801,6 +848,7 @@ private async Task RunShortcutCreator(CancellationToken token)
801848
shortcutData.DesktopShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "tools", "DataLogTool.exe"), $"{frcYear} WPILib Tools/Data Log Tool {frcYear}", $"Data Log Tool {frcYear}", ""));
802849
shortcutData.DesktopShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "advantagescope", "AdvantageScope (WPILib).exe"), $"{frcYear} WPILib Tools/AdvantageScope (WPILib) {frcYear}", $"AdvantageScope (WPILib) {frcYear}", ""));
803850
shortcutData.DesktopShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "choreo", "choreo.exe"), $"{frcYear} WPILib Tools/Choreo (WPILib) {frcYear}", $"Choreo (WPILib) {frcYear}", ""));
851+
shortcutData.DesktopShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "elastic", "elastic_dashboard.exe"), $"{frcYear} WPILib Tools/Elastic (WPILib) {frcYear}", $"Elastic (WPILib) {frcYear}", ""));
804852

805853
shortcutData.StartMenuShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "tools", "Glass.exe"), $"Programs/{frcYear} WPILib Tools/Glass {frcYear}", $"Glass {frcYear}", ""));
806854
shortcutData.StartMenuShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "tools", "OutlineViewer.exe"), $"Programs/{frcYear} WPILib Tools/OutlineViewer {frcYear}", $"OutlineViewer {frcYear}", ""));
@@ -813,6 +861,7 @@ private async Task RunShortcutCreator(CancellationToken token)
813861
shortcutData.StartMenuShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "tools", "DataLogTool.exe"), $"Programs/{frcYear} WPILib Tools/Data Log Tool {frcYear}", $"Data Log Tool {frcYear}", ""));
814862
shortcutData.StartMenuShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "advantagescope", "AdvantageScope (WPILib).exe"), $"Programs/{frcYear} WPILib Tools/AdvantageScope (WPILib) {frcYear}", $"AdvantageScope (WPILib) {frcYear}", ""));
815863
shortcutData.StartMenuShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "choreo", "choreo.exe"), $"Programs/{frcYear} WPILib Tools/Choreo (WPILib) {frcYear}", $"Choreo (WPILib) {frcYear}", ""));
864+
shortcutData.StartMenuShortcuts.Add(new ShortcutInfo(Path.Join(frcHomePath, "elastic", "elastic_dashboard.exe"), $"Programs/{frcYear} WPILib Tools/Elastic (WPILib) {frcYear}", $"Elastic (WPILib) {frcYear}", ""));
816865

817866
if (toInstallProvider.Model.InstallEverything)
818867
{

WPILibInstaller-Avalonia/ViewModels/StartPageViewModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,17 @@ private async Task<bool> SelectResourceFilesWithFile(string file)
225225
}) ?? throw new InvalidOperationException("Not Valid");
226226
}
227227

228+
entry = zipArchive.GetEntry("elasticConfig.json");
229+
230+
using (StreamReader reader = new StreamReader(entry!.Open()))
231+
{
232+
var configStr = await reader.ReadToEndAsync();
233+
ElasticConfig = JsonConvert.DeserializeObject<ElasticConfig>(configStr, new JsonSerializerSettings
234+
{
235+
MissingMemberHandling = MissingMemberHandling.Error
236+
}) ?? throw new InvalidOperationException("Not Valid");
237+
}
238+
228239
entry = zipArchive.GetEntry("fullConfig.json");
229240

230241
using (StreamReader reader = new StreamReader(entry!.Open()))
@@ -427,6 +438,8 @@ public override PageViewModelBase MoveNext()
427438

428439
public ChoreoConfig ChoreoConfig { get; private set; } = null!;
429440

441+
public ElasticConfig ElasticConfig { get; private set; } = null!;
442+
430443
public VsCodeConfig VsCodeConfig { get; private set; } = null!;
431444

432445
}

WPILibInstaller-Avalonia/WPILibInstaller-Avalonia.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
5656
<PackageReference Include="SharpZipLib" Version="1.4.2" />
5757
<PackageReference Include="Dotnet.Bundle" Version="0.9.13" />
58+
<PackageReference Include="SkiaSharp" Version="2.88.9" />
59+
<PackageReference Include="System.Drawing.Common" Version="4.7.3" />
5860
</ItemGroup>
5961
<ItemGroup>
6062
<EmbeddedResource Include="Assets\wpilib-generic-75.png" />
@@ -100,4 +102,10 @@
100102
<PropertyGroup>
101103
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
102104
</PropertyGroup>
105+
106+
<ItemGroup>
107+
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-5f2m-466j-3848" />
108+
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-x5qj-9vmx-7g6g" />
109+
<NuGetAuditSuppress Include="https://github.com/advisories/GHSA-xhfc-gr8f-ffwc" />
110+
</ItemGroup>
103111
</Project>

apps/ToolsUpdater/src/main/java/Program.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,40 @@ private static void installAdvantageScope(String toolsPath) {
116116
}
117117
}
118118

119+
private static void installElastic(String toolsPath) {
120+
if (SystemUtils.IS_OS_MAC) {
121+
String archiveFileName = "Elastic-WPILib-macOS.tar.gz";
122+
String elasticFolder = Paths.get(new File(toolsPath).getParent(), "elastic").toString();
123+
Path archivePath = Paths.get(elasticFolder, archiveFileName);
124+
125+
try {
126+
Runtime.getRuntime().exec(new String[] {
127+
"tar", "-xzf", archivePath.toString(), "-C", elasticFolder
128+
}).waitFor();
129+
} catch (IOException | InterruptedException e) {
130+
System.out.println(e.toString());
131+
e.printStackTrace();
132+
}
133+
}
134+
}
135+
136+
private static void installUtility(String toolsPath) {
137+
if (SystemUtils.IS_OS_MAC) {
138+
String archiveFileName = "wpilibutility-mac.tar.gz";
139+
String utilityFolder = Paths.get(new File(toolsPath).getParent(), "utility").toString();
140+
Path archivePath = Paths.get(utilityFolder, archiveFileName);
141+
142+
try {
143+
Runtime.getRuntime().exec(new String[] {
144+
"tar", "-xzf", archivePath.toString(), "-C", utilityFolder
145+
}).waitFor();
146+
} catch (IOException | InterruptedException e) {
147+
System.out.println(e.toString());
148+
e.printStackTrace();
149+
}
150+
}
151+
}
152+
119153
public static void main(String[] args) throws URISyntaxException, IOException {
120154
Gson gson = new Gson();
121155

@@ -131,6 +165,10 @@ public static void main(String[] args) throws URISyntaxException, IOException {
131165
System.out.println("Installing " + tool.name);
132166
if (tool.name.equals("AdvantageScope")) {
133167
installAdvantageScope(toolsPath);
168+
} else if (tool.name.equals("Elastic")) {
169+
installElastic(toolsPath);
170+
} else if (tool.name.equals("Utility")) {
171+
installUtility(toolsPath);
134172
} else if (tool.artifact != null) {
135173
if (tool.cpp) {
136174
installCppTool(tool, toolsPath);

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ apply from: 'scripts/maven.gradle'
104104

105105
apply from: 'scripts/advantagescope.gradle'
106106
apply from: 'scripts/choreo.gradle'
107+
apply from: 'scripts/elastic.gradle'
107108

108109
// Tools must happen after maven
109110
apply from: 'scripts/tools.gradle'
@@ -223,6 +224,7 @@ def generateFullResourcesTask = tasks.register('generateFullResources', project.
223224

224225
advantageScopeZipSetup(it)
225226
choreoZipSetup(it)
227+
elasticZipSetup(it)
226228

227229
if (OperatingSystem.current().isWindows()) {
228230
def task = it
@@ -329,6 +331,7 @@ def generateConfigFiles = tasks.register('generateCommonResources', Zip) {
329331

330332
advantageScopeConfigFileSetup(zip)
331333
choreoConfigFileSetup(zip)
334+
elasticConfigFileSetup(zip)
332335

333336
vscodeConfigZipSetup(zip)
334337
}
@@ -457,5 +460,5 @@ tasks.register('generateInstallers', Task) {
457460
}
458461

459462
wrapper {
460-
gradleVersion = '8.10.2'
463+
gradleVersion = '8.11'
461464
}

files/Elastic.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
SCRIPT_PATH="$(dirname "$(realpath "$0")")"
4+
SCRIPT_NAME="$(basename "$(realpath "$0")")"
5+
SCRIPT_BASE="$(basename -s .sh "$SCRIPT_NAME")"
6+
OS_NAME="$(uname -s)"
7+
ELASTIC_PATH="$(realpath "$SCRIPT_PATH/../elastic")"
8+
9+
if [ "$OS_NAME" = "Darwin" ]; then
10+
open "$ELASTIC_PATH/elastic_dashboard.app"
11+
else
12+
exec "$ELASTIC_PATH/elastic_dashboard"
13+
fi

files/Elastic.vbs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'Create File System Object for working with directories
2+
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
3+
4+
'Get the folder of this script
5+
toolsFolder = fso.GetParentFolderName(WScript.ScriptFullName)
6+
7+
'Get the Elastic folder
8+
toolsFolder = fso.GetParentFolderName(WScript.ScriptFullName)
9+
yearFolder = fso.GetParentFolderName(toolsFolder)
10+
elasticFolder = fso.BuildPath(yearFolder, "elastic")
11+
12+
'Get the full path to the exe
13+
fullExeName = fso.BuildPath(elasticFolder, "elastic_dashboard.exe")
14+
15+
shellScript = fullExeName
16+
17+
'Create Shell Object
18+
Set objShell = WScript.CreateObject( "WScript.Shell" )
19+
Set objEnv = objShell.Environment("PROCESS")
20+
dim runObject
21+
' Allow us to catch a script run failure
22+
On Error Resume Next
23+
Set runObj = objShell.Exec(shellScript)
24+
If Err.Number <> 0 Then
25+
If WScript.Arguments.Count > 0 Then
26+
If (WScript.Arguments(0) <> "silent") Then
27+
WScript.Echo "Error Launching Tool" + vbCrLf + Err.Description
28+
Else
29+
WScript.StdOut.Write("Error Launching Tool")
30+
WScript.StdOut.Write(Error.Description)
31+
End If
32+
Else
33+
WScript.Echo "Error Launching Tool" + vbCrLf + Err.Description
34+
End If
35+
Set runObj = Nothing
36+
Set objShell = Nothing
37+
Set fso = Nothing
38+
WScript.Quit(1)
39+
End If
40+
41+
Set runObj = Nothing
42+
Set objShell = Nothing
43+
Set fso = Nothing
44+
WScript.Quit(0)

0 commit comments

Comments
 (0)