You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should likely live in a separate helper package.
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file// for details. All rights reserved. Use of this source code is governed by a// BSD-style license that can be found in the LICENSE file.import'dart:io';
import'package:logging/logging.dart';
import'../../native_assets_cli.dart';
abstractclassBuilder {
Future<void> run({
requiredBuildConfig config,
requiredBuildOutput output,
requiredLogger? logger,
});
}
// TODO(dacoharkes): Should we really add this? It seems too specific.// E.g. what about varying file names, zipped downloads etc. etc. ?classAssetDownloaderimplementsBuilder {
finalUriFunction(OS, Architecture) downloadUri;
/// Asset identifier. /// /// If omitted, no asset will be added to the build output.finalString assetName;
AssetDownloader({
requiredthis.downloadUri,
requiredthis.assetName,
});
@overrideFuture<void> run({
requiredBuildConfig config,
requiredBuildOutput output,
requiredLogger? logger,
}) async {
Uri? targetUri;
if (!config.dryRun) {
final downloadUri2 =downloadUri(
config.targetOS,
config.targetArchitecture!,
);
final fileName =
downloadUri2.pathSegments.lastWhere((element) => element.isNotEmpty);
targetUri = config.outputDirectory.resolve(fileName);
final request =awaitHttpClient().getUrl(downloadUri2);
final response =await request.close();
await response.pipe(File.fromUri(targetUri).openWrite());
}
output.addAsset(
CCodeAsset(
package: config.packageName,
name: assetName,
file: targetUri,
linkMode:LinkMode.dynamic,
dynamicLoading:BundledDylib(),
os: config.targetOS,
architecture: config.targetArchitecture,
),
);
}
}
In cargokit (project I'm hoping to retire the moment native assets are no longer experimental) I use private / public key to check the downloaded binaries. The public key is part of dart package, and when downloading binaries a ed25519_edwards signature is downloaded alongside to verify that the binary was built by the github workflow (the repository has access to private key as a github secret).
I'm punting this from
package:native_assets_cli
.This should likely live in a separate helper package.
It might implement the shared interface
Builder
:Builder
abstraction #995The text was updated successfully, but these errors were encountered: