Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate the rest of the samples to the convention plugin. #1035

Merged
merged 29 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
04a8909
Migrate bitmap-plasma to convention plugin.
DanAlbert May 8, 2024
6b1432c
Migrate camera to convention plugin.
DanAlbert May 8, 2024
9717b19
Migrate display-p3 to convention plugin.
DanAlbert May 8, 2024
64b7fc9
Migrate endless-tunnel to convention plugin.
DanAlbert May 8, 2024
7dc18b0
Migrate gles3jni to convention plugin.
DanAlbert May 8, 2024
03dabd5
Migrate hello-gl2 to convention plugin.
DanAlbert May 8, 2024
765ff8e
Migrate hello-jni to convention plugin.
DanAlbert May 8, 2024
5123aeb
Migrate hello-jniCallback to convention plugin.
DanAlbert May 8, 2024
8ef1cb6
Migrate hello-libs to convention plugin.
DanAlbert May 8, 2024
e9916f5
Migrate hello-neon to convention plugin.
DanAlbert May 8, 2024
f0cb058
Migrate hello-oboe to convention plugin.
DanAlbert May 8, 2024
8e4851f
Migrate hello-vulkan to convention plugin.
DanAlbert May 8, 2024
5aa06e5
Migrate native-activity to convention plugin.
DanAlbert May 8, 2024
405a6c8
Migrate native-audio to convention plugin.
DanAlbert May 8, 2024
9816d9b
Migrate native-codec to convention plugin.
DanAlbert May 8, 2024
a7528e6
Migrate native-media to convention plugin.
DanAlbert May 8, 2024
f1b9ceb
Migrate native-midi to convention plugin.
DanAlbert May 8, 2024
35bfbb5
Migrate native-plasma to convention plugin.
DanAlbert May 8, 2024
38f71dd
Migrate nn-samples to convention plugin.
DanAlbert May 8, 2024
08f632c
Migrate orderfile to convention plugin.
DanAlbert May 8, 2024
8f0da77
Migrate curl-ssl to convention plugin.
DanAlbert May 8, 2024
b48b743
Migrate prefab-dependency to convention plugin.
DanAlbert May 8, 2024
013bd1c
Migrate prefab-publishing to convention plugin.
DanAlbert May 8, 2024
3b8848e
Migrate san-angeles to convention plugin.
DanAlbert May 8, 2024
21cf515
Migrate sanitizers to convention plugin.
DanAlbert May 8, 2024
98861da
Migrate sensor-graph to convention plugin.
DanAlbert May 8, 2024
ffd4d16
Migrate teapots to convention plugin.
DanAlbert May 8, 2024
ca8ae6b
Migrate unit-test to convention plugin.
DanAlbert May 8, 2024
9b5255a
Migrate webp-view to convention plugin.
DanAlbert May 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions bitmap-plasma/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
plugins {
id 'com.android.application'
id "ndksamples.android.application"
}

android {
compileSdk 33
ndkVersion '25.1.8937393'

defaultConfig.with {
namespace 'com.example.plasma'
defaultConfig {
applicationId 'com.example.plasma'
minSdkVersion 14
targetSdkVersion 33
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
namespace 'com.example.plasma'
}
4 changes: 4 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ gradlePlugin {
id = "ndksamples.android.application"
implementationClass = "com.android.ndk.samples.buildlogic.AndroidApplicationConventionPlugin"
}
register("androidLibrary") {
id = "ndksamples.android.library"
implementationClass = "com.android.ndk.samples.buildlogic.AndroidLibraryConventionPlugin"
}
register("kotlinAndroid") {
id = "ndksamples.android.kotlin"
implementationClass = "com.android.ndk.samples.buildlogic.KotlinConventionPlugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.android.ndk.samples.buildlogic

import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

class AndroidLibraryConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("com.android.library")
}

extensions.configure<LibraryExtension> {
compileSdk = Versions.COMPILE_SDK
ndkVersion = Versions.NDK
defaultConfig {
minSdk = Versions.MIN_SDK
lint {
targetSdk = Versions.TARGET_SDK
}
testOptions {
targetSdk = Versions.TARGET_SDK
}
}
compileOptions {
sourceCompatibility = Versions.JAVA
targetCompatibility = Versions.JAVA
}
}
}
}
}
21 changes: 3 additions & 18 deletions camera/basic/build.gradle
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
plugins {
id 'com.android.application'
id "ndksamples.android.application"
}

android {
compileSdk 33
ndkVersion '25.1.8937393'

namespace 'com.sample.camera.basic'
defaultConfig {
applicationId 'com.sample.camera.basic'
minSdkVersion 24
targetSdkVersion 33
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
namespace 'com.sample.camera.basic'
}

dependencies {
implementation fileTree(dir:'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation libs.appcompat
}
19 changes: 3 additions & 16 deletions camera/texture-view/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
plugins {
id 'com.android.application'
id "ndksamples.android.application"
}

android {
compileSdk 33
ndkVersion '25.1.8937393'

namespace 'com.sample.textureview'
defaultConfig {
applicationId "com.sample.textureview"
minSdkVersion 24
targetSdkVersion 33
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
Expand All @@ -22,18 +19,8 @@ android {
path 'src/main/cpp/CMakeLists.txt'
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
namespace 'com.sample.textureview'

}

dependencies {
implementation 'androidx.core:core:1.9.0'
implementation libs.androidx.core
}
22 changes: 7 additions & 15 deletions display-p3/image-view/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
plugins {
id 'com.android.application'
id "ndksamples.android.application"
}

android {
compileSdk 33
ndkVersion '25.1.8937393'

namespace 'com.example.widecolor'
defaultConfig {
applicationId = 'com.example.widecolor'
// p3_passthrough_ext starts from Android-29
// it could be lowered to Android-26, from which p3_ext started
// TODO: Make the sample degrade gracefully on older API levels, reduce to 24 or 21.
minSdkVersion 29
targetSdkVersion 33 // p3_passthrough_ext starts from Android-29
// it could be lowered to Android-26, from which p3_ext started
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-29'
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
namespace 'com.example.widecolor'
}

// TODO: Vendor this into the tree.
// download third_party libs: mathfu, stb
List<String> TARGET_DIR = [projectDir.toString() + '/../third_party/mathfu',
projectDir.toString() + '/../third_party/stb']
Expand All @@ -53,5 +45,5 @@ for (int i = 0; i < TARGET_DIR.size(); i++) {
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation libs.appcompat
}
19 changes: 2 additions & 17 deletions endless-tunnel/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@
*/

plugins {
id 'com.android.application'
id "ndksamples.android.application"
}

android {
compileSdk 33
ndkVersion '25.1.8937393'

namespace 'com.google.sample.tunnel'
defaultConfig {
applicationId 'com.google.sample.tunnel'
minSdkVersion 14
targetSdkVersion 33
versionCode 1
versionName '1.0'
externalNativeBuild {
Expand All @@ -34,21 +30,10 @@ android {
}
}
}
buildTypes {
release {
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
lint {
abortOnError false
}
namespace 'com.google.sample.tunnel'
}

20 changes: 3 additions & 17 deletions gles3jni/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
plugins {
id 'com.android.application'
id "ndksamples.android.application"
}

def platformVersion = 24 // openGLES 3.2 min api level
// def platformVersion = 18 //openGLES 3 min api level
// def platformVersion = 12 //openGLES 2 min api level

android {
compileSdk 33
ndkVersion '25.1.8937393'
namespace 'com.android.gles3jni'

defaultConfig {
applicationId 'com.android.gles3jni'
minSdkVersion "${platformVersion}"
targetSdkVersion 33
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
}
}
}
buildTypes {
release {
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}

externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
namespace 'com.android.gles3jni'
}
20 changes: 20 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
[versions]
agp = "8.4.0"
kotlin = "1.7.21"
kotlinxCoroutines = "1.6.1"
junit = "4.13.2"
junitVersion = "1.1.5"
espressoCore = "3.5.1"
androidxConstraintLayout = "2.1.4"
androidxCore = "1.9.0"
androidxGames = "2.1.0-alpha01"
androidxJUnitGTest = "1.0.0-alpha01"
appcompat = "1.6.1"
material = "1.12.0"
jetbrainsKotlinJvm = "1.7.21"
oboe = "1.6.1"

curl = "7.79.1-beta-1"
googletest = "1.11.0-beta-1"
jsoncpp = "1.9.5-beta-1"
openssl = "1.1.1l-beta-1"

[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidxConstraintLayout" }
androidx-core = { group = "androidx.core", name = "core", version.ref = "androidxCore" }
androidx-games-gameactivity = { group = "androidx.games", name = "games-activity", version.ref = "androidxGames" }
androidx-junit-gtest = { group = "androidx.test.ext", name = "junit-gtest", version.ref = "androidxJUnitGTest" }
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
oboe = { group = "com.google.oboe", name = "oboe", version.ref = "oboe" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" }
curl = { group = "com.android.ndk.thirdparty", name = "curl", version.ref = "curl" }
googletest = { group = "com.android.ndk.thirdparty", name = "googletest", version.ref = "googletest" }
jsoncpp = { group = "com.android.ndk.thirdparty", name = "jsoncpp", version.ref = "jsoncpp" }
openssl = { group = "com.android.ndk.thirdparty", name = "openssl", version.ref = "openssl" }

# build-logic dependencies
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" }
Expand Down
18 changes: 3 additions & 15 deletions hello-gl2/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
plugins {
id 'com.android.application'
id "ndksamples.android.application"
}

android {
compileSdk 33
ndkVersion '25.1.8937393'

namespace 'com.android.gl2jni'

defaultConfig {
applicationId 'com.android.gl2jni'
minSdkVersion 14
targetSdkVersion 33
externalNativeBuild {
cmake {
// Available arguments are inside ${SDK}/cmake/.../android.toolchain.cmake file
Expand All @@ -18,18 +15,9 @@ android {
}
}

buildTypes {
release {
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
}
}
namespace 'com.android.gl2jni'
}

Loading
Loading