Rename # vndk tag to # llndk

The APIs that are tagged with # vndk are actually for LLNDK libraries.
Although LLNDK is part of VNDK, calling those APIs 'vndk' has given
users a wrong perception that the APIs don't need to be kept stable
because that's the norm for most of the VNDK libraries that are not
LLNDK.

In order to eliminate the misunderstanding, rename the tag to 'llndk' so
that people introducing new such API will realize what they are signing
themselves up for.

Exempt-From-Owner-Approval: cherry-pick from internal gerrit

Bug: 143765505
Test: m
Test: python3 test_gen_stub_libs.py
Merged-In: I2853df3b6e245056c21d4ab3d62466954cf26d72
(cherry picked from commit 3d7b69a657)
Change-Id: I2853df3b6e245056c21d4ab3d62466954cf26d72
This commit is contained in:
Jiyong Park 2019-11-06 12:37:43 +09:00
parent 9ea28aef68
commit 92d6bc189c
3 changed files with 36 additions and 36 deletions

View file

@ -108,7 +108,7 @@ def version_is_private(version):
return version.endswith('_PRIVATE') or version.endswith('_PLATFORM')
def should_omit_version(version, arch, api, vndk, apex):
def should_omit_version(version, arch, api, llndk, apex):
"""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
@ -120,9 +120,9 @@ def should_omit_version(version, arch, api, vndk, apex):
if 'platform-only' in version.tags:
return True
no_vndk_no_apex = 'vndk' not in version.tags and 'apex' not in version.tags
keep = no_vndk_no_apex or \
('vndk' in version.tags and vndk) or \
no_llndk_no_apex = 'llndk' not in version.tags and 'apex' not in version.tags
keep = no_llndk_no_apex or \
('llndk' in version.tags and llndk) or \
('apex' in version.tags and apex)
if not keep:
return True
@ -133,11 +133,11 @@ def should_omit_version(version, arch, api, vndk, apex):
return False
def should_omit_symbol(symbol, arch, api, vndk, apex):
def should_omit_symbol(symbol, arch, api, llndk, apex):
"""Returns True if the symbol should be omitted."""
no_vndk_no_apex = 'vndk' not in symbol.tags and 'apex' not in symbol.tags
keep = no_vndk_no_apex or \
('vndk' in symbol.tags and vndk) or \
no_llndk_no_apex = 'llndk' not in symbol.tags and 'apex' not in symbol.tags
keep = no_llndk_no_apex or \
('llndk' in symbol.tags and llndk) or \
('apex' in symbol.tags and apex)
if not keep:
return True
@ -250,12 +250,12 @@ class Symbol(object):
class SymbolFileParser(object):
"""Parses NDK symbol files."""
def __init__(self, input_file, api_map, arch, api, vndk, apex):
def __init__(self, input_file, api_map, arch, api, llndk, apex):
self.input_file = input_file
self.api_map = api_map
self.arch = arch
self.api = api
self.vndk = vndk
self.llndk = llndk
self.apex = apex
self.current_line = None
@ -284,11 +284,11 @@ class SymbolFileParser(object):
symbol_names = set()
multiply_defined_symbols = set()
for version in versions:
if should_omit_version(version, self.arch, self.api, self.vndk, self.apex):
if should_omit_version(version, self.arch, self.api, self.llndk, self.apex):
continue
for symbol in version.symbols:
if should_omit_symbol(symbol, self.arch, self.api, self.vndk, self.apex):
if should_omit_symbol(symbol, self.arch, self.api, self.llndk, self.apex):
continue
if symbol.name in symbol_names:
@ -372,12 +372,12 @@ class SymbolFileParser(object):
class Generator(object):
"""Output generator that writes stub source files and version scripts."""
def __init__(self, src_file, version_script, arch, api, vndk, apex):
def __init__(self, src_file, version_script, arch, api, llndk, apex):
self.src_file = src_file
self.version_script = version_script
self.arch = arch
self.api = api
self.vndk = vndk
self.llndk = llndk
self.apex = apex
def write(self, versions):
@ -387,14 +387,14 @@ class Generator(object):
def write_version(self, version):
"""Writes a single version block's data to the output files."""
if should_omit_version(version, self.arch, self.api, self.vndk, self.apex):
if should_omit_version(version, self.arch, self.api, self.llndk, self.apex):
return
section_versioned = symbol_versioned_in_api(version.tags, self.api)
version_empty = True
pruned_symbols = []
for symbol in version.symbols:
if should_omit_symbol(symbol, self.arch, self.api, self.vndk, self.apex):
if should_omit_symbol(symbol, self.arch, self.api, self.llndk, self.apex):
continue
if symbol_versioned_in_api(symbol.tags, self.api):
@ -456,7 +456,7 @@ def parse_args():
'--arch', choices=ALL_ARCHITECTURES, required=True,
help='Architecture being targeted.')
parser.add_argument(
'--vndk', action='store_true', help='Use the VNDK variant.')
'--llndk', action='store_true', help='Use the LLNDK variant.')
parser.add_argument(
'--apex', action='store_true', help='Use the APEX variant.')
@ -493,14 +493,14 @@ def main():
with open(args.symbol_file) as symbol_file:
try:
versions = SymbolFileParser(symbol_file, api_map, args.arch, api,
args.vndk, args.apex).parse()
args.llndk, args.apex).parse()
except MultiplyDefinedSymbolError as ex:
sys.exit('{}: error: {}'.format(args.symbol_file, ex))
with open(args.stub_src, 'w') as src_file:
with open(args.version_script, 'w') as version_file:
generator = Generator(src_file, version_file, args.arch, api,
args.vndk, args.apex)
args.llndk, args.apex)
generator.write(versions)

