opencv/platforms/android/aar-template/OpenCV/build.gradle.template
alexlyulkov 30549d65c2
Merge pull request #24456 from alexlyulkov:al/aar
Added scripts for creating an AAR package and a local Maven repository with OpenCV library #24456

Added scripts for creating an AAR package and a local Maven repository with OpenCV library.

The build_java_shared_aar.py script creates AAR with Java + C++ shared libraries.
The build_static_aar.py script creates AAR with static C++ libraries.

The scripts use an Android project template. The project is almost a default Android AAR library project with empty Java code and one empty C++ library. Only build.gradle.template and CMakeLists.txt.template files contain significant changes.

See README.md for more information.
2023-11-07 14:23:33 +03:00

88 lines
1.9 KiB
Plaintext

plugins {
id 'com.android.library'
id 'maven-publish'
}
android {
namespace 'org.opencv'
compileSdk ${COMPILE_SDK}
defaultConfig {
minSdk ${MIN_SDK}
targetSdk ${TARGET_SDK}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
arguments "-DANDROID_STL=${LIB_TYPE}"
}
}
ndk {
abiFilters ${ABI_FILTERS}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_${JAVA_VERSION}
targetCompatibility JavaVersion.VERSION_${JAVA_VERSION}
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
}
}
buildFeatures {
aidl true
prefabPublishing true
buildConfig true
}
prefab {
${LIB_NAME} {
headers "src/main/cpp/include"
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java']
//jniLibs.srcDirs = ['libs']
aidl.srcDirs = ['src/main/java']
}
}
publishing {
singleVariant('release') {
withSourcesJar()
}
}
}
publishing {
publications {
release(MavenPublication) {
groupId = 'org.opencv'
artifactId = '${PACKAGE_NAME}'
version = '${OPENCV_VERSION}'
artifact("opencv-release.aar")
// afterEvaluate {
// from components.release
// }
}
}
repositories {
maven {
name = 'myrepo'
url = "${project.buildDir}/repo"
}
}
}
dependencies {
}