From 8c7b3f6f7bb8d96a25b738e13af8959f555f475b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=A8=9F=E5=8F=96?= Date: Sun, 2 Jul 2017 15:42:54 +0800 Subject: [PATCH] * add variant param --- .../com/qihoo360/replugin/gradle/host/RePlugin.groovy | 2 +- .../replugin/gradle/host/creator/FileCreators.groovy | 6 +++--- .../creator/impl/java/RePluginHostConfigCreator.groovy | 5 ++++- .../host/creator/impl/json/PluginBuiltinJsonCreator.groovy | 7 ++++--- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/RePlugin.groovy b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/RePlugin.groovy index a52eb40..fb03a9e 100644 --- a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/RePlugin.groovy +++ b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/RePlugin.groovy @@ -62,7 +62,7 @@ public class Replugin implements Plugin { } output.processResources.doFirst { - new FileCreators().init(project, config).create() + new FileCreators().init(project, variant, config).create() } output.processManifest.doLast { diff --git a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/FileCreators.groovy b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/FileCreators.groovy index e4b9075..59dca82 100644 --- a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/FileCreators.groovy +++ b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/FileCreators.groovy @@ -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 } diff --git a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/java/RePluginHostConfigCreator.groovy b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/java/RePluginHostConfigCreator.groovy index a2a8274..e78361b 100644 --- a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/java/RePluginHostConfigCreator.groovy +++ b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/java/RePluginHostConfigCreator.groovy @@ -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 sourceSets = project.extensions.getByType(AppExtension).getSourceSets() File sourceDir = sourceSets.findByName('main')['javaDirectories'][0] diff --git a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/json/PluginBuiltinJsonCreator.groovy b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/json/PluginBuiltinJsonCreator.groovy index 83c0796..57579b1 100644 --- a/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/json/PluginBuiltinJsonCreator.groovy +++ b/replugin-host-gradle/src/main/groovy/com/qihoo360/replugin/gradle/host/creator/impl/json/PluginBuiltinJsonCreator.groovy @@ -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 sourceSets = project.extensions.getByType(AppExtension).getSourceSets() fileDir = sourceSets.findByName('main')['assetsDirectories'][0] fileName = config.builtInJsonFileName