build.gradle.template 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. plugins {
  2. id 'com.android.library'
  3. id 'maven-publish'
  4. id 'kotlin-android'
  5. }
  6. android {
  7. namespace 'org.opencv'
  8. compileSdk ${COMPILE_SDK}
  9. ndkVersion "${NDK_VERSION}"
  10. defaultConfig {
  11. minSdk ${MIN_SDK}
  12. targetSdk ${TARGET_SDK}
  13. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  14. externalNativeBuild {
  15. cmake {
  16. cppFlags ""
  17. arguments "-DANDROID_STL=${LIB_TYPE}"
  18. }
  19. }
  20. ndk {
  21. abiFilters ${ABI_FILTERS}
  22. }
  23. }
  24. buildTypes {
  25. release {
  26. minifyEnabled false
  27. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  28. }
  29. }
  30. compileOptions {
  31. sourceCompatibility JavaVersion.VERSION_${JAVA_VERSION}
  32. targetCompatibility JavaVersion.VERSION_${JAVA_VERSION}
  33. }
  34. externalNativeBuild {
  35. cmake {
  36. path file('src/main/cpp/CMakeLists.txt')
  37. }
  38. }
  39. buildFeatures {
  40. prefabPublishing true
  41. buildConfig true
  42. }
  43. prefab {
  44. ${LIB_NAME} {
  45. headers "src/main/cpp/include"
  46. }
  47. }
  48. sourceSets {
  49. main {
  50. java.srcDirs = ['src/main/java']
  51. //jniLibs.srcDirs = ['libs']
  52. }
  53. }
  54. publishing {
  55. singleVariant('release') {
  56. withSourcesJar()
  57. withJavadocJar()
  58. }
  59. }
  60. }
  61. publishing {
  62. publications {
  63. release(MavenPublication) {
  64. // Builds aar, sources jar and javadoc jar from project sources and creates maven
  65. groupId = 'org.opencv'
  66. artifactId = '${PACKAGE_NAME}'
  67. version = '${OPENCV_VERSION}'
  68. afterEvaluate {
  69. from components.release
  70. }
  71. }
  72. modified(MavenPublication) {
  73. // Creates maven from opencv-release.aar
  74. groupId = 'org.opencv'
  75. artifactId = '${PACKAGE_NAME}'
  76. version = '${OPENCV_VERSION}'
  77. artifact("opencv-release.aar")
  78. pom {
  79. name = "OpenCV"
  80. description = "Open Source Computer Vision Library"
  81. url = "https://opencv.org/"
  82. licenses {
  83. license {
  84. name = "The Apache License, Version 2.0"
  85. url = "https://github.com/opencv/opencv/blob/master/LICENSE"
  86. }
  87. }
  88. developers {
  89. developer {
  90. id = "admin"
  91. name = "OpenCV Team"
  92. email = "admin@opencv.org"
  93. }
  94. }
  95. scm {
  96. connection = "scm:git:https://github.com/opencv/opencv.git"
  97. url = "https://github.com/opencv/opencv"
  98. }
  99. }
  100. }
  101. }
  102. repositories {
  103. maven {
  104. name = 'myrepo'
  105. url = "${project.buildDir}/repo"
  106. }
  107. }
  108. }
  109. dependencies {
  110. }