/*
 * Copyright (c) 2017-2019 Altimit Community Contributors
 *
 * 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 imp
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

apply plugin: 'com.android.application'

android {

    /**
     * Advanced Configuration
     */
    def BACK_BUTTON_QUITS   = true // Use back button to quit the app?
    def SHOW_FPS            = false // Display the FPS monitor?
    def FORCE_CANVAS        = false // Disables fast WebGL rendering when available
    def FORCE_NO_AUDIO      = false // Disables WebAudio

    // Android 9+ "Q" API 29
    def ANDROID_SDK_TARGET  = 29

    defaultConfig {

        /**
         * Project Identification
         */
        applicationId "id.application.rpgmakermv" // Change this to your applicationId.
        versionCode 1 // Set this to a higher number for game updates.
        versionName "1.0" // This is the version that the player sees.

        compileSdkVersion ANDROID_SDK_TARGET
        targetSdkVersion ANDROID_SDK_TARGET
    }

    buildTypes {
        buildTypes.each { buildType ->
            buildType.buildConfigField "boolean",  "BACK_BUTTON_QUITS", String.valueOf(BACK_BUTTON_QUITS)
            buildType.buildConfigField "boolean",  "SHOW_FPS",          String.valueOf(SHOW_FPS)
            buildType.buildConfigField "boolean",  "FORCE_CANVAS",      String.valueOf(FORCE_CANVAS)
            buildType.buildConfigField "boolean",  "FORCE_NO_AUDIO",    String.valueOf(FORCE_NO_AUDIO)
        }
    }

    flavorDimensions "mv_android_client"

    productFlavors {
        webview {
            dimension "mv_android_client"
            minSdkVersion 14

            buildConfigField "boolean", "BOOTSTRAP_INTERFACE", "true"
        }

        // WARNING: As of February 2017 Crosswalk is no longer maintained https://crosswalk-project.org/blog/crosswalk-final-release.html
        zz_crosswalk {
            dimension "mv_android_client"
            minSdkVersion 16

            buildConfigField "boolean", "BOOTSTRAP_INTERFACE", "true"
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.0.2'

    zz_crosswalkImplementation 'org.xwalk:xwalk_core_library:23.53.589.4'
}