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

Revert Developer Level Change again. Bump version to 1.0.4. Tweak CI to give more flexibility... #315

Merged
merged 3 commits into from
Jun 28, 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
59 changes: 31 additions & 28 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Meadow.CLI
env:
TOOLS_RELEASE_VERSION: 1.0.2.2
TOOLS_RELEASE_VERSION: 1.0.4.0
SHORT_TOOLS_RELEASE_VERSION: 1.0.4
MEADOW_OS_VERSION: 1.0.2.0
VS_MAC_2019_VERSION: 8.10
VS_MAC_2022_VERSION: 17.5

on:
push:
Expand Down Expand Up @@ -33,7 +36,7 @@ jobs:
- name: Setup NuGet
uses: NuGet/[email protected]

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update CLI Version Numbers
run: |
$content = Get-Content main/Meadow.CLI/Meadow.CLI.csproj | Out-String
Expand Down Expand Up @@ -68,7 +71,7 @@ jobs:
- name: Upload nuget Artifacts for internal testing
uses: actions/upload-artifact@v2
with:
name: Meadow.CLI.nuget
name: Meadow.CLI.nuget.${{ ENV.TOOLS_RELEASE_VERSION }}
path: 'main\**\Meadow.CLI\bin\Release\*.nupkg'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -117,11 +120,11 @@ jobs:
- name: Add MSBuild to Path
uses: microsoft/[email protected]

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update VS2019 Version Numbers
run: |
$content = Get-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2019/source.extension.vsixmanifest | Out-String
$newcontent = $content -replace 'Version="0.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"'
$newcontent = $content -replace 'Version="1.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"'
$newcontent | Set-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2019/source.extension.vsixmanifest

- name: Restore VS2019 dependencies
Expand All @@ -136,7 +139,7 @@ jobs:
- name: Upload VS2019 VSIX Artifacts
uses: actions/upload-artifact@v2
with:
name: Meadow.Win.VS2019.vsix
name: Meadow.Win.VS2019.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}
path: 'vs-win\VS_Meadow_Extension\VS_Meadow_Extension.2019\bin\Release\*.vsix'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -186,11 +189,11 @@ jobs:
with:
vs-version: '[17.0, 18.0)'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update VS2022 Version Numbers
run: |
$content = Get-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2022/source.extension.vsixmanifest | Out-String
$newcontent = $content -replace 'Version="0.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"'
$newcontent = $content -replace 'Version="1.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"'
$newcontent | Set-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2022/source.extension.vsixmanifest

- name: Restore VS2022 dependencies
Expand All @@ -204,7 +207,7 @@ jobs:
- name: Upload VS2022 VSIX Artifacts
uses: actions/upload-artifact@v2
with:
name: Meadow.Win.VS2022.vsix
name: Meadow.Win.VS2022.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}
path: 'vs-win\VS_Meadow_Extension\VS_Meadow_Extension.2022\bin\Release\*.vsix'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -260,10 +263,10 @@ jobs:
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' && github.ref == 'refs/heads/main' }}
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update VS2019 Version Numbers
run: |
sed -i "" "s/Version = \"0.*\"/Version = \"${{ENV.TOOLS_RELEASE_VERSION}}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.cs
sed -i "" "s/Version = \"1.*\"/Version = \"${{ENV.SHORT_TOOLS_RELEASE_VERSION}}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.cs

- name: Restore our VS2019 project
run: |
Expand All @@ -276,7 +279,7 @@ jobs:
- name: Upload Mac VS2019 mpack Artifacts
uses: actions/upload-artifact@v2
with:
name: Meadow.Mac.2019.mpack
name: Meadow.Mac.2019.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}
path: 'vs-mac/VS4Mac_Meadow_Extension/bin/Release/net472/*.mpack'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -313,8 +316,8 @@ jobs:
with:
owner: WildernessLabs
repo: VS_Mac_Meadow_Extension
tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}.VS2019
release_name: VS Mac VS2019 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }}
tag_name: v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2019_VERSION }}
release_name: VS Mac VS2019 Extension v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }}
body: |
${{ steps.commit_messages.outputs.result }}
draft: true
Expand All @@ -323,13 +326,13 @@ jobs:

# - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
#- name: Upload Release Asset
# uses: actions/[email protected].2
# uses: actions/[email protected].4
# env:
# GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: vs-mac/VS4Mac_Meadow_Extension/bin/Release/net472/*.mpack
# asset_name: Meadow.Mac.2019.mpack
# asset_name: Meadow.Mac.2019.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}
# asset_content_type: application/zip

build-vsmac-2022:
Expand Down Expand Up @@ -368,10 +371,10 @@ jobs:
- name: Setup NuGet
uses: NuGet/[email protected]

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update VS2022 Version Numbers
run: |
sed -i "" "s/Version = \"0.*\"/Version = \"${{ ENV.TOOLS_RELEASE_VERSION }}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.2022.cs
sed -i "" "s/Version = \"1.*\"/Version = \"${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.2022.cs

- name: Restore our VS2022 project
run: |
Expand All @@ -384,7 +387,7 @@ jobs:
- name: Upload VS2022 mpack Artifacts
uses: actions/upload-artifact@v2
with:
name: Meadow.Mac.2022.mpack
name: Meadow.Mac.2022.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}
path: 'vs-mac/VS4Mac_Meadow_Extension/bin/Release/net7.0/*.mpack'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -421,8 +424,8 @@ jobs:
with:
owner: WildernessLabs
repo: VS_Mac_Meadow_Extension
tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}.VS2022
release_name: VS Mac VS2022 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }}
tag_name: v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2022_VERSION }}
release_name: VS Mac VS2022 Extension v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }}
body: |
${{ steps.commit_messages.outputs.result }}
draft: true
Expand All @@ -431,13 +434,13 @@ jobs:

# - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
#- name: Upload Release Asset
# uses: actions/[email protected].2
# uses: actions/[email protected].4
# env:
# GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: vs-mac/VS4Mac_Meadow_Extension/bin/Release/net7.0/*.mpack
# asset_name: Meadow.Mac.2022.mpack
# asset_name: Meadow.Mac.2022.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}
# asset_content_type: application/zip

build-vscode:
Expand Down Expand Up @@ -478,10 +481,10 @@ jobs:
- name: Setup Nuget
uses: Nuget/[email protected]

- name: Setup Node.js 14
- name: Setup Node.js 16
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '16'

- name: Install NPM
run: |
Expand All @@ -496,11 +499,11 @@ jobs:
- name: Add MSBuild to Path
uses: microsoft/[email protected]

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Update VSCode Version Numbers
run: |
$content = Get-Content vs-code/package.json | Out-String
$newcontent = $content -replace '"version": "0.*",', '"version": "${{ENV.TOOLS_RELEASE_VERSION}}",'
$newcontent = $content -replace '"version": "1.*",', '"version": "${{ENV.SHORT_TOOLS_RELEASE_VERSION}}",'
$newcontent | Set-Content vs-code/package.json

- name: Restore VSCode Extension dependencies
Expand Down Expand Up @@ -532,7 +535,7 @@ jobs:
- name: Upload VSIX Artifacts
uses: actions/upload-artifact@v2
with:
name: Meadow.VSCode.vsix
name: Meadow.VSCode.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}
path: 'vs-code/*.vsix'

- if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
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.2.2";
public const string CLI_VERSION = "1.0.4.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
5 changes: 4 additions & 1 deletion Meadow.CLI.Core/Devices/IMeadowDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ public interface IMeadowDevice : IDisposable
public Task NshDisable(CancellationToken cancellationToken = default);
public Task TraceEnable(CancellationToken cancellationToken = default);
public Task SetTraceLevel(uint traceLevel, CancellationToken cancellationToken = default);
public Task SetDeveloper(ushort mode, uint userData, CancellationToken cancellationToken = default);
public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default);
public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default);
public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default);
public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default);
public Task Uart1Apps(CancellationToken cancellationToken = default);
public Task Uart1Trace(CancellationToken cancellationToken = default);
public Task TraceDisable(CancellationToken cancellationToken = default);
Expand Down
19 changes: 17 additions & 2 deletions Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,24 @@ public Task TraceDisable(CancellationToken cancellationToken = default)
return _meadowDevice.TraceDisable(cancellationToken);
}

