From efc336e60cf1331bf5f3213d296981b87b8b2a6c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 4 Jun 2023 19:24:05 +0300 Subject: =?UTF-8?q?fixes=20#3537=20(Telegram:=2032-=D1=80=D0=B0=D0=B7?= =?UTF-8?q?=D1=80=D1=8F=D0=B4=D0=BD=D0=B0=D1=8F=20=D0=B2=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D0=B0=D0=B4=D0=B0=D0=B5=D1=82=20=D0=B2=20?= =?UTF-8?q?64-=D1=80=D0=B0=D0=B7=D1=80=D1=8F=D0=B4=D0=BD=D0=BE=D0=B9=20Win?= =?UTF-8?q?dows)=20+=20update=20to=20the=20fresh=20TDLIB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/tdlib/td/example/uwp/README.md | 15 ++++++--- .../tdlib/td/example/uwp/Telegram.Td.UWP.nuspec | 16 ++++++++++ .../tdlib/td/example/uwp/Telegram.Td.UWP.targets | 21 ++++++++++++ .../Telegram/tdlib/td/example/uwp/app/App.xaml.cs | 2 +- .../tdlib/td/example/uwp/app/MainPage.xaml.cs | 7 +--- .../td/example/uwp/app/Properties/AssemblyInfo.cs | 2 +- protocols/Telegram/tdlib/td/example/uwp/build.ps1 | 37 +++++++++++++++++++--- .../tdlib/td/example/uwp/extension.vsixmanifest | 2 +- 8 files changed, 84 insertions(+), 18 deletions(-) create mode 100644 protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.nuspec create mode 100644 protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.targets (limited to 'protocols/Telegram/tdlib/td/example/uwp') diff --git a/protocols/Telegram/tdlib/td/example/uwp/README.md b/protocols/Telegram/tdlib/td/example/uwp/README.md index c0b4de723f..3faa890d51 100644 --- a/protocols/Telegram/tdlib/td/example/uwp/README.md +++ b/protocols/Telegram/tdlib/td/example/uwp/README.md @@ -6,13 +6,15 @@ This is an example of building TDLib SDK for Universal Windows Platform and an e * Download and install Microsoft Visual Studio 2015+ with Windows 10 SDK. We recommend to use the latest available versions of Microsoft Visual Studio and Windows 10 SDK. * Download and install [CMake](https://cmake.org/download/). -* Install [vcpkg](https://github.com/Microsoft/vcpkg#quick-start) or update it to the latest version using `vcpkg update` and following received instructions. -* Install `zlib` and `openssl` for all UWP architectures and `gperf` for x86 using `vcpkg`: +* Install `zlib` and `openssl` for all UWP architectures and `gperf` for x86 using [vcpkg](https://github.com/Microsoft/vcpkg#quick-start): ``` -cd +git clone https://github.com/Microsoft/vcpkg.git +cd vcpkg +git checkout 1b1ae50e1a69f7c659bd7d731e80b358d21c86ad +.\bootstrap-vcpkg.bat .\vcpkg.exe install gperf:x86-windows openssl:arm-uwp openssl:arm64-uwp openssl:x64-uwp openssl:x86-uwp zlib:arm-uwp zlib:arm64-uwp zlib:x64-uwp zlib:x86-uwp ``` -* (Optional. For XML documentation generation.) Download [PHP](https://windows.php.net/download#php-7.2). Add the path to php.exe to the PATH environment variable. +* (Optional. For XML documentation generation.) Download [PHP](https://windows.php.net/download). Add the path to php.exe to the PATH environment variable. * Download and install [7-Zip](http://www.7-zip.org/download.html) archiver, which is used by the `build.ps1` script to create a Telegram.Td.UWP Visual Studio Extension. Add the path to 7z.exe to the PATH environment variable. Alternatively `build.ps1` supports compressing using [WinRAR](https://en.wikipedia.org/wiki/WinRAR) with option `-compress winrar` and compressing using [zip](http://gnuwin32.sourceforge.net/packages/zip.htm) with `-compress zip`. * Build `TDLib` using provided `build.ps1` script (TDLib should be built 6 times for multiple platforms in Debug and Release configurations, so it make take few hours). Pass path to vcpkg.exe as `-vcpkg-root` argument, for example: @@ -22,7 +24,10 @@ powershell -ExecutionPolicy ByPass .\build.ps1 -vcpkg_root C:\vcpkg If you need to restart the build from scratch, call `.\build.ps1 -vcpkg_root C:\vcpkg -mode clean` first. * Install Visual Studio Extension "TDLib for Universal Windows Platform" located at `build-uwp\vsix\tdlib.vsix`, which was created on the previous step by `build.ps1` script. -Now `TDLib` can be used from any UWP project, built in Visual Studio. +After this `TDLib` can be used from any UWP project, built in Visual Studio. + +Alternatively, you can build `TDLib` as a NuGet package, adding the option `-nupkg` to the `.\build.ps1` script invocation. The resulting package will be placed in the directory `build-uwp\nupkg`. ## Example of usage + The `app/` directory contains a simple example of a C# application for Universal Windows Platform. Just open it with Visual Studio 2015 or later and run. diff --git a/protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.nuspec b/protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.nuspec new file mode 100644 index 0000000000..039ec2adaf --- /dev/null +++ b/protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.nuspec @@ -0,0 +1,16 @@ + + + + Telegram.Td.UWP + 1.8.14 + TDLib for Universal Windows Platform + Telegram + Telegram + false + LICENSE_1_0.txt + https://core.telegram.org/tdlib + https://github.com/tdlib/td/blob/master/CHANGELOG.md + TDLib for Universal Windows Platform + © Telegram FZ-LLC. All rights reserved. + + \ No newline at end of file diff --git a/protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.targets b/protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.targets new file mode 100644 index 0000000000..3ad7f3e95d --- /dev/null +++ b/protocols/Telegram/tdlib/td/example/uwp/Telegram.Td.UWP.targets @@ -0,0 +1,21 @@ + + + + + x86 + $(Platform) + + -$(Platform) + + + + + Telegram.Td.dll + + + + + + + + \ No newline at end of file diff --git a/protocols/Telegram/tdlib/td/example/uwp/app/App.xaml.cs b/protocols/Telegram/tdlib/td/example/uwp/app/App.xaml.cs index 5bfc66a30f..faaa46cab0 100644 --- a/protocols/Telegram/tdlib/td/example/uwp/app/App.xaml.cs +++ b/protocols/Telegram/tdlib/td/example/uwp/app/App.xaml.cs @@ -1,5 +1,5 @@ // -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022 +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/protocols/Telegram/tdlib/td/example/uwp/app/MainPage.xaml.cs b/protocols/Telegram/tdlib/td/example/uwp/app/MainPage.xaml.cs index 4c42e27676..e4218386e3 100644 --- a/protocols/Telegram/tdlib/td/example/uwp/app/MainPage.xaml.cs +++ b/protocols/Telegram/tdlib/td/example/uwp/app/MainPage.xaml.cs @@ -1,5 +1,5 @@ // -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022 +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -85,11 +85,6 @@ namespace TdApp AcceptCommand("LogOut"); _client.Send(new TdApi.LogOut(), _handler); } - else if (command.StartsWith("gas")) - { - AcceptCommand(command); - _client.Send(new TdApi.GetAuthorizationState(), _handler); - } else if (command.StartsWith("sap")) { var args = command.Split(" ".ToCharArray(), 2); diff --git a/protocols/Telegram/tdlib/td/example/uwp/app/Properties/AssemblyInfo.cs b/protocols/Telegram/tdlib/td/example/uwp/app/Properties/AssemblyInfo.cs index 2e008d1a29..14a02677cd 100644 --- a/protocols/Telegram/tdlib/td/example/uwp/app/Properties/AssemblyInfo.cs +++ b/protocols/Telegram/tdlib/td/example/uwp/app/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("App2")] -[assembly: AssemblyCopyright("Copyright © 2015-2022")] +[assembly: AssemblyCopyright("Copyright © 2015-2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/protocols/Telegram/tdlib/td/example/uwp/build.ps1 b/protocols/Telegram/tdlib/td/example/uwp/build.ps1 index 587945a4b2..463592fa3d 100644 --- a/protocols/Telegram/tdlib/td/example/uwp/build.ps1 +++ b/protocols/Telegram/tdlib/td/example/uwp/build.ps1 @@ -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"} @@ -77,13 +78,14 @@ function build { cd $arch ForEach ($config in $config_list) { cmake --build . --config $config --target tddotnet + CheckLastExitCode } cd .. } 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 +121,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 +160,11 @@ function run { build } if (($mode -eq "export") -or ($mode -eq "all")) { - export + if ($nupkg) { + export-nupkg + } else { + export-vsix + } } } Finally { Pop-Location diff --git a/protocols/Telegram/tdlib/td/example/uwp/extension.vsixmanifest b/protocols/Telegram/tdlib/td/example/uwp/extension.vsixmanifest index 28cacff65f..66c434a164 100644 --- a/protocols/Telegram/tdlib/td/example/uwp/extension.vsixmanifest +++ b/protocols/Telegram/tdlib/td/example/uwp/extension.vsixmanifest @@ -1,6 +1,6 @@ - + TDLib for Universal Windows Platform TDLib is a library for building Telegram clients https://core.telegram.org/tdlib -- cgit v1.2.3