[build] Omit SDK and Git hashes on RBE.
Bug: b/296994239 Change-Id: I70c10fddc3bd01fef5ed5182e1d28d0797c431e3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342421 Commit-Queue: Jonas Termansen <sortie@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
c152cce35c
commit
669060f8c7
@@ -16,7 +16,7 @@ String get dartVm => Platform.executable;
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
ProcessResult result = await Process.run(
|
||||
"python3", ["tools/make_version.py", "--no_git", "-q"],
|
||||
"python3", ["tools/make_version.py", "--no-git-hash", "-q"],
|
||||
workingDirectory: repoDir);
|
||||
|
||||
String stdout = result.stdout.toString();
|
||||
|
||||
+2
-2
@@ -366,9 +366,9 @@ action("generate_version_cc_file") {
|
||||
rebase_path("vm/version_in.cc", root_build_dir),
|
||||
]
|
||||
if (!dart_version_git_info) {
|
||||
args += [ "--no_git_hash" ]
|
||||
args += [ "--no-git-hash" ]
|
||||
}
|
||||
if (!verify_sdk_hash) {
|
||||
args += [ "--no_sdk_hash" ]
|
||||
args += [ "--no-sdk-hash" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,14 +59,6 @@ Future<void> main(List<String> args) async {
|
||||
myFile.writeAsBytesSync(bytes);
|
||||
}
|
||||
|
||||
{
|
||||
final result = await Process.run(dart, [dillPath, '--child']);
|
||||
Expect.equals(
|
||||
'Can\'t load Kernel binary: Invalid SDK hash.', result.stderr.trim());
|
||||
Expect.equals(253, result.exitCode);
|
||||
Expect.equals('', result.stdout);
|
||||
}
|
||||
|
||||
// Zero out the SDK hash in the kernel dill to disable the check:
|
||||
{
|
||||
final myFile = File(dillPath);
|
||||
|
||||
@@ -674,6 +674,9 @@ action("write_version_file") {
|
||||
"--output",
|
||||
rebase_path(output),
|
||||
]
|
||||
if (!dart_version_git_info) {
|
||||
args += [ "--no-git-hash" ]
|
||||
}
|
||||
}
|
||||
|
||||
# This rule writes the revision file.
|
||||
@@ -687,6 +690,9 @@ action("write_revision_file") {
|
||||
"--output",
|
||||
rebase_path(output),
|
||||
]
|
||||
if (!dart_version_git_info) {
|
||||
args += [ "--no-git-hash" ]
|
||||
}
|
||||
}
|
||||
|
||||
# This rule copies the README file.
|
||||
@@ -714,6 +720,9 @@ action("write_dartdoc_options") {
|
||||
"--output",
|
||||
rebase_path(output),
|
||||
]
|
||||
if (!dart_version_git_info) {
|
||||
args += [ "--no-git-hash" ]
|
||||
}
|
||||
}
|
||||
|
||||
# This rule copies the API readme file to lib/
|
||||
|
||||
+24
-6
@@ -189,7 +189,8 @@ def UseSysroot(args, gn_args):
|
||||
return True
|
||||
|
||||
|
||||
def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash):
|
||||
def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash,
|
||||
git_version):
|
||||
gn_args = {}
|
||||
|
||||
host_os = HostOsForGn(HOST_OS)
|
||||
@@ -332,6 +333,7 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash):
|
||||
gn_args['debug_optimization_level'] = args.debug_opt_level
|
||||
|
||||
gn_args['verify_sdk_hash'] = verify_sdk_hash
|
||||
gn_args['dart_version_git_info'] = git_version
|
||||
|
||||
if args.codesigning_identity != '':
|
||||
gn_args['codesigning_identity'] = args.codesigning_identity
|
||||
@@ -437,22 +439,26 @@ def ide_switch(host_os):
|
||||
def AddCommonGnOptionArgs(parser):
|
||||
"""Adds arguments that will change the default GN arguments."""
|
||||
|
||||
use_rbe = os.environ.get('RBE_cfg') != None
|
||||
|
||||
parser.add_argument('--goma', help='Use goma', action='store_true')
|
||||
parser.add_argument('--no-goma',
|
||||
help='Disable goma',
|
||||
dest='goma',
|
||||
action='store_false')
|
||||
parser.set_defaults(goma=os.environ.get('RBE_cfg') == None)
|
||||
parser.set_defaults(goma=not use_rbe)
|
||||
|
||||
parser.add_argument('--rbe', help='Use rbe', action='store_true')
|
||||
parser.add_argument('--no-rbe',
|
||||
help='Disable rbe',
|
||||
dest='rbe',
|
||||
action='store_false')
|
||||
parser.set_defaults(rbe=os.environ.get('RBE_cfg') != None)
|
||||
parser.set_defaults(rbe=use_rbe)
|
||||
|
||||
# Disable git hashes when remote compiling to ensure cache hits of the final
|
||||
# output artifacts when nothing has changed.
|
||||
parser.add_argument('--verify-sdk-hash',
|
||||
help='Enable SDK hash checks (default)',
|
||||
help='Enable SDK hash checks',
|
||||
dest='verify_sdk_hash',
|
||||
action='store_true')
|
||||
parser.add_argument('-nvh',
|
||||
@@ -460,7 +466,18 @@ def AddCommonGnOptionArgs(parser):
|
||||
help='Disable SDK hash checks',
|
||||
dest='verify_sdk_hash',
|
||||
action='store_false')
|
||||
parser.set_defaults(verify_sdk_hash=True)
|
||||
parser.set_defaults(verify_sdk_hash=not use_rbe)
|
||||
|
||||
parser.add_argument('--git-version',
|
||||
help='Enable git commit in version',
|
||||
dest='git_version',
|
||||
action='store_true')
|
||||
parser.add_argument('-ngv',
|
||||
'--no-git-version',
|
||||
help='Disable git commit in version',
|
||||
dest='git_version',
|
||||
action='store_false')
|
||||
parser.set_defaults(git_version=not use_rbe)
|
||||
|
||||
parser.add_argument('--clang', help='Use Clang', action='store_true')
|
||||
parser.add_argument('--no-clang',
|
||||
@@ -615,7 +632,8 @@ def BuildGnCommand(args, mode, arch, target_os, sanitizer, out_dir):
|
||||
# See dartbug.com/32364
|
||||
command = [gn, 'gen', out_dir]
|
||||
gn_args = ToCommandLine(
|
||||
ToGnArgs(args, mode, arch, target_os, sanitizer, args.verify_sdk_hash))
|
||||
ToGnArgs(args, mode, arch, target_os, sanitizer, args.verify_sdk_hash,
|
||||
args.git_version))
|
||||
gn_args += GetGNArgs(args)
|
||||
if args.ide:
|
||||
command.append(ide_switch(HOST_OS))
|
||||
|
||||
@@ -96,13 +96,13 @@ def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--input', help='Input template file.')
|
||||
parser.add_argument(
|
||||
'--no_git_hash',
|
||||
'--no-git-hash',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=('Don\'t try to call git to derive things like '
|
||||
'git revision hash.'))
|
||||
parser.add_argument(
|
||||
'--no_sdk_hash',
|
||||
'--no-sdk-hash',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Use null SDK hash to disable SDK verification in the VM')
|
||||
|
||||
@@ -15,6 +15,10 @@ def ParseArgs(args):
|
||||
|
||||
parser.add_argument(
|
||||
'--output', '-o', type=str, required=True, help='File to write')
|
||||
parser.add_argument('--no-git-hash',
|
||||
help='Omit the git hash in the output',
|
||||
dest='no_git_hash',
|
||||
action='store_true')
|
||||
|
||||
return parser.parse_args(args)
|
||||
|
||||
@@ -22,9 +26,11 @@ def ParseArgs(args):
|
||||
def Main(argv):
|
||||
args = ParseArgs(argv)
|
||||
# TODO(jcollins-g): switch to version numbers when github has its tags synced
|
||||
revision = utils.GetGitRevision()
|
||||
revision = None
|
||||
if not args.no_git_hash:
|
||||
revision = utils.GetGitRevision()
|
||||
if revision is None:
|
||||
revision = 'master'
|
||||
revision = 'main'
|
||||
output = '''dartdoc:
|
||||
categoryOrder: ["Core", "VM", "Web"]
|
||||
linkToSource:
|
||||
|
||||
@@ -12,17 +12,24 @@ import utils
|
||||
def ParseArgs(args):
|
||||
args = args[1:]
|
||||
parser = argparse.ArgumentParser(
|
||||
description='A script to write the version string to a file')
|
||||
description='A script to write the revision string to a file')
|
||||
|
||||
parser.add_argument(
|
||||
'--output', '-o', type=str, required=True, help='File to write')
|
||||
parser.add_argument('--no-git-hash',
|
||||
help='Omit the git hash in the output',
|
||||
dest='no_git_hash',
|
||||
action='store_true')
|
||||
|
||||
return parser.parse_args(args)
|
||||
|
||||
|
||||
def Main(argv):
|
||||
args = ParseArgs(argv)
|
||||
revision = utils.GetGitRevision()
|
||||
if not args.no_git_hash:
|
||||
revision = utils.GetGitRevision()
|
||||
else:
|
||||
revision = ''
|
||||
if revision is not None:
|
||||
with open(args.output, 'w') as f:
|
||||
f.write('%s\n' % revision)
|
||||
|
||||
@@ -16,13 +16,17 @@ def ParseArgs(args):
|
||||
|
||||
parser.add_argument(
|
||||
'--output', '-o', type=str, required=True, help='File to write')
|
||||
parser.add_argument('--no-git-hash',
|
||||
help='Omit the git hash in the output',
|
||||
dest='no_git_hash',
|
||||
action='store_true')
|
||||
|
||||
return parser.parse_args(args)
|
||||
|
||||
|
||||
def Main(argv):
|
||||
args = ParseArgs(argv)
|
||||
version = utils.GetVersion()
|
||||
version = utils.GetVersion(no_git_hash=args.no_git_hash)
|
||||
with open(args.output, 'w') as versionFile:
|
||||
versionFile.write(version + '\n')
|
||||
return 0
|
||||
|
||||
@@ -45,6 +45,9 @@ prebuilt_dart_action("dart2js_create_snapshot_entry") {
|
||||
packages = "../../.dart_tool/package_config.json"
|
||||
|
||||
args = [ "--output_dir=$output_dir" ]
|
||||
if (!dart_version_git_info) {
|
||||
args += [ "--no-git-hash" ]
|
||||
}
|
||||
}
|
||||
|
||||
sdk_root = "../../sdk"
|
||||
|
||||
@@ -9,9 +9,15 @@
|
||||
import 'dart:io';
|
||||
import 'dart:async';
|
||||
|
||||
Future<String> getVersion(var rootPath) {
|
||||
Future<String> getVersion(var rootPath, bool noGitHash) {
|
||||
var printVersionScript = rootPath.resolve("tools/make_version.py");
|
||||
return Process.run("python3", [printVersionScript.toFilePath(), "--quiet"],
|
||||
return Process.run(
|
||||
"python3",
|
||||
[
|
||||
printVersionScript.toFilePath(),
|
||||
"--quiet",
|
||||
if (noGitHash) '--no-git-hash'
|
||||
],
|
||||
runInShell: true)
|
||||
.then((result) {
|
||||
if (result.exitCode != 0) {
|
||||
@@ -21,8 +27,8 @@ Future<String> getVersion(var rootPath) {
|
||||
});
|
||||
}
|
||||
|
||||
Future<String> getDart2jsSnapshotGenerationFile(var rootPath) {
|
||||
return getVersion(rootPath).then((version) {
|
||||
Future<String> getDart2jsSnapshotGenerationFile(var rootPath, bool noGitHash) {
|
||||
return getVersion(rootPath, noGitHash).then((version) {
|
||||
var snapshotGenerationText = """
|
||||
import 'package:compiler/src/dart2js.dart' as dart2jsMain;
|
||||
|
||||
@@ -39,11 +45,17 @@ void main(List<String> arguments) {
|
||||
* Takes the following arguments:
|
||||
* --output_dir=val The full path to the output_dir.
|
||||
* --dart2js_main=val The path to the dart2js main script relative to root.
|
||||
* --no-git-hash Omit the git hash in the output.
|
||||
*/
|
||||
void main(List<String> arguments) {
|
||||
bool noGitHash = false;
|
||||
var validArguments = ["--output_dir", "--dart2js_main"];
|
||||
var args = {};
|
||||
for (var argument in arguments) {
|
||||
if (argument == '--no-git-hash') {
|
||||
noGitHash = true;
|
||||
continue;
|
||||
}
|
||||
var argumentSplit = argument.split("=");
|
||||
if (argumentSplit.length != 2) throw "Invalid argument $argument, no =";
|
||||
if (!validArguments.contains(argumentSplit[0])) {
|
||||
@@ -57,7 +69,7 @@ void main(List<String> arguments) {
|
||||
var path = scriptFile.resolve(".");
|
||||
var rootPath = path.resolve("../..");
|
||||
|
||||
getDart2jsSnapshotGenerationFile(rootPath).then((result) {
|
||||
getDart2jsSnapshotGenerationFile(rootPath, noGitHash).then((result) {
|
||||
var wrapper = "${args['output_dir']}/dart2js.dart";
|
||||
new File(wrapper).writeAsStringSync(result);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user