/*
 * Copyright (C) 2020 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.
 *
 */

apply plugin: 'com.android.application'

// Wrap the relative path with file() since CMake requires an absolute path.
def PLAY_CORE_NATIVE_SDK_DIR = file('../play-core-native-sdk')

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId = 'com.google.android.samples.playassetdeliverynative'
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0.0"
        ndk {
            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
        externalNativeBuild {
            cmake {
                arguments "-DANDROID_STL=c++_static"
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
            proguardFile "$PLAY_CORE_NATIVE_SDK_DIR/proguard/asset_delivery.pgcfg"
            proguardFile "$PLAY_CORE_NATIVE_SDK_DIR/proguard/common.pgcfg"
        }
        debug {
            minifyEnabled false
        }
    }
    externalNativeBuild {
        cmake {
            path 'src/main/cpp/CMakeLists.txt'
        }
    }

    //All asset packs listed here will be included in the final AppBundle
    assetPacks = [":install_time_pack", ":on_demand_pack", ":fast_follow_pack"]

    packagingOptions {
        exclude 'META-INF/androidx.versionedparcelable_versionedparcelable.version'
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation files("$PLAY_CORE_NATIVE_SDK_DIR/playcore.aar")
}
