Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Started adding the engine hash to frameworks' Info.plist. #9847

Merged
merged 6 commits into from
Jul 16, 2019
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
33 changes: 33 additions & 0 deletions build/copy_info_plist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""
Copies the Info.plist and adds extra fields to it like the git hash of the
engine.

Precondition: $CWD/../../flutter is the path to the flutter engine repo.

usage: copy_info_plist.py <src_path> <dest_path>
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import sys
import git_revision
import os

def main():
text = open(sys.argv[1]).read()
engine_path = os.path.join(os.getcwd(), "..", "..", "flutter")
revision = git_revision.GetRepositoryVersion(engine_path)
text = text.format(revision)
with open(sys.argv[2], "w") as outfile:
outfile.write(text)

if __name__ == "__main__":
main()
34 changes: 20 additions & 14 deletions build/git_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,19 @@
# found in the LICENSE file.

"""Get the Git HEAD revision of a specified Git repository."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import sys
import subprocess
import os
import argparse

def main():
parser = argparse.ArgumentParser();

parser.add_argument('--repository',
action='store',
help='Path to the Git repository.',
required=True)

args = parser.parse_args()

repository = os.path.abspath(args.repository)

def GetRepositoryVersion(repository):
"Returns the Git HEAD for the supplied repository path as a string."
if not os.path.exists(repository):
exit -1
raise IOError("path doesn't exist")

version = subprocess.check_output([
'git',
Expand All @@ -34,7 +27,20 @@ def main():
'HEAD',
])

print (version.strip())
return version.strip()

def main():
parser = argparse.ArgumentParser()

parser.add_argument('--repository',
action='store',
help='Path to the Git repository.',
required=True)

args = parser.parse_args()
repository = os.path.abspath(args.repository)
version = GetRepositoryVersion(repository)
print(version.strip())

return 0

Expand Down
7 changes: 6 additions & 1 deletion shell/platform/darwin/ios/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,19 @@ action("copy_dylib_and_update_framework_install_name") {
]
}

copy("copy_framework_info_plist") {
action("copy_framework_info_plist") {
script = "$flutter_root/build/copy_info_plist.py"
visibility = [ ":*" ]
sources = [
"framework/Info.plist",
]
outputs = [
"$_flutter_framework_dir/Info.plist",
]
args = [
rebase_path(sources[0]),
rebase_path(outputs[0]),
]
}

copy("copy_framework_module_map") {
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/darwin/ios/framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>FlutterEngine<key>
<string>{0}<string>
</dict>
</plist>
7 changes: 6 additions & 1 deletion shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,19 @@ if (is_mac && !embedder_for_target) {
]
}

copy("copy_info_plist") {
action("copy_info_plist") {
script = "$flutter_root/build/copy_info_plist.py"
visibility = [ ":*" ]
sources = [
"assets/EmbedderInfo.plist",
]
outputs = [
"$_flutter_embedder_framework_dir/Versions/A/Resources/Info.plist",
]
args = [
rebase_path(sources[0]),
rebase_path(outputs[0]),
]
}

copy("copy_module_map") {
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/embedder/assets/EmbedderInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright 2013 The Flutter Authors. All rights reserved.</string>
<key>FlutterEngine<key>
<string>{0}<string>
</dict>
</plist>