Skip to content

Commit

Permalink
fix windows compress script, file info, and so on. (#83)
Browse files Browse the repository at this point in the history
* fix windows compress script
See: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-7.1#example-4--compress-a-directory-that-excludes-the-root-directory

* 0.1.0-alpha.1

* change windows file info

* fix home indicator

* fix noisy snackbar

* title centering

* fix msvc path
  • Loading branch information
sensuikan1973 authored Mar 20, 2021
1 parent 0e8f31d commit ac6ed61
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 26 deletions.
12 changes: 8 additions & 4 deletions .github/scripts/prepare_to_pack_for_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# See: https://flutter.dev/desktop#windows
# See: https://github.com/sensuikan1973/pedax/pull/71#issuecomment-798849250
target_dll_path="/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.28.29325/x64/Microsoft.VC142.CRT"
cp "$target_dll_path/vcruntime140.dll" build/windows/runner/Release/
cp "$target_dll_path/vcruntime140_1.dll" build/windows/runner/Release/
cp "$target_dll_path/msvcp140.dll" build/windows/runner/Release/
# See: https://github.com/sensuikan1973/pedax/pull/83#issuecomment-803240876
msvc_path="/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC"
ls "$msvc_path"

target_vc_path="$msvc_path/14.28.29910/x64/Microsoft.VC142.CRT"
cp "$target_vc_path/vcruntime140.dll" build/windows/runner/Release/
cp "$target_vc_path/vcruntime140_1.dll" build/windows/runner/Release/
cp "$target_vc_path/msvcp140.dll" build/windows/runner/Release/
9 changes: 5 additions & 4 deletions .github/workflows/flutter_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
timeout-minutes: 20
strategy:
fail-fast: false # I want results from all OSes even if one fails.
matrix:
Expand Down Expand Up @@ -51,6 +51,10 @@ jobs:
run: flutter doctor -v
- name: build
run: flutter build ${{ matrix.subcommand }} --${{ matrix.mode }}

# - name: debug
# uses: mxschmitt/action-tmate@v3

- name: prepare to pack
shell: bash
run: ${{ matrix.prepare_to_pack_script }}
Expand All @@ -65,9 +69,6 @@ jobs:
shell: bash
run: .github/scripts/output_build_info.sh ${{ matrix.distribution_path }}

# - name: debug
# uses: mxschmitt/action-tmate@v3

- uses: actions/upload-artifact@v2
with:
name: pedax-${{ runner.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
run: |-
mkdir -p ${{ env.PUBLISH_DIR }}
cd ${{ matrix.distribution_path }}
powershell Compress-Archive -Path *.* -DestinationPath $Env:GITHUB_WORKSPACE/${{ env.PUBLISH_DIR }}/pedax-${{ runner.os }}.zip
powershell Compress-Archive -Path ./* -DestinationPath $Env:GITHUB_WORKSPACE/${{ env.PUBLISH_DIR }}/pedax-${{ runner.os }}.zip
- name: compress files (macOS, Linux)
if: runner.os == 'macOS' || runner.os == 'Linux'
run: |-
Expand Down
17 changes: 9 additions & 8 deletions lib/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,19 @@ class _HomeState extends State<Home> {

@override
Widget build(BuildContext context) {
final edaxInitOnce = context.select<BoardNotifier, bool>((notifier) => notifier.value.edaxInitOnce);
if (!edaxInitOnce) return const Center(child: CupertinoActivityIndicator());
final bookLoadStatus = context.select<BoardNotifier, BookLoadStatus>((notifier) => notifier.value.bookLoadStatus);
if (bookLoadStatus == BookLoadStatus.loaded) _showSnackBarOfBookLoaded();
final edaxServerSpawned = context.select<BoardNotifier, bool>((notifier) => notifier.value.edaxServerSpawned);
if (!edaxServerSpawned) return const Center(child: CupertinoActivityIndicator());
final bookLoadStatus = context.select<BoardNotifier, BookLoadStatus?>((notifier) => notifier.value.bookLoadStatus);
if (bookLoadStatus == BookLoadStatus.loading) _showSnackBarOfBookLoading();
if (bookLoadStatus == BookLoadStatus.loaded) _showSnackBarOfBookLoaded();

return Scaffold(
appBar: AppBar(
leading: _menu(),
title: Text(AppLocalizations.of(context)!.analysisMode, textAlign: TextAlign.center),
title: Text(AppLocalizations.of(context)!.analysisMode),
centerTitle: true,
),
body: context.select<BoardNotifier, bool>((notifier) => notifier.value.edaxServerSpawned)
body: context.select<BoardNotifier, bool>((notifier) => notifier.value.edaxInitOnce)
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expand Down Expand Up @@ -159,7 +160,7 @@ class _HomeState extends State<Home> {
void _showSnackBarOfBookLoaded() {
context.read<BoardNotifier>().value.bookLoadStatus = BookLoadStatus.notifiedToUser;
WidgetsBinding.instance?.addPostFrameCallback((_) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context)!.finishedLoadingBookFile, textAlign: TextAlign.center),
Expand All @@ -171,7 +172,7 @@ class _HomeState extends State<Home> {
void _showSnackBarOfBookLoading() {
context.read<BoardNotifier>().value.bookLoadStatus = BookLoadStatus.notifiedToUser;
WidgetsBinding.instance?.addPostFrameCallback((_) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).removeCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(AppLocalizations.of(context)!.loadingBookFile, textAlign: TextAlign.center),
Expand Down
8 changes: 4 additions & 4 deletions lib/models/board_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ class BoardNotifier extends ValueNotifier<BoardState> {
notifyListeners();
});

_edaxServerPort.send(const InitRequest());

value
..edaxServerSpawned = true
..level = level
..hintStepByStep = hintStepByStep;
notifyListeners();

_edaxServerPort.send(const InitRequest());
}

void requestInit() => _edaxServerPort.send(const InitRequest());
Expand Down Expand Up @@ -127,15 +127,15 @@ class BoardNotifier extends ValueNotifier<BoardState> {
..lastMove = message.lastMove
..currentMoves = message.moves;
} else if (message is InitResponse) {
if (!value.edaxInitOnce) value.edaxInitOnce = true;
_requestLatestHintList(message.moves);
value
..board = message.board
..squaresOfPlayer = UnmodifiableListView(value.board.squaresOfPlayer)
..squaresOfOpponent = UnmodifiableListView(value.board.squaresOfOpponent)
..currentColor = message.currentColor
..lastMove = message.lastMove
..currentMoves = message.moves;
if (!value.edaxInitOnce) value.edaxInitOnce = true;
_requestLatestHintList(message.moves);
} else if (message is RotateResponse) {
_requestLatestHintList(message.moves);
value
Expand Down
2 changes: 1 addition & 1 deletion lib/models/board_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BoardState {
UnmodifiableListView<Hint> hints = UnmodifiableListView([]);
bool edaxInitOnce = false;
String currentMoves = '';
BookLoadStatus bookLoadStatus = BookLoadStatus.loading;
BookLoadStatus? bookLoadStatus;
bool hintIsVisible = true;
bool edaxServerSpawned = false;
int bestScore = 0;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ issue_tracker: https://github.com/sensuikan1973/pedax/issues
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.1.0-alpha.0+1
version: 0.1.0-alpha.1+1

environment: # See: https://dart.dev/tools/pub/pubspec#sdk-constraints
sdk: '>=2.12.0 <3.0.0'
Expand Down
6 changes: 3 additions & 3 deletions windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ BEGIN
BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "com.example" "\0"
VALUE "FileDescription", "A new Flutter project." "\0"
VALUE "CompanyName", "com.done.sensuikan1973" "\0"
VALUE "FileDescription", "othello Board GUI with edax." "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "pedax" "\0"
VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0"
VALUE "LegalCopyright", "Copyright (C) 2021 com.done.sensuikan1973. All rights reserved." "\0"
VALUE "OriginalFilename", "pedax.exe" "\0"
VALUE "ProductName", "pedax" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
Expand Down

0 comments on commit ac6ed61

Please sign in to comment.