1// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
3buildscript {
4
5    repositories {
6        google()
7        jcenter()
8    }
9    dependencies {
10        classpath 'com.android.tools.build:gradle:@ANDROID_GRADLE_PLUGIN_VERSION@'
11        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:@KOTLIN_PLUGIN_VERSION@'
12
13        // NOTE: Do not place your application dependencies here; they belong
14        // in the individual module build.gradle files
15    }
16}
17
18allprojects {
19    repositories {
20        google()
21        jcenter()
22    }
23}
24
25task clean(type: Delete) {
26    delete rootProject.buildDir
27}
28
29//allprojects {
30//    gradle.projectsEvaluated {
31//        tasks.withType(JavaCompile) {
32//            options.compilerArgs << "-Xlint:unchecked"
33//            options.compilerArgs << "-Xlint:deprecation"
34//        }
35//    }
36//}
37
38
39gradle.afterProject { project ->
40    if (project.pluginManager.hasPlugin('com.android.application')
41            || project.pluginManager.hasPlugin('com.android.library')
42            || project.pluginManager.hasPlugin('com.android.test')
43            || project.pluginManager.hasPlugin('com.android.feature') ) {
44        if (true) {
45            gradle.println("Override build ABIs for the project ${project.name}")
46            project.android {
47                splits {
48                    abi {
49                        enable true
50                        universalApk false
51                        @ANDROID_ABI_FILTER@
52                    }
53                }
54            }
55        }
56
57        if (true) {
58            gradle.println("Override lintOptions for the project ${project.name}")
59            project.android {
60                lintOptions {
61                    // checkReleaseBuilds false
62                    abortOnError false
63                }
64            }
65        }
66
67        // (you still need to re-build OpenCV with debug information to debug it)
68        if (true) {
69            gradle.println("Override doNotStrip-debug for the project ${project.name}")
70            project.android {
71                buildTypes {
72                    debug {
73                        packagingOptions {
74                            doNotStrip '**/*.so'  // controlled by OpenCV CMake scripts
75                        }
76                    }
77                }
78            }
79        }
80        if (false || project.hasProperty("doNotStrip")) {
81            gradle.println("Override doNotStrip-release for the project ${project.name}")
82            project.android {
83                buildTypes {
84                    release {
85                        packagingOptions {
86                            doNotStrip '**/*.so'  // controlled by OpenCV CMake scripts
87                        }
88                    }
89                }
90            }
91        }
92
93    }
94}
95