Merge "Rename compiler, linker and installer methods to be unique"
diff --git a/cc/builder.go b/cc/builder.go
index 02ea63d..f1282f5 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -96,8 +96,8 @@
darwinStrip = pctx.StaticRule("darwinStrip",
blueprint.RuleParams{
- Command: "${macStripPath} -u -r -o $out $in",
- CommandDeps: []string{"${macStripPath}"},
+ Command: "${config.MacStripPath} -u -r -o $out $in",
+ CommandDeps: []string{"${config.MacStripPath}"},
Description: "strip $out",
})
diff --git a/cc/gen_stub_libs.py b/cc/gen_stub_libs.py
index a4a0421..4b7c244 100755
--- a/cc/gen_stub_libs.py
+++ b/cc/gen_stub_libs.py
@@ -65,12 +65,34 @@
return self.stack[-1]
+def get_tags(line):
+ """Returns a list of all tags on this line."""
+ _, _, all_tags = line.strip().partition('#')
+ return re.split(r'\s+', all_tags)
+
+
def version_is_private(version):
"""Returns True if the version name should be treated as private."""
return version.endswith('_PRIVATE') or version.endswith('_PLATFORM')
-def enter_version(scope, line, version_file):
+def should_omit_version(name, tags, arch, api):
+ """Returns True if the version section should be ommitted.
+
+ We want to omit any sections that do not have any symbols we'll have in the
+ stub library. Sections that contain entirely future symbols or only symbols
+ for certain architectures.
+ """
+ if version_is_private(name):
+ return True
+ if not symbol_in_arch(tags, arch):
+ return True
+ if not symbol_in_version(tags, arch, api):
+ return True
+ return False
+
+
+def enter_version(scope, line, version_file, arch, api):
"""Enters a new version block scope."""
if scope.top != Scope.Top:
raise RuntimeError('Encountered nested version block.')
@@ -78,7 +100,8 @@
# Entering a new version block. By convention symbols with versions ending
# with "_PRIVATE" or "_PLATFORM" are not included in the NDK.
version_name = line.split('{')[0].strip()
- if version_is_private(version_name):
+ tags = get_tags(line)
+ if should_omit_version(version_name, tags, arch, api):
scope.push(Scope.Private)
else:
scope.push(Scope.Global) # By default symbols are visible.
@@ -116,10 +139,10 @@
assert scope.top == Scope.Top
-def handle_top_scope(scope, line, version_file):
+def handle_top_scope(scope, line, version_file, arch, api):
"""Processes a line in the top level scope."""
if '{' in line:
- enter_version(scope, line, version_file)
+ enter_version(scope, line, version_file, arch, api)
else:
raise RuntimeError('Unexpected contents at top level: ' + line)
@@ -166,6 +189,11 @@
elif tag.startswith('introduced-' + arch + '='):
introduced_tag = tag
arch_specific = True
+ elif tag == 'future':
+ # This symbol is not in any released API level.
+ # TODO(danalbert): These need to be emitted for version == current.
+ # That's not a construct we have yet, so just skip it for now.
+ return False
if introduced_tag is None:
# We found no "introduced" tags, so the symbol has always been
@@ -194,8 +222,7 @@
# Line is now in the format "<symbol-name>; # tags"
# Tags are whitespace separated.
symbol_name, _, rest = line.strip().partition(';')
- _, _, all_tags = rest.partition('#')
- tags = re.split(r'\s+', all_tags)
+ tags = get_tags(line)
if not symbol_in_arch(tags, arch):
return
@@ -217,7 +244,7 @@
if line.strip() == '' or line.strip().startswith('#'):
version_file.write(line)
elif scope.top == Scope.Top:
- handle_top_scope(scope, line, version_file)
+ handle_top_scope(scope, line, version_file, arch, api)
elif scope.top == Scope.Private:
handle_private_scope(scope, line, version_file)
elif scope.top == Scope.Local:
diff --git a/cc/pylintrc b/cc/pylintrc
index 5d1aa9a..ed49dd7 100644
--- a/cc/pylintrc
+++ b/cc/pylintrc
@@ -38,7 +38,7 @@
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
-disable=design
+disable=design,fixme
[REPORTS]