public Task SetDeveloper(ushort level, uint userData, CancellationToken cancellationToken = default)
public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default)
{
return _meadowDevice.SetDeveloper(level, userData, cancellationToken);
return _meadowDevice.SetDeveloper1(userData, cancellationToken);
}

public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default)
{
return _meadowDevice.SetDeveloper2(userData, cancellationToken);
}

public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default)
{
return _meadowDevice.SetDeveloper3(userData, cancellationToken);
}

public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default)
{
return _meadowDevice.SetDeveloper4(userData, cancellationToken);
}

public Task Uart1Apps(CancellationToken cancellationToken = default)
Expand Down
2 changes: 1 addition & 1 deletion Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task<IList<string>> GetFilesAndFolders(
}
};

var command = new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_GET_FILES_AND_FOLDERS)
var command = new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_4)
.WithResponseHandler(handler)
.Build();

Expand Down
35 changes: 32 additions & 3 deletions Meadow.CLI.Core/Devices/MeadowLocalDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,40 @@ public Task SetTraceLevel(uint traceLevel, CancellationToken cancellationToken =
return SendCommand(command, cancellationToken);
}

public Task SetDeveloper(ushort level, uint userData, CancellationToken cancellationToken = default)
public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default)
{
var command =
new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER)
.WithDeveloperLevel(level)
new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_1)
.WithUserData(userData)
.Build();

return SendCommand(command, cancellationToken);
}

public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default)
{
var command =
new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_2)
.WithUserData(userData)
.Build();

return SendCommand(command, cancellationToken);
}

public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default)
{
var command =
new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_3)
.WithUserData(userData)
.Build();

return SendCommand(command, cancellationToken);
}

public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default)
{
var command =
new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_4)
.WithUserData(userData)
.Build();

Expand Down
9 changes: 4 additions & 5 deletions Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ public class Command
{
private protected const int HcomProtocolCommandRequiredHeaderLength = 12;
private protected const int HcomProtocolCommandSeqNumber = 0;
// TODO No longer required? private protected const ushort HcomProtocolExtraDataDefaultValue = 0x0000;
private protected const ushort HcomProtocolExtraDataDefaultValue = 0x0000;
private protected const int HcomProtocolRequestMd5HashLength = 32;
static internal ushort HcomProtocolCommunicationVersion = Constants.HCOM_PROTOCOL_CURRENT_VERSION_NUMBER;

public Command(HcomMeadowRequestType requestType,
TimeSpan timeout,
ushort developerLevel,
uint userData,
byte[]? data,
Predicate<MeadowMessageEventArgs> responsePredicate,
Predicate<MeadowMessageEventArgs> completionPredicate,
EventHandler<MeadowMessageEventArgs>? responseHandler,
Expand All @@ -24,8 +24,8 @@ public Command(HcomMeadowRequestType requestType,
{
RequestType = requestType;
Timeout = timeout;
DeveloperLevel = developerLevel;
UserData = userData;
Data = data;
ResponsePredicate = responsePredicate;
CompletionPredicate = completionPredicate;
ResponseHandler = responseHandler;
Expand All @@ -34,7 +34,6 @@ public Command(HcomMeadowRequestType requestType,
}

public HcomMeadowRequestType RequestType { get; protected set; }
public ushort DeveloperLevel { get; protected set; }
public uint UserData { get; protected set; }
public TimeSpan Timeout { get; protected set; }
public byte[]? Data { get; protected set; }
Expand Down Expand Up @@ -80,7 +79,7 @@ protected int ToMessageBytes(ref byte[] messageBytes)

// Extra Data
Array.Copy(
BitConverter.GetBytes(DeveloperLevel),
BitConverter.GetBytes(HcomProtocolExtraDataDefaultValue),
0,
messageBytes,
offset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal FileCommand(HcomMeadowRequestType requestType,
Predicate<MeadowMessageEventArgs> responseHandler,
Predicate<MeadowMessageEventArgs> completionHandler,
string commandBuilder)
: base(requestType, timeout, 0, partition, responseHandler, completionHandler, null, true, commandBuilder)
: base(requestType, timeout, partition, null, responseHandler, completionHandler, null, true, commandBuilder)
{
SourceFileName = sourceFileName;
DestinationFileName = destinationFileName;
Expand Down
Loading