ktaglib: autobuild taglib on gradle build

This commit is contained in:
Alexander Capehart 2024-12-12 12:11:03 -07:00
parent 1c85dc96e0
commit a85acceed6
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 21 additions and 10 deletions

View file

@ -1,3 +1,5 @@
import org.apache.tools.ant.taskdefs.condition.Os
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
@ -41,12 +43,21 @@ android {
}
}
dependencies {
task assembleTaglib(type: Exec) {
def jniDir = "$projectDir/src/main/cpp/"
def libs = new File("$jniDir/taglib/pkg")
if (libs.exists()) {
commandLine "true"
return
}
commandLine "sh", "-c", "$jniDir/build_taglib.sh $android.ndkDirectory"
}
implementation 'androidx.core:core-ktx:1.15.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
afterEvaluate {
preDebugBuild.dependsOn assembleTaglib
preReleaseBuild.dependsOn assembleTaglib
}
clean {
delete "$projectDir/src/main/jni/ffmpeg/android-libs/"
}

View file

@ -25,7 +25,7 @@ project("ktaglib")
# for GameActivity/NativeActivity derived applications, the same library name must be
# used in the AndroidManifest.xml file.
set(taglib_location "${CMAKE_CURRENT_SOURCE_DIR}/taglib")
set(taglib_pkg "${taglib_location}/android-libs/${ANDROID_ABI}")
set(taglib_pkg "${taglib_location}/pkg/${ANDROID_ABI}")
set(taglib_lib "${taglib_pkg}/lib")
set(taglib_include "${taglib_pkg}/include")

View file

@ -11,4 +11,4 @@ object KTagLib {
* which is packaged with this application.
*/
external fun stringFromJNI(): String
}b
}