Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[flutter_tools] Add entries to HostArtifacts for impellerc, libtessellator #102593

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

Merged
merged 1 commit into from
Apr 26, 2022
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
93 changes: 59 additions & 34 deletions packages/flutter_tools/lib/src/artifacts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ enum HostArtifact {
idevicesyslog,
idevicescreenshot,
iproxy,

/// The root of the sky_engine package.
skyEnginePath,

// The Impeller shader compiler.
impellerc,
// Impeller's tessellation library.
libtessellator,
}

// TODO(knopp): Remove once darwin artifacts are universal and moved out of darwin-x64
Expand Down Expand Up @@ -214,8 +220,14 @@ String? _artifactToFileName(Artifact artifact, [ TargetPlatform? platform, Build
}
}

String _hostArtifactToFileName(HostArtifact artifact, bool windows) {
final String exe = windows ? '.exe' : '';
String _hostArtifactToFileName(HostArtifact artifact, Platform platform) {
final String exe = platform.isWindows ? '.exe' : '';
String dll = '.so';
if (platform.isWindows) {
dll = '.dll';
} else if (platform.isMacOS) {
dll = '.dylib';
}
switch (artifact) {
case HostArtifact.flutterWebSdk:
return '';
Expand Down Expand Up @@ -259,6 +271,10 @@ String _hostArtifactToFileName(HostArtifact artifact, bool windows) {
case HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps:
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps:
return 'dart_sdk.js.map';
case HostArtifact.impellerc:
return 'impellerc$exe';
case HostArtifact.libtessellator:
return 'libtessellator$dll';
}
}

Expand Down Expand Up @@ -349,63 +365,68 @@ class CachedArtifacts implements Artifacts {
final String path = _dartSdkPath(_cache);
return _fileSystem.directory(path);
case HostArtifact.engineDartBinary:
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.flutterWebSdk:
final String path = _getFlutterWebSdkPath();
return _fileSystem.directory(path);
case HostArtifact.flutterWebLibrariesJson:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPlatformKernelDill:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPlatformSoundKernelDill:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledSdk:
case HostArtifact.webPrecompiledSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitSdk:
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledSoundSdk:
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitSoundSdk:
case HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-sound', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-sound', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk:
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html-sound', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html-sound', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.idevicesyslog:
case HostArtifact.idevicescreenshot:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform.isWindows);
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
return _cache.getArtifactDirectory('libimobiledevice').childFile(artifactFileName);
case HostArtifact.skyEnginePath:
final Directory dartPackageDirectory = _cache.getCacheDir('pkg');
final String path = _fileSystem.path.join(dartPackageDirectory.path, _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(dartPackageDirectory.path, _hostArtifactToFileName(artifact, _platform));
return _fileSystem.directory(path);
case HostArtifact.dart2jsSnapshot:
case HostArtifact.dartdevcSnapshot:
case HostArtifact.kernelWorkerSnapshot:
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.iosDeploy:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform.isWindows);
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
return _cache.getArtifactDirectory('ios-deploy').childFile(artifactFileName);
case HostArtifact.iproxy:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform.isWindows);
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName);
case HostArtifact.impellerc:
case HostArtifact.libtessellator:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
final String engineDir = _getEngineArtifactsPath(_currentHostPlatform(_platform, _operatingSystemUtils))!;
return _fileSystem.file(_fileSystem.path.join(engineDir, artifactFileName));
}
}

Expand Down Expand Up @@ -791,67 +812,71 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk');
return _fileSystem.directory(path);
case HostArtifact.engineDartBinary:
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.dart2jsSnapshot:
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.dartdevcSnapshot:
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.kernelWorkerSnapshot:
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.flutterWebSdk:
final String path = _getFlutterWebSdkPath();
return _fileSystem.directory(path);
case HostArtifact.flutterWebLibrariesJson:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPlatformKernelDill:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPlatformSoundKernelDill:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledSdk:
case HostArtifact.webPrecompiledSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitSdk:
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledSoundSdk:
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitSoundSdk:
case HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-sound', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-sound', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk:
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps:
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html-sound', _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html-sound', _hostArtifactToFileName(artifact, _platform));
return _fileSystem.file(path);
case HostArtifact.idevicesyslog:
case HostArtifact.idevicescreenshot:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform.isWindows);
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
return _cache.getArtifactDirectory('libimobiledevice').childFile(artifactFileName);
case HostArtifact.skyEnginePath:
final Directory dartPackageDirectory = _cache.getCacheDir('pkg');
final String path = _fileSystem.path.join(dartPackageDirectory.path, _hostArtifactToFileName(artifact, _platform.isWindows));
final String path = _fileSystem.path.join(dartPackageDirectory.path, _hostArtifactToFileName(artifact, _platform));
return _fileSystem.directory(path);
case HostArtifact.iosDeploy:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform.isWindows);
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
return _cache.getArtifactDirectory('ios-deploy').childFile(artifactFileName);
case HostArtifact.iproxy:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform.isWindows);
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
return _cache.getArtifactDirectory('usbmuxd').childFile(artifactFileName);
case HostArtifact.impellerc:
case HostArtifact.libtessellator:
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
return _fileSystem.file(_fileSystem.path.join(_hostEngineOutPath, artifactFileName));
}
}

Expand Down
8 changes: 8 additions & 0 deletions packages/flutter_tools/test/general.shard/artifacts_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ void main() {
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin',
'snapshots', 'frontend_server.dart.snapshot')
);
expect(
artifacts.getHostArtifact(HostArtifact.impellerc).path,
fileSystem.path.join('/out', 'host_debug_unopt', 'impellerc'),
);
expect(
artifacts.getHostArtifact(HostArtifact.libtessellator).path,
fileSystem.path.join('/out', 'host_debug_unopt', 'libtessellator.so'),
);
});

testWithoutContext('getEngineType', () {
Expand Down