build.gradle 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. apply plugin: 'com.android.library'
  2. //apply plugin: 'maven'
  3. //apply plugin: 'com.github.dcendents.android-maven'
  4. //apply plugin: 'realm-android'
  5. android {
  6. compileSdkVersion 27
  7. // resourcePrefix 'mpcht'
  8. defaultConfig {
  9. minSdkVersion 15
  10. targetSdkVersion 27
  11. versionCode 3
  12. versionName '3.0.2'
  13. }
  14. buildTypes {
  15. release {
  16. minifyEnabled false
  17. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  18. }
  19. }
  20. lintOptions {
  21. abortOnError false
  22. }
  23. testOptions {
  24. unitTests.returnDefaultValues = true // this prevents "not mocked" error
  25. }
  26. }
  27. //repositories {
  28. // maven {
  29. // url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
  30. // }
  31. //}
  32. dependencies {
  33. //compile fileTree(dir: 'libs', include: ['*.jar'])
  34. //compile 'com.android.support:support-v4:19.+'
  35. //provided 'io.realm:realm-android:0.87.5' // "optional" dependency to realm-database API
  36. testImplementation "org.mockito:mockito-core:1.9.5"
  37. }
  38. android.libraryVariants.all { variant ->
  39. def name = variant.buildType.name
  40. def task = project.tasks.create "jar${name.capitalize()}", Jar
  41. task.dependsOn variant.javaCompile
  42. task.from variant.javaCompile.destinationDir
  43. artifacts.add('archives', task);
  44. }
  45. task sourcesJar(type: Jar) {
  46. from android.sourceSets.main.java.srcDirs
  47. classifier = 'sources'
  48. }
  49. task javadoc(type: Javadoc) {
  50. options.charSet = 'UTF-8'
  51. failOnError false
  52. source = android.sourceSets.main.java.sourceFiles
  53. classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  54. }
  55. task javadocJar(type: Jar, dependsOn: javadoc) {
  56. classifier = 'javadoc'
  57. from javadoc.destinationDir
  58. }
  59. artifacts {
  60. archives sourcesJar
  61. archives javadocJar
  62. }