Added nupkg support to UWP example

This commit is contained in:
Fela Ameghino 2023-03-22 17:53:22 +04:00 committed by Aliaksei Levin
parent 7d70dcc9a4
commit e9b6313b56
3 changed files with 67 additions and 4 deletions

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata>
<id>Telegram.Td.UWP</id>
<version>1.8.12</version>
<title>TDLib for Universal Windows Platform</title>
<authors>Telegram</authors>
<owners>Telegram</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="file">LICENSE_1_0.txt</license>
<projectUrl>https://core.telegram.org/tdlib</projectUrl>
<releaseNotes>https://github.com/tdlib/td/blob/master/CHANGELOG.md</releaseNotes>
<description>TDLib for Universal Windows Platform</description>
<copyright>© Telegram FZ-LLC. All rights reserved.</copyright>
</metadata>
</package>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TelegramTdPlatform Condition="'$(Platform)' == 'Win32'">x86</TelegramTdPlatform>
<TelegramTdPlatform Condition="'$(Platform)' != 'Win32'">$(Platform)</TelegramTdPlatform>
</PropertyGroup>
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Telegram.Td.winmd">
<Implementation>Telegram.Td.dll</Implementation>
</Reference>
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(TelegramTdPlatform)\native\Telegram.Td.dll" />
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(TelegramTdPlatform)\native\libcrypto-1_1-x64.dll" />
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(TelegramTdPlatform)\native\libssl-1_1-x64.dll" />
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(TelegramTdPlatform)\native\zlib1.dll" />
</ItemGroup>
</Project>

View File

@ -3,7 +3,8 @@ param (
[string]$arch = "",
[string]$mode = "all",
[string]$compress = "7z",
[switch]$release_only = $false
[switch]$release_only = $false,
[switch]$nupkg = $false
)
$ErrorActionPreference = "Stop"
@ -15,7 +16,7 @@ if ($arch) {
$arch_list = @(, $arch)
}
$config_list = @( "Debug", "Release" )
if ($release_only) {
if ($release_only -or $nupkg) {
$config_list = @(, "RelWithDebInfo")
}
$targets = @{ Debug = "Debug"; Release = "Retail"; RelWithDebInfo = "CommonConfiguration"}
@ -83,7 +84,7 @@ function build {
cd ..
}
function export {
function export-vsix {
cd build-uwp
Remove-Item vsix -Force -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path vsix
@ -119,6 +120,29 @@ function export {
cd ..
}
function export-nupkg {
cd build-uwp
Remove-Item nupkg -Force -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path nupkg/build/native
cp ../LICENSE_1_0.txt nupkg
cp ../Telegram.Td.UWP.nuspec nupkg
cp ../Telegram.Td.UWP.targets nupkg/build/native
ForEach ($arch in $arch_list) {
New-Item -ItemType Directory -Force -Path nupkg/runtimes/win10-${arch}/native
New-Item -ItemType Directory -Force -Path nupkg/lib/uap10.0
ForEach ($config in $config_list) {
cp ${arch}/${config}/* -include "SSLEAY*","LIBEAY*","libcrypto*","libssl*","zlib*","Telegram.Td.pdb","Telegram.Td.pri","Telegram.Td.dll" nupkg/runtimes/win10-${arch}/native
cp ${arch}/${config}/* -include "Telegram.Td.winmd","Telegram.Td.xml" nupkg/lib/uap10.0
}
}
cd nupkg
nuget pack Telegram.Td.UWP.nuspec
cd ..
}
function run {
Push-Location
Try {
@ -135,7 +159,11 @@ function run {
build
}
if (($mode -eq "export") -or ($mode -eq "all")) {
export
if ($nupkg) {
export-nupkg
} else {
export-vsix
}
}
} Finally {
Pop-Location