diff --git a/.github/workflows/update-plugins.yml b/.github/workflows/update-plugins.yml index ad2308c..5dc952d 100644 --- a/.github/workflows/update-plugins.yml +++ b/.github/workflows/update-plugins.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/checkout@v4 - name: Download artifacts from workflow build - uses: dawidd6/action-download-artifact@v3 + uses: dawidd6/action-download-artifact@v6 with: # Optional, GitHub token github_token: ${{secrets.GITHUB_TOKEN}} diff --git a/NativeLibs/yasio/1k/1kiss.ps1 b/NativeLibs/yasio/1k/1kiss.ps1 index 77e9e98..7875d48 100644 --- a/NativeLibs/yasio/1k/1kiss.ps1 +++ b/NativeLibs/yasio/1k/1kiss.ps1 @@ -195,6 +195,7 @@ $1k = [_1kiss]::new() # x.y.z~x2.y2.z2 : range $manifest = @{ msvc = '14.39+'; # cl.exe @link.exe 14.39 VS2022 17.9.x + vs = '12.0+'; ndk = 'r23c'; xcode = '13.0.0+'; # range # _EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang xx.x.x or newer."); @@ -597,7 +598,8 @@ function find_prog($name, $path = $null, $mode = 'ONLY', $cmd = $null, $params = else { if (!$preferredVer.Contains('*')) { $checkVerCond = '$(version_eq $foundVer $preferredVer)' - } else { + } + else { $wildcardVer = $preferredVer $preferredVer = $wildcardVer.TrimEnd('.*') $checkVerCond = '$(version_like $foundVer $wildcardVer)' @@ -752,6 +754,46 @@ function fetch_pkg($url, $exrep = $null) { if ($pfn_rename) { &$pfn_rename } } + +# +# Find latest installed: Visual Studio 12 2013 + +# installationVersion +# installationPath +# instanceId: used for EnterDevShell +# result: +# $Global:VS_INST +# +$Global:VS_INST = $null +function find_vs() { + if (!$Global:VS_INST) { + $VSWHERE_EXE = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $eap = $ErrorActionPreference + $ErrorActionPreference = 'SilentlyContinue' + + $required_vs_ver = $manifest['vs'] + if (!$required_vs_ver) { $required_vs_ver = '12.0+' } + + $require_comps = @('Microsoft.Component.MSBuild', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64') + $vs_installs = ConvertFrom-Json "$(&$VSWHERE_EXE -version $required_vs_ver.TrimEnd('+') -format 'json' -requires $require_comps)" + $ErrorActionPreference = $eap + + if ($vs_installs) { + $vs_inst_latest = $null + $vs_ver = '' + foreach ($vs_inst in $vs_installs) { + $inst_ver = [VersionEx]$vs_inst.installationVersion + if ($vs_ver -lt $inst_ver) { + $vs_ver = $inst_ver + $vs_inst_latest = $vs_inst + } + } + $Global:VS_INST = $vs_inst_latest + } else { + throw "No suitable visual studio installed, required: $required_vs_ver" + } + } +} + # setup nuget, not add to path function setup_nuget() { if (!$manifest['nuget']) { return $null } @@ -1231,11 +1273,12 @@ function setup_emsdk() { function setup_msvc() { $cl_prog, $cl_ver = find_prog -name 'msvc' -cmd 'cl' -silent $true -usefv $true if (!$cl_prog) { - if ($VS_INST) { - Import-Module "$VS_PATH\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" + if ($Global:VS_INST) { + $vs_path = $Global:VS_INST.installationPath + Import-Module "$vs_path\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" $dev_cmd_args = "-arch=$target_cpu -host_arch=x64 -no_logo" if (!$manifest['msvc'].EndsWith('+')) { $dev_cmd_args += " -vcvars_ver=$cl_ver" } - Enter-VsDevShell -VsInstanceId $VS_INST.instanceId -SkipAutomaticLocation -DevCmdArguments $dev_cmd_args + Enter-VsDevShell -VsInstanceId $Global:VS_INST.instanceId -SkipAutomaticLocation -DevCmdArguments $dev_cmd_args $cl_prog, $cl_ver = find_prog -name 'msvc' -cmd 'cl' -silent $true -usefv $true $1k.println("Using msvc: $cl_prog, version: $cl_ver") @@ -1297,44 +1340,6 @@ function setup_gclient() { $env:DEPOT_TOOLS_WIN_TOOLCHAIN = 0 } -# -# Find latest installed: Visual Studio 12 2013 + -# installationVersion -# instanceId EnterDevShell can use it -# result: -# $Global:VS_VERSION -# $Global:VS_INST -# $Global:VS_PATH -# -$Global:VS_VERSION = $null -$Global:VS_PATH = $null -$Global:VS_INST = $null -function find_vs_latest() { - $vs_version = [VersionEx]'12.0' - if (!$Global:VS_INST) { - $VSWHERE_EXE = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" - $eap = $ErrorActionPreference - $ErrorActionPreference = 'SilentlyContinue' - - $vs_installs = ConvertFrom-Json "$(&$VSWHERE_EXE -version '12.0' -format 'json')" - $ErrorActionPreference = $eap - - if ($vs_installs) { - $vs_inst_latest = $null - foreach ($vs_inst in $vs_installs) { - $inst_ver = [VersionEx]$vs_inst.installationVersion - if ($vs_version -lt $inst_ver) { - $vs_version = $inst_ver - $vs_inst_latest = $vs_inst - } - } - $Global:VS_PATH = $vs_inst_latest.installationPath - $Global:VS_INST = $vs_inst_latest - } - } - $Global:VS_VERSION = $vs_version -} - # preprocess methods: # -inputOptions [CMAKE_OPTIONS] function preprocess_win([string[]]$inputOptions) { @@ -1350,13 +1355,15 @@ function preprocess_win([string[]]$inputOptions) { $arch = if ($options.a -eq 'x86') { 'Win32' } else { $options.a } # arch - if ($VS_VERSION -ge [VersionEx]'16.0') { + $vs_ver = [VersionEx]$Global:VS_INST.installationVersion + if ($vs_ver -ge [VersionEx]'16.0') { $outputOptions += '-A', $arch if ($TOOLCHAIN_VER) { $outputOptions += "-Tv$TOOLCHAIN_VER" } } else { + if (!$TOOLCHAIN_VER) { $TOOLCHAIN_VER = "$($vs_ver.Major)0" } $gens = @{ '120' = 'Visual Studio 12 2013'; '140' = 'Visual Studio 14 2015' @@ -1364,7 +1371,7 @@ function preprocess_win([string[]]$inputOptions) { } $Script:cmake_generator = $gens[$TOOLCHAIN_VER] if (!$Script:cmake_generator) { - throw "Unsupported toolchain: $TOOLCHAIN" + throw "Unsupported toolchain: $TOOLCHAIN$TOOLCHAIN_VER" } if ($options.a -eq "x64") { $Script:cmake_generator += ' Win64' @@ -1558,7 +1565,7 @@ $null = setup_glslcc $cmake_prog, $Script:cmake_ver = setup_cmake if ($Global:is_win_family) { - find_vs_latest + find_vs $nuget_prog = setup_nuget } @@ -1614,7 +1621,8 @@ if (!$setupOnly) { if ($is_host_target) { if (!$is_host_cpu) { $out_dir = "${prefix}${TARGET_CPU}" - } else { + } + else { $out_dir = $prefix.TrimEnd("_") } } diff --git a/NativeLibs/yasio/1k/install-pwsh.sh b/NativeLibs/yasio/1k/install-pwsh.sh index fb86bec..e9cd29f 100644 --- a/NativeLibs/yasio/1k/install-pwsh.sh +++ b/NativeLibs/yasio/1k/install-pwsh.sh @@ -12,7 +12,7 @@ mkdir -p $cacheDir pwsh_ver=$1 if [ "$pwsh_ver" = "" ] ; then - pwsh_ver='7.4.4' + pwsh_ver='7.4.6' fi pwsh_min_ver=$2 @@ -64,8 +64,8 @@ elif [ $HOST_OS = 'Linux' ] ; then curl -L "https://github.com/PowerShell/PowerShell/releases/download/v$pwsh_ver/$pwsh_pkg" -o "$pwsh_pkg_out" fi sudo_cmd=$(which sudo) - $sudo_cmd dpkg -i "$pwsh_pkg_out" - $sudo_cmd apt-get install -f + $sudo_cmd dpkg -i --ignore-depends=libicu72 "$pwsh_pkg_out" + $sudo_cmd apt-get install -f powershell elif command -v pacman > /dev/null; then # Linux distro: Arch # refer: https://ephos.github.io/posts/2018-9-17-Pwsh-ArchLinux # available pwsh version, refer to: https://aur.archlinux.org/packages/powershell-bin diff --git a/NativeLibs/yasio/manifest.json b/NativeLibs/yasio/manifest.json index 433f64a..d4473f4 100644 --- a/NativeLibs/yasio/manifest.json +++ b/NativeLibs/yasio/manifest.json @@ -1,6 +1,6 @@ { "versions": { - "1kdist": "v90" + "1kdist": "v93" }, "mirrors": { "github": { diff --git a/NativeLibs/yasio/yasio/config.hpp b/NativeLibs/yasio/yasio/config.hpp index c41511f..f8e3b5e 100644 --- a/NativeLibs/yasio/yasio/config.hpp +++ b/NativeLibs/yasio/yasio/config.hpp @@ -205,7 +205,7 @@ SOFTWARE. /* ** The yasio version macros */ -#define YASIO_VERSION_NUM 0x040301 +#define YASIO_VERSION_NUM 0x040302 /* ** The macros used by io_service. diff --git a/NativeLibs/yasio/yasio/fsutils.hpp b/NativeLibs/yasio/yasio/file.hpp similarity index 100% rename from NativeLibs/yasio/yasio/fsutils.hpp rename to NativeLibs/yasio/yasio/file.hpp diff --git a/NativeLibs/yasio/yasio/io_service.cpp b/NativeLibs/yasio/yasio/io_service.cpp index 9578e1f..b3625c0 100644 --- a/NativeLibs/yasio/yasio/io_service.cpp +++ b/NativeLibs/yasio/yasio/io_service.cpp @@ -533,11 +533,7 @@ int io_transport_ssl::do_ssl_handshake(int& error) return -1; }; this->write_cb_ = [this](const void* data, int len, const ip::endpoint*, int& error) { return yssl_write(ssl_, data, len, error); }; - - YASIO_KLOGD("[index: %d] the connection #%u <%s> --> <%s> is established.", ctx_->index_, this->id_, this->local_endpoint().to_string().c_str(), - this->remote_endpoint().to_string().c_str()); - get_service().fire_event(ctx_->index_, YEK_ON_OPEN, 0, this); - + get_service().notify_connect_succeed(this); error = EWOULDBLOCK; } else @@ -1708,16 +1704,19 @@ void io_service::active_transport(transport_handle_t t) #endif } if (!yasio__testbits(ctx->properties_, YCM_SSL)) - { - YASIO__UNUSED_PARAM(s); - YASIO_KLOGV("[index: %d] sndbuf=%d, rcvbuf=%d", ctx->index_, s->get_optval(SOL_SOCKET, SO_SNDBUF), s->get_optval(SOL_SOCKET, SO_RCVBUF)); - YASIO_KLOGD("[index: %d] the connection #%u <%s> --> <%s> is established.", ctx->index_, t->id_, t->local_endpoint().to_string().c_str(), - t->remote_endpoint().to_string().c_str()); - this->fire_event(ctx->index_, YEK_ON_OPEN, 0, t); - } + notify_connect_succeed(t); else if (yasio__testbits(ctx->properties_, YCM_CLIENT)) this->wakeup(); } +void io_service::notify_connect_succeed(transport_handle_t t) +{ + auto& s = t->socket_; + auto ctx = t->ctx_; + YASIO_KLOGD("[index: %d] the connection #%u <%s> --> <%s> is established(sndbuf=%d, rcvbuf=%d).", ctx->index_, t->id_, + t->local_endpoint().to_string().c_str(), t->remote_endpoint().to_string().c_str(), s->get_optval(SOL_SOCKET, SO_SNDBUF), + s->get_optval(SOL_SOCKET, SO_RCVBUF)); + fire_event(ctx->index_, YEK_ON_OPEN, 0, t); +} transport_handle_t io_service::allocate_transport(io_channel* ctx, xxsocket_ptr&& s) { transport_handle_t transport; diff --git a/NativeLibs/yasio/yasio/io_service.hpp b/NativeLibs/yasio/yasio/io_service.hpp index f16b0f7..c4ea239 100644 --- a/NativeLibs/yasio/yasio/io_service.hpp +++ b/NativeLibs/yasio/yasio/io_service.hpp @@ -1186,6 +1186,7 @@ class YASIO_API io_service // lgtm [cpp/class-many-fields] YASIO__DECL void handle_connect_succeed(transport_handle_t); YASIO__DECL void handle_connect_failed(io_channel*, int ec); YASIO__DECL void active_transport(transport_handle_t); + YASIO__DECL void notify_connect_succeed(transport_handle_t); YASIO__DECL transport_handle_t allocate_transport(io_channel*, xxsocket_ptr&&); YASIO__DECL void deallocate_transport(transport_handle_t); diff --git a/NativeLibs/yasio/yasio/string.hpp b/NativeLibs/yasio/yasio/string.hpp index 077bcb7..2467320 100644 --- a/NativeLibs/yasio/yasio/string.hpp +++ b/NativeLibs/yasio/yasio/string.hpp @@ -243,9 +243,9 @@ class basic_string { const_iterator end() const YASIO__NOEXCEPT { return begin() + _Mysize; } #pragma endregion - pointer data() YASIO__NOEXCEPT { return _Myfirst ? _Myfirst : reinterpret_cast(&_Myfirst); } - const_pointer data() const YASIO__NOEXCEPT { return _Myfirst ? _Myfirst : reinterpret_cast(&_Myfirst); } - const_pointer c_str() const YASIO__NOEXCEPT { return this->data(); } + pointer data() YASIO__NOEXCEPT { return _Myfirst; } + const_pointer data() const YASIO__NOEXCEPT { return _Myfirst; } + const_pointer c_str() const YASIO__NOEXCEPT { return _Myfirst ? _Myfirst : reinterpret_cast(&_Myfirst);; } const_reference operator[](size_type index) const { return this->at(index); } reference operator[](size_type index) { return this->at(index); } const_reference at(size_type index) const