Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.47.5"
"flutter": "3.50.0"
}
2 changes: 1 addition & 1 deletion .github/actions/setup-zig/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
version:
description: Zig version to install
required: false
default: '0.16.0'
default: '0.17.1'

runs:
using: composite
Expand Down
50 changes: 49 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ jobs:
flutter pub get
flutter build apk --debug

- name: Enable KVM access
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Run Android hash smoke test
uses: reactivecircus/android-emulator-runner@v2
with:
working-directory: example
api-level: 35
target: google_apis
arch: x86_64
profile: pixel_2
emulator-options: -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect -no-snapshot
script: flutter test integration_test/hash_smoke_test.dart -d emulator-5554

build-ios:
runs-on: macos-latest

Expand Down Expand Up @@ -123,6 +140,20 @@ jobs:
flutter pub get
flutter build ios --debug --no-codesign

- name: Run iOS hash smoke test
run: |
set -euo pipefail
device_id="$(xcrun simctl list devices available | awk -F '[()]' '/iPhone/ { print $2; exit }')"
if [[ -z "${device_id}" ]]; then
echo 'No available iPhone Simulator found.' >&2
xcrun simctl list devices available >&2
exit 1
fi
xcrun simctl boot "${device_id}" 2>/dev/null || true
xcrun simctl bootstatus "${device_id}" -b
cd example
flutter test integration_test/hash_smoke_test.dart -d "${device_id}"

build-macos:
runs-on: macos-latest

Expand Down Expand Up @@ -166,6 +197,12 @@ jobs:
exit 1
fi

- name: Run macOS hash smoke test
run: |
flutter config --enable-macos-desktop
cd example
flutter test integration_test/hash_smoke_test.dart -d macos

build-linux:
runs-on: ubuntu-latest

Expand All @@ -178,7 +215,7 @@ jobs:
- name: Install Linux desktop dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev xvfb

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand All @@ -203,6 +240,11 @@ jobs:
flutter pub get
flutter build linux --debug

- name: Run Linux hash smoke test
run: |
cd example
xvfb-run -a flutter test integration_test/hash_smoke_test.dart -d linux

build-windows:
runs-on: windows-latest

Expand Down Expand Up @@ -238,6 +280,12 @@ jobs:
flutter pub get
flutter build windows --debug

- name: Run Windows hash smoke test
shell: pwsh
run: |
Set-Location example
flutter test integration_test/hash_smoke_test.dart -d windows

verify-prebuilts:
runs-on: macos-latest

Expand Down
26 changes: 13 additions & 13 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "ad70ec4617166f1c38e5d2bfd388af71fda14f06"
revision: "ab2912035e160d9cad6306df307576da6128ebdb"
channel: "stable"

project_type: package_ffi
Expand All @@ -13,23 +13,23 @@ project_type: package_ffi
migration:
platforms:
- platform: root
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
create_revision: ab2912035e160d9cad6306df307576da6128ebdb
base_revision: ab2912035e160d9cad6306df307576da6128ebdb
- platform: android
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
create_revision: ab2912035e160d9cad6306df307576da6128ebdb
base_revision: ab2912035e160d9cad6306df307576da6128ebdb
- platform: ios
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
create_revision: ab2912035e160d9cad6306df307576da6128ebdb
base_revision: ab2912035e160d9cad6306df307576da6128ebdb
- platform: linux
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
create_revision: ab2912035e160d9cad6306df307576da6128ebdb
base_revision: ab2912035e160d9cad6306df307576da6128ebdb
- platform: macos
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
create_revision: ab2912035e160d9cad6306df307576da6128ebdb
base_revision: ab2912035e160d9cad6306df307576da6128ebdb
- platform: windows
create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06
create_revision: ab2912035e160d9cad6306df307576da6128ebdb
base_revision: ab2912035e160d9cad6306df307576da6128ebdb

# User provided section

Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Releases

## 0.0.6

### Changed

- Updated the bundled Zig core to `zig-files-hash` `v0.0.8` / Zig `0.17.1`.
- Removed the Apple static-library repacking workaround now that Zig emits correctly aligned Mach-O archives ([ziglang/zig#35984](https://codeberg.org/ziglang/zig/pulls/35984)).
- Updated the Zig CI version and platform build scripts for the new core version. C ABI remains v4.
- Adapted the iOS Simulator build hook to Flutter 3.50's stricter native asset
validation by extracting the requested architecture from the universal Zig
dylib.

### Example app

- Migrated the example app from Flutter's deprecated Material import to the
standalone `material_ui` package recommended for Flutter 3.50.

### CI / validation

- Added target-platform hash smoke tests for Android, iOS, macOS, Linux, and
Windows. Each target verifies the reference SHA-256 digest through both
`stringHash` and `fileHash`.

---

## 0.0.5

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Use the package from pub.dev:

```yaml
dependencies:
flutter_file_hash: ^0.0.5
flutter_file_hash: ^0.0.6
```

For local development, use a path dependency:
Expand Down
5 changes: 5 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml

# Additional information about this file can be found at
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ group = "com.preeternal.flutter_file_hash"
version = "1.0-SNAPSHOT"

buildscript {
val kotlinVersion = "2.3.20"
val kotlinVersion = "2.4.0"
repositories {
google()
mavenCentral()
}

dependencies {
classpath("com.android.tools.build:gradle:9.0.1")
classpath("com.android.tools.build:gradle:9.1.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/.fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.47.5"
"flutter": "3.50.0"
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
4 changes: 2 additions & 2 deletions example/android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pluginManagement {

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "9.0.1" apply false
id("org.jetbrains.kotlin.android") version "2.3.20" apply false
id("com.android.application") version "9.1.1" apply false
id("org.jetbrains.kotlin.android") version "2.4.0" apply false
}

include(":app")
36 changes: 36 additions & 0 deletions example/integration_test/hash_smoke_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import 'dart:io';

import 'package:flutter_file_hash/flutter_file_hash.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

const _sha256Abc =
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets('hashes the reference vector on the target platform', (
tester,
) async {
expect(stringHash('abc', algorithm: HashAlgorithm.sha256), _sha256Abc);

final tempDir = await Directory.systemTemp.createTemp(
'flutter_file_hash_smoke_',
);
try {
final file = File.fromUri(tempDir.uri.resolve('input.txt'));
await file.writeAsString('abc');
expect(
await fileHash(file.path, algorithm: HashAlgorithm.sha256),
_sha256Abc,
);
} finally {
await tempDir.delete(recursive: true);
}

// Keep a clear marker in CI logs in addition to the test assertion.
// ignore: avoid_print
print('FILE_HASH_FLUTTER_SMOKE_PASS');
});
}
45 changes: 24 additions & 21 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import 'dart:io';
import 'dart:math' as math;

import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_file_hash/flutter_file_hash.dart';
import 'package:material_ui/material_ui.dart';

void main() {
runApp(const HashExampleApp());
Expand Down Expand Up @@ -322,26 +322,29 @@ class _HashDemoPageState extends State<HashDemoPage> {
},
),
const SizedBox(height: 8),
CheckboxListTile(
contentPadding: EdgeInsets.zero,
controlAffinity: ListTileControlAffinity.leading,
value: _useMmap,
onChanged: _fileRunning || _benchmarkRunning
? null
: (value) {
setState(() {
_useMmap = value ?? false;
_fileHash = '';
_fileElapsedMs = null;
_fileStatus = null;
_benchmarkResults = const [];
_benchmarkStatus = null;
});
},
title: const Text('Use mmap for local files'),
subtitle: Text(
'Applies to Hash file and Benchmark. Use only stable local files; ignored for Android content:// URIs.',
style: TextStyle(color: palette.muted),
Material(
type: MaterialType.transparency,
child: CheckboxListTile(
contentPadding: EdgeInsets.zero,
controlAffinity: ListTileControlAffinity.leading,
value: _useMmap,
onChanged: _fileRunning || _benchmarkRunning
? null
: (value) {
setState(() {
_useMmap = value ?? false;
_fileHash = '';
_fileElapsedMs = null;
_fileStatus = null;
_benchmarkResults = const [];
_benchmarkStatus = null;
});
},
title: const Text('Use mmap for local files'),
subtitle: Text(
'Applies to Hash file and Benchmark. Use only stable local files; ignored for Android content:// URIs.',
style: TextStyle(color: palette.muted),
),
),
),
],
Expand Down
Loading
Loading