Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support #259

Open
wants to merge 9 commits into
base: main-2.X
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- windows
pull_request:
schedule:
# Every night at 03:00
Expand Down Expand Up @@ -77,15 +78,25 @@ jobs:
./dashi sidekick plugins install sidekick_vault
./dashi vault -h

integration_tests_windows:
integration_tests_windows_local:
runs-on: windows-2022

# They don't work yet, but someone should invest time here
if: 'false'
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- name: Set up Chocolatey
run: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- name: Install Dart SDK
run: choco install dart-sdk --version 3.0
- name: Add Dart SDK to PATH
shell: powershell
run: |
$dartSdkPath = "C:\\tools\\dart-sdk\\bin"
echo $dartSdkPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Dart version
run: dart --version
- uses: actions/checkout@v1
- name: Install dependencies
run: cd sidekick && dart pub get --no-precompile
- name: Run tests
run: cd sidekick && dart test test/test_runner.dart
env:
SIDEKICK_PUB_DEPS: "false"
SIDEKICK_ANALYZE: "false"
19 changes: 19 additions & 0 deletions .github/workflows/unit_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ jobs:
- name: Run tests sidekick_core
run: cd sidekick_core && dart test

core_test_windows:
runs-on: windows-2022

steps:
- name: Set up Chocolatey
run: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- name: Install Dart SDK
run: choco install dart-sdk --version 3.0.0
- name: Add Dart SDK to PATH
shell: powershell
run: |
$dartSdkPath = "C:\\tools\\dart-sdk\\bin"
echo $dartSdkPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/checkout@v1
- name: Install dependencies sidekick_core
run: cd sidekick_core && dart pub get --no-precompile
- name: Run tests sidekick_core
run: cd sidekick_core && dart test

vault_test:
runs-on: ubuntu-latest

Expand Down
16 changes: 14 additions & 2 deletions sidekick_core/lib/src/commands/recompile_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ class RecompileCommand extends Command {
Future<void> run() async {
final installScript =
SidekickContext.sidekickPackage.root.file('tool/install.sh');
final process = start(installScript.path, nothrow: true, terminal: true);
exitCode = process.exitCode ?? -1;
final bash = which('bash');
final String bashExe;
if (bash.found) {
bashExe = bash.path!;
} else {
bashExe = '/usr/bin/bash';
}
final progress = startFromArgs(
bashExe,
[installScript.path],
nothrow: true,
terminal: true,
);
exitCode = progress.exitCode ?? -1;
}
}
7 changes: 5 additions & 2 deletions sidekick_core/lib/src/flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ int flutter(
dcli.waitForEx(future);
}
}
final exe = Platform.isWindows
? sdk.file('bin/flutter.bat')
: sdk.file('bin/flutter');

final process = dcli.startFromArgs(
Platform.isWindows ? 'bash' : sdk.file('bin/flutter').path,
[if (Platform.isWindows) sdk.file('bin/flutter.exe').path, ...args],
exe.path,
args,
workingDirectory: workingDirectory?.absolute.path,
nothrow: nothrow || throwOnError != null,
progress: progress,
Expand Down
Loading