plugins {
    id 'com.gradle.plugin-publish' version "0.10.0" //for pluginPublish.gradle
}

apply {
    plugin "groovy"
    plugin "java-gradle-plugin"
    from "${rootDir.path}/gradle/upload/pluginPublish.gradle"
    if (gradle.ext.depConfig.plugin_bus.useLocal) {
        plugin "maven"
    } else {
        plugin "com.github.dcendents.android-maven"
        plugin "com.jfrog.bintray"
        from "${rootDir.path}/gradle/upload/bintrayUploadJava.gradle"
    }
}

gradlePlugin {
    plugins {
        busPlugin {
            id = 'com.blankj.bus'
            implementationClass = 'com.blankj.bus.BusPlugin'
        }
    }
}

dependencies {
    implementation "com.android.tools.build:gradle:3.4.0"
    implementation "com.android.tools.build:gradle-api:3.4.0"

    implementation gradle.ext.dep.javassist
    implementation gradle.ext.dep.commons_io
    implementation gradleApi()
    implementation localGroovy()

    testImplementation gradle.ext.dep.junit
}

sourceSets {
    main {
        groovy {
            srcDirs += 'src/main/java'
        }
    }

    test {
        groovy {
            srcDirs += 'src/test/java'
        }
    }
}

group = gradle.ext.depConfig.plugin_bus.groupId
version = gradle.ext.depConfig.plugin_bus.version

if (gradle.ext.depConfig.plugin_bus.useLocal) {
    uploadArchives {
        repositories {
            mavenDeployer {
                repository(url: uri(new File(project.rootDir, "busMaven")))
            }
        }
    }
}

//./gradlew bus-gradle-plugin:bintrayUpload
//./gradlew publishPlugins
