Unverified Commit 25e9d049 authored by stuartmorgan's avatar stuartmorgan Committed by GitHub

Add Linux GTK artifacts to unpack list (#57452)

To simplify development of the in-progress GTK embedding, which will
replace the GLFW embedding on Linux, add the GTK artifacts to the unpack
list. This means that until the transition, both the GLFW and GTK
artifacts will be unpacked.

Part of #54860
parent f991308e
...@@ -49,6 +49,8 @@ enum Artifact { ...@@ -49,6 +49,8 @@ enum Artifact {
iproxy, iproxy,
/// The root of the Linux desktop sources. /// The root of the Linux desktop sources.
linuxDesktopPath, linuxDesktopPath,
// The root of the cpp headers for Linux desktop.
linuxHeaders,
// The root of the cpp client code for Linux desktop. // The root of the cpp client code for Linux desktop.
linuxCppClientWrapper, linuxCppClientWrapper,
/// The root of the Windows desktop sources. /// The root of the Windows desktop sources.
...@@ -118,6 +120,8 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo ...@@ -118,6 +120,8 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
return 'iproxy'; return 'iproxy';
case Artifact.linuxDesktopPath: case Artifact.linuxDesktopPath:
return ''; return '';
case Artifact.linuxHeaders:
return 'flutter_linux';
case Artifact.windowsDesktopPath: case Artifact.windowsDesktopPath:
return ''; return '';
case Artifact.windowsCppClientWrapper: case Artifact.windowsCppClientWrapper:
...@@ -356,6 +360,7 @@ class CachedArtifacts extends Artifacts { ...@@ -356,6 +360,7 @@ class CachedArtifacts extends Artifacts {
case Artifact.linuxDesktopPath: case Artifact.linuxDesktopPath:
case Artifact.windowsDesktopPath: case Artifact.windowsDesktopPath:
case Artifact.flutterMacOSPodspec: case Artifact.flutterMacOSPodspec:
case Artifact.linuxHeaders:
// TODO(jonahwilliams): remove once debug desktop artifacts are uploaded // TODO(jonahwilliams): remove once debug desktop artifacts are uploaded
// under a separate directory from the host artifacts. // under a separate directory from the host artifacts.
// https://github.com/flutter/flutter/issues/38935 // https://github.com/flutter/flutter/issues/38935
...@@ -530,6 +535,7 @@ class LocalEngineArtifacts extends Artifacts { ...@@ -530,6 +535,7 @@ class LocalEngineArtifacts extends Artifacts {
case Artifact.iproxy: case Artifact.iproxy:
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName).path; return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName).path;
case Artifact.linuxDesktopPath: case Artifact.linuxDesktopPath:
case Artifact.linuxHeaders:
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName); return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
case Artifact.linuxCppClientWrapper: case Artifact.linuxCppClientWrapper:
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName); return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
......
...@@ -8,7 +8,7 @@ import '../../base/file_system.dart'; ...@@ -8,7 +8,7 @@ import '../../base/file_system.dart';
import '../depfile.dart'; import '../depfile.dart';
/// Unpack the engine artifact list [artifacts] from [engineSourcePath] and /// Unpack the engine artifact list [artifacts] from [engineSourcePath] and
/// [clientSourcePath] (if provided) into a directory [outputDirectory]. /// [clientSourcePaths] (if provided) into a directory [outputDirectory].
/// ///
/// Returns a [Depfile] including all copied files. /// Returns a [Depfile] including all copied files.
/// ///
...@@ -19,7 +19,7 @@ Depfile unpackDesktopArtifacts({ ...@@ -19,7 +19,7 @@ Depfile unpackDesktopArtifacts({
@required List<String> artifacts, @required List<String> artifacts,
@required Directory outputDirectory, @required Directory outputDirectory,
@required String engineSourcePath, @required String engineSourcePath,
String clientSourcePath, List<String> clientSourcePaths,
}) { }) {
final List<File> inputs = <File>[]; final List<File> inputs = <File>[];
final List<File> outputs = <File>[]; final List<File> outputs = <File>[];
...@@ -46,9 +46,10 @@ Depfile unpackDesktopArtifacts({ ...@@ -46,9 +46,10 @@ Depfile unpackDesktopArtifacts({
inputs.add(inputFile); inputs.add(inputFile);
outputs.add(destinationFile); outputs.add(destinationFile);
} }
if (clientSourcePath == null) { if (clientSourcePaths == null) {
return Depfile(inputs, outputs); return Depfile(inputs, outputs);
} }
for (final String clientSourcePath in clientSourcePaths) {
final Directory clientSourceDirectory = fileSystem.directory(clientSourcePath); final Directory clientSourceDirectory = fileSystem.directory(clientSourcePath);
if (!clientSourceDirectory.existsSync()) { if (!clientSourceDirectory.existsSync()) {
throw Exception('Missing clientSourceDirectory: $clientSourcePath'); throw Exception('Missing clientSourceDirectory: $clientSourcePath');
...@@ -69,5 +70,6 @@ Depfile unpackDesktopArtifacts({ ...@@ -69,5 +70,6 @@ Depfile unpackDesktopArtifacts({
inputs.add(inputFile); inputs.add(inputFile);
outputs.add(destinationFile); outputs.add(destinationFile);
} }
}
return Depfile(inputs, outputs); return Depfile(inputs, outputs);
} }
...@@ -15,11 +15,15 @@ import 'icon_tree_shaker.dart'; ...@@ -15,11 +15,15 @@ import 'icon_tree_shaker.dart';
/// The only files/subdirectories we care out. /// The only files/subdirectories we care out.
const List<String> _kLinuxArtifacts = <String>[ const List<String> _kLinuxArtifacts = <String>[
// GLFW. Will be removed after the switch to GTK.
'libflutter_linux_glfw.so', 'libflutter_linux_glfw.so',
'flutter_export.h', 'flutter_export.h',
'flutter_messenger.h', 'flutter_messenger.h',
'flutter_plugin_registrar.h', 'flutter_plugin_registrar.h',
'flutter_glfw.h', 'flutter_glfw.h',
// GTK. Not yet used by the template.
'libflutter_linux_gtk.so',
// Shared.
'icudtl.dat', 'icudtl.dat',
]; ];
...@@ -55,12 +59,20 @@ class UnpackLinux extends Target { ...@@ -55,12 +59,20 @@ class UnpackLinux extends Target {
mode: buildMode, mode: buildMode,
platform: TargetPlatform.linux_x64, platform: TargetPlatform.linux_x64,
); );
// For the GLFW embedding.
final String clientSourcePath = environment.artifacts final String clientSourcePath = environment.artifacts
.getArtifactPath( .getArtifactPath(
Artifact.linuxCppClientWrapper, Artifact.linuxCppClientWrapper,
mode: buildMode, mode: buildMode,
platform: TargetPlatform.linux_x64, platform: TargetPlatform.linux_x64,
); );
// For the GTK embedding.
final String headersPath = environment.artifacts
.getArtifactPath(
Artifact.linuxHeaders,
mode: buildMode,
platform: TargetPlatform.linux_x64,
);
final Directory outputDirectory = environment.fileSystem.directory( final Directory outputDirectory = environment.fileSystem.directory(
environment.fileSystem.path.join( environment.fileSystem.path.join(
environment.projectDir.path, environment.projectDir.path,
...@@ -73,7 +85,7 @@ class UnpackLinux extends Target { ...@@ -73,7 +85,7 @@ class UnpackLinux extends Target {
engineSourcePath: engineSourcePath, engineSourcePath: engineSourcePath,
outputDirectory: outputDirectory, outputDirectory: outputDirectory,
artifacts: _kLinuxArtifacts, artifacts: _kLinuxArtifacts,
clientSourcePath: clientSourcePath, clientSourcePaths: <String>[clientSourcePath, headersPath],
); );
final DepfileService depfileService = DepfileService( final DepfileService depfileService = DepfileService(
fileSystem: environment.fileSystem, fileSystem: environment.fileSystem,
......
...@@ -77,7 +77,7 @@ class UnpackWindows extends Target { ...@@ -77,7 +77,7 @@ class UnpackWindows extends Target {
artifacts: _kWindowsArtifacts, artifacts: _kWindowsArtifacts,
engineSourcePath: engineSourcePath, engineSourcePath: engineSourcePath,
outputDirectory: outputDirectory, outputDirectory: outputDirectory,
clientSourcePath: clientSourcePath, clientSourcePaths: <String>[clientSourcePath],
); );
final DepfileService depfileService = DepfileService( final DepfileService depfileService = DepfileService(
fileSystem: environment.fileSystem, fileSystem: environment.fileSystem,
......
...@@ -1392,6 +1392,7 @@ const List<List<String>> _windowsDesktopBinaryDirs = <List<String>>[ ...@@ -1392,6 +1392,7 @@ const List<List<String>> _windowsDesktopBinaryDirs = <List<String>>[
const List<List<String>> _linuxDesktopBinaryDirs = <List<String>>[ const List<List<String>> _linuxDesktopBinaryDirs = <List<String>>[
<String>['linux-x64', 'linux-x64/linux-x64-flutter-glfw.zip'], <String>['linux-x64', 'linux-x64/linux-x64-flutter-glfw.zip'],
<String>['linux-x64', 'linux-x64/flutter-cpp-client-wrapper-glfw.zip'], <String>['linux-x64', 'linux-x64/flutter-cpp-client-wrapper-glfw.zip'],
<String>['linux-x64', 'linux-x64/linux-x64-flutter-gtk.zip'],
]; ];
const List<List<String>> _macOSDesktopBinaryDirs = <List<String>>[ const List<List<String>> _macOSDesktopBinaryDirs = <List<String>>[
......
...@@ -29,7 +29,7 @@ void main() { ...@@ -29,7 +29,7 @@ void main() {
'a.txt', 'a.txt',
'b.txt', 'b.txt',
], ],
clientSourcePath: 'foo', clientSourcePaths: <String>['foo'],
); );
// Files are copied // Files are copied
...@@ -61,7 +61,7 @@ void main() { ...@@ -61,7 +61,7 @@ void main() {
artifacts: <String>[ artifacts: <String>[
'a.txt', 'a.txt',
], ],
clientSourcePath: 'foo' clientSourcePaths: <String>['foo'],
), throwsA(isA<Exception>())); ), throwsA(isA<Exception>()));
}); });
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
artifacts: <String>[ artifacts: <String>[
'a.txt', 'a.txt',
], ],
clientSourcePath: 'foo' clientSourcePaths: <String>['foo'],
), throwsA(isA<Exception>())); ), throwsA(isA<Exception>()));
}); });
......
...@@ -30,6 +30,11 @@ void main() { ...@@ -30,6 +30,11 @@ void main() {
mode: anyNamed('mode'), mode: anyNamed('mode'),
platform: anyNamed('platform'), platform: anyNamed('platform'),
)).thenReturn('linux-x64/cpp_client_wrapper_glfw'); )).thenReturn('linux-x64/cpp_client_wrapper_glfw');
when(mockArtifacts.getArtifactPath(
Artifact.linuxHeaders,
mode: anyNamed('mode'),
platform: anyNamed('platform'),
)).thenReturn('linux-x64/flutter_linux');
final Environment testEnvironment = Environment.test( final Environment testEnvironment = Environment.test(
fileSystem.currentDirectory, fileSystem.currentDirectory,
...@@ -45,13 +50,18 @@ void main() { ...@@ -45,13 +50,18 @@ void main() {
await const UnpackLinux().build(testEnvironment); await const UnpackLinux().build(testEnvironment);
// GLFW.
expect(fileSystem.file('linux/flutter/ephemeral/libflutter_linux_glfw.so'), exists); expect(fileSystem.file('linux/flutter/ephemeral/libflutter_linux_glfw.so'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/flutter_export.h'), exists); expect(fileSystem.file('linux/flutter/ephemeral/flutter_export.h'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/flutter_messenger.h'), exists); expect(fileSystem.file('linux/flutter/ephemeral/flutter_messenger.h'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/flutter_plugin_registrar.h'), exists); expect(fileSystem.file('linux/flutter/ephemeral/flutter_plugin_registrar.h'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/flutter_glfw.h'), exists); expect(fileSystem.file('linux/flutter/ephemeral/flutter_glfw.h'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/icudtl.dat'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/cpp_client_wrapper_glfw/foo'), exists); expect(fileSystem.file('linux/flutter/ephemeral/cpp_client_wrapper_glfw/foo'), exists);
// GTK.
expect(fileSystem.file('linux/flutter/ephemeral/libflutter_linux_gtk.so'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/flutter_linux/foo.h'), exists);
// Both.
expect(fileSystem.file('linux/flutter/ephemeral/icudtl.dat'), exists);
expect(fileSystem.file('linux/flutter/ephemeral/unrelated-stuff'), isNot(exists)); expect(fileSystem.file('linux/flutter/ephemeral/unrelated-stuff'), isNot(exists));
}); });
...@@ -94,13 +104,18 @@ void main() { ...@@ -94,13 +104,18 @@ void main() {
void setUpCacheDirectory(FileSystem fileSystem) { void setUpCacheDirectory(FileSystem fileSystem) {
fileSystem.file('linux-x64/unrelated-stuff').createSync(recursive: true); fileSystem.file('linux-x64/unrelated-stuff').createSync(recursive: true);
// GLFW.
fileSystem.file('linux-x64/libflutter_linux_glfw.so').createSync(recursive: true); fileSystem.file('linux-x64/libflutter_linux_glfw.so').createSync(recursive: true);
fileSystem.file('linux-x64/flutter_export.h').createSync(); fileSystem.file('linux-x64/flutter_export.h').createSync();
fileSystem.file('linux-x64/flutter_messenger.h').createSync(); fileSystem.file('linux-x64/flutter_messenger.h').createSync();
fileSystem.file('linux-x64/flutter_plugin_registrar.h').createSync(); fileSystem.file('linux-x64/flutter_plugin_registrar.h').createSync();
fileSystem.file('linux-x64/flutter_glfw.h').createSync(); fileSystem.file('linux-x64/flutter_glfw.h').createSync();
fileSystem.file('linux-x64/icudtl.dat').createSync();
fileSystem.file('linux-x64/cpp_client_wrapper_glfw/foo').createSync(recursive: true); fileSystem.file('linux-x64/cpp_client_wrapper_glfw/foo').createSync(recursive: true);
// GTK.
fileSystem.file('linux-x64/libflutter_linux_gtk.so').createSync(recursive: true);
fileSystem.file('linux-x64/flutter_linux/foo.h').createSync(recursive: true);
// Both.
fileSystem.file('linux-x64/icudtl.dat').createSync();
fileSystem.file('packages/flutter_tools/lib/src/build_system/targets/linux.dart').createSync(recursive: true); fileSystem.file('packages/flutter_tools/lib/src/build_system/targets/linux.dart').createSync(recursive: true);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment