gradle插件开发build.gradle配置

apply plugin: 'groovy'// 插件开发必备: groovy
apply plugin: 'maven'// 发布插件用
apply plugin: 'kotlin'// kotlin支持

dependencies {
    implementation gradleApi()//gradle sdk
    implementation localGroovy()//groovy sdk
    // Transform
    implementation 'com.android.tools.build:gradle:4.0.0'
    // ASM
    implementation 'org.ow2.asm:asm:7.1'
    implementation 'org.ow2.asm:asm-util:7.1'
    implementation 'org.ow2.asm:asm-commons:7.1'
}

uploadArchives {
    repositories.mavenDeployer {
        repository(url: uri('../repo')) //仓库的路径,此处是项目根目录下的 repo 的文件夹
        pom.groupId = 'com.example.asm'  //groupId ,自行定义,一般是包名
        pom.artifactId = 'myplugin' //artifactId ,自行定义
        pom.version = '1.0.0' //version 版本号
    }
}

repositories {
    jcenter()
}

// kotlin支持
compileGroovy {
    dependsOn tasks.getByPath('compileKotlin')
    classpath += files(compileKotlin.destinationDir)
}

你可能感兴趣的:(gradle插件开发build.gradle配置)