creativecreatorormaybenot
Committed by GitHub

Release wakelock_macos (#89)

* Release wakelock_macos

* Fix warnings

* macOS integration tests only on dev

* Correct syntax

* Add macOS test stub

* Update platforms

* Enable macOS in config

* Fix tests

* Correct private getter
... ... @@ -30,6 +30,7 @@ jobs:
- 'dev'
package:
- 'wakelock'
- 'wakelock_macos'
- 'wakelock_platform_interface'
- 'wakelock_web'
fail-fast: false
... ... @@ -50,7 +51,7 @@ jobs:
test:
timeout-minutes: 14
runs-on: macos-latest
name: Testing of ${{ matrix.package }} (${{ matrix.channel }}; ${{ matrix.device }})
name: Testing of ${{ matrix.package }} (${{ matrix.channel }})
strategy:
matrix:
device:
... ... @@ -62,6 +63,7 @@ jobs:
- 'dev'
package:
- 'wakelock'
- 'wakelock_macos'
- 'wakelock_platform_interface'
# Web tests do not work for now.
# - 'wakelock_web'
... ... @@ -92,10 +94,18 @@ jobs:
working-directory: ${{ matrix.package }}
- name: Run unit tests (chrome)
if: matrix.package == 'wakelock_web'
run: flutter test --platform chrome
run: |
flutter config --enable-web
flutter test --platform chrome
working-directory: ${{ matrix.package }}
- name: Integration tests on iOS
if: matrix.package == 'wakelock'
run: |
cd wakelock/example
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/wakelock_test.dart --no-sound-null-safety
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/wakelock_test.dart
- name: Integration tests on macOS
if: matrix.package == 'wakelock_macos' && matrix.channel == 'dev'
run: |
cd wakelock/example
flutter config --enable-macos-desktop
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/wakelock_test.dart -d macos
... ...
... ... @@ -23,6 +23,7 @@ jobs:
matrix:
package:
- 'wakelock'
- 'wakelock_macos'
- 'wakelock_platform_interface'
- 'wakelock_web'
fail-fast: false
... ...
... ... @@ -13,10 +13,10 @@ jobs:
strategy:
matrix:
package:
# - 'wakelock'
# - 'wakelock_platform_interface'
- 'wakelock_web'
- 'wakelock'
- 'wakelock_macos'
- 'wakelock_platform_interface'
- 'wakelock_web'
fail-fast: false
steps:
... ... @@ -35,6 +35,7 @@ jobs:
matrix:
package:
- 'wakelock'
- 'wakelock_macos'
- 'wakelock_platform_interface'
- 'wakelock_web'
fail-fast: false
... ... @@ -52,19 +53,19 @@ jobs:
echo ::set-output name=changed::$?
set -e
- name: Extract package version
# if: steps.pubspec.outputs.changed == 0
if: steps.pubspec.outputs.changed == 0
run: |
cd ${{ matrix.package }}
echo "VERSION=$(awk '{if ($1 ~ /^version:/) print $2}' pubspec.yaml)" >> $GITHUB_ENV
- uses: sakebook/actions-flutter-pub-publisher@v1.3.1
# if: steps.pubspec.outputs.changed == 0
if: steps.pubspec.outputs.changed == 0
with:
package_directory: ${{ matrix.package }}
credential: ${{ secrets.PUB_CREDENTIALS }}
flutter_package: true
skip_test: true
- name: Create Release
# if: steps.pubspec.outputs.changed == 0
if: steps.pubspec.outputs.changed == 0
id: create_release
uses: actions/create-release@v1.1.4
env:
... ...
## 0.4.0-nullsafety.0
* Added macOS support 🚀
## 0.3.0-nullsafety.3
* Add supported platforms to README.
... ...
... ... @@ -19,10 +19,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/wakelock/ios"
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
integration_test: 5ed24a436eb7ec17b6a13046e9bf7ca4a404e59e
wakelock: bfc7955c418d0db797614075aabbc58a39ab5107
PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d
COCOAPODS: 1.9.3
COCOAPODS: 1.10.0
... ...
... ... @@ -150,7 +150,6 @@
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
FAD6D21B222DFE9FB43C310E /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
... ... @@ -258,24 +257,6 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
FAD6D21B222DFE9FB43C310E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
... ...
... ... @@ -15,7 +15,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
wakelock_macos: d4628428650258e4b7bcb43458408b2a83385ea1
wakelock_macos: 493294b94b32c558d5ca409b3991a131c89c1970
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
... ...
... ... @@ -6,7 +6,10 @@ publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=2.12.0-0 <3.0.0'
# Opt out of null safety on purpose because dependencies do not support sound null safety yet
# and flutter drive ignores the --no-sound-null-safety parameter.
# todo(creativecreatorormaybenot): switch to 2.12.0-0 lower bound.
sdk: '>=2.11.0 <3.0.0'
dependencies:
flutter:
... ...
... ... @@ -5,9 +5,9 @@
Pod::Spec.new do |s|
s.name = 'wakelock'
s.version = '0.0.1'
s.summary = 'Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, and web.'
s.summary = 'Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, macOS, and web.'
s.description = <<-DESC
Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, and web.
Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, macOS, and web.
DESC
s.homepage = 'http://example.com'
s.license = { :file => '../LICENSE' }
... ...
... ... @@ -4,7 +4,15 @@ import 'package:flutter/foundation.dart';
import 'package:wakelock_macos/wakelock_macos.dart';
import 'package:wakelock_platform_interface/wakelock_platform_interface.dart';
final _wakelockPlatformInstance = !kIsWeb &&
/// The [WakelockPlatformInterface] that is used by [Wakelock].
///
/// This needs to be exposed for testing as unit tests might run on macOS.
/// In that case, the "hacky" instance override that we use here would be
/// triggered for the unit tests, even though the unit tests should actually
/// test the `pigeon` method channel implementation. Therefore, we want to
/// override this in tests that run on macOS (where there is no actual device).
@visibleForTesting
var wakelockPlatformInstance = !kIsWeb &&
// Assigning the macOS platform instance like this is not optimal.
// Ideally, we would use the default method channel instance on macOS,
// however, it is not yet entirely clear how to integrate with pigeon.
... ... @@ -66,7 +74,7 @@ class Wakelock {
static Future<void> toggle({
required bool enable,
}) {
return _wakelockPlatformInstance.toggle(enable: enable);
return wakelockPlatformInstance.toggle(enable: enable);
}
/// Returns whether the wakelock is currently enabled or not.
... ... @@ -77,5 +85,5 @@ class Wakelock {
/// ```dart
/// bool wakelockEnabled = await Wakelock.enabled;
/// ```
static Future<bool> get enabled => _wakelockPlatformInstance.enabled;
static Future<bool> get enabled => wakelockPlatformInstance.enabled;
}
... ...
name: wakelock
description: >-2
Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on
Android, iOS, and web.
version: 0.3.0-nullsafety.3
Android, iOS, macOS, and web.
version: 0.4.0-nullsafety.0
homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock
environment:
... ... @@ -15,7 +15,6 @@ dependencies:
meta: ^1.2.0
# Include in a followup version when wakelock_macos has been published.
wakelock_macos: ^0.1.0-nullsafety.0
wakelock_platform_interface: ^0.2.0-nullsafety.2
wakelock_web: ^0.2.0-nullsafety.0
... ...
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:wakelock/wakelock.dart';
import 'package:wakelock_platform_interface/messages.dart';
import 'package:wakelock_platform_interface/wakelock_platform_interface.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
... ... @@ -9,6 +12,12 @@ void main() {
late FakeWakelockApi fakeWakelock;
setUpAll(() {
if (Platform.isMacOS) {
// See the member documentation for the reason behind this.
// todo(creativecreatorormaybenot): remove this once macOS is migrated
// todo| to pigeon.
wakelockPlatformInstance = WakelockPlatformInterface.instance;
}
fakeWakelock = FakeWakelockApi();
});
... ...
... ... @@ -4,9 +4,9 @@
Pod::Spec.new do |s|
s.name = 'wakelock_macos'
s.version = '0.0.1'
s.summary = 'Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, and web.'
s.summary = 'Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, macOS, and web.'
s.description = <<-DESC
Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, and web.
Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, macOS, and web.
DESC
s.homepage = 'https://github.com/creativecreatorormaybenot/wakelock/tree/master/packages/wakelock_macos'
s.license = { :type => 'BSD', :file => '../LICENSE' }
... ...
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
... ... @@ -12,4 +11,8 @@ void main() {
// example app.
// Consequently, the macOS implementation will be tested in CI via the
// example integration test running on -d macos.
test('stub', () {
final acceptUnitTestingDefeat = true;
expect(acceptUnitTestingDefeat, isTrue);
});
}
... ...