mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
![Liam Appelbe](/assets/img/avatar_default.png)
I need to access the flag in bin/main.cc, so it can't be in the vm directory Bug: https://github.com/dart-lang/sdk/issues/36047 Change-Id: Ib19a1b4d89295449b25f7753b2a39f6232c004e3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97122 Commit-Queue: Liam Appelbe <liama@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
// Copyright (c) 2012, 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.
|
|
|
|
#include "vm/version.h"
|
|
|
|
#include "vm/cpu.h"
|
|
#include "vm/flags.h"
|
|
#include "vm/os.h"
|
|
|
|
namespace dart {
|
|
|
|
// TODO(iposva): Avoid racy initialization.
|
|
static const char* formatted_version = NULL;
|
|
|
|
const char* Version::String() {
|
|
if (formatted_version == NULL) {
|
|
const char* os = OS::Name();
|
|
const char* arch = CPU::Id();
|
|
formatted_version = OS::SCreate(NULL, "%s on \"%s_%s\"", str_, os, arch);
|
|
}
|
|
return formatted_version;
|
|
}
|
|
|
|
const char* Version::SnapshotString() {
|
|
return snapshot_hash_;
|
|
}
|
|
|
|
const char* Version::CommitString() {
|
|
return commit_;
|
|
}
|
|
|
|
int Version::CurrentAbiVersion() {
|
|
return {{ABI_VERSION}};
|
|
}
|
|
|
|
int Version::OldestSupportedAbiVersion() {
|
|
return {{OLDEST_SUPPORTED_ABI_VERSION}};
|
|
}
|
|
|
|
const char* Version::snapshot_hash_ = "{{SNAPSHOT_HASH}}";
|
|
const char* Version::str_ = "{{VERSION_STR}} ({{COMMIT_TIME}})";
|
|
const char* Version::commit_ = "{{VERSION_STR}}";
|
|
|
|
} // namespace dart
|