Skip to content

Commit 3671aa6

Browse files
committed
Preparing for the first launch
1 parent cf8dc60 commit 3671aa6

8 files changed

Lines changed: 346 additions & 24 deletions

File tree

.github/workflows/ci-nightly.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI Nightly Extended
2+
3+
on:
4+
schedule:
5+
- cron: "0 3 * * *" # every night at 03:00 UTC
6+
workflow_dispatch: # manual trigger possible
7+
8+
jobs:
9+
extended-windows:
10+
name: Extended / Windows ${{ matrix.os }} / Perl ${{ matrix.perl }}
11+
runs-on: ${{ matrix.os }}
12+
continue-on-error: true
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ windows-2022, windows-latest ]
18+
perl: [ "5.10", "5.12", "5.14", "5.16", "5.18", "5.20", "5.32", "5.36", "5.38", "5.40", "latest" ]
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: shogo82148/actions-setup-perl@v1
24+
with:
25+
distribution: strawberry
26+
perl-version: ${{ matrix.perl }}
27+
28+
- shell: pwsh
29+
run: perl -V
30+
31+
- shell: pwsh
32+
run: >
33+
cpanm --skip-satisfied --quiet --notest
34+
autodie::Scope::Guard
35+
Carp~1.01
36+
Class::Struct
37+
Devel::StrictMode~0.003
38+
Encode
39+
Importer~0.026
40+
Import::Into~1.002005
41+
List::Util~1.33
42+
Module::Loaded
43+
Params::Check
44+
Scalar::Util~1.36
45+
UNIVERSAL::Object~0.17
46+
Win32~0.59
47+
Win32API::File~0.1101
48+
Win32::API~0.84
49+
Win32::Console~0.10
50+
Win32::Console::PatchForRT33513~0.008
51+
Test::Exception~0.43
52+
Test::More~0.95
53+
Devel::Refcount~0.10
54+
55+
- shell: pwsh
56+
run: |
57+
perl Makefile.PL
58+
if (Get-Command gmake -ErrorAction SilentlyContinue) {
59+
gmake test
60+
} elseif (Get-Command dmake -ErrorAction SilentlyContinue) {
61+
dmake test
62+
} else {
63+
make test
64+
}

.github/workflows/ci-smoke.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI Smoke
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
smoke:
10+
name: Smoke / Windows / Perl latest
11+
runs-on: windows-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: shogo82148/actions-setup-perl@v1
17+
with:
18+
distribution: strawberry
19+
perl-version: latest
20+
21+
- shell: pwsh
22+
run: perl -V
23+
24+
- shell: pwsh
25+
run: >
26+
cpanm --skip-satisfied --quiet --notest
27+
Devel::StrictMode
28+
Importer
29+
Import::Into
30+
UNIVERSAL::Object
31+
Win32::Console::PatchForRT33513
32+
33+
- shell: pwsh
34+
run: |
35+
perl Makefile.PL
36+
gmake test

Makefile.PL

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
use 5.008;
1+
use 5.010;
22
use strict;
33
use warnings;
44

5-
use ExtUtils::MakeMaker 6.64;
5+
use ExtUtils::MakeMaker;
66

7-
WriteMakefile(
7+
unless ($^O eq "MSWin32" || $^O eq "cygwin") {
8+
die "OS unsupported\n";
9+
}
10+
11+
WriteMakefile1(
812
NAME => 'TUI::Vision',
913
AUTHOR => 'J. Schneider',
1014
VERSION_FROM => 'lib/TUI/Vision.pm',
@@ -100,3 +104,37 @@ WriteMakefile(
100104

101105
},
102106
);
107+
108+
# Taken from eumm-upgrade by Alexandr Ciornii
109+
sub WriteMakefile1 { # void (%params)
110+
my %params = @_;
111+
my $eumm_version = $ExtUtils::MakeMaker::VERSION;
112+
$eumm_version = eval $eumm_version;
113+
114+
if ($params{TEST_REQUIRES} and $eumm_version < 6.64) {
115+
$params{BUILD_REQUIRES} = {
116+
%{$params{BUILD_REQUIRES} || {}},
117+
%{$params{TEST_REQUIRES}}
118+
};
119+
delete $params{TEST_REQUIRES};
120+
}
121+
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
122+
#EUMM 6.5502 has problems with BUILD_REQUIRES
123+
$params{PREREQ_PM} = {
124+
%{$params{PREREQ_PM} || {}},
125+
%{$params{BUILD_REQUIRES}}
126+
};
127+
delete $params{BUILD_REQUIRES};
128+
}
129+
130+
delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
131+
delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
132+
delete $params{META_MERGE} if $eumm_version < 6.46;
133+
delete $params{META_ADD} if $eumm_version < 6.46;
134+
delete $params{LICENSE} if $eumm_version < 6.31;
135+
delete $params{AUTHOR} if $] < 5.005;
136+
delete $params{ABSTRACT_FROM} if $] < 5.005;
137+
delete $params{BINARY_LOCATION} if $] < 5.005;
138+
139+
WriteMakefile(%params);
140+
}

