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

Fix compiler execution on ARM64. #249

Open
wants to merge 3 commits into
base: main
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
36 changes: 36 additions & 0 deletions .github/workflows/compiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,39 @@ jobs:
# with:
# lcov-file: ./packages/vector_graphics_compiler/coverage/lcov.info
# github-token: ${{ secrets.GITHUB_TOKEN }}

test_windows:
runs-on: windows-2022
defaults:
run:
working-directory: packages/vector_graphics_compiler
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
- run: flutter test

test_mac_x86:
runs-on: macos-13
defaults:
run:
working-directory: packages/vector_graphics_compiler
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
- run: flutter test

test_mac_m1:
runs-on: macos-14
defaults:
run:
working-directory: packages/vector_graphics_compiler
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
cache: true
- run: flutter test
44 changes: 44 additions & 0 deletions packages/vector_graphics_compiler/lib/src/_bin_root.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:ffi';
import 'dart:io';

/// Get executable root directory
String binRootDir() {
final Directory cacheRoot;
if (Platform.resolvedExecutable.contains('flutter_tester')) {
cacheRoot = File(Platform.resolvedExecutable).parent.parent.parent.parent;
} else if (Platform.resolvedExecutable.contains('dart')) {
cacheRoot = File(Platform.resolvedExecutable).parent.parent.parent;
} else {
throw Exception('Unknown executable: ${Platform.resolvedExecutable}');
}
final String platform;
if (Platform.isWindows) {
if (Abi.current() == Abi.windowsX64) {
platform = 'windows-x64';
} else if (Abi.current() == Abi.windowsArm64) {
platform = 'windows-arm64';
} else {
throw Exception('Unsupported ABI: ${Abi.current()}');
}
} else if (Platform.isMacOS) {
platform = 'darwin-x64';
} else if (Platform.isLinux) {
if (Abi.current() == Abi.linuxX64) {
platform = 'linux-x64';
} else if (Abi.current() == Abi.linuxArm64) {
platform = 'linux-arm64';
} else {
throw Exception('Unsupported ABI: ${Abi.current()}');
}
} else {
throw Exception('Cannot identify platform ${Platform.localeName}');
}
final String output = '${cacheRoot.path}/artifacts/engine/$platform/';
if (!Directory(output).existsSync()) {
throw Exception('Could not find directory $output for executables');
}
return output;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,24 @@
// found in the LICENSE file.

import 'dart:io';

import '_bin_root.dart';
import 'svg/path_ops.dart';

/// Look up the location of the pathops from flutter's artifact cache.
bool initializePathOpsFromFlutterCache() {
final Directory cacheRoot;
if (Platform.resolvedExecutable.contains('flutter_tester')) {
cacheRoot = File(Platform.resolvedExecutable).parent.parent.parent.parent;
} else if (Platform.resolvedExecutable.contains('dart')) {
cacheRoot = File(Platform.resolvedExecutable).parent.parent.parent;
} else {
print('Unknown executable: ${Platform.resolvedExecutable}');
return false;
}

final String platform;
final String executable;
if (Platform.isWindows) {
platform = 'windows-x64';
executable = 'path_ops.dll';
} else if (Platform.isMacOS) {
platform = 'darwin-x64';
executable = 'libpath_ops.dylib';
} else if (Platform.isLinux) {
platform = 'linux-x64';
executable = 'libpath_ops.so';
} else {
print('path_ops not supported on ${Platform.localeName}');
return false;
}
final String pathops =
'${cacheRoot.path}/artifacts/engine/$platform/$executable';
final String pathops = '${binRootDir()}/$executable';
if (!File(pathops).existsSync()) {
print('Could not locate libpathops at $pathops.');
print('Ensure you are on a supported version of flutter and then run ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,24 @@
// found in the LICENSE file.

import 'dart:io';

import '_bin_root.dart';
import 'svg/tessellator.dart';

/// Look up the location of the tessellator from flutter's artifact cache.
bool initializeTessellatorFromFlutterCache() {
final Directory cacheRoot;
if (Platform.resolvedExecutable.contains('flutter_tester')) {
cacheRoot = File(Platform.resolvedExecutable).parent.parent.parent.parent;
} else if (Platform.resolvedExecutable.contains('dart')) {
cacheRoot = File(Platform.resolvedExecutable).parent.parent.parent;
} else {
print('Unknown executable: ${Platform.resolvedExecutable}');
return false;
}

final String platform;
final String executable;
if (Platform.isWindows) {
platform = 'windows-x64';
executable = 'libtessellator.dll';
} else if (Platform.isMacOS) {
platform = 'darwin-x64';
executable = 'libtessellator.dylib';
} else if (Platform.isLinux) {
platform = 'linux-x64';
executable = 'libtessellator.so';
} else {
print('Tesselation not supported on ${Platform.localeName}');
return false;
}
final String tessellator =
'${cacheRoot.path}/artifacts/engine/$platform/$executable';
final String tessellator = '${binRootDir()}/$executable';
if (!File(tessellator).existsSync()) {
print('Could not locate libtessellator at $tessellator.');
print('Ensure you are on a supported version of flutter and then run ');
Expand Down
2 changes: 2 additions & 0 deletions packages/vector_graphics_compiler/test/parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,8 @@ void main() {
.translated(-250, -250),
),
);
}, onPlatform: <String, Skip>{
'windows': const Skip('small floating point differences on Windows')
});

test('Opaque blend mode gets a save layer', () {
Expand Down