Skip to content

Commit

Permalink
Add Android configuration (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsmith authored Aug 19, 2024
1 parent 261bfce commit 56db932
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
5 changes: 5 additions & 0 deletions master/custom/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
Wasm32WasiCrossBuild,
Wasm32WasiDebugBuild,
IOSARM64SimulatorBuild,
AndroidBuild,
)

# A builder can be marked as stable when at least the 10 latest builds are
Expand Down Expand Up @@ -172,6 +173,10 @@

# iOS
("iOS ARM64 Simulator", "rkm-arm64-ios-simulator", IOSARM64SimulatorBuild),

# Android
("aarch64 Android", "mhsmith-android-aarch64", AndroidBuild),
("AMD64 Android", "mhsmith-android-x86_64", AndroidBuild),
]


Expand Down
72 changes: 72 additions & 0 deletions master/custom/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,10 @@ class Wasm32WasiDebugBuild(_Wasm32WasiBuild):
testFlags = ["-u-cpu"]


##############################################################################
################################ IOS BUILDS ################################
##############################################################################

class _IOSSimulatorBuild(UnixBuild):
"""iOS Simulator build.
Expand Down Expand Up @@ -1138,3 +1142,71 @@ def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
class IOSARM64SimulatorBuild(_IOSSimulatorBuild):
"""An ARM64 iOS simulator build."""
arch = "arm64"


##############################################################################
############################## ANDROID BUILDS ##############################
##############################################################################

class AndroidBuild(BaseBuild):
"""Build Python for Android on a Linux or Mac machine, and test it using a
Gradle-managed emulator. Worker setup instructions:
* Install all the usual tools and libraries needed to build Python for the
worker's own operating system.
* Follow the instructions in the Prerequisites section of
cpython/Android/README.md.
* On Linux:
* Make sure the worker has access to the KVM virtualization interface.
* Start an X server such as Xvfb, and set the DISPLAY environment variable
to point at it.
"""

def setup(self, **kwargs):
android_py = "Android/android.py"
self.addSteps([
SetPropertyFromCommand(
name="Get build triple",
command=["./config.guess"],
property="build_triple",
haltOnFailure=True,
),
Configure(
name="Configure build Python",
command=[android_py, "configure-build"],
),
Compile(
name="Compile build Python",
command=[android_py, "make-build"],
),
Configure(
name="Configure host Python",
command=[android_py, "configure-host", self.host_triple],
),
Compile(
name="Compile host Python",
command=[android_py, "make-host", self.host_triple],
),
Compile(
name="Build testbed",
command=[android_py, "build-testbed"],
),
Test(
command=[
android_py, "test", "--managed", "maxVersion", "--",
"-W", "-uall",
],
timeout=step_timeout(self.test_timeout),
),
ShellCommand(
name="Clean",
command=[android_py, "clean"],
),
])

@util.renderer
def host_triple(props):
build_triple = props.getProperty("build_triple")
return build_triple.split("-")[0] + "-linux-android"
12 changes: 12 additions & 0 deletions master/custom/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,16 @@ def get_workers(settings):
not_branches=['3.9', '3.10', '3.11', '3.12'],
parallel_builders=4,
),
cpw(
name="mhsmith-android-aarch64",
tags=['android'],
not_branches=['3.9', '3.10', '3.11', '3.12'],
parallel_builders=1, # All builds use the same emulator and app ID.
),
cpw(
name="mhsmith-android-x86_64",
tags=['android'],
not_branches=['3.9', '3.10', '3.11', '3.12'],
parallel_builders=1, # All builds use the same emulator and app ID.
),
]

0 comments on commit 56db932

Please sign in to comment.