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

Change to support v2. #84

Draft
wants to merge 35 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
573b92d
Change to support v2.
CartBlanche Feb 26, 2024
36ebe4a
We need to checkout Meadow.Contracts too now.
CartBlanche Feb 26, 2024
ba8462b
Bump to latest checkout action v4
CartBlanche Feb 26, 2024
1c090b8
Bump to latest setup dotnet action v4
CartBlanche Feb 26, 2024
a1e5771
Bump to latest setup nuget action v2
CartBlanche Feb 26, 2024
2efb467
Bump to latest upload artefact action v4
CartBlanche Feb 26, 2024
ccb5139
Drop to Logging to allow VS4M to build.
CartBlanche Feb 27, 2024
5001809
Refactor to use the generic GetSerialPorts and some tidying up.
CartBlanche Feb 27, 2024
bf629bb
We need to wait for the connection to the device.
CartBlanche Mar 7, 2024
70803f8
Remove setting the Xamarin SDK, to see if it fixed the CI build
CartBlanche Mar 7, 2024
ed2bee6
Remove .NET 8 from installable SDKs
CartBlanche Mar 7, 2024
449f58a
Ridy up and Remove 2019 CI info.
CartBlanche Mar 7, 2024
6b79cf4
Refactor to use new Meadow.Tooling.Core project.
CartBlanche Mar 8, 2024
9cc1de9
Refernce v7.x of *.Logging so VS4Mac can build.
CartBlanche Mar 8, 2024
db8c431
Refactor to get Deployment working again.
CartBlanche Mar 11, 2024
bf4108e
Refactor to redirect logger messages, to be more in line with v2 Mess…
CartBlanche Mar 11, 2024
d715923
Slight refactor of where we check when to inlcude PCBs
CartBlanche Mar 18, 2024
dfc3702
Make sure we reference System.IO.Port 7.x to avoid incompatibilities.
CartBlanche Mar 24, 2024
6bbb0be
Log message received more accurately, based on e.source.
CartBlanche Mar 24, 2024
a3d60d8
Point to the correct Meadow.CLI repo for CI
CartBlanche Mar 25, 2024
fb6da02
Get the Messages appearing in the correct tabs.
CartBlanche Mar 25, 2024
3df365c
Standardise Transferrring message across IDEs.
CartBlanche Mar 26, 2024
c36d32b
We shouldn't need to listne for debugger messages in command execution.
CartBlanche Mar 26, 2024
21a003e
Let's pass in a packageManager, like in the other IDE extensions.
CartBlanche Mar 26, 2024
a07c9a6
Trimming is no longer part of DeployApplication, so making sure we do…
CartBlanche May 18, 2024
04a7090
Ensure we disable the runtime before we Trim and Deploy and re-enable…
CartBlanche May 26, 2024
3841cd5
Follow Adrians pattern of having a MeadowConnection static class.
CartBlanche May 28, 2024
a1c08dc
Point to specific CLI commit.
CartBlanche Jul 5, 2024
4cf7690
Point to TestDB for now.
CartBlanche Jul 9, 2024
a8a82be
Remove RuntimeEnabled check and just Enable or Disable as needed.
CartBlanche Jul 11, 2024
8fdfc1d
Refactor MeadowConnection class to make it awaitable and remove Threa…
CartBlanche Jul 14, 2024
4abb4c6
Use MeadowConnectionManaager.GetConnectionForRoute instead.
CartBlanche Jul 14, 2024
30a9a16
Point to dominique-TestDebugging temporarily.
CartBlanche Aug 20, 2024
b914509
Get the deploy to run in a background Task.
CartBlanche Sep 4, 2024
29906bd
Reference the bumped nuget directly, so everything builds.
CartBlanche Sep 4, 2024
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
86 changes: 18 additions & 68 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: VS4Mac Extension
env:
IDE_TOOLS_RELEASE_VERSION: 1.9.4
IDE_TOOLS_RELEASE_VERSION: 2.0.0
MEADOW_OS_VERSION: 2.0.0.0
VS_MAC_2022_VERSION: 17.6

