build.gradle 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. buildscript {
  2. repositories {
  3. google()
  4. mavenCentral()
  5. }
  6. dependencies {
  7. classpath "com.android.tools.build:gradle:7.2.2"
  8. }
  9. }
  10. def isNewArchitectureEnabled() {
  11. return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
  12. }
  13. apply plugin: "com.android.library"
  14. if (isNewArchitectureEnabled()) {
  15. apply plugin: "com.facebook.react"
  16. }
  17. def getExtOrDefault(name) {
  18. return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["CompdfkitPdf_" + name]
  19. }
  20. def getExtOrIntegerDefault(name) {
  21. return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CompdfkitPdf_" + name]).toInteger()
  22. }
  23. def supportsNamespace() {
  24. def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
  25. def major = parsed[0].toInteger()
  26. def minor = parsed[1].toInteger()
  27. // Namespace support was added in 7.3.0
  28. return (major == 7 && minor >= 3) || major >= 8
  29. }
  30. android {
  31. if (supportsNamespace()) {
  32. namespace "com.compdfkitpdf.reactnative"
  33. sourceSets {
  34. main {
  35. manifest.srcFile "src/main/AndroidManifestNew.xml"
  36. }
  37. }
  38. }
  39. compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
  40. defaultConfig {
  41. minSdkVersion getExtOrIntegerDefault("minSdkVersion")
  42. targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
  43. }
  44. buildTypes {
  45. release {
  46. minifyEnabled false
  47. }
  48. }
  49. lintOptions {
  50. disable "GradleCompatible"
  51. }
  52. compileOptions {
  53. sourceCompatibility JavaVersion.VERSION_1_8
  54. targetCompatibility JavaVersion.VERSION_1_8
  55. }
  56. }
  57. repositories {
  58. mavenCentral()
  59. google()
  60. }
  61. dependencies {
  62. // For < 0.71, this will be from the local maven repo
  63. // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
  64. //noinspection GradleDynamicVersion
  65. implementation "com.facebook.react:react-native:+"
  66. api "com.compdf:compdfkit:2.0.1"
  67. api "com.compdf:compdfkit-ui:2.0.1"
  68. api "com.compdf:compdfkit-tools:2.0.1"
  69. }