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.

Bug: 143765505
Test: m
Test: python3 test_gen_stub_libs.py
Change-Id: I2853df3b6e245056c21d4ab3d62466954cf26d72
This commit is contained in:
Jiyong Park
2019-11-06 12:37:43 +09:00
parent 01dd09de1a
commit 3d7b69a657
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') 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. """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 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: if 'platform-only' in version.tags:
return True return True
no_vndk_no_apex = 'vndk' not in version.tags and 'apex' not in version.tags no_llndk_no_apex = 'llndk' not in version.tags and 'apex' not in version.tags
keep = no_vndk_no_apex or \ keep = no_llndk_no_apex or \
('vndk' in version.tags and vndk) or \ ('llndk' in version.tags and llndk) or \
('apex' in version.tags and apex) ('apex' in version.tags and apex)
if not keep: if not keep:
return True return True
@@ -133,11 +133,11 @@ def should_omit_version(version, arch, api, vndk, apex):
return False 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.""" """Returns True if the symbol should be omitted."""
no_vndk_no_apex = 'vndk' not in symbol.tags and 'apex' not in symbol.tags no_llndk_no_apex = 'llndk' not in symbol.tags and 'apex' not in symbol.tags
keep = no_vndk_no_apex or \ keep = no_llndk_no_apex or \
('vndk' in symbol.tags and vndk) or \ ('llndk' in symbol.tags and llndk) or \
('apex' in symbol.tags and apex) ('apex' in symbol.tags and apex)
if not keep: if not keep:
return True return True
@@ -250,12 +250,12 @@ class Symbol(object):
class SymbolFileParser(object): class SymbolFileParser(object):
"""Parses NDK symbol files.""" """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.input_file = input_file
self.api_map = api_map self.api_map = api_map
self.arch = arch self.arch = arch
self.api = api self.api = api
self.vndk = vndk self.llndk = llndk
self.apex = apex self.apex = apex
self.current_line = None self.current_line = None
@@ -284,11 +284,11 @@ class SymbolFileParser(object):
symbol_names = set() symbol_names = set()
multiply_defined_symbols = set() multiply_defined_symbols = set()
for version in versions: 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 continue
for symbol in version.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 continue
if symbol.name in symbol_names: if symbol.name in symbol_names:
@@ -372,12 +372,12 @@ class SymbolFileParser(object):
class Generator(object): class Generator(object):
"""Output generator that writes stub source files and version scripts.""" """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.src_file = src_file
self.version_script = version_script self.version_script = version_script
self.arch = arch self.arch = arch
self.api = api self.api = api
self.vndk = vndk self.llndk = llndk
self.apex = apex self.apex = apex
def write(self, versions): def write(self, versions):
@@ -387,14 +387,14 @@ class Generator(object):
def write_version(self, version): def write_version(self, version):
"""Writes a single version block's data to the output files.""" """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 return
section_versioned = symbol_versioned_in_api(version.tags, self.api) section_versioned = symbol_versioned_in_api(version.tags, self.api)
version_empty = True version_empty = True
pruned_symbols = [] pruned_symbols = []
for symbol in version.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 continue
if symbol_versioned_in_api(symbol.tags, self.api): if symbol_versioned_in_api(symbol.tags, self.api):
@@ -456,7 +456,7 @@ def parse_args():
'--arch', choices=ALL_ARCHITECTURES, required=True, '--arch', choices=ALL_ARCHITECTURES, required=True,
help='Architecture being targeted.') help='Architecture being targeted.')
parser.add_argument( parser.add_argument(
'--vndk', action='store_true', help='Use the VNDK variant.') '--llndk', action='store_true', help='Use the LLNDK variant.')
parser.add_argument( parser.add_argument(
'--apex', action='store_true', help='Use the APEX variant.') '--apex', action='store_true', help='Use the APEX variant.')
@@ -493,14 +493,14 @@ def main():
with open(args.symbol_file) as symbol_file: with open(args.symbol_file) as symbol_file:
try: try:
versions = SymbolFileParser(symbol_file, api_map, args.arch, api, versions = SymbolFileParser(symbol_file, api_map, args.arch, api,
args.vndk, args.apex).parse() args.llndk, args.apex).parse()
except MultiplyDefinedSymbolError as ex: except MultiplyDefinedSymbolError as ex:
sys.exit('{}: error: {}'.format(args.symbol_file, ex)) sys.exit('{}: error: {}'.format(args.symbol_file, ex))
with open(args.stub_src, 'w') as src_file: with open(args.stub_src, 'w') as src_file:
with open(args.version_script, 'w') as version_file: with open(args.version_script, 'w') as version_file:
generator = Generator(src_file, version_file, args.arch, api, generator = Generator(src_file, version_file, args.arch, api,
args.vndk, args.apex) args.llndk, args.apex)
generator.write(versions) 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" // For non-enforcing devices, use "current"
vndk_ver = "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 stub.versionScriptPath = versionScript
return objs return objs
} }

View File

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