// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
    def needReplaceLocal = true
    gradle.startParameter.taskNames.each {
        if (it.contains('uploadArchives')) {
            needReplaceLocal = false
        }
    }
    if (needReplaceLocal) {
        configurations.all {
            resolutionStrategy {
                dependencySubstitution {
                    substitute module('pub.doric:core') with project(":doric")
                    substitute module('pub.doric:devkit') with project(":devkit")
                }
            }
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Properties properties = new Properties()
properties.load(project.rootProject.file('version.properties').newDataInputStream())
ext {
    Version = properties.version
}

task publisCore dependsOn(":doric:uploadArchives") {
    println "doric published"
}

task publishDevKit dependsOn(publisCore, ":devkit:uploadArchives") {
    println "devkit published"
}

task PublishAll dependsOn(publisCore, publishDevKit) {
    println "All published"
}