Expand All @@ -14,89 +14,39 @@ on:
workflow_dispatch:

jobs:
build-mac-2019:

runs-on: macos-11

steps:
- name: Checkout current repo
uses: actions/checkout@v3
with:
path: main

- name: Checkout Meadow.CLI.Core side-by-side
uses: actions/checkout@v3
with:
repository: WildernessLabs/Meadow.CLI
path: Meadow.CLI
ref: develop

- name: Set default Xamarin SDK versions
run: |
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --mac=8.2

- name: Setup .NET Core SDK 5.0.x and 6.0.x
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
5.0.x
6.0.x

- name: Setup NuGet
uses: NuGet/[email protected]

- name: Rename VS so we pick up VS2019 IDE
run: |
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio 2022.app"
mv "/Applications/Visual Studio 2019.app" "/Applications/Visual Studio.app"

- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update VS2019 Version Numbers
run: |
sed -i "" "s/Version = \"1.*\"/Version = \"${{ENV.IDE_TOOLS_RELEASE_VERSION}}\"/" main/VS4Mac_Meadow_Extension/Properties/AddinInfo.cs

- name: Restore our VS2019 project
run: |
msbuild main/VS4Mac_Meadow_Extension/Meadow.Sdks.IdeExtensions.Vs4Mac.csproj /t:Restore /p:Configuration=Release

- name: Build and Package the VS2019 Extension
run: |
msbuild main/VS4Mac_Meadow_Extension/Meadow.Sdks.IdeExtensions.Vs4Mac.csproj /t:Build /p:Configuration=Release /p:CreatePackage=true

- name: Upload mpack Artifacts
uses: actions/upload-artifact@v2
with:
name: Meadow.Mac.2019.mpack.${{ ENV.IDE_TOOLS_RELEASE_VERSION }}
path: 'main/VS4Mac_Meadow_Extension/bin/Release/net472/*.mpack'

build-mac-2022:
runs-on: macos-12

steps:
- name: Checkout current repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: main

- name: Checkout Meadow.CLI.Core side-by-side
uses: actions/checkout@v3
- name: Checkout Meadow.CLI side-by-side
uses: actions/checkout@v4
with:
repository: WildernessLabs/Meadow.CLI
path: Meadow.CLI
ref: develop

- name: Set default Xamarin SDK versions
run: |
$VM_ASSETS/select-xamarin-sdk-v2.sh --mono=6.12 --mac=8.2
ref: dominique-TestDebugging

- name: Checkout Meadow.Contracts side-by-side
uses: actions/checkout@v4
with:
repository: WildernessLabs/Meadow.Contracts
path: Meadow.Contracts
ref: main

- name: Setup .NET Core 6.0.x
uses: actions/setup-dotnet@v2
- name: Setup .NET Core 6.0.x, 7.0.x and 8.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x

- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
uses: NuGet/setup-nuget@v2

- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update VS2022 Version Numbers
Expand All @@ -112,7 +62,7 @@ jobs:
dotnet msbuild main/VS4Mac_Meadow_Extension/Meadow.Sdks.IdeExtensions.Vs4Mac.2022.csproj /t:Build /p:Configuration=Release /p:CreatePackage=true

- name: Upload mpack Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Meadow.Mac.2022.mpack.${{ ENV.IDE_TOOLS_RELEASE_VERSION }}
path: 'main/VS4Mac_Meadow_Extension/bin/Release/net7.0/*.mpack'
Expand Down
75 changes: 11 additions & 64 deletions VS4Mac_Meadow_Extension/DeploymentTargetsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Meadow.CLI.Commands.DeviceManagement;

