Skip to content

Commit

Permalink
Remove support for KitKat.
Browse files Browse the repository at this point in the history
Bug: android/ndk#1751
Test: treehugger
Change-Id: I52c45663a8fb997cc8b8e3955e4843772c881792
  • Loading branch information
DanAlbert committed Oct 13, 2022
1 parent e556869 commit 82a673d
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 133 deletions.
7 changes: 7 additions & 0 deletions docs/changelogs/Changelog-r26.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ directly, see the [build system maintainers guide].
[Android Studio site]: http://tools.android.com/filing-bugs
[build system maintainers guide]: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md

## Announcements

* KitKat (APIs 19 and 20) is no longer supported. The minimum OS supported by
the NDK is Lollipop (API level 21). See [Issue 1751] for details.

[Issue 1751]: https://github.com/android/nßdk/issues/1751

## Changes

## Known Issues
Expand Down
2 changes: 1 addition & 1 deletion meta/platforms.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"min": 19,
"min": 21,
"max": 33,
"aliases": {
"20": 19,
Expand Down
8 changes: 4 additions & 4 deletions ndk/abis.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def clang_target(arch: Arch, api: Optional[int] = None) -> str:
def min_api_for_abi(abi: Abi) -> int:
"""Returns the minimum supported build API for the given ABI.
>>> min_api_for_abi('arm64-v8a')
>>> min_api_for_abi(Abi('arm64-v8a'))
21
>>> min_api_for_abi('armeabi-v7a')
19
>>> min_api_for_abi(Abi('armeabi-v7a'))
21
>>> min_api_for_abi('foobar')
>>> min_api_for_abi(Abi('foobar'))
Traceback (most recent call last):
...
ValueError: Invalid ABI: foobar
Expand Down
44 changes: 1 addition & 43 deletions ndk/checkbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,6 @@ class Libcxx(ndk.builds.Module):
notice_group = ndk.builds.NoticeGroup.TOOLCHAIN
deps = {
"base-toolchain",
"libandroid_support",
"ndk-build",
"ndk-build-shortcut",
}
Expand Down Expand Up @@ -1501,7 +1500,6 @@ class BaseToolchain(ndk.builds.Module):
notice_group = ndk.builds.NoticeGroup.TOOLCHAIN
deps = {
"clang",
"libandroid_support",
"make",
"platforms",
"sysroot",
Expand All @@ -1513,7 +1511,6 @@ class BaseToolchain(ndk.builds.Module):
def notices(self) -> Iterator[Path]:
yield from Clang().notices
yield from Yasm().notices
yield from LibAndroidSupport().notices
yield from Platforms().notices
yield from Sysroot().notices
yield from SystemStl().notices
Expand All @@ -1524,7 +1521,6 @@ def build(self) -> None:
def install(self) -> None:
install_dir = self.get_install_path()
yasm_dir = self.get_dep("yasm").get_install_path()
libandroid_support_dir = self.get_dep("libandroid_support").get_install_path()
platforms_dir = self.get_dep("platforms").get_install_path()
sysroot_dir = self.get_dep("sysroot").get_install_path()
system_stl_dir = self.get_dep("system-stl").get_install_path()
Expand Down Expand Up @@ -1577,19 +1573,6 @@ def install(self) -> None:
system_stl_inc_dst = system_stl_hdr_dir / "4.9.x"
shutil.copytree(system_stl_inc_src, system_stl_inc_dst)

# $SYSROOT/usr/local/include comes before $SYSROOT/usr/include, so we
# can use that for libandroid_support's headers. Puting them here
# *does* mean that libandroid_support's headers get used even when
# we're not using libandroid_support, but they should be a no-op for
# android-21+ and in the case of pre-21 without libandroid_support
# (libstdc++), we're only degrading the UX; the user will get a linker
# error instead of a compiler error.
support_hdr_dir = install_dir / "sysroot/usr/local"
support_hdr_dir.mkdir(parents=True)
support_inc_src = libandroid_support_dir / "include"
support_inc_dst = support_hdr_dir / "include"
shutil.copytree(support_inc_src, support_inc_dst)


@register
class Vulkan(ndk.builds.Module):
Expand Down Expand Up @@ -1679,8 +1662,6 @@ def install(self) -> None:
"libc++_static.a",
"libc++abi.a",
]
if abi in ndk.abis.LP32_ABIS:
static_libs.append("libandroid_support.a")

for lib in static_libs:
shutil.copy2(
Expand All @@ -1689,6 +1670,7 @@ def install(self) -> None:

platforms = self.get_dep("platforms")
assert isinstance(platforms, Platforms)
# Also install a libc++.so and libc++.a linker script per API level.
for api in platforms.get_apis():
if api in Platforms.skip_apis:
continue
Expand All @@ -1697,25 +1679,8 @@ def install(self) -> None:
triple = ndk.abis.arch_to_triple(arch)
dst_dir = install_dir / "sysroot/usr/lib" / triple / str(api)

# Also install a libc++.so and libc++.a linker script per API
# level. We need this to be done on a per-API level basis
# because libandroid_support is only used on pre-21 API levels.
static_script = ["-lc++_static", "-lc++abi"]
shared_script = ["-lc++_shared"]
if api < 21:
# The ordering here is funky because of interdependencies
# between libandroid_support and libc++abi.
# libandroid_support needs new/delete from libc++abi but
# libc++abi needs posix_memalign from libandroid_support.
static_script.extend(
[
"-landroid_support",
"-lc++abi",
# TODO: Remove once API 16 is no longer supported.
"-landroid_support",
]
)
shared_script.insert(0, "-landroid_support")

libcxx_so_path = dst_dir / "libc++.so"
with open(libcxx_so_path, "w") as script:
Expand Down Expand Up @@ -1920,13 +1885,6 @@ class SystemStl(ndk.builds.PackageModule):
src = NDK_DIR / "sources/cxx-stl/system"


@register
class LibAndroidSupport(ndk.builds.PackageModule):
name = "libandroid_support"
install_path = Path("sources/android/support")
src = NDK_DIR / "sources/android/support"


@register
class Libcxxabi(ndk.builds.PackageModule):
name = "libc++abi"
Expand Down
Empty file.
4 changes: 0 additions & 4 deletions tests/build/cmake_api_pull_up/project/CMakeLists.txt

This file was deleted.

3 changes: 0 additions & 3 deletions tests/build/cmake_api_pull_up/project/foo.cpp

This file was deleted.

68 changes: 0 additions & 68 deletions tests/build/cmake_api_pull_up/test.py

This file was deleted.

10 changes: 0 additions & 10 deletions tests/build/cmake_api_pull_up/test_config.py

This file was deleted.

10 changes: 10 additions & 0 deletions tests/device/emutls-dealloc/test_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Optional
from ndk.abis import Abi
from ndk.test.devices import Device
from ndk.test.devicetest.case import TestCase


def run_broken(test: TestCase, device: Device) -> tuple[Optional[str], Optional[str]]:
if device.version == 21 and test.config.abi == Abi("armeabi-v7a"):
return f"{device.version}", "https://github.com/android/ndk/issues/1753"
return None, None

0 comments on commit 82a673d

Please sign in to comment.