lib/TUI/Drivers/HardwareInfo/Win32.pm

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,21 +216,21 @@ INIT {
216216
# I<conctl.cpp>
217217
{
218218
my $console;
219-
my $have_console = 0;
219+
my $have_console = false;
220220

221221
$console = Win32::Console->new( STD_INPUT_HANDLE );
222222
if ( $console && $console->$isValid() ) {
223-
$have_console = 1;
223+
$have_console = true;
224224
$consoleHandle[cnInput] = $console;
225225
}
226226
$console = Win32::Console->new( STD_OUTPUT_HANDLE );
227227
if ( $console && $console->$isValid() ) {
228-
$have_console = 1;
228+
$have_console = true;
229229
$consoleHandle[cnStartup] = $console;
230230
}
231231
$console = Win32::Console->new( STD_ERROR_HANDLE );
232232
if ( $console && $console->$isValid() ) {
233-
$have_console = 1;
233+
$have_console = true;
234234
$consoleHandle[cnStartup] = $console;
235235
}
236236

@@ -244,8 +244,6 @@ INIT {
244244
# Create a new generic object
245245
$console = Win32::Console->new();
246246
if ( $console && $console->$isValid() ) {
247-
# If object is a valid console, close the old handle
248-
$console->Close();
249247
# Assign a handle created by CreateFile() to the object
250248
$console->{handle} = Win32API::File::createFile(
251249
'CONIN$',
@@ -261,7 +259,6 @@ INIT {
261259
unless ( $consoleHandle[cnStartup] ) {
262260
$console = Win32::Console->new();
263261
if ( $console && $console->$isValid() ) {
264-
$console->Close();
265262
$console->{handle} = Win32API::File::createFile(
266263
'CONOUT$',
267264
{
@@ -276,7 +273,8 @@ INIT {
276273
$console = Win32::Console->new( GENERIC_READ | GENERIC_WRITE, 0 );
277274
if ( $console && $console->$isValid() ) {
278275
$consoleHandle[cnOutput] = $console;
279-
if ( @sbInfo = $consoleHandle[cnStartup]->Info() ) {
276+
if ( ref $consoleHandle[cnStartup] ) {
277+
@sbInfo = $consoleHandle[cnStartup]->Info();
280278
# Force the screen buffer size to match the window size.
281279
# The Console API guarantees this, but some implementations
282280
# are not compliant (e.g. Wine).
@@ -298,7 +296,7 @@ INIT {
298296

299297
END {
300298
$consoleHandle[cnStartup]->Display()
301-
if $consoleHandle[cnStartup];
299+
if ref $consoleHandle[cnStartup];
302300
Win32::Console::Free()
303301
if $ownsConsole;
304302
}
@@ -321,6 +319,7 @@ sub setCaretSize { # void ($class, $size)
321319
my ( $class, $size ) = @_;
322320
assert ( $class and !ref $class );
323321
assert ( looks_like_number $size );
322+
return unless ref $consoleHandle[cnOutput];
324323
@crInfo = $consoleHandle[cnOutput]->Cursor();
325324
if ( $size == 0 ) {
326325
$crInfo[bVisible] = 0;
@@ -344,6 +343,7 @@ sub setCaretPosition { # void ($class, $x, $y)
344343
assert ( $class and !ref $class );
345344
assert ( looks_like_number $x );
346345
assert ( looks_like_number $y );
346+
return unless ref $consoleHandle[cnOutput];
347347
$consoleHandle[cnOutput]->Cursor($x, $y);
348348
return;
349349
}
@@ -382,6 +382,7 @@ sub setScreenMode { # void ($class, $mode)
382382
my ( $class, $mode ) = @_;
383383
assert ( $class and !ref $class );
384384
assert ( looks_like_number $mode );
385+
return unless ref $consoleHandle[cnOutput];
385386
my %newSize = ( X => 80, Y => 25 );
386387
my %rect = ( Left => 0, Top => 0, Right => 79, Bottom => 24 );
387388

@@ -416,6 +417,7 @@ sub clearScreen { # void ($class, $w, $h);
416417
assert ( $class and !ref $class );
417418
assert ( looks_like_number $w );
418419
assert ( looks_like_number $h );
420+
return unless ref $consoleHandle[cnOutput];
419421
$consoleHandle[cnOutput]->FillAttr( 0x07, $w * $h, 0, 0 );
420422
$consoleHandle[cnOutput]->FillChar( ' ', $w * $h, 0, 0 );
421423
return;
@@ -428,6 +430,7 @@ sub screenWrite { # void ($class, $x, $y, $buf, $len)
428430
assert ( looks_like_number $y );
429431
assert ( ref $buf );
430432
assert ( looks_like_number $len );
433+
return unless ref $consoleHandle[cnOutput];
431434
my %to = ( Left => $x, Top => $y, Right => $x + $len - 1, Bottom => $y );
432435

433436
$consoleHandle[cnOutput]->WriteRect(
@@ -466,6 +469,7 @@ sub getButtonCount { # $num ($class)
466469

467470
sub cursorOn { # void ($class)
468471
assert ( $_[0] and !ref $_[0] );
472+
return unless ref $consoleHandle[cnInput];
469473
# Disable the Quick Edit mode, which inhibits the mouse.
470474
local $consoleMode = $consoleMode;
471475
$consoleMode |= ENABLE_EXTENDED_FLAGS;
@@ -476,6 +480,7 @@ sub cursorOn { # void ($class)
476480

477481
sub cursorOff { # void ($class)
478482
assert ( $_[0] and !ref $_[0] );
483+
return unless ref $consoleHandle[cnInput];
479484
$consoleHandle[cnInput]->Mode( $consoleMode & ~ENABLE_MOUSE_INPUT );
480485
return;
481486
}
@@ -492,6 +497,7 @@ sub getMouseEvent { # $bool ($class, $event)
492497
my ( $class, $event ) = @_;
493498
assert ( $class and !ref $class );
494499
assert ( blessed $event );
500+
return unless ref $consoleHandle[cnInput];
495501
if ( !$pendingEvent ) {
496502
$pendingEvent = $consoleHandle[cnInput]->GetEvents();
497503
if ( $pendingEvent ) {
@@ -517,6 +523,7 @@ sub getKeyEvent { # $bool ($class, $event)
517523
my ( $class, $event ) = @_;
518524
assert ( $class and !ref $class );
519525
assert ( blessed $event );
526+
return unless ref $consoleHandle[cnInput];
520527
if ( !$pendingEvent ) {
521528
$pendingEvent = $consoleHandle[cnInput]->GetEvents();
522529
if ( $pendingEvent ) {
@@ -588,6 +595,7 @@ sub setCtrlBrkHandler { # $success ($class, $install)
588595
assert ( @_ == 2 );
589596
assert ( $class and !ref $class );
590597
assert ( !defined $install or !ref $install );
598+
return unless ref $consoleHandle[cnInput];
591599
my $consoleMode = $consoleHandle[cnInput]->Mode() || return;
592600
return $consoleHandle[cnInput]->Mode(
593601
$install

0 commit comments

Comments
 (0)