Created
July 15, 2019 08:19
-
-
Save pgreze/bd43b0fa9c7d423e9640beef9513e7a4 to your computer and use it in GitHub Desktop.
Project specific library / app plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.android.build.gradle.AppExtension | |
import com.android.build.gradle.AppPlugin | |
import com.android.build.gradle.BaseExtension | |
import com.android.build.gradle.LibraryPlugin | |
import org.gradle.api.Plugin | |
import org.gradle.api.Project | |
class MercariAndroidPlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
project.extensions.findByType(BaseExtension::class.java)?.apply { | |
setCompileSdkVersion(Config.compileSdkVersion) | |
defaultConfig { | |
setMinSdkVersion(Config.minSdkVersion) | |
setTargetSdkVersion(Config.targetSdkVersion) | |
} | |
} | |
} | |
} | |
class MercariAndroidApplication : Plugin<Project> { | |
override fun apply(project: Project) { | |
project.plugins.apply(AppPlugin::class.java) | |
project.plugins.apply(MercariAndroidPlugin::class.java) | |
project.extensions.findByType(AppExtension::class.java)?.apply { | |
defaultConfig { | |
// TODO: setVersionName | |
} | |
} | |
} | |
} | |
class MercariAndroidLibrary : Plugin<Project> { | |
override fun apply(project: Project) { | |
project.plugins.apply(LibraryPlugin::class.java) | |
project.plugins.apply(MercariAndroidPlugin::class.java) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment