Skip to content

Commit

Permalink
support productflavor
Browse files Browse the repository at this point in the history
  • Loading branch information
dony authored and johnsonlee committed Jul 15, 2024
1 parent d62ca3a commit c87d667
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.didiglobal.booster.transform.activitythread

import com.android.build.api.variant.DynamicFeatureVariantBuilder
import com.android.build.api.variant.LibraryVariantBuilder
import com.android.build.api.variant.VariantBuilder
import com.didiglobal.booster.gradle.*
import com.android.build.api.variant.DynamicFeatureVariant
import com.android.build.api.variant.LibraryVariant
import com.android.build.api.variant.Variant
import com.didiglobal.booster.task.spi.VariantProcessor
import com.didiglobal.booster.transform.activity.thread.Build.GROUP
import com.didiglobal.booster.transform.activity.thread.Build.VERSION
Expand All @@ -16,11 +15,11 @@ import org.gradle.api.Project
@AutoService(VariantProcessor::class)
class ActivityThreadVariantProcessor(private val project: Project) : VariantProcessor {

override fun beforeProcess(variantBuilder: VariantBuilder) {
if (variantBuilder is LibraryVariantBuilder || variantBuilder is DynamicFeatureVariantBuilder) {
override fun process(variant: Variant) {
super.process(variant)
if (variant is LibraryVariant || variant is DynamicFeatureVariant) {
return
}
project.dependencies.add("${variantBuilder.name}Implementation", "$GROUP:booster-android-instrument-activity-thread:$VERSION")
project.dependencies.add("${variant.name}Implementation", "$GROUP:booster-android-instrument-activity-thread:$VERSION")
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.didiglobal.booster.transform.finalizer.watchdog.daemon

import com.android.build.api.variant.DynamicFeatureVariantBuilder
import com.android.build.api.variant.LibraryVariantBuilder
import com.android.build.api.variant.VariantBuilder
import com.android.build.api.variant.DynamicFeatureVariant
import com.android.build.api.variant.LibraryVariant
import com.android.build.api.variant.Variant
import com.didiglobal.booster.task.spi.VariantProcessor
import com.didiglobal.booster.transform.finalizer.watchdog.daemon.Build.GROUP
import com.didiglobal.booster.transform.finalizer.watchdog.daemon.Build.VERSION
Expand All @@ -15,12 +15,12 @@ import org.gradle.api.Project
@AutoService(VariantProcessor::class)
class FinalizerWatchdogDaemonVariantProcessor(private val project: Project) : VariantProcessor {

override fun beforeProcess(variantBuilder: VariantBuilder) {
if (variantBuilder is LibraryVariantBuilder || variantBuilder is DynamicFeatureVariantBuilder) {
override fun process(variant: Variant) {
super.process(variant)
if (variant is LibraryVariant || variant is DynamicFeatureVariant) {
return
}
project.dependencies.add("${variantBuilder.name}Implementation", "$GROUP:booster-android-instrument-finalizer-watchdog-daemon:$VERSION")

project.dependencies.add("${variant.name}Implementation", "$GROUP:booster-android-instrument-finalizer-watchdog-daemon:$VERSION")
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.didiglobal.booster.transform.logcat

import com.android.build.api.variant.DynamicFeatureVariantBuilder
import com.android.build.api.variant.LibraryVariantBuilder
import com.android.build.api.variant.VariantBuilder
import com.android.build.api.variant.DynamicFeatureVariant
import com.android.build.api.variant.LibraryVariant
import com.android.build.api.variant.Variant
import com.didiglobal.booster.task.spi.VariantProcessor
import com.didiglobal.booster.transform.logcat.Build.GROUP
import com.didiglobal.booster.transform.logcat.Build.VERSION
Expand All @@ -15,11 +15,12 @@ import org.gradle.api.Project
@AutoService(VariantProcessor::class)
class LogcatVariantProcessor(private val project: Project) : VariantProcessor {

override fun beforeProcess(variantBuilder: VariantBuilder) {
if (variantBuilder is LibraryVariantBuilder || variantBuilder is DynamicFeatureVariantBuilder) {
override fun process(variant: Variant) {
super.process(variant)
if (variant is LibraryVariant || variant is DynamicFeatureVariant) {
return
}
project.dependencies.add("${variantBuilder.name}Implementation", "$GROUP:booster-android-instrument-logcat:$VERSION")
project.dependencies.add("${variant.name}Implementation", "$GROUP:booster-android-instrument-logcat:$VERSION")
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.didiglobal.booster.transform.mediaplayer

import com.android.build.api.variant.DynamicFeatureVariantBuilder
import com.android.build.api.variant.LibraryVariantBuilder
import com.android.build.api.variant.VariantBuilder
import com.android.build.api.variant.DynamicFeatureVariant
import com.android.build.api.variant.LibraryVariant
import com.android.build.api.variant.Variant
import com.didiglobal.booster.task.spi.VariantProcessor
import com.didiglobal.booster.transform.media.player.Build.GROUP
import com.didiglobal.booster.transform.media.player.Build.VERSION
Expand All @@ -15,11 +15,12 @@ import org.gradle.api.Project
@AutoService(VariantProcessor::class)
class MediaPlayerVariantProcessor(private val project: Project) : VariantProcessor {

override fun beforeProcess(variantBuilder: VariantBuilder) {
if (variantBuilder is LibraryVariantBuilder || variantBuilder is DynamicFeatureVariantBuilder) {
override fun process(variant: Variant) {
super.process(variant)
if (variant is LibraryVariant || variant is DynamicFeatureVariant) {
return
}
project.dependencies.add("${variantBuilder.name}Implementation", "$GROUP:booster-android-instrument-media-player:$VERSION")
project.dependencies.add("${variant.name}Implementation", "$GROUP:booster-android-instrument-media-player:$VERSION")
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.didiglobal.booster.transform.res.check

import com.android.build.api.variant.DynamicFeatureVariantBuilder
import com.android.build.api.variant.LibraryVariantBuilder
import com.android.build.api.variant.VariantBuilder
import com.android.build.api.variant.DynamicFeatureVariant
import com.android.build.api.variant.LibraryVariant
import com.android.build.api.variant.Variant
import com.didiglobal.booster.task.spi.VariantProcessor
import com.didiglobal.booster.transform.res.check.Build.GROUP
import com.didiglobal.booster.transform.res.check.Build.VERSION
Expand All @@ -15,11 +15,12 @@ import org.gradle.api.Project
@AutoService(VariantProcessor::class)
class ResCheckVariantProcessor(private val project: Project) : VariantProcessor {

override fun beforeProcess(variantBuilder: VariantBuilder) {
if (variantBuilder is LibraryVariantBuilder || variantBuilder is DynamicFeatureVariantBuilder) {
override fun process(variant: Variant) {
super.process(variant)
if (variant is LibraryVariant || variant is DynamicFeatureVariant) {
return
}
project.dependencies.add("${variantBuilder.name}Implementation", "$GROUP:booster-android-instrument-res-check:$VERSION")
project.dependencies.add("${variant.name}Implementation", "$GROUP:booster-android-instrument-res-check:$VERSION")
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.didiglobal.booster.transform.thread

import com.android.build.api.variant.DynamicFeatureVariantBuilder
import com.android.build.api.variant.LibraryVariantBuilder
import com.android.build.api.variant.VariantBuilder
import com.android.build.api.variant.DynamicFeatureVariant
import com.android.build.api.variant.LibraryVariant
import com.android.build.api.variant.Variant
import com.didiglobal.booster.task.spi.VariantProcessor
import com.didiglobal.booster.transform.thread.Build.GROUP
import com.didiglobal.booster.transform.thread.Build.VERSION
Expand All @@ -12,11 +12,12 @@ import org.gradle.api.Project
@AutoService(VariantProcessor::class)
class ThreadVariantProcessor(private val project: Project) : VariantProcessor {

override fun beforeProcess(variantBuilder: VariantBuilder) {
if (variantBuilder is LibraryVariantBuilder || variantBuilder is DynamicFeatureVariantBuilder) {
override fun process(variant: Variant) {
super.process(variant)
if (variant is LibraryVariant || variant is DynamicFeatureVariant) {
return
}
project.dependencies.add("${variantBuilder.name}Implementation", "$GROUP:booster-android-instrument-thread:$VERSION")
project.dependencies.add("${variant.name}Implementation", "$GROUP:booster-android-instrument-thread:$VERSION")
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.didiglobal.booster.transform.toast

import com.android.build.api.variant.DynamicFeatureVariantBuilder
import com.android.build.api.variant.LibraryVariantBuilder
import com.android.build.api.variant.VariantBuilder
import com.android.build.api.variant.DynamicFeatureVariant
import com.android.build.api.variant.LibraryVariant
import com.android.build.api.variant.Variant
import com.didiglobal.booster.task.spi.VariantProcessor
import com.didiglobal.booster.transform.toast.Build.GROUP
import com.didiglobal.booster.transform.toast.Build.VERSION
Expand All @@ -12,11 +12,12 @@ import org.gradle.api.Project
@AutoService(VariantProcessor::class)
class ToastVariantProcessor(private val project: Project) : VariantProcessor {

override fun beforeProcess(variantBuilder: VariantBuilder) {
if (variantBuilder is LibraryVariantBuilder || variantBuilder is DynamicFeatureVariantBuilder) {
override fun process(variant: Variant) {
super.process(variant)
if (variant is LibraryVariant || variant is DynamicFeatureVariant) {
return
}
project.dependencies.add("${variantBuilder.name}Implementation", "$GROUP:booster-android-instrument-toast:$VERSION")
project.dependencies.add("${variant.name}Implementation", "$GROUP:booster-android-instrument-toast:$VERSION")
}

}

0 comments on commit c87d667

Please sign in to comment.