Skip to content

Commit

Permalink
Merge pull request #573 from WildernessLabs/linker_fallback
Browse files Browse the repository at this point in the history
Linker BCL fallback + other cleanup
  • Loading branch information
jorgedevs authored May 27, 2024
2 parents 3be3c3a + b4043c2 commit a85a894
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 92 deletions.
5 changes: 4 additions & 1 deletion Source/v2/Meadow.CLI/Commands/Current/App/AppTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ internal static async Task<bool> TrimApplication(string path,

if (configuration is not null)
{
file = candidates.Where(c => c.DirectoryName.Contains(configuration)).OrderByDescending(c => c.LastWriteTime).First();
file = candidates
.Where(c => c.DirectoryName.IndexOf(configuration, StringComparison.OrdinalIgnoreCase) >= 0)
.OrderByDescending(c => c.LastWriteTime)
.First();

if (file == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Meadow.CLI.Commands.DeviceManagement;

[Command("app deploy", Description = "Deploys a previously compiled Meadow application to a target device. Note: This command does not compile the application.")]
[Command("app deploy", Description = "Deploys a previously compiled Meadow application to a target device")]
public class AppDeployCommand : BaseDeviceCommand<AppDeployCommand>
{
private readonly IPackageManager _packageManager;
Expand Down
5 changes: 0 additions & 5 deletions Source/v2/Meadow.Cli/Commands/Current/App/AppRunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ protected override async ValueTask ExecuteCommand()
throw new CommandException(Strings.NoFirmwarePackagesFound, CommandExitCode.GeneralError);
}

if (collection.DefaultPackage == null)
{
throw new CommandException(Strings.NoDefaultFirmwarePackageSet, CommandExitCode.GeneralError);
}

var path = AppTools.ValidateAndSanitizeAppPath(Path);

Configuration ??= "Release";
Expand Down
11 changes: 4 additions & 7 deletions Source/v2/Meadow.Cli/Commands/Current/App/AppTrimCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public AppTrimCommand(FileManager fileManager, IPackageManager packageManager, M

protected override async ValueTask ExecuteCommand()
{
await _fileManager.Refresh();

// for now we only support F7
// TODO: add switch and support for other platforms
var collection = _fileManager.Firmware["Meadow F7"];
Expand All @@ -41,10 +39,7 @@ protected override async ValueTask ExecuteCommand()
throw new CommandException(Strings.NoFirmwarePackagesFound, CommandExitCode.GeneralError);
}

if (collection.DefaultPackage == null)
{
throw new CommandException(Strings.NoDefaultFirmwarePackageSet, CommandExitCode.GeneralError);
}
await _fileManager.Refresh();

var path = AppTools.ValidateAndSanitizeAppPath(Path);

Expand All @@ -68,7 +63,9 @@ protected override async ValueTask ExecuteCommand()
throw new CommandException(Strings.UnableToGetDeviceInfo, CommandExitCode.GeneralError);
}

Logger.LogInformation($"Preparing to trim using v{deviceInfo.OsVersion} assemblies...");
var package = collection.GetClosestLocalPackage(deviceInfo.OsVersion);

Logger.LogInformation($"Preparing to trim using v{package?.Version ?? " unknown"} assemblies...");
await AppTools.TrimApplication(path, _packageManager, deviceInfo.OsVersion, Configuration, NoLink, Logger, Console, CancellationToken);
Logger.LogInformation("Application trimmed successfully");
}
Expand Down
2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Authors>Wilderness Labs, Inc</Authors>
<Company>Wilderness Labs, Inc</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.0.46.0</PackageVersion>
<PackageVersion>2.0.45.0</PackageVersion>
<Platforms>AnyCPU</Platforms>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.CLI/</PackageProjectUrl>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.CLI</RepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion Source/v2/Meadow.Cli/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ namespace Meadow.CLI;

public static class Constants
{
public const string CLI_VERSION = "2.0.46.0";
public const string CLI_VERSION = "2.0.45.0";
}
148 changes: 76 additions & 72 deletions Source/v2/Meadow.Cli/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,29 @@
"Meadow.CLI": {
"commandName": "Project"
},
"Help": {
"commandName": "Project",
"commandLineArgs": "--help"
},
"Version": {
"commandName": "Project",
"commandLineArgs": "--version"
},
"Port List": {
"commandName": "Project",
"commandLineArgs": "port list"
},
"Port Select": {
"commandName": "Project",
"commandLineArgs": "port select"
},
"Listen": {
"commandName": "Project",
"commandLineArgs": "listen"
},
"Listen (no prefix)": {
"App Build": {
"commandName": "Project",
"commandLineArgs": "listen -n"
"commandLineArgs": "app build H:\\WL\\Blinky\\Blinky\\BlinkyCs"
},
"Device Info": {
"App Build Debug": {
"commandName": "Project",
"commandLineArgs": "device info"
"commandLineArgs": "app build H:\\WL\\Blinky\\Blinky\\BlinkyCs -c Debug"
},
"Device Public Key": {
"App Deploy (project folder)": {
"commandName": "Project",
"commandLineArgs": "device info -k"
"commandLineArgs": "app deploy H:\\WL\\Blinky\\Blinky\\BlinkyCs"
},
"Device Reset": {
"App Deploy (untrimmed output)": {
"commandName": "Project",
"commandLineArgs": "device reset"
"commandLineArgs": "app deploy F:\\temp\\MeadowApplication1\\bin\\Debug\\netstandard2.1"
},
"Device Clock Read": {
"App Run": {
"commandName": "Project",
"commandLineArgs": "device clock"
"commandLineArgs": "app run H:\\WL\\Blinky\\Blinky\\BlinkyCs"
},
"Device Clock Set": {
"App Trim": {
"commandName": "Project",
"commandLineArgs": "device clock now"
"commandLineArgs": "app trim H:\\WL\\Blinky\\Blinky\\BlinkyCs --nolink BlinkyLib"
},
"Config: Set Route local": {
"commandName": "Project",
Expand All @@ -67,17 +47,37 @@
"commandName": "Project",
"commandLineArgs": "config --help"
},
"Runtime Enable": {
"Developer": {
"commandName": "Project",
"commandLineArgs": "runtime enable"
"commandLineArgs": "developer -p 2 -v 20"
},
"Runtime Disable": {
"Device Info": {
"commandName": "Project",
"commandLineArgs": "runtime disable"
"commandLineArgs": "device info"
},
"Runtime State": {
"Device Public Key": {
"commandName": "Project",
"commandLineArgs": "runtime state"
"commandLineArgs": "device info -k"
},
"Device Reset": {
"commandName": "Project",
"commandLineArgs": "device reset"
},
"Device Clock Read": {
"commandName": "Project",
"commandLineArgs": "device clock"
},
"Device Clock Set": {
"commandName": "Project",
"commandLineArgs": "device clock now"
},
"Dfu Install": {
"commandName": "Project",
"commandLineArgs": "dfu install"
},
"Dfu Install 0.10": {
"commandName": "Project",
"commandLineArgs": "dfu install -v 0.10"
},
"File List": {
"commandName": "Project",
Expand All @@ -103,6 +103,10 @@
"commandName": "Project",
"commandLineArgs": "file delete all"
},
"File initial": {
"commandName": "Project",
"commandLineArgs": "file initial meadow.log"
},
"File Read Large": {
"commandName": "Project",
"commandLineArgs": "file read Meadow.F7.dll"
Expand Down Expand Up @@ -167,69 +171,65 @@
"commandName": "Project",
"commandLineArgs": "firmware write os -v 1.2.0.1"
},
"Trace enable": {
"commandName": "Project",
"commandLineArgs": "trace enable"
},
"Trace disable": {
"Flash erase": {
"commandName": "Project",
"commandLineArgs": "trace disable"
"commandLineArgs": "flash erase"
},
"Trace level": {
"Help": {
"commandName": "Project",
"commandLineArgs": "trace level 2"
"commandLineArgs": "--help"
},
"Developer": {
"Listen": {
"commandName": "Project",
"commandLineArgs": "developer -p 2 -v 20"
"commandLineArgs": "listen"
},
"Uart trace enable": {
"Listen (no prefix)": {
"commandName": "Project",
"commandLineArgs": "uart trace enable"
"commandLineArgs": "listen -n"
},
"Uart trace disable": {
"Port List": {
"commandName": "Project",
"commandLineArgs": "uart trace disable"
"commandLineArgs": "port list"
},
"App Build": {
"Port Select": {
"commandName": "Project",
"commandLineArgs": "app build H:\\WL\\Blinky\\Blinky\\BlinkyCs"
"commandLineArgs": "port select"
},
"App Build Debug": {
"Runtime Enable": {
"commandName": "Project",
"commandLineArgs": "app build H:\\WL\\Blinky\\Blinky\\BlinkyCs -c Debug"
"commandLineArgs": "runtime enable"
},
"App Trim": {
"Runtime Disable": {
"commandName": "Project",
"commandLineArgs": "app trim H:\\WL\\Blinky\\Blinky\\BlinkyCs --nolink BlinkyLib"
"commandLineArgs": "runtime disable"
},
"Dfu Install": {
"Runtime State": {
"commandName": "Project",
"commandLineArgs": "dfu install"
"commandLineArgs": "runtime state"
},
"Dfu Install 0.10": {
"Version": {
"commandName": "Project",
"commandLineArgs": "dfu install -v 0.10"
"commandLineArgs": "--version"
},
"App Deploy (project folder)": {
"Trace enable": {
"commandName": "Project",
"commandLineArgs": "app deploy H:\\WL\\Blinky\\Blinky\\BlinkyCs"
"commandLineArgs": "trace enable"
},
"App Deploy (untrimmed output)": {
"Trace disable": {
"commandName": "Project",
"commandLineArgs": "app deploy F:\\temp\\MeadowApplication1\\bin\\Debug\\netstandard2.1"
"commandLineArgs": "trace disable"
},
"App Run": {
"Trace level": {
"commandName": "Project",
"commandLineArgs": "app run H:\\WL\\Blinky\\Blinky\\BlinkyCs"
"commandLineArgs": "trace level 2"
},
"Flash erase": {
"Uart trace enable": {
"commandName": "Project",
"commandLineArgs": "flash erase"
"commandLineArgs": "uart trace enable"
},
"File initial": {
"Uart trace disable": {
"commandName": "Project",
"commandLineArgs": "file initial meadow.log"
"commandLineArgs": "uart trace disable"
},
"Device provision": {
"commandName": "Project",
Expand Down Expand Up @@ -298,6 +298,10 @@
"legacy flash os": {
"commandName": "Project",
"commandLineArgs": "flash os"
},
"WSL": {
"commandName": "WSL2",
"distributionName": ""
}
}
}
Loading

0 comments on commit a85a894

Please sign in to comment.