* add variant param

This commit is contained in:
李樟取 2017-07-02 15:42:54 +08:00
parent 3ae4425476
commit 8c7b3f6f7b
4 changed files with 12 additions and 8 deletions

View File

@ -62,7 +62,7 @@ public class Replugin implements Plugin<Project> {
}
output.processResources.doFirst {
new FileCreators().init(project, config).create()
new FileCreators().init(project, variant, config).create()
}
output.processManifest.doLast {

View File

@ -28,12 +28,12 @@ public class FileCreators {
def creators
def init(Project project, def config) {
def init(Project project, def variant, def config) {
creators = []
creators << new RePluginHostConfigCreator(project, config)
creators << new RePluginHostConfigCreator(project, variant, config)
if (config.autoManageBuiltInJsonFile) {
creators << new PluginBuiltinJsonCreator(project, config)
creators << new PluginBuiltinJsonCreator(project, variant, config)
}
return this
}

View File

@ -20,6 +20,7 @@ import com.android.build.gradle.AppExtension
import com.android.build.gradle.api.AndroidSourceSet
import com.qihoo360.replugin.gradle.host.creator.IFileCreator
import org.gradle.api.NamedDomainObjectContainer
/**
* @author RePlugin Team
*/
@ -30,11 +31,13 @@ public class RePluginHostConfigCreator implements IFileCreator {
def config
def project
def variant
def fileDir
def fileName
def RePluginHostConfigCreator(def project, def cfg) {
def RePluginHostConfigCreator(def project, def variant, def cfg) {
this.project = project
this.variant = variant;
this.config = cfg
NamedDomainObjectContainer<AndroidSourceSet> sourceSets = project.extensions.getByType(AppExtension).getSourceSets()
File sourceDir = sourceSets.findByName('main')['javaDirectories'][0]

View File

@ -29,14 +29,15 @@ import org.gradle.api.NamedDomainObjectContainer
*/
public class PluginBuiltinJsonCreator implements IFileCreator {
def variant
def config
File fileDir
def fileName
def pluginInfos = []
def PluginBuiltinJsonCreator(def project, def cfg) {
config = cfg
def PluginBuiltinJsonCreator(def project, def variant, def cfg) {
this.config = cfg
this.variant = variant
NamedDomainObjectContainer<AndroidSourceSet> sourceSets = project.extensions.getByType(AppExtension).getSourceSets()
fileDir = sourceSets.findByName('main')['assetsDirectories'][0]
fileName = config.builtInJsonFileName