根目录的的build-gradle

https://docs.gradle.org/4.3.1/dsl/org.gradle.api.Project.html#org.gradle.api.Project:buildscript(groovy.lang.Closure)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenLocal()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
        classpath "com.github.dcendents:android-maven-gradle-plugin:1.4.1"
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
    }

    tasks.withType(Javadoc).all {
        enabled = false
        options.setEncoding('UTF-8')
    }
}

ext {
    minSdkVersion = 10
    compileSdkVersion = 23
    targetSdkVersion = compileSdkVersion
    buildToolsVersion = '23.0.2'
    supportLibVersion = '23.0.1'
    javaVersion = JavaVersion.VERSION_1_7

    GROUP = 'com.tencent.tinker'
    VERSION_NAME = "${VERSION_NAME_PREFIX}${VERSION_NAME_SUFFIX}"

    POM_PACKAGING = "pom"
    POM_DESCRIPTION= "tinker"

    POM_URL = "https://github.com/Tencent/tinker"
    POM_SCM_URL = "https://github.com/Tencent/tinker.git"
    POM_ISSUE_URL = 'https://github.com/Tencent/tinker/issues'

    POM_LICENCE_NAME = "BSD License"
    POM_LICENCE_URL = "https://opensource.org/licenses/BSD-3-Clause"
    POM_LICENCE_DIST = "repo"

    POM_DEVELOPER_ID="Tencent Wechat"
    POM_DEVELOPER_NAME="Tencent Wechat, Inc."

    BINTRAY_LICENCE= ['BSD 3-Clause']
    BINTRAY_ORGANIZATION = "tinker"

}
  • buildscript
    声明的是gradle脚本自身需要使用的资源。

  • repositories
    配置该想项目需要的存储库

  • dependencies
    配置该项目的依赖项

    《根目录的的build-gradle》 image.png
    《根目录的的build-gradle》 image.png

  • allprojects
    配置该项目以及每一个子项目

  • tasks
    项目本质上是任务对象的集合。每个任务执行一些基本的工作,例如编译类、运行单元测试或压缩WAR文件。

  • ext
    Gradle领域对象的一个属性,我们将自定义的属性添加到ext对象上,Build.gradle中的其它片段可以使用

    原文作者:hiandg
    原文地址: https://www.jianshu.com/p/1bc439ed7a0a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