build.gradle 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import org.apache.tools.ant.taskdefs.condition.Os
  2. apply plugin: 'com.android.library'
  3. android {
  4. compileSdkVersion rootProject.ext.compileSdkVersion
  5. buildToolsVersion rootProject.ext.buildToolsVersion
  6. sourceSets {
  7. main {
  8. java.srcDirs = ['../src/main/java']
  9. manifest.srcFile '../src/main/AndroidManifest.xml'
  10. }
  11. }
  12. defaultConfig {
  13. minSdkVersion rootProject.ext.minSdkVersion
  14. targetSdkVersion rootProject.ext.targetSdkVersion
  15. versionCode rootProject.ext.versionCode
  16. versionName rootProject.ext.versionName
  17. externalNativeBuild {
  18. cmake {
  19. targets "image"
  20. arguments "-DANDROID_ARM_NEON=TRUE",
  21. "-DIMAGE_SINGLE_SHARED_LIB=TRUE"
  22. }
  23. }
  24. }
  25. buildTypes {
  26. release {
  27. minifyEnabled false
  28. proguardFiles getDefaultProguardFile('proguard-android.txt'), '../proguard-rules.pro'
  29. }
  30. }
  31. externalNativeBuild {
  32. cmake {
  33. path '../src/main/jni/CMakeLists.txt'
  34. }
  35. }
  36. }
  37. clean {
  38. delete '../src/main/jni/image/javah'
  39. }
  40. task javah(type: Exec, dependsOn: 'compileReleaseJavaWithJavac') {
  41. char separator = Os.isFamily(Os.FAMILY_WINDOWS) ? ';' : ':'
  42. commandLine 'javah', '-jni',
  43. '-d', '../src/main/jni/image/javah',
  44. '-cp', "${android.getSdkDirectory().getAbsolutePath()}/platforms/android-${rootProject.ext.targetSdkVersion}/android.jar${separator}build/intermediates/javac/release/compileReleaseJavaWithJavac/classes",
  45. 'com.hippo.image.Image',
  46. 'com.hippo.image.StaticImage',
  47. 'com.hippo.image.StaticDelegateImage',
  48. 'com.hippo.image.AnimatedImage',
  49. 'com.hippo.image.AnimatedDelegateImage',
  50. 'com.hippo.image.BitmapDecoder',
  51. 'com.hippo.image.BitmapRegionDecoder'
  52. inputs.dir('../src/main/java')
  53. outputs.dir('../src/main/jni/image/javah')
  54. }
  55. dependencies {
  56. implementation "com.android.support:support-annotations:${rootProject.ext.supportLibraryVersion}"
  57. testImplementation "junit:junit:${rootProject.ext.junitVersion}"
  58. }
  59. project.afterEvaluate {
  60. externalNativeBuildDebug.dependsOn javah
  61. externalNativeBuildRelease.dependsOn javah
  62. }
  63. // Publish arr with java source and java doc
  64. apply from: rootProject.file('android-maven-gradle.gradle')