Skip to content

Commit

Permalink
Fixes #3784. SelfContained and NativeAot projects should use the loca…
Browse files Browse the repository at this point in the history
…l package in the release mode. (#3785)

* Fixes #3784. SelfContained and NativeAot projects should use the local package in the release mode.

* Run dotnet restore before build.

* Using local_packages folder for CI.

* Add build_release_consumer.

* Remove build_release_consumer.

* Fix folder for CI.

* Fix System.Text.Json vulnerability.

* Fix local_packageslocation.

* Add package sources to the packageSourceMapping tag.

* Using the original configuration.

* Only add the Terminal.Gui pattern in the LocalPackages.

* Fix the path folder separator with unit style.

* Using pack instead of build.

* Create LocalPackages Directory

* Add local_packages source.

* Using scripts to build release for NativeAot and SelfContained.

* Trying to fix path.

* Again.

* Fix the path for the package,

* Need to build before pack.

* Needs also build before pack locally.

* Fix build path.
  • Loading branch information
BDisp authored Oct 11, 2024
1 parent f789f6a commit 9c6a305
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ jobs:
dotnet-version: 8.x
dotnet-quality: 'ga'

- name: Build Release
- name: Build Release Terminal.Gui
run: dotnet build Terminal.Gui/Terminal.Gui.csproj --configuration Release

- name: Pack Release Terminal.Gui
run: dotnet pack Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ./local_packages

- name: Build Release Solution
run: dotnet build --configuration Release


Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ demo.*
*.tui/

*.dotCover
/local_packages/
2 changes: 1 addition & 1 deletion NativeAot/NativeAot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PackageReference Include="Terminal.Gui" Version="[2.0.0-v2-develop.2189,3)" />
<PackageReference Include="Terminal.Gui" Version="2.0.0" />
<TrimmerRootAssembly Include="Terminal.Gui" />
</ItemGroup>

Expand Down
9 changes: 9 additions & 0 deletions NativeAot/PackTerminalGui.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages

# Step 2: Restore NativeAot with the new package
dotnet restore ./NativeAot.csproj --source ./local_packages

# Step 3: Build NativeAot
dotnet build ./NativeAot.csproj --configuration Release
11 changes: 11 additions & 0 deletions NativeAot/PackTerminalGui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages

# Step 2: Restore NativeAot with the new package
dotnet restore ./NativeAot.csproj --source ./local_packages

# Step 3: Build NativeAot
dotnet build ./NativeAot.csproj --configuration Release
9 changes: 9 additions & 0 deletions SelfContained/PackTerminalGui.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages

# Step 2: Restore SelfContained with the new package
dotnet restore ./SelfContained.csproj --source ./local_packages

# Step 3: Build SelfContained
dotnet build ./SelfContained.csproj --configuration Release
11 changes: 11 additions & 0 deletions SelfContained/PackTerminalGui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Step 1: Build and pack Terminal.Gui
dotnet build ../Terminal.Gui/Terminal.Gui.csproj --configuration Release
dotnet pack ../Terminal.Gui/Terminal.Gui.csproj --configuration Release --output ../local_packages

# Step 2: Restore SelfContained with the new package
dotnet restore ./SelfContained.csproj --source ./local_packages

# Step 3: Build SelfContained
dotnet build ./SelfContained.csproj --configuration Release
2 changes: 1 addition & 1 deletion SelfContained/SelfContained.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PackageReference Include="Terminal.Gui" Version="[2.0.0-pre.1788,3)" />
<PackageReference Include="Terminal.Gui" Version="2.0.0" />
<TrimmerRootAssembly Include="Terminal.Gui" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Terminal.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<!-- Enable Nuget Source Link for github -->
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="[8,9)" PrivateAssets="all" />
<PackageReference Include="System.IO.Abstractions" Version="[21.0.22,22)" />
<PackageReference Include="System.Text.Json" Version="[8.0.4,9)" />
<PackageReference Include="System.Text.Json" Version="[8.0.5,9)" />
<PackageReference Include="Wcwidth" Version="[2,3)" />
</ItemGroup>
<!-- =================================================================== -->
Expand Down
4 changes: 4 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="LocalPackages" value="./local_packages" />
</packageSources>
<packageSourceMapping>
<packageSource key="nuget">
<package pattern="*" />
</packageSource>
<packageSource key="LocalPackages">
<package pattern="Terminal.Gui*" />
</packageSource>
</packageSourceMapping>
</configuration>

0 comments on commit 9c6a305

Please sign in to comment.