mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +00:00
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
This commit is contained in:
parent
f991308e3e
commit
25e9d0494b
|
@ -49,6 +49,8 @@ enum Artifact {
|
|||
iproxy,
|
||||
/// The root of the Linux desktop sources.
|
||||
linuxDesktopPath,
|
||||
// The root of the cpp headers for Linux desktop.
|
||||
linuxHeaders,
|
||||
// The root of the cpp client code for Linux desktop.
|
||||
linuxCppClientWrapper,
|
||||
/// The root of the Windows desktop sources.
|
||||
|
@ -118,6 +120,8 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
|
|||
return 'iproxy';
|
||||
case Artifact.linuxDesktopPath:
|
||||
return '';
|
||||
case Artifact.linuxHeaders:
|
||||
return 'flutter_linux';
|
||||
case Artifact.windowsDesktopPath:
|
||||
return '';
|
||||
case Artifact.windowsCppClientWrapper:
|
||||
|
@ -356,6 +360,7 @@ class CachedArtifacts extends Artifacts {
|
|||
case Artifact.linuxDesktopPath:
|
||||
case Artifact.windowsDesktopPath:
|
||||
case Artifact.flutterMacOSPodspec:
|
||||
case Artifact.linuxHeaders:
|
||||
// TODO(jonahwilliams): remove once debug desktop artifacts are uploaded
|
||||
// under a separate directory from the host artifacts.
|
||||
// https://github.com/flutter/flutter/issues/38935
|
||||
|
@ -530,6 +535,7 @@ class LocalEngineArtifacts extends Artifacts {
|
|||
case Artifact.iproxy:
|
||||
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName).path;
|
||||
case Artifact.linuxDesktopPath:
|
||||
case Artifact.linuxHeaders:
|
||||
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
|
||||
case Artifact.linuxCppClientWrapper:
|
||||
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
|
||||
|
|
|
@ -8,7 +8,7 @@ import '../../base/file_system.dart';
|
|||
import '../depfile.dart';
|
||||
|
||||
/// 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.
|
||||
///
|
||||
|
@ -19,7 +19,7 @@ Depfile unpackDesktopArtifacts({
|
|||
@required List<String> artifacts,
|
||||
@required Directory outputDirectory,
|
||||
@required String engineSourcePath,
|
||||
String clientSourcePath,
|
||||
List<String> clientSourcePaths,
|
||||
}) {
|
||||
final List<File> inputs = <File>[];
|
||||
final List<File> outputs = <File>[];
|
||||
|
@ -46,28 +46,30 @@ Depfile unpackDesktopArtifacts({
|
|||
inputs.add(inputFile);
|
||||
outputs.add(destinationFile);
|
||||
}
|
||||
if (clientSourcePath == null) {
|
||||
if (clientSourcePaths == null) {
|
||||
return Depfile(inputs, outputs);
|
||||
}
|
||||
final Directory clientSourceDirectory = fileSystem.directory(clientSourcePath);
|
||||
if (!clientSourceDirectory.existsSync()) {
|
||||
throw Exception('Missing clientSourceDirectory: $clientSourcePath');
|
||||
}
|
||||
for (final File input in clientSourceDirectory
|
||||
.listSync(recursive: true)
|
||||
.whereType<File>()) {
|
||||
final String outputPath = fileSystem.path.join(
|
||||
outputDirectory.path,
|
||||
fileSystem.path.relative(input.path, from: clientSourceDirectory.parent.path),
|
||||
);
|
||||
final File destinationFile = fileSystem.file(outputPath);
|
||||
if (!destinationFile.parent.existsSync()) {
|
||||
destinationFile.parent.createSync(recursive: true);
|
||||
for (final String clientSourcePath in clientSourcePaths) {
|
||||
final Directory clientSourceDirectory = fileSystem.directory(clientSourcePath);
|
||||
if (!clientSourceDirectory.existsSync()) {
|
||||
throw Exception('Missing clientSourceDirectory: $clientSourcePath');
|
||||
}
|
||||
for (final File input in clientSourceDirectory
|
||||
.listSync(recursive: true)
|
||||
.whereType<File>()) {
|
||||
final String outputPath = fileSystem.path.join(
|
||||
outputDirectory.path,
|
||||
fileSystem.path.relative(input.path, from: clientSourceDirectory.parent.path),
|
||||
);
|
||||
final File destinationFile = fileSystem.file(outputPath);
|
||||
if (!destinationFile.parent.existsSync()) {
|
||||
destinationFile.parent.createSync(recursive: true);
|
||||
}
|
||||
final File inputFile = fileSystem.file(input);
|
||||
inputFile.copySync(destinationFile.path);
|
||||
inputs.add(inputFile);
|
||||
outputs.add(destinationFile);
|
||||
}
|
||||
final File inputFile = fileSystem.file(input);
|
||||
inputFile.copySync(destinationFile.path);
|
||||
inputs.add(inputFile);
|
||||
outputs.add(destinationFile);
|
||||
}
|
||||
return Depfile(inputs, outputs);
|
||||
}
|
||||
|
|
|
@ -15,11 +15,15 @@ import 'icon_tree_shaker.dart';
|
|||
|
||||
/// The only files/subdirectories we care out.
|
||||
const List<String> _kLinuxArtifacts = <String>[
|
||||
// GLFW. Will be removed after the switch to GTK.
|
||||
'libflutter_linux_glfw.so',
|
||||
'flutter_export.h',
|
||||
'flutter_messenger.h',
|
||||
'flutter_plugin_registrar.h',
|
||||
'flutter_glfw.h',
|
||||
// GTK. Not yet used by the template.
|
||||
'libflutter_linux_gtk.so',
|
||||
// Shared.
|
||||
'icudtl.dat',
|
||||
];
|
||||
|
||||
|
@ -55,12 +59,20 @@ class UnpackLinux extends Target {
|
|||
mode: buildMode,
|
||||
platform: TargetPlatform.linux_x64,
|
||||
);
|
||||
// For the GLFW embedding.
|
||||
final String clientSourcePath = environment.artifacts
|
||||
.getArtifactPath(
|
||||
Artifact.linuxCppClientWrapper,
|
||||
mode: buildMode,
|
||||
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(
|
||||
environment.fileSystem.path.join(
|
||||
environment.projectDir.path,
|
||||
|
@ -73,7 +85,7 @@ class UnpackLinux extends Target {
|
|||
engineSourcePath: engineSourcePath,
|
||||
outputDirectory: outputDirectory,
|
||||
artifacts: _kLinuxArtifacts,
|
||||
clientSourcePath: clientSourcePath,
|
||||
clientSourcePaths: <String>[clientSourcePath, headersPath],
|
||||
);
|
||||
final DepfileService depfileService = DepfileService(
|
||||
fileSystem: environment.fileSystem,
|
||||
|
|
|
@ -77,7 +77,7 @@ class UnpackWindows extends Target {
|
|||
artifacts: _kWindowsArtifacts,
|
||||
engineSourcePath: engineSourcePath,
|
||||
outputDirectory: outputDirectory,
|
||||
clientSourcePath: clientSourcePath,
|
||||
clientSourcePaths: <String>[clientSourcePath],
|
||||
);
|
||||
final DepfileService depfileService = DepfileService(
|
||||
fileSystem: environment.fileSystem,
|
||||
|
|
|
@ -1392,6 +1392,7 @@ const List<List<String>> _windowsDesktopBinaryDirs = <List<String>>[
|
|||
const List<List<String>> _linuxDesktopBinaryDirs = <List<String>>[
|
||||
<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/linux-x64-flutter-gtk.zip'],
|
||||
];
|
||||
|
||||
const List<List<String>> _macOSDesktopBinaryDirs = <List<String>>[
|
||||
|
|
|
@ -29,7 +29,7 @@ void main() {
|
|||
'a.txt',
|
||||
'b.txt',
|
||||
],
|
||||
clientSourcePath: 'foo',
|
||||
clientSourcePaths: <String>['foo'],
|
||||
);
|
||||
|
||||
// Files are copied
|
||||
|
@ -61,7 +61,7 @@ void main() {
|
|||
artifacts: <String>[
|
||||
'a.txt',
|
||||
],
|
||||
clientSourcePath: 'foo'
|
||||
clientSourcePaths: <String>['foo'],
|
||||
), throwsA(isA<Exception>()));
|
||||
});
|
||||
|
||||
|
@ -76,7 +76,7 @@ void main() {
|
|||
artifacts: <String>[
|
||||
'a.txt',
|
||||
],
|
||||
clientSourcePath: 'foo'
|
||||
clientSourcePaths: <String>['foo'],
|
||||
), throwsA(isA<Exception>()));
|
||||
});
|
||||
|
||||
|
|
|
@ -30,6 +30,11 @@ void main() {
|
|||
mode: anyNamed('mode'),
|
||||
platform: anyNamed('platform'),
|
||||
)).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(
|
||||
fileSystem.currentDirectory,
|
||||
|
@ -45,13 +50,18 @@ void main() {
|
|||
|
||||
await const UnpackLinux().build(testEnvironment);
|
||||
|
||||
// GLFW.
|
||||
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_messenger.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/icudtl.dat'), 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));
|
||||
});
|
||||
|
||||
|
@ -94,13 +104,18 @@ void main() {
|
|||
|
||||
void setUpCacheDirectory(FileSystem fileSystem) {
|
||||
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/flutter_export.h').createSync();
|
||||
fileSystem.file('linux-x64/flutter_messenger.h').createSync();
|
||||
fileSystem.file('linux-x64/flutter_plugin_registrar.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);
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue