Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync To Main #325

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Meadow.CLI
env:
TOOLS_RELEASE_VERSION: 1.0.4.0
SHORT_TOOLS_RELEASE_VERSION: 1.0.4
MEADOW_OS_VERSION: 1.0.2.0
TOOLS_RELEASE_VERSION: 1.1.0.0
SHORT_TOOLS_RELEASE_VERSION: 1.1.0
MEADOW_OS_VERSION: 1.1.0.0
VS_MAC_2019_VERSION: 8.10
VS_MAC_2022_VERSION: 17.5

Expand Down Expand Up @@ -72,12 +72,12 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: Meadow.CLI.nuget.${{ ENV.TOOLS_RELEASE_VERSION }}
path: 'main\**\Meadow.CLI\bin\Release\*.nupkg'
path: 'main\Meadow.CLI\bin\Release\*.nupkg'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
name: Publish Meadow.CLI Nuget publically
run: |
nuget push main\**\Meadow.CLI\bin\Release\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
nuget push main\Meadow.CLI\bin\Release\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}

build-vswin-2019:
runs-on: windows-2019
Expand Down Expand Up @@ -326,7 +326,7 @@ jobs:

# - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
#- name: Upload Release Asset
# uses: actions/upload-release-asset@v1.0.4
# uses: actions/upload-release-asset@v1.1.0
# env:
# GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }}
# with:
Expand Down Expand Up @@ -434,7 +434,7 @@ jobs:

# - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
#- name: Upload Release Asset
# uses: actions/upload-release-asset@v1.0.4
# uses: actions/upload-release-asset@v1.1.0
# env:
# GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }}
# with:
Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI.Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Meadow.CLI.Core
{
public static class Constants
{
public const string CLI_VERSION = "1.0.4.0";
public const string CLI_VERSION = "1.1.0.0";
public const ushort HCOM_PROTOCOL_PREVIOUS_VERSION_NUMBER = 0x0006;
public const ushort HCOM_PROTOCOL_CURRENT_VERSION_NUMBER = 0x0007; // Used for transmission
public const string WILDERNESS_LABS_USB_VID = "2E6A";
Expand Down
9 changes: 4 additions & 5 deletions Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,16 @@ public async static Task<IList<string>> GetMeadowSerialPortsForLinux(ILogger? lo
};

using var proc = Process.Start(psi);
proc.WaitForExit(1000);
var output = proc.StandardOutput.ReadToEnd();
_ = proc?.WaitForExit(1000);
var output = proc?.StandardOutput.ReadToEnd();

return output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
.Where(x => x.Contains("Wilderness_Labs"))
.Select(
line =>
{
var parts = line.Split(' ');
var source = parts[8];
var target = parts[10];
var parts = line.Split(new[] { "-> " }, StringSplitOptions.RemoveEmptyEntries);
var target = parts[1];
var port = Path.GetFullPath(Path.Combine(devicePath, target));
return port;
}).ToArray();
Expand Down
47 changes: 43 additions & 4 deletions Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using YamlDotNet.Serialization;

namespace Meadow.CLI.Core.Devices
{
public abstract partial class MeadowLocalDevice
{
string[] dllLinkIngoreList = { "System.Threading.Tasks.Extensions.dll" };//, "Microsoft.Extensions.Primitives.dll" };
string[] pdbLinkIngoreList = { "System.Threading.Tasks.Extensions.pdb" };//, "Microsoft.Extensions.Primitives.pdb" };
private string[] dllLinkIngoreList = { "System.Threading.Tasks.Extensions.dll" };//, "Microsoft.Extensions.Primitives.dll" };
private string[] pdbLinkIngoreList = { "System.Threading.Tasks.Extensions.pdb" };//, "Microsoft.Extensions.Primitives.pdb" };

public async Task<IList<string>> GetFilesAndFolders(
TimeSpan timeout,
Expand Down Expand Up @@ -470,7 +471,7 @@ public Task ForwardVisualStudioDataToMono(byte[] debuggerData,

//ToDo this is super fragile (extra-super fragile!)
//Need updated API to read files after B5.1
async Task DeleteTemporaryFiles(CancellationToken cancellationToken = default)
private async Task DeleteTemporaryFiles(CancellationToken cancellationToken = default)
{
var items = await GetFilesAndFolders(new TimeSpan(0, 0, 15), cancellationToken);

Expand Down Expand Up @@ -523,13 +524,51 @@ async Task DeleteTemporaryFiles(CancellationToken cancellationToken = default)
}
}

private record BuildOptions
{
public DeployOptions Deploy { get; set; }

public record DeployOptions
{
public List<string> NoLink { get; set; }
public bool? IncludePDBs { get; set; }
}
}

public async Task DeployApp(string applicationFilePath,
string osVersion,
bool includePdbs = false,
bool verbose = false,
IList<string>? noLink = null,
CancellationToken cancellationToken = default)
{
try
{
// does a meadow.build.yml file exist?
var buildOptionsFile = Path.Combine(Path.GetDirectoryName(applicationFilePath), "app.build.yaml");
if (File.Exists(buildOptionsFile))
{
var yaml = File.ReadAllText(buildOptionsFile);
var deserializer = new DeserializerBuilder()
.IgnoreUnmatchedProperties()
.Build();
var opts = deserializer.Deserialize<BuildOptions>(yaml);

if (opts.Deploy.NoLink != null && opts.Deploy.NoLink.Count > 0)
{
noLink = opts.Deploy.NoLink;
}
if (opts.Deploy.IncludePDBs != null)
{
includePdbs = opts.Deploy.IncludePDBs.Value;
}
}
}
catch (Exception ex)
{
Logger.LogInformation($"Failed to read app.build.yaml: {ex.Message}");
}

try
{
if (!File.Exists(applicationFilePath))
Expand Down Expand Up @@ -661,7 +700,7 @@ async Task AddFile(string file, bool includePdbs)
{
found = true;
}
if(found) { break; }
if (found) { break; }
}
if (found == false)
{
Expand Down
3 changes: 2 additions & 1 deletion Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.0.4.0</Version>
<Version>1.1.0.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -56,6 +56,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="LibUsbDotNet" Version="3.0.102-alpha" />
<PackageReference Include="YamlDotNet" Version="13.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.0.4.0</Version>
<Version>1.1.0.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -59,6 +59,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="YamlDotNet" Version="13.1.1" />
</ItemGroup>

<Import Project="..\MeadowLogger\MeadowLogger.projitems" Label="Shared" />
Expand Down
3 changes: 2 additions & 1 deletion Meadow.CLI.Core/Meadow.CLI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.0.4.0</Version>
<Version>1.1.0.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -54,6 +54,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="YamlDotNet" Version="13.1.1" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Meadow.CLI/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<PackAsTool>true</PackAsTool>
<Company>Wilderness Labs, Inc</Company>
<ToolCommandName>meadow</ToolCommandName>
<PackageId>WildernessLabs.Meadow.CLI</PackageId>
<Authors>Peter Moody, Adrian Stevens, Brian Kim, Pete Garafano, Dominique Louis</Authors>
<Company>Wilderness Labs, Inc</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>1.0.4.0</PackageVersion>
<PackageVersion>1.1.0.0</PackageVersion>
<Platforms>AnyCPU</Platforms>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
Expand Down