mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm] Ensure SDK hash is correctly embedded for CFE and other tools that produce Kernel
The missing --short=10 was causing (depending on git version and configuration) us to sometimes default to using '0000000000'. Furthermore the build rules were missing two places where -Dsdk_hash has to be set. Issue https://github.com/dart-lang/sdk/issues/41802 Change-Id: I83dbfcce677e2594074c1139093bd9592d4fa3ee Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154684 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
parent
5900c6b2b6
commit
90bba3ae27
|
@ -30,11 +30,8 @@ Future<void> main(List<String> args) async {
|
|||
|
||||
{
|
||||
final result = await Process.run(dart, [
|
||||
genKernel,
|
||||
'--platform',
|
||||
platformDill,
|
||||
'-o',
|
||||
dillPath,
|
||||
'--snapshot-kind=kernel',
|
||||
'--snapshot=$dillPath',
|
||||
sourcePath,
|
||||
]);
|
||||
Expect.equals('', result.stderr);
|
||||
|
@ -57,8 +54,9 @@ Future<void> main(List<String> args) async {
|
|||
// tags (both UInt32).
|
||||
Expect.listEquals(tagComponentFile, bytes.sublist(0, 4));
|
||||
Expect.listEquals(tagBinaryFormatVersion, bytes.sublist(4, 8));
|
||||
Expect.notEquals('0000000000', ascii.decode(bytes.sublist(8, 10)));
|
||||
// Flip the first byte in the hash:
|
||||
bytes[8] ^= bytes[8];
|
||||
bytes[8] = ~bytes[8];
|
||||
myFile.writeAsBytesSync(bytes);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,8 @@ Future<void> main(List<String> args) async {
|
|||
|
||||
{
|
||||
final result = await Process.run(dart, [
|
||||
genKernel,
|
||||
'--platform',
|
||||
platformDill,
|
||||
'-o',
|
||||
dillPath,
|
||||
'--snapshot-kind=kernel',
|
||||
'--snapshot=$dillPath',
|
||||
sourcePath,
|
||||
]);
|
||||
Expect.equals('', result.stderr);
|
||||
|
@ -57,8 +54,9 @@ Future<void> main(List<String> args) async {
|
|||
// tags (both UInt32).
|
||||
Expect.listEquals(tagComponentFile, bytes.sublist(0, 4));
|
||||
Expect.listEquals(tagBinaryFormatVersion, bytes.sublist(4, 8));
|
||||
Expect.notEquals('0000000000', ascii.decode(bytes.sublist(8, 18)));
|
||||
// Flip the first byte in the hash:
|
||||
bytes[8] ^= bytes[8];
|
||||
bytes[8] = ~bytes[8];
|
||||
myFile.writeAsBytesSync(bytes);
|
||||
}
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ def GetGitRevision(git_revision_file=None, repo_path=DART_DIR):
|
|||
|
||||
|
||||
def GetShortGitHash(repo_path=DART_DIR):
|
||||
p = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
|
||||
p = subprocess.Popen(['git', 'rev-parse', '--short=10', 'HEAD'],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
shell=IsWindows(),
|
||||
|
|
|
@ -102,6 +102,8 @@ template("_application_snapshot") {
|
|||
vm_args = [
|
||||
"--depfile=$abs_depfile",
|
||||
"--depfile_output_filename=$rebased_output",
|
||||
|
||||
# Ensure gen_kernel.dart will use this SDK hash when consuming/producing kernel.
|
||||
"-Dsdk_hash=$sdk_hash",
|
||||
]
|
||||
|
||||
|
@ -114,6 +116,13 @@ template("_application_snapshot") {
|
|||
"--no-embed-sources",
|
||||
"--no-link-platform",
|
||||
"--output=" + rebase_path(output),
|
||||
|
||||
# Ensure the compiled appliation (e.g. kernel-service, frontend-server,
|
||||
# ...) will use this SDK hash when consuming/producing kernel.
|
||||
#
|
||||
# (Instead of ensuring every user of the "application_snapshot" /
|
||||
# "kernel_snapshot" passes this if needed, we always pass it)
|
||||
"-Dsdk_hash=$sdk_hash",
|
||||
]
|
||||
if (dart_platform_bytecode) {
|
||||
args += [
|
||||
|
|
|
@ -89,6 +89,9 @@ template("kernel_service_dill") {
|
|||
vm_args = [
|
||||
"--depfile=$abs_depfile",
|
||||
"--depfile_output_filename=$rebased_output",
|
||||
|
||||
# Ensure gen_kernel.dart will use this SDK hash when consuming/producing
|
||||
# kernel.
|
||||
"-Dsdk_hash=$sdk_hash",
|
||||
]
|
||||
|
||||
|
@ -97,6 +100,10 @@ template("kernel_service_dill") {
|
|||
|
||||
args =
|
||||
invoker.extra_args + [
|
||||
# Ensure the compiled kernel-service will use this SDK hash when
|
||||
# consuming/producing kernel.
|
||||
"-Dsdk_hash=$sdk_hash",
|
||||
|
||||
"--packages=" + scheme + ":///.packages",
|
||||
"--platform=" + rebase_path("$root_out_dir/vm_platform_strong.dill"),
|
||||
"--filesystem-root=" + rebase_path("../../"),
|
||||
|
|
Loading…
Reference in a new issue