uniui_build 0.0.15

Builds uniui applicatins for different targets
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "$APP_ID$"
        minSdkVersion "$MIN_SDK$"
        targetSdkVersion "$TARGET_SDK$"
        versionCode $VERSION_CODE$
        versionName "$VERSION$"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.1'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}

apply plugin: 'org.mozilla.rust-android-gradle.rust-android'

cargo {
    module  = "../rust"       // Or whatever directory contains your Cargo.toml
    libname = "uni_android"          // Or whatever matches Cargo.toml's [package] name.
    targets = [$ARCH_LIST$]  // See bellow for a longer list of options
    profile = "$PROFILE$"
}

tasks.whenTaskAdded { task ->
    if ((task.name == 'javaPreCompileDebug' || task.name == 'javaPreCompileRelease')) {
        task.dependsOn 'cargoBuild'
    }
}


// License? https://gist.github.com/MoshDev/a61080cc5e1f5bafdf3cc0bf70fd86fd
project.afterEvaluate {
  android.applicationVariants.all { variant ->
    task "installRun${variant.name.capitalize()}"(type: Exec, dependsOn: "install${variant.name.capitalize()}", group: "run") {
      commandLine = ["adb", "shell", "monkey", "-p", variant.applicationId + " 1"]
      doLast {
        println "Launching ${variant.applicationId}"
      }
    }
  }
}