Merge changes from topic 'ndk-weak-stubs'
* changes: Add NDK API codenames for old releases. Add support for weak symbols in the NDK stubs.
This commit is contained in:
@@ -55,7 +55,19 @@ func GetApiLevelsJson(ctx PathContext) Path {
|
|||||||
|
|
||||||
func (a *apiLevelsSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
func (a *apiLevelsSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
|
||||||
baseApiLevel := 9000
|
baseApiLevel := 9000
|
||||||
apiLevelsMap := map[string]int{}
|
apiLevelsMap := map[string]int{
|
||||||
|
"G": 9,
|
||||||
|
"I": 14,
|
||||||
|
"J": 16,
|
||||||
|
"J-MR1": 17,
|
||||||
|
"J-MR2": 18,
|
||||||
|
"K": 19,
|
||||||
|
"L": 21,
|
||||||
|
"L-MR1": 22,
|
||||||
|
"M": 23,
|
||||||
|
"N": 24,
|
||||||
|
"N-MR1": 25,
|
||||||
|
}
|
||||||
for i, codename := range ctx.Config().(Config).PlatformVersionAllCodenames() {
|
for i, codename := range ctx.Config().(Config).PlatformVersionAllCodenames() {
|
||||||
apiLevelsMap[codename] = baseApiLevel + i
|
apiLevelsMap[codename] = baseApiLevel + i
|
||||||
}
|
}
|
||||||
|
@@ -347,10 +347,16 @@ class Generator(object):
|
|||||||
if section_versioned and emit_version:
|
if section_versioned and emit_version:
|
||||||
self.version_script.write(' ' + symbol.name + ';\n')
|
self.version_script.write(' ' + symbol.name + ';\n')
|
||||||
|
|
||||||
|
weak = ''
|
||||||
|
if 'weak' in symbol.tags:
|
||||||
|
weak = '__attribute__((weak)) '
|
||||||
|
|
||||||
if 'var' in symbol.tags:
|
if 'var' in symbol.tags:
|
||||||
self.src_file.write('int {} = 0;\n'.format(symbol.name))
|
self.src_file.write('{}int {} = 0;\n'.format(
|
||||||
|
weak, symbol.name))
|
||||||
else:
|
else:
|
||||||
self.src_file.write('void {}() {{}}\n'.format(symbol.name))
|
self.src_file.write('{}void {}() {{}}\n'.format(
|
||||||
|
weak, symbol.name))
|
||||||
|
|
||||||
if not version_empty and section_versioned:
|
if not version_empty and section_versioned:
|
||||||
base = '' if version.base is None else ' ' + version.base
|
base = '' if version.base is None else ' ' + version.base
|
||||||
|
@@ -430,6 +430,8 @@ class GeneratorTest(unittest.TestCase):
|
|||||||
gsl.Version('VERSION_1', None, [], [
|
gsl.Version('VERSION_1', None, [], [
|
||||||
gsl.Symbol('foo', []),
|
gsl.Symbol('foo', []),
|
||||||
gsl.Symbol('bar', ['var']),
|
gsl.Symbol('bar', ['var']),
|
||||||
|
gsl.Symbol('woodly', ['weak']),
|
||||||
|
gsl.Symbol('doodly', ['weak', 'var']),
|
||||||
]),
|
]),
|
||||||
gsl.Version('VERSION_2', 'VERSION_1', [], [
|
gsl.Version('VERSION_2', 'VERSION_1', [], [
|
||||||
gsl.Symbol('baz', []),
|
gsl.Symbol('baz', []),
|
||||||
@@ -443,6 +445,8 @@ class GeneratorTest(unittest.TestCase):
|
|||||||
expected_src = textwrap.dedent("""\
|
expected_src = textwrap.dedent("""\
|
||||||
void foo() {}
|
void foo() {}
|
||||||
int bar = 0;
|
int bar = 0;
|
||||||
|
__attribute__((weak)) void woodly() {}
|
||||||
|
__attribute__((weak)) int doodly = 0;
|
||||||
void baz() {}
|
void baz() {}
|
||||||
void qux() {}
|
void qux() {}
|
||||||
""")
|
""")
|
||||||
@@ -453,6 +457,8 @@ class GeneratorTest(unittest.TestCase):
|
|||||||
global:
|
global:
|
||||||
foo;
|
foo;
|
||||||
bar;
|
bar;
|
||||||
|
woodly;
|
||||||
|
doodly;
|
||||||
};
|
};
|
||||||
VERSION_2 {
|
VERSION_2 {
|
||||||
global:
|
global:
|
||||||
|
Reference in New Issue
Block a user