buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.1'
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.24.16"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'

def projectName = project.getName()
def fileName = "${projectName}-${gradle.versionNumber}.aar"

android {
    compileSdkVersion 33

    defaultConfig {
        minSdkVersion 26
        targetSdkVersion 33
    }

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

publishing {
    publications {
        aar(MavenPublication) {
            groupId = "com.wickr.crypto"
            version = gradle.versionNumber
            artifactId project.getName()
            artifact("build/outputs/aar/${fileName}")
        }
    }
}

artifactory {
    contextUrl = System.getenv("ARTIFACTORY_URL")
    publish {
        repository {
            // The Artifactory repository key to publish to
            repoKey = 'libs-release-local'
            username = System.getenv("ARTIFACTORY_USER")
            password = System.getenv("ARTIFACTORY_PASS")
        }
        defaults {
            // Tell the Artifactory Plugin which artifacts should be published to Artifactory.
            publications('aar')
            properties = ['qa.level': 'basic', 'dev.team': 'core']
            publishArtifacts = true 
            publishPom = true
        }
    }
}
