package com.qmai.android.plugin

import org.gradle.api.Plugin
import org.gradle.api.Project

/***
 * 通过蒲公英上传
 */
class PygerUploadPlugin implements Plugin<Project> {
    @Override
    void apply(Project project) {
        println("create pgyer upload task")
        PygerBean pygerBean = project.getExtensions().create("pyger", PygerBean.class)
        project.afterEvaluate {
            println("create pgyer upload task afterEvaluate  filepath=  "+pygerBean.filePath+"  key = "+pygerBean.key)
            def uploadFile = new File(pygerBean.filePath)
            println("PygerUploadPlugin file path = "+pygerBean.filePath+" file key = "+pygerBean.key)
            project.getTasks().register("pygerUpload", PygerUploadTask.class, uploadFile,"1", pygerBean.key,"","")
        }
    }
}
