|
1 |
| -buildscript { |
2 |
| - repositories { |
3 |
| - jcenter() |
4 |
| - google() |
5 |
| - } |
6 |
| - dependencies { |
7 |
| - classpath "com.android.tools.build:gradle:3.4.0" |
8 |
| - } |
9 |
| -} |
10 |
| - |
11 |
| -apply plugin: "com.android.library" |
12 |
| - |
13 | 1 | def safeExtGet(prop, fallback) {
|
14 | 2 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
15 | 3 | }
|
16 | 4 |
|
17 |
| -def _excludeAppGlideModule = safeExtGet("excludeAppGlideModule", false) |
18 |
| -def _buildToolsVersion = safeExtGet("buildToolsVersion", "28.0.3") |
19 |
| -def _compileSdkVersion = safeExtGet("compileSdkVersion", 28) |
20 |
| -def _glideVersion = safeExtGet("glideVersion", "4.11.0") |
21 |
| -def _minSdkVersion = safeExtGet("minSdkVersion", 16) |
22 |
| -def _reactNativeVersion = safeExtGet("reactNative", "+") |
23 |
| -def _targetSdkVersion = safeExtGet("targetSdkVersion", 28) |
| 5 | +buildscript { |
| 6 | + // The Android Gradle plugin is only required when opening the android folder stand-alone. |
| 7 | + // This avoids unnecessary downloads and potential conflicts when the library is included as a |
| 8 | + // module dependency in an application project. |
| 9 | + if (project == rootProject) { |
| 10 | + repositories { |
| 11 | + google() |
| 12 | + jcenter() |
| 13 | + } |
| 14 | + dependencies { |
| 15 | + classpath 'com.android.tools.build:gradle:3.5.3' |
| 16 | + } |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +apply plugin: 'com.android.library' |
24 | 21 |
|
25 | 22 | android {
|
26 |
| - compileSdkVersion _compileSdkVersion |
27 |
| - buildToolsVersion _buildToolsVersion |
28 |
| - |
| 23 | + compileSdkVersion safeExtGet('compileSdkVersion', 28) |
| 24 | + buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') |
| 25 | + defaultConfig { |
| 26 | + minSdkVersion safeExtGet('minSdkVersion', 16) |
| 27 | + targetSdkVersion safeExtGet('targetSdkVersion', 28) |
| 28 | + versionCode 1 |
| 29 | + versionName "1.0" |
| 30 | + } |
29 | 31 | sourceSets {
|
30 | 32 | main {
|
31 | 33 | java {
|
32 |
| - if (_excludeAppGlideModule) { |
| 34 | + if (safeExtGet('excludeAppGlideModule', false)) { |
33 | 35 | srcDir "src"
|
34 | 36 | exclude "**/FastImageGlideModule.java"
|
35 | 37 | }
|
36 | 38 | }
|
37 | 39 | }
|
38 | 40 | }
|
39 |
| - |
40 |
| - defaultConfig { |
41 |
| - minSdkVersion _minSdkVersion |
42 |
| - targetSdkVersion _targetSdkVersion |
43 |
| - versionCode 1 |
44 |
| - versionName "1.0" |
45 |
| - } |
46 | 41 | lintOptions {
|
47 | 42 | abortOnError false
|
48 | 43 | }
|
49 | 44 | }
|
50 | 45 |
|
51 | 46 | repositories {
|
52 |
| - mavenCentral() |
53 |
| - google() |
| 47 | + mavenLocal() |
| 48 | + maven { |
| 49 | + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm |
| 50 | + url "$rootDir/../node_modules/react-native/android" |
| 51 | + } |
54 | 52 | maven {
|
55 |
| - url "https://maven.google.com" |
| 53 | + // Android JSC is installed from npm |
| 54 | + url "$rootDir/../node_modules/jsc-android/dist" |
56 | 55 | }
|
| 56 | + google() |
| 57 | + jcenter() |
57 | 58 | }
|
58 | 59 |
|
| 60 | +def glideVersion = safeExtGet('glideVersion', '4.11.0') |
| 61 | + |
59 | 62 | dependencies {
|
60 | 63 | //noinspection GradleDynamicVersion
|
61 |
| - implementation "com.facebook.react:react-native:${_reactNativeVersion}" |
62 |
| - implementation "androidx.core:core:1.0.0" |
63 |
| - implementation "androidx.appcompat:appcompat:1.0.0" |
64 |
| - implementation "androidx.annotation:annotation:1.0.0" |
65 |
| - implementation("com.github.bumptech.glide:glide:${_glideVersion}") |
66 |
| - implementation("com.github.bumptech.glide:annotations:${_glideVersion}") |
67 |
| - annotationProcessor 'com.android.support:support-annotations:28.0.0-alpha3' |
68 |
| - annotationProcessor "com.github.bumptech.glide:compiler:${_glideVersion}" |
69 |
| - implementation("com.github.bumptech.glide:okhttp3-integration:${_glideVersion}") |
| 64 | + implementation 'com.facebook.react:react-native:+' // From node_modules |
| 65 | + implementation "com.github.bumptech.glide:glide:${glideVersion}" |
| 66 | + implementation "com.github.bumptech.glide:okhttp3-integration:${glideVersion}" |
| 67 | + annotationProcessor "com.github.bumptech.glide:compiler:${glideVersion}" |
70 | 68 | }
|
0 commit comments