Skip to content

Commit

Permalink
Update Terminal.Gui to 1.16.0, and make psedit compatible again (#63)
Browse files Browse the repository at this point in the history
* Updated Terminal.Gui reference to 1.16.0, as they have dropped support for .NET Standard 2.0

Change from targetting .NET Standard to multi target .NET Standard 2.1 + .NET Framework 4.7.2

Updated vscode launch/tasks json files, and confirmed launching/debugging still works

Updated yml workflows for github, as dotnet publish is no longer supported. We must use dotnet build as publish is not supported for multi targetting projects
  • Loading branch information
halvarsson authored May 8, 2024
1 parent b35d636 commit 2f562af
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 17 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@ jobs:
with:
dotnet-version: 6.0.x

- name: Build
run: dotnet publish
- name: Build .NET Standard 2.1
run: dotnet build -c Release -f netstandard2.1

- name: Build .NET Framework 4.7.2
run: dotnet build -c Release -f net472

- name: List build artifacts
shell: pwsh
run: Get-ChildItem -Path .\bin\Release -Recurse
9 changes: 6 additions & 3 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ jobs:
with:
dotnet-version: 6.0.x

- name: Build
run: dotnet publish -o psedit
- name: Build .NET Standard 2.1
run: dotnet build -c Release -f netstandard2.1

- name: Build .NET Framework 4.7.2
run: dotnet build -c Release -f net472

- name: Release
run: Publish-Module -Path .\psedit -NuGetApiKey $Env:APIKEY
run: Publish-Module -Path .\bin\Release -NuGetApiKey $Env:APIKEY
env:
APIKEY: ${{ secrets.APIKEY }}
shell: pwsh
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"-Command",
"& { Import-Module .\\psedit.psd1; Show-PSEditor}"
],
"cwd": "${workspaceFolder}\\bin\\Debug\\netstandard2.0\\publish",
"cwd": "${workspaceFolder}\\bin\\Debug",
"console": "externalTerminal",
"stopAtEntry": false
},
Expand All @@ -30,7 +30,7 @@
"-Command",
"& { Import-Module .\\psedit.psd1; Show-PSEditor}"
],
"cwd": "${workspaceFolder}\\bin\\Debug\\netstandard2.0\\publish",
"cwd": "${workspaceFolder}\\bin\\Debug",
"console": "externalTerminal",
"stopAtEntry": false
},
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"command": "dotnet",
"type": "shell",
"args": [
"publish",
"build",
// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
Expand Down
43 changes: 36 additions & 7 deletions psedit.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.1;net472</TargetFrameworks>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageReference Include="Terminal.Gui" Version="1.10.0" />
<PackageReference Include="Terminal.Gui" Version="1.16.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<None Include="psedit.psd1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<!-- Output paths for Debug configuration -->
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Debug|netstandard2.1'">
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputPath>bin\Debug\coreclr\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Debug|net472'">
<OutputPath>bin\Debug\clr\</OutputPath>
</PropertyGroup>

<Target Name="CopyAdditionalFiles" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug'">
<!-- Copy psedit.psd1 to the root output directory -->
<Copy SourceFiles="psedit.psd1"
DestinationFolder="bin\Debug"
SkipUnchangedFiles="true" />
</Target>

<!-- Output paths for Release configuration -->
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|netstandard2.1'">
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputPath>bin\Release\coreclr\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)'=='Release|net472'">
<OutputPath>bin\Release\clr\</OutputPath>
</PropertyGroup>

<Target Name="CopyAdditionalFilesRelease" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
<!-- Copy psedit.psd1 to the root output directory -->
<Copy SourceFiles="psedit.psd1"
DestinationFolder="bin\Release"
SkipUnchangedFiles="true" />
</Target>

</Project>
10 changes: 8 additions & 2 deletions psedit.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
@{

# Script module or binary module file associated with this manifest.
RootModule = 'psedit.dll'

RootModule = if($PSEdition -eq 'Core')
{
'coreclr\psedit.dll'
}
else # Desktop
{
'clr\psedit.dll'
}
# Version number of this module.
ModuleVersion = '0.0.6'

Expand Down

0 comments on commit 2f562af

Please sign in to comment.