Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ affectedModuleDetector {
- `excludedModules`: A list of modules that will be excluded from the build process, can be the name of a module, or a regex against the module gradle path
- `includeUncommitted`: If uncommitted files should be considered affected
- `top`: The top of the git log to use. Must be used in combination with configuration `includeUncommitted = false`
- `customTasks`: set of [CustomTask](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleConfiguration.kt)
- `customTasks`: set of [CustomTask](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/health/flo/affectedmoduledetector/AffectedModuleConfiguration.kt)

By default, the Detector will look for `assembleAndroidDebugTest`, `connectedAndroidDebugTest`, and `testDebug`. Modules can specify a configuration block to specify which variant tests to run:
```groovy
Expand Down Expand Up @@ -216,8 +216,8 @@ You should see zero tests run. Make a change within one of the modules and commi
## Custom tasks

If you want to add a custom gradle command to execute with impact analysis
you must declare [AffectedModuleConfiguration.CustomTask](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleConfiguration.kt)
which is implementing the [AffectedModuleTaskType](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleTaskType.kt) interface in the `build.gradle` configuration of your project:
you must declare [AffectedModuleConfiguration.CustomTask](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/health/flo/affectedmoduledetector/AffectedModuleConfiguration.kt)
which is implementing the [AffectedModuleTaskType](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/health/flo/affectedmoduledetector/AffectedModuleTaskType.kt) interface in the `build.gradle` configuration of your project:

```groovy
// ...
Expand All @@ -238,7 +238,7 @@ affectedModuleDetector {
**NOTE:** Please, test all your custom commands.
If your custom task doesn't work correctly after testing, it might be that your task is quite complex
and to work correctly it must use more gradle api's.
Hence, you must create `buildSrc` module and write a custom plugin manually like [AffectedModuleDetectorPlugin](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt)
Hence, you must create `buildSrc` module and write a custom plugin manually like [AffectedModuleDetectorPlugin](https://github.com/flo-health/AffectedModuleDetector/blob/main/affectedmoduledetector/src/main/kotlin/health/flo/affectedmoduledetector/AffectedModuleDetectorPlugin.kt)

## Notes

Expand Down
2 changes: 1 addition & 1 deletion affectedmoduledetector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gradlePlugin {
plugins {
affectedModuleDetectorPlugin {
id = GROUP
implementationClass = "com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin"
implementationClass = "health.flo.affectedmoduledetector.AffectedModuleDetectorPlugin"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import com.dropbox.affectedmoduledetector.util.toOsSpecificPath
import health.flo.affectedmoduledetector.util.toOsSpecificPath
import java.io.File
import java.io.Serializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
*/
@file:JvmName("AffectedModuleDetectorUtil")

package com.dropbox.affectedmoduledetector

import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.CHANGED_PROJECTS_ARG
import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.DEPENDENT_PROJECTS_ARG
import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.ENABLE_ARG
import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.MODULES_ARG
import com.dropbox.affectedmoduledetector.commitshaproviders.CommitShaProviderConfiguration
import com.dropbox.affectedmoduledetector.util.toPathSections
package health.flo.affectedmoduledetector

import health.flo.affectedmoduledetector.AffectedModuleDetector.Companion.CHANGED_PROJECTS_ARG
import health.flo.affectedmoduledetector.AffectedModuleDetector.Companion.DEPENDENT_PROJECTS_ARG
import health.flo.affectedmoduledetector.AffectedModuleDetector.Companion.ENABLE_ARG
import health.flo.affectedmoduledetector.AffectedModuleDetector.Companion.MODULES_ARG
import health.flo.affectedmoduledetector.commitshaproviders.CommitShaProviderConfiguration
import health.flo.affectedmoduledetector.util.toPathSections
import org.gradle.api.Action
import org.gradle.api.GradleException
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2020, Dropbox, Inc. All rights reserved.
*/

package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import org.gradle.api.Plugin
import org.gradle.api.Project
Expand Down Expand Up @@ -31,7 +31,7 @@ import org.jetbrains.annotations.VisibleForTesting
* logFolder = "${project.rootDir}".
* }
*
* To enable affected module detection, you need to pass [com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.ENABLE_ARG]
* To enable affected module detection, you need to pass [health.flo.affectedmoduledetector.AffectedModuleDetector.Companion.ENABLE_ARG]
* into the build as a command line parameter.
*
* See [AffectedModuleDetector] for additional flags.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import java.io.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

/**
* Used to configure which variant to run for affected tasks by adding following block to modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/*
* Copyright (c) 2020, Dropbox, Inc. All rights reserved.
*/
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import org.gradle.api.Project
import org.gradle.api.artifacts.ProjectDependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import org.gradle.api.logging.LogLevel
import org.gradle.internal.logging.slf4j.OutputEventListenerBackedLogger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
* Copyright (c) 2020, Dropbox, Inc. All rights reserved.
*/

package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import com.dropbox.affectedmoduledetector.GitClientImpl.Companion.CHANGED_FILES_CMD_PREFIX
import com.dropbox.affectedmoduledetector.commitshaproviders.CommitShaProviderConfiguration
import com.dropbox.affectedmoduledetector.commitshaproviders.ForkCommit
import com.dropbox.affectedmoduledetector.commitshaproviders.PreviousCommit
import com.dropbox.affectedmoduledetector.commitshaproviders.SpecifiedBranchCommit
import com.dropbox.affectedmoduledetector.commitshaproviders.SpecifiedBranchCommitMergeBase
import com.dropbox.affectedmoduledetector.commitshaproviders.SpecifiedRawCommitSha
import com.dropbox.affectedmoduledetector.util.toOsSpecificLineEnding
import com.dropbox.affectedmoduledetector.util.toOsSpecificPath
import health.flo.affectedmoduledetector.GitClientImpl.Companion.CHANGED_FILES_CMD_PREFIX
import health.flo.affectedmoduledetector.commitshaproviders.CommitShaProviderConfiguration
import health.flo.affectedmoduledetector.commitshaproviders.ForkCommit
import health.flo.affectedmoduledetector.commitshaproviders.PreviousCommit
import health.flo.affectedmoduledetector.commitshaproviders.SpecifiedBranchCommit
import health.flo.affectedmoduledetector.commitshaproviders.SpecifiedBranchCommitMergeBase
import health.flo.affectedmoduledetector.commitshaproviders.SpecifiedRawCommitSha
import health.flo.affectedmoduledetector.util.toOsSpecificLineEnding
import health.flo.affectedmoduledetector.util.toOsSpecificPath
import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.logging.Logger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

internal enum class InternalTaskType(
override val commandByImpact: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Copyright (c) 2020, Dropbox, Inc. All rights reserved.
*/

package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import org.gradle.api.Project
import org.gradle.api.logging.Logger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.GitClient
import com.dropbox.affectedmoduledetector.Sha
import health.flo.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.Sha
import java.io.Serializable

interface CommitShaProvider : Serializable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.GitClient
import com.dropbox.affectedmoduledetector.Sha
import health.flo.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.Sha

class ForkCommit : CommitShaProvider {
override fun get(commandRunner: GitClient.CommandRunner): Sha {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.GitClient
import com.dropbox.affectedmoduledetector.Sha
import health.flo.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.Sha

class PreviousCommit : CommitShaProvider {
override fun get(commandRunner: GitClient.CommandRunner): Sha {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.GitClient
import com.dropbox.affectedmoduledetector.Sha
import health.flo.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.Sha

class SpecifiedBranchCommit(private val branch: String) : CommitShaProvider {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.GitClient
import com.dropbox.affectedmoduledetector.Sha
import health.flo.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.Sha

class SpecifiedBranchCommitMergeBase(private val specifiedBranch: String) : CommitShaProvider {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.GitClient
import com.dropbox.affectedmoduledetector.Sha
import health.flo.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.Sha

class SpecifiedRawCommitSha(private val commitSha: String) : CommitShaProvider {
override fun get(commandRunner: GitClient.CommandRunner): Sha {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector.util
package health.flo.affectedmoduledetector.util

import java.io.File

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector.util
package health.flo.affectedmoduledetector.util

import java.io.File

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import com.google.common.truth.Truth.assertThat
import org.junit.Assert.assertFalse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import com.google.common.truth.Truth
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import com.dropbox.affectedmoduledetector.rules.SetupAndroidProject
import health.flo.affectedmoduledetector.rules.SetupAndroidProject
import com.google.common.truth.Truth.assertThat
import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import com.google.common.truth.Truth.assertThat
import org.gradle.api.Project
Expand Down Expand Up @@ -59,7 +59,7 @@ class AffectedModuleDetectorPluginTest {
throw IllegalStateException("Expected to throw exception")
} catch (e: PluginApplicationException) {
// THEN
assertThat(e.message).isEqualTo("Failed to apply plugin class 'com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin'.")
assertThat(e.message).isEqualTo("Failed to apply plugin class 'health.flo.affectedmoduledetector.AffectedModuleDetectorPlugin'.")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import com.google.common.truth.Truth.assertThat
import org.junit.Before
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import org.junit.rules.TestRule
import org.junit.runner.Description
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import org.junit.Test
import org.junit.runner.RunWith
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector
package health.flo.affectedmoduledetector

import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.AttachLogsTestRule
import com.dropbox.affectedmoduledetector.mocks.MockCommandRunner
import health.flo.affectedmoduledetector.AttachLogsTestRule
import health.flo.affectedmoduledetector.mocks.MockCommandRunner
import com.google.common.truth.Truth.assertThat
import org.junit.Assert.fail
import org.junit.Rule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.AttachLogsTestRule
import com.dropbox.affectedmoduledetector.mocks.MockCommandRunner
import health.flo.affectedmoduledetector.AttachLogsTestRule
import health.flo.affectedmoduledetector.mocks.MockCommandRunner
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.AttachLogsTestRule
import com.dropbox.affectedmoduledetector.mocks.MockCommandRunner
import health.flo.affectedmoduledetector.AttachLogsTestRule
import health.flo.affectedmoduledetector.mocks.MockCommandRunner
import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.commitshaproviders
package health.flo.affectedmoduledetector.commitshaproviders

import com.dropbox.affectedmoduledetector.AttachLogsTestRule
import com.dropbox.affectedmoduledetector.mocks.MockCommandRunner
import health.flo.affectedmoduledetector.AttachLogsTestRule
import health.flo.affectedmoduledetector.mocks.MockCommandRunner
import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.dropbox.affectedmoduledetector.mocks
package health.flo.affectedmoduledetector.mocks

import com.dropbox.affectedmoduledetector.FileLogger
import com.dropbox.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.FileLogger
import health.flo.affectedmoduledetector.GitClient

internal class MockCommandRunner(private val logger: FileLogger) : GitClient.CommandRunner {
private val replies = mutableMapOf<String, List<String>>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.dropbox.affectedmoduledetector.mocks
package health.flo.affectedmoduledetector.mocks

import com.dropbox.affectedmoduledetector.GitClient
import com.dropbox.affectedmoduledetector.Sha
import com.dropbox.affectedmoduledetector.commitshaproviders.CommitShaProvider
import health.flo.affectedmoduledetector.GitClient
import health.flo.affectedmoduledetector.Sha
import health.flo.affectedmoduledetector.commitshaproviders.CommitShaProvider

class MockCommitShaProvider : CommitShaProvider {
private val replies = mutableListOf<Sha>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.affectedmoduledetector.rules
package health.flo.affectedmoduledetector.rules

import org.junit.rules.TemporaryFolder
import java.io.File
Expand Down
4 changes: 2 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import com.dropbox.affectedmoduledetector.AffectedModuleConfiguration
import com.dropbox.sample.Dependencies
import health.flo.affectedmoduledetector.AffectedModuleConfiguration
import health.flo.sample.Dependencies

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dropbox.sample
package health.flo.sample

import com.dropbox.affectedmoduledetector.AffectedModuleDetector
import health.flo.affectedmoduledetector.AffectedModuleDetector
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dropbox.sample
package health.flo.sample

object Dependencies {

Expand Down
Loading
Loading