Android Studio 에서 자주 사용하는 Gradle Task 정리
import org.apache.tools.ant.taskdefs.condition.Os
// NDK Build
task ndkBuild(type: Exec, description:'Compile JNI source via NDK') {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def command = properties.getProperty('ndk.dir')
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
command += "\\ndk-build.cmd"
} else {
command += "/ndk-build"
}
// Task내에서 Build Type을 검사할 수 없기 때문에 local.properties의 ndk.dir로
// Debug 가능한 Library를 Build할 지 검사한다.
def isDebug = properties.getProperty('ndk.debug').toBoolean()
if (isDebug) {
commandLine command, 'NDK_DEBUG=1', '-C', file('src/main').absolutePath
} else {
commandLine command, '-C', file('src/main').absolutePath
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
// NDK 결과물 App Module 쪽 JNI 폴더로 복사
task ndkResultCopy(type: Copy, dependsOn: 'ndkBuild') {
from('src/main/obj/local') {
include '**/*.a'
exclude '**/objs-debug'
}
into('../app/src/main/jni')
}
task clearJar(type: Delete) {
delete 'build/libs/' + ARTIFACT_ID + '_' + VERSION_NAME + '.jar'
}
task makeJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('build/libs/')
include('classes.jar')
rename ('classes.jar', ARTIFACT_ID + '_' + VERSION_NAME + '.jar')
}
makeJar.dependsOn(clearJar, build)
comments powered by Disqus
Subscribe to this blog via RSS.
LazyColumn/Row에서 동일한 Key를 사용하면 크래시가 발생하는 이유
Posted on 30 Nov 2024