View file

@ -86,7 +86,7 @@ func (stub *llndkStubDecorator) compile(ctx ModuleContext, flags Flags, deps Pat
// For non-enforcing devices, use "current"
vndk_ver = "current"
}
objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), vndk_ver, "--vndk")
objs, versionScript := compileStubLibrary(ctx, flags, String(stub.Properties.Symbol_file), vndk_ver, "--llndk")
stub.versionScriptPath = versionScript
return objs
}

View file

@ -179,17 +179,17 @@ class OmitVersionTest(unittest.TestCase):
gsl.Version('foo', None, ['platform-only'], []), 'arm', 9,
False, False))
def test_omit_vndk(self):
def test_omit_llndk(self):
self.assertTrue(
gsl.should_omit_version(
gsl.Version('foo', None, ['vndk'], []), 'arm', 9, False, False))
gsl.Version('foo', None, ['llndk'], []), 'arm', 9, False, False))
self.assertFalse(
gsl.should_omit_version(
gsl.Version('foo', None, [], []), 'arm', 9, True, False))
self.assertFalse(
gsl.should_omit_version(
gsl.Version('foo', None, ['vndk'], []), 'arm', 9, True, False))
gsl.Version('foo', None, ['llndk'], []), 'arm', 9, True, False))
def test_omit_apex(self):
self.assertTrue(
@ -231,16 +231,16 @@ class OmitVersionTest(unittest.TestCase):
class OmitSymbolTest(unittest.TestCase):
def test_omit_vndk(self):
def test_omit_llndk(self):
self.assertTrue(
gsl.should_omit_symbol(
gsl.Symbol('foo', ['vndk']), 'arm', 9, False, False))
gsl.Symbol('foo', ['llndk']), 'arm', 9, False, False))
self.assertFalse(
gsl.should_omit_symbol(gsl.Symbol('foo', []), 'arm', 9, True, False))
self.assertFalse(
gsl.should_omit_symbol(
gsl.Symbol('foo', ['vndk']), 'arm', 9, True, False))
gsl.Symbol('foo', ['llndk']), 'arm', 9, True, False))
def test_omit_apex(self):
self.assertTrue(
@ -441,12 +441,12 @@ class SymbolFileParseTest(unittest.TestCase):
self.assertEqual(expected, versions)
def test_parse_vndk_apex_symbol(self):
def test_parse_llndk_apex_symbol(self):
input_file = io.StringIO(textwrap.dedent("""\
VERSION_1 {
foo;
bar; # vndk
baz; # vndk apex
bar; # llndk
baz; # llndk apex
qux; # apex
};
"""))
@ -459,8 +459,8 @@ class SymbolFileParseTest(unittest.TestCase):
expected_symbols = [
gsl.Symbol('foo', []),
gsl.Symbol('bar', ['vndk']),
gsl.Symbol('baz', ['vndk', 'apex']),
gsl.Symbol('bar', ['llndk']),
gsl.Symbol('baz', ['llndk', 'apex']),
gsl.Symbol('qux', ['apex']),
]
self.assertEqual(expected_symbols, version.symbols)
@ -517,7 +517,7 @@ class GeneratorTest(unittest.TestCase):
self.assertEqual('', version_file.getvalue())
version = gsl.Version('VERSION_1', None, [], [
gsl.Symbol('foo', ['vndk']),
gsl.Symbol('foo', ['llndk']),
])
generator.write_version(version)
self.assertEqual('', src_file.getvalue())
@ -607,7 +607,7 @@ class IntegrationTest(unittest.TestCase):
VERSION_4 { # versioned=9
wibble;
wizzes; # vndk
wizzes; # llndk
waggle; # apex
} VERSION_2;
@ -749,10 +749,10 @@ class IntegrationTest(unittest.TestCase):
VERSION_4 { # versioned=9
wibble;
wizzes; # vndk
wizzes; # llndk
waggle; # apex
bubble; # apex vndk
duddle; # vndk apex
bubble; # apex llndk
duddle; # llndk apex
} VERSION_2;
VERSION_5 { # versioned=14