Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup integration #34

Merged
merged 1 commit into from
Mar 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Improve coverage for AdvancedBuildVersionPlugin
moallemi committed Mar 21, 2020
commit e079bab998f429c555cf18e28bf50b80246fe690
Original file line number Diff line number Diff line change
@@ -35,11 +35,12 @@ class AdvancedBuildVersionPlugin : Plugin<Project> {
}
}

private fun configureAndroid(project: Project, config: AdvancedBuildVersionConfig) =
with(project.extensions.getByType(AppExtension::class.java)) {
config.increaseVersionCodeIfPossible()
config.renameOutputApkIfPossible(applicationVariants)
}
private fun configureAndroid(project: Project, config: AdvancedBuildVersionConfig) {
config.increaseVersionCodeIfPossible()

val appExtension = project.extensions.getByType(AppExtension::class.java)
config.renameOutputApkIfPossible(appExtension.applicationVariants)
}

companion object {
const val EXTENSION_NAME = "advancedVersioning"
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package org.moallemi.gradle.advancedbuildversion

import com.android.build.gradle.AppExtension
import com.android.build.gradle.AppPlugin
import io.mockk.clearAllMocks
import io.mockk.every
import io.mockk.just
import io.mockk.mockk
import io.mockk.mockkStatic
import io.mockk.runs
import io.mockk.slot
import io.mockk.verifyOrder
import org.gradle.api.Action
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.junit.After
import org.junit.Before
@@ -35,7 +39,24 @@ class AdvancedBuildVersionPluginTest {
any<Project>()
)
} returns mockk()
every { project.afterEvaluate(any<Action<in Project>>()) } just runs

val afterEvaluateSlot = slot<Action<in Project>>()
every {
project.afterEvaluate(capture(afterEvaluateSlot))
} answers { afterEvaluateSlot.captured.execute(project) }

val applicationPlugin = mockk<AppPlugin>()
val pluginsSlot = slot<Action<in Plugin<*>>>()
every {
project.plugins.all(capture(pluginsSlot))
} just runs
// answers { pluginsSlot.captured.execute(applicationPlugin) }

every {
project.extensions.getByType(AppExtension::class.java)
} returns mockk() {
every { applicationVariants } returns mockk()
}

plugin = AdvancedBuildVersionPlugin()
}