This repository contains the source code for the Chartboost Android SDKs, including the Core, Mediation, and Monetization products. This guide is intended for internal developers and provides information on building, testing, and releasing the SDKs.
The repository is a multi-module monorepository. The main components are:
| Module / Directory | Description |
|---|---|
ChartboostCore/ |
The Core SDK, providing common functionalities like networking, logging, and module management used by other Chartboost SDKs. |
ChartboostMediation/ |
The Chartboost Mediation SDK, which integrates multiple ad network partners. |
ChartboostMonetization/ |
The Chartboost Monetization SDK. |
ChartboostMediationCanary/ |
An internal testing application for the Mediation SDK, used for development, QA, and canary releases. |
ChartboostCoreJavaValidator/ |
A small project to ensure the Core SDK has proper Java interoperability. |
ChartboostMediationJavaValidator/ |
A small project to ensure the Mediation SDK has proper Java interoperability. |
chartboost-mediation-android-adapter-* |
Git submodules for each third-party mediation adapter (e.g., AdMob, AppLovin). These are separate repositories. |
chartboost-core-android-consent-adapter-* |
Git submodules for consent management platform adapters (e.g., Usercentrics, Google UMP). |
buildSrc/ |
Contains build logic, dependencies, and version information shared across modules. |
scripts/ |
Contains various scripts for CI/CD, releasing, and other automation tasks. |
.github/workflows/ |
GitHub Actions workflows for CI, nightly builds, releases, etc. |
- Android Studio: Use the version specified in the root
build.gradle.kts. - Java Development Kit (JDK): Ensure you have JDK 17 installed.
- Artifactory Credentials: To build the project, you need credentials for Chartboost's Artifactory instance. They can be found in the team's 1Password vault. Set the following environment variables:
export JFROG_USER="<artifactory-username>" export JFROG_PASS="<artifactory-password>"
- Git Submodules: The adapter dependencies are managed as git submodules. After cloning the repository, you must initialize and update the submodules:
To pull the latest changes for all submodules, run:
git submodule update --init --recursive
git submodule foreach git pull origin main
You can build the entire project and all its modules by running the following command from the root directory:
./gradlew buildTo build a specific module, you can run the build task for that module. For example, to build the Mediation SDK:
./gradlew :ChartboostMediation:buildThe ChartboostMediationCanary app is the primary tool for testing and debugging the SDKs. To run it:
- Open the project root in Android Studio.
- Select the
ChartboostMediationCanaryrun configuration. - Choose an emulator or connected device.
- Click "Run".
The CI process is handled by GitHub Actions. The main workflow is defined in ci-tests.yml. It runs on every pull request (see below for details).
Before pushing your changes, you should run the same high-level CI tasks that are used in GitHub Actions. These tasks lint, test, and build the main SDKs.
- For Core SDK changes:
./gradlew chartboostcore-ci - For Mediation SDK changes:
./gradlew chartboostmediation-ci - For Monetization SDK changes:
./gradlew chartboostmonetization-ci
When you open a pull request, the ci-tests.yml workflow will automatically run. It performs the following steps:
- Determines Changed Modules: It intelligently inspects the changed files to determine which SDK modules are affected (Core, Mediation, Monetization).
- Automated Fixes: It automatically checks for and adds missing copyright headers. It also runs
ktlintandblackto format Kotlin and Python code. Any changes are automatically committed and pushed to your PR branch. - Static Analysis: It runs
detekton the changed Kotlin files and posts a report as a comment on the PR. This comment is updated on subsequent pushes. - Build & Test: It runs the appropriate
*-ciGradle task (e.g.,chartboostmediation-ci) for the modules that were changed. This ensures the code builds and all tests pass.
The release process is highly automated through GitHub Actions. Do not create and push tags manually. The entire process is managed by a script to ensure consistency and safety.
The release process is initiated through the Manual Release (odd name, we know) workflow in the GitHub Actions tab.
- Navigate to the Actions tab in the GitHub repository.
- Select the Manual Release workflow from the list on the left.
- Click the Run workflow dropdown button.
- Fill in the required parameters:
version: The version to release inMAJOR.MINOR.PATCHformat (e.g.,5.3.0).sdk_module: The SDK module to release (choose fromChartboostCore,ChartboostMediation, orChartboostMonetization).dry_run: Selecttrueto run a test release orfalsefor a production release.
- Click the Run workflow button.
Here is what happens after you trigger the manual release:
manual-release.ymlis triggered: This workflow takes your inputs.scripts/release.shis executed: The workflow calls this shell script, passing your inputs as parameters. The script checks out the correct release branch (e.g.,release/5.3.0-ChartboostMediation), then creates and pushes the corresponding git tag (e.g.,5.3.0-ChartboostMediationor5.3.0-ChartboostMediation-dryrun).release.ymlis triggered: The push of the new tag automatically triggers the mainrelease.ymlworkflow. This workflow is responsible for the actual release process:- It runs precondition checks.
- It builds the AAR and publishes it to Artifactory.
- It creates a GitHub Release with the AAR as an artifact.
- It automatically creates PRs to merge the release branch back into
developandmain. - It publishes the documentation to S3.
- It syncs the code to the public open-source repository (for Core and Mediation).
It is highly recommended to perform a dry run before a production release. To do this, simply set the dry_run input parameter to true when running the Manual Release workflow.
The dry run will execute all the same steps as a real release, but it will not publish to the public Artifactory repositories. It will create a temporary GitHub release and PRs, and then automatically delete them at the end of the workflow. This allows you to safely verify that the entire release process is working correctly.
- Nightly Builds: The
nightly.ymlworkflow runs daily, building the latestdevelopbranch and publishing it to a private Artifactory repository. - Release Candidates: The
generate-release-candidate.ymlworkflow can be run manually to create and publish a release candidate for testing.