/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

repositories {
    google()
    mavenCentral()
}

buildscript {
    repositories {
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
    }
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 33
    defaultConfig {
        targetSdkVersion 33
        minSdkVersion 31

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = [
                    'java',
                    '../service-core/java',
                    '../service/java',
                    '../framework/java',
                    '../../../../../external/guava/guava/src',
                    '../../../../../frameworks/base/packages/SettingsLib/' +
                            'ActionBarShadow/src',
                    '../../../../../frameworks/base/core/java',
                    '../../../../../frameworks/base/packages/SettingsLib/' +
                            'CollapsingToolbarBaseActivity/src',
                    '../../../../../frameworks/base/packages/SettingsLib/' +
                            'MainSwitchPreference/src',
                    '../../../../../out/soong/.intermediates/packages/modules/AdServices/adservices/service-core/statslog-adservices-java-gen/gen',
                    '../../../../../external/dexmaker/dexmaker-mockito-inline-extended/src/main/java',
                    '../../../../../external/mockito/src/main/java',
                    '../../../../../external/mobile-data-download/java',
            ]
            java.setIncludes(new HashSet([
                    'com/android/adservices/ui/**/*.java',
                    'com/android/adservices/**/*.java',
                    'com/android/settingslib/widget/**/*.java',
                    'com/google/common/collect/*.java',
                    'android/os/*.java',
                    'com/android/settingslib/collapsingtoolbar/**/*.java',
                    'com/android/adservices/service/stats/*.java',
                    'com/android/dx/mockito/**/*.java',
                    'org/mockito/**/*.java',
                    'com/google/android/libraries/mobiledatadownload/**/*.java',
            ]))
            res.srcDirs = [
                    'res',
                    '../../../../../frameworks/base/packages/SettingsLib/' +
                            'SettingsTheme/res',
            ]
            resources.setIncludes(new HashSet([
                    'drawable/*',
                    'drawable24/*',
                    'layout/*',
                    'mipmap-*/*',
                    'values/*',
                    'xml/*',
            ]))
        }

        androidTest {
            java.srcDirs = [
                'tests/src',
                'unittest/src',
                'tests/notification/src',
                'tests/settings/src',
                'tests/settingsgaota/src',
                'tests/util/java',
            ]
            java.setIncludes(new HashSet([
                'com/android/adservices/ui/**/*.java',
            ]))
        }
    }
    buildToolsVersion '30.0.3'
}

dependencies {
    implementation 'androidx.preference:preference:1.2.0'
    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    implementation files('../../../../../prebuilts/tools/common/m2/repository/com/google/truth/truth/1.0.1/truth-1.0.1.jar')
    // at least one compilation needs to be run (e.g. aidegen .)
    implementation files('../../../../../out/target/common/obj/JAVA_LIBRARIES/mobile-data-download-java-proto-lite_intermediates/classes.jar')
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'

    // test dependencies
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test:runner:1.4.0'
    androidTestImplementation 'androidx.test:rules:1.4.0'
    androidTestImplementation 'org.mockito:mockito-core:1.10.19'
}