namespace Meadow.Sdks.IdeExtensions.Vs4Mac
{
Expand All @@ -18,7 +19,7 @@ public static class DeploymentTargetsManager
public static List<MeadowDeviceExecutionTarget> Targets { get; private set; } = new List<MeadowDeviceExecutionTarget>();

private static bool isPolling;
private static CancellationTokenSource cts;
private static CancellationTokenSource cancellationTokenSource = null;

public static event Action<object> DeviceListChanged;

Expand All @@ -30,11 +31,14 @@ public static async Task StartPollingForDevices()

isPolling = true;

cts = new CancellationTokenSource();
if (cancellationTokenSource == null)
{
cancellationTokenSource = new CancellationTokenSource();
}

while (cts.IsCancellationRequested == false)
while (cancellationTokenSource.IsCancellationRequested == false)
{
await Task.Run(()=> UpdateTargetsList(GetMeadowSerialPorts(), cts.Token));
await Task.Run(async ()=> UpdateTargetsList(await MeadowConnectionManager.GetSerialPorts(), cancellationTokenSource.Token));
await Task.Delay(5000);
}

Expand All @@ -43,75 +47,18 @@ public static async Task StartPollingForDevices()

public static void StopPollingForDevices()
{
cts?.Cancel();
}

//Experiemental use of ioreg to find serial ports for connected Meadow devices
//Relies on string parsing - may break if macOS moves ioreg or the output of ioreg changes signifigantly
//Adrian - my guess is, this is fairly stable
static List<string> GetMeadowSerialPorts()
{
Debug.WriteLine("Get Meadow Serial ports");
var ports = new List<string>();

var psi = new ProcessStartInfo
{
FileName = "/usr/sbin/ioreg",
UseShellExecute = false,
RedirectStandardOutput = true,
Arguments = "-r -c IOUSBHostDevice -l"
};

string output = string.Empty;

using (var p = Process.Start(psi))
{
if (p != null)
{
output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
}
}

//split into lines
var lines = output.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

bool foundMeadow = false;
for (int i = 0; i < lines.Length; i++)
{
if (lines[i].Contains("Meadow F7 Micro"))
{
foundMeadow = true;
}
else if (lines[i].IndexOf("+-o") == 0)
{
foundMeadow = false;
}

//now find the IODialinDevice entry which contains the serial port name
if (foundMeadow && lines[i].Contains("IODialinDevice"))
{
int startIndex = lines[i].IndexOf("/");
int endIndex = lines[i].IndexOf("\"", startIndex + 1);
var port = lines[i].Substring(startIndex, endIndex - startIndex);
Debug.WriteLine($"Found Meadow at {port}");

ports.Add(port);
foundMeadow = false;
}
}
return ports;
cancellationTokenSource?.Cancel();
}

private static void UpdateTargetsList(List<string> serialPorts, CancellationToken ct)
private static void UpdateTargetsList(IList<string> serialPorts, CancellationToken cancellationToken)
{
Debug.WriteLine("Update targets list");
//var serialPorts = MeadowDeviceManager.FindSerialDevices();
//use the local hack version that leverages ioreg

foreach (var port in serialPorts)
{
if (ct.IsCancellationRequested)
if (cancellationToken.IsCancellationRequested)
{ break; }

if (Targets.Any(t => t.Id == port))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudioMac.Sdk" Version="17.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.*" />
<PackageReference Include="System.IO.Ports" Version="8.*" />
</ItemGroup>
<ItemGroup>
<None Update="WildernessLabs.Meadow.Template.1.1.0.nupkg">
Expand All @@ -23,6 +24,8 @@
<Compile Remove="Properties\AddinInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Meadow.CLI\Meadow.CLI.Core\Meadow.CLI.Core.6.0.0.csproj" />
<ProjectReference Include="..\..\Meadow.CLI\Source\v2\Meadow.Tooling.Core\Meadow.Tooling.Core.csproj" />
<ProjectReference Include="..\..\Meadow.CLI\Source\v2\Meadow.SoftwareManager\Meadow.SoftwareManager.csproj" />
<ProjectReference Include="..\..\Meadow.CLI\Source\v2\Meadow.HCom\Meadow.HCom.csproj" />
</ItemGroup>
</Project>
</Project>
Loading
Loading