Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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
35 changes: 3 additions & 32 deletions shell/version/version.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,6 @@ declare_args() {

_flutter_root = "//flutter"

if (engine_version == "") {
engine_version_lines =
exec_script("//flutter/build/git_revision.py",
[
"--repository",
rebase_path(_flutter_root, "", _flutter_root),
],
"list lines")
engine_version = engine_version_lines[0]
}

if (skia_version == "") {
skia_version_lines = exec_script(
"//flutter/build/git_revision.py",
[
"--repository",
rebase_path("//flutter/third_party/skia", "", _flutter_root),
],
"list lines")
skia_version = skia_version_lines[0]
}

if (dart_version == "") {
dart_version_lines =
exec_script("//flutter/build/git_revision.py",
[
"--repository",
rebase_path("$dart_src", "", _flutter_root),
],
"list lines")
dart_version = dart_version_lines[0]
}
assert(engine_version != "", "The engine_version argument must be supplied")
assert(skia_version != "", "The skia_version argument must be supplied")
assert(dart_version != "", "The dart_version argument must be supplied")
38 changes: 38 additions & 0 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,40 @@ def setup_apple_sdks():
return sdks_gn_args


def get_repository_version(repository):
'Returns the Git HEAD for the supplied repository path as a string.'
if not os.path.exists(repository):
raise IOError('path does not exist')

git = 'git'
if sys.platform.startswith(('cygwin', 'win')):
git = 'git.bat'
version = subprocess.check_output([
git,
'-C',
repository,
'rev-parse',
'HEAD',
])

return str(version.strip(), 'utf-8')


def setup_git_versions():
revision_args = {}

engine_path = os.path.join(SRC_ROOT, 'flutter')
revision_args['engine_version'] = get_repository_version(engine_path)

skia_path = os.path.join(SRC_ROOT, 'flutter', 'third_party', 'skia')
revision_args['skia_version'] = get_repository_version(skia_path)

dart_path = os.path.join(SRC_ROOT, 'third_party', 'dart')
revision_args['dart_version'] = get_repository_version(dart_path)

return revision_args


def to_gn_args(args):
if args.simulator:
if args.target_os != 'ios':
Expand All @@ -355,6 +389,8 @@ def to_gn_args(args):

gn_args['is_debug'] = args.unoptimized

gn_args.update(setup_git_versions())

gn_args.update(setup_goma(args))

gn_args.update(setup_rbe(args))
Expand Down Expand Up @@ -697,6 +733,8 @@ def to_gn_args(args):
# for a host Windows build and make GN think we will be building ANGLE.
# Angle is not used on Mac hosts as there are no tests for the OpenGL backend.
if is_host_build(args) or (args.target_os == 'android' and get_host_os() == 'win'):
# Don't include git commit information.
gn_args['angle_enable_commit_id'] = False
# Do not build unnecessary parts of the ANGLE tree.
gn_args['angle_build_all'] = False
gn_args['angle_has_astc_encoder'] = False
Expand Down