Skip to content

Commit

Permalink
Merge pull request #1604 from beto-rodriguez/update-targets
Browse files Browse the repository at this point in the history
Update targets
  • Loading branch information
beto-rodriguez authored Sep 17, 2024
2 parents dae323f + 427640f commit 6352fb6
Show file tree
Hide file tree
Showing 20 changed files with 147 additions and 383 deletions.
133 changes: 11 additions & 122 deletions build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,149 +9,38 @@ param([string]$configuration = "Debug", [string]$nupkgOutputPath = "./nupkg")
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharp.Xamarin.Forms/LiveChartsCore.SkiaSharpView.Xamarin.Forms.csproj")
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.Blazor/LiveChartsCore.SkiaSharpView.Blazor.csproj")
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.Eto/LiveChartsCore.SkiaSharpView.Eto.csproj")
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj", $true)
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.Uno/LiveChartsCore.SkiaSharpView.Uno.csproj", $true)
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj", $true),
[Project]::new(
"./src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.csproj", $true,
"nuget", "./src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.nuspec")
[Project]::new(
"./src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj", $true,
"nuget", "./src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.nuspec"
)
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.Maui/LiveChartsCore.SkiaSharpView.Maui.csproj")
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.Uno.WinUI/LiveChartsCore.SkiaSharpView.Uno.WinUI.csproj")
[Project]::new("./src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.csproj")
[Project]::new("./src/skiasharp/LiveChartsCore.SkiaSharpView.WinUI/LiveChartsCore.SkiaSharpView.WinUI.csproj")
)

$msbuild = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe

class Project {
[string]$src
[bool]$useMsbuild
[string]$packingMethod ## dotnet | msbuild | nuget
[string]$nuspecFile

Project(
[string]$src
) {
$this.src = $src
$this.useMsbuild = $false
$this.packingMethod = "dotnet"
$this.nuspecFile = $null
}

Project(
[string]$src,
[bool]$useMsbuild
) {
$this.src = $src
$this.useMsbuild = $useMsbuild
if ($useMsbuild) {
$this.packingMethod = "msbuild"
$this.nuspecFile = ""
}
}

Project(
[string]$src,
[bool]$useMsbuild,
[string]$packingMethod,
[string]$nuspecFile
) {
$this.src = $src
$this.useMsbuild = $useMsbuild
$this.packingMethod = $packingMethod
$this.nuspecFile = $nuspecFile
}

[string]GetFolder() {
return $this.src.SubString(0, $this.src.LastIndexOf("/"));
}
}

function Add-Build {
param (
[Project] $project
)

$folder = $project.GetFolder()

if (Test-Path $($folder + "/bin")) {
Remove-Item $($folder + "/bin") -Force -Recurse
}

if ($project.useMsbuild) {
# skip the build, it will be built in the pack method.
if ($project.packingMethod -ne "msbuild") {
& $msbuild $project.src /p:configuration=$configuration /restore
}
}
else {
dotnet build $project.src -c $configuration
}

if ($LastExitCode -ne 0) {
throw $("failed at '" + $project.src + "' with exit code " + $LastExitCode);
}
}

function Add-Pack {
param (
[Project] $project
)

if ($project.packingMethod -eq "dotnet") {
dotnet pack $project.src -o $nupkgOutputPath -c $configuration --no-build
}

if ($project.packingMethod -eq "msbuild") {
& $msbuild $project.src -t:pack /p:configuration=$configuration /restore

$folder = $project.GetFolder()

$found = Get-ChildItem $folder -Filter "*.nupkg" -Recurse -Force
Copy-Item $found.FullName $nupkgOutputPath

$found = Get-ChildItem $folder -Filter "*.snupkg" -Recurse -Force
Copy-Item $found.FullName $nupkgOutputPath
}

if ($project.packingMethod -eq "nuget") {
if (!(Test-Path "./nuget.exe")) {
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile "./nuget.exe"
}

./nuget pack $project.nuspecFile -OutputDirectory $nupkgOutputPath -Symbols -SymbolPackageFormat snupkg
}
}

function Write-ColorOutput($foregroundColor)
{
# save the current color
$fc = $host.UI.RawUI.ForegroundColor

# set the new color
$host.UI.RawUI.ForegroundColor = $foregroundColor

# output
if ($args) {
Write-Output $args
}
else {
$input | Write-Output
}

# restore the original color
$host.UI.RawUI.ForegroundColor = $fc
}

if (Test-Path $nupkgOutputPath) {
Get-ChildItem $nupkgOutputPath -Include *.* -File -Recurse | ForEach-Object { $_.Delete() }
} else {
New-Item $nupkgOutputPath -ItemType "directory"
}

foreach ($p in $projects) {
Add-Build $p
Add-Pack $p
}
$folder = $p.GetFolder()

Write-ColorOutput green $("`n`nSuccessfully built and packed " + $projects.length + " projects at '" + $nupkgOutputPath + "' using '" + $configuration + "' config.`n`n")
if (Test-Path $($folder + "/bin")) {
Remove-Item $($folder + "/bin") -Force -Recurse
}

dotnet pack $p.src -o $nupkgOutputPath -c $configuration
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
One for Windows with net8.0-windows TFM, one for MacOS with net80.0-macos and one with net8.0 TFM for Linux.-->
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorSample/Pages/Axes/LabelsFormat2.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

protected async override Task OnInitializedAsync()
{
// On .net7, SkiaSharp 2.88.6 and SkiaSharp.HarfBuzz 2.88.6 the MatchCharacter does not load the font.
// On .net8, SkiaSharp 2.88.6 and SkiaSharp.HarfBuzz 2.88.6 the MatchCharacter does not load the font.
// The MatchCharacter function loads a font from the system,
// it seems that on WASM we must load the font manually.
Expand Down
25 changes: 16 additions & 9 deletions src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,29 @@
<LangVersion>12.0</LangVersion>

<TargetFrameworks>
netstandard2.0;
net6.0;
netstandard2.0;netstandard2.1;
net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst;
</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">
$(TargetFrameworks);
net462;
net6.0-windows10.0.19041.0;
net8.0-windows10.0.19041.0
net8.0-windows10.0.19041.0;
</TargetFrameworks>

<EnableMsixTooling Condition="$([MSBuild]::IsOSPlatform('windows'))">true</EnableMsixTooling>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>

<!--
net 8 breaking changes:
https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/rid-graph
-->
<RuntimeIdentifiers Condition="$(TargetFramework.Contains('8.0-windows'))">win-x86;win-x64;win-arm64;</RuntimeIdentifiers>

<AssemblyName>LiveChartsCore.Behaviours</AssemblyName>
<RootNamespace>LiveChartsCore.Behaviours</RootNamespace>
<Version>2.0.0-rc3</Version>
<Version>2.0.0-rc3.1</Version>
<PackageIcon>icon.png</PackageIcon>
<Description>Adds user interaction for touch screens, touch pads and mouse.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand All @@ -40,6 +36,12 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<RepositoryUrl>https://github.com/beto-rodriguez/LiveCharts2</RepositoryUrl>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>

<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -54,6 +56,11 @@

<ItemGroup>
<ProjectReference Include="..\LiveChartsCore\LiveChartsCore.csproj" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
<None Include="images\icon.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
Expand Down
107 changes: 0 additions & 107 deletions src/LiveChartsCore.Behaviours/LiveChartsCore.Behaviours.nuspec

This file was deleted.

Binary file added src/LiveChartsCore.Behaviours/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6352fb6

Please sign in to comment.