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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
.externalNativeBuild
.cxx
local.properties
buildSrc/build
buildSrc/.idea/
build_configuration/build
build_configuration/.idea/
affected_module_detector.log
42 changes: 0 additions & 42 deletions build.gradle

This file was deleted.

4 changes: 2 additions & 2 deletions sample/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
.externalNativeBuild
.cxx
local.properties
buildSrc/build
buildSrc/.idea/
build_configuration/build
build_configuration/.idea/
54 changes: 0 additions & 54 deletions sample/build.gradle

This file was deleted.

39 changes: 39 additions & 0 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import com.dropbox.affectedmoduledetector.AffectedModuleConfiguration

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.ktlint)
alias(libs.plugins.detekt) apply false
alias(libs.plugins.affected.module.detector)
id("affected-tests-plugin") // custom plugin based on AMD
id("affected-tasks-plugin") // custom plugin based on AMD
}

affectedModuleDetector {
baseDir = project.rootDir.toString()
pathsAffectingAllModules =
setOf(
"build_configuration/",
)
specifiedBranch = "origin/main"
compareFrom = "SpecifiedBranchCommitMergeBase"
customTasks =
setOf(
AffectedModuleConfiguration.CustomTask(
"runDetektByImpact",
"detekt",
"Run static analysis tool by Impact analysis",
),
)
logFolder = project.rootDir.toString()
excludedModules =
setOf(
"sample-util",
)
}

tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
20 changes: 0 additions & 20 deletions sample/buildSrc/build.gradle.kts

This file was deleted.

25 changes: 0 additions & 25 deletions sample/buildSrc/src/main/kotlin/com/dropbox/sample/Dependencies.kt

This file was deleted.

This file was deleted.

This file was deleted.

33 changes: 33 additions & 0 deletions sample/build_configuration/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2020, Dropbox, Inc. All rights reserved.
*/
plugins {
alias(libs.plugins.kotlin.jvm)
`java-gradle-plugin`
}

repositories {
google()
mavenCentral()
mavenLocal()
}

gradlePlugin {
plugins {
register("affected-tests-plugin") {
id = "affected-tests-plugin"
implementationClass = "com.dropbox.affectedmoduledetector.AffectedTestsPlugin"
}
register("affected-tasks-plugin") {
id = "affected-tasks-plugin"
implementationClass = "com.dropbox.affectedmoduledetector.AffectedTasksPlugin"
}
}
}

dependencies {
implementation(libs.affected.module.detector)
testImplementation(libs.junit)
testImplementation(libs.mockito.kotlin)
testImplementation(libs.google.truth)
}
7 changes: 7 additions & 0 deletions sample/build_configuration/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package com.dropbox.affectedmoduledetector.tasks
package com.dropbox.affectedmoduledetector

import com.dropbox.affectedmoduledetector.AffectedModuleDetector
import com.dropbox.affectedmoduledetector.DependencyTracker
import com.dropbox.affectedmoduledetector.projectPath
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.testing.Test
import java.util.*

var TEST_TASK_TO_RUN_EXTENSION = "TestTasks"

Expand All @@ -23,9 +18,9 @@ open class TestTasks {
* registers all affected test tasks. Advantage is speed in not needing to skip modules at a large scale
*
* Registers 3 tasks
* gradlew runAffectedUnitTests - runs jvm tests
* gradlew runAffectedAndroidTests - runs connected tests
* gradlew assembleAffectedAndroidTests - assembles but does not run on device tests, useful when working with device labs
* gradlew runCustomAffectedUnitTests - runs jvm tests
* gradlew runCustomAffectedAndroidUnitTests - runs connected tests
* gradlew customAssembleAffectedAndroidTests - assembles but does not run on device tests, useful when working with device labs
*/
class AffectedTasksPlugin : Plugin<Project> {
var ANDROID_TEST_BUILD_VARIANT = "AndroidTest"
Expand All @@ -39,7 +34,7 @@ class AffectedTasksPlugin : Plugin<Project> {
project.extensions.findByName(TEST_TASK_TO_RUN_EXTENSION)
) as TestTasks
registerAffectedTestTask(
"runAffectedUnitTests",
"runCustomAffectedUnitTests",
testTasks.jvmTest, testTasks.jvmTestBackup, rootProject,
)

Expand Down Expand Up @@ -92,7 +87,7 @@ class AffectedTasksPlugin : Plugin<Project> {
rootProject: Project
) {
registerAffectedTestTask(
"runAffectedAndroidUnitTests",
"runCustomAffectedAndroidUnitTests",
testTasks.runAndroidTestTask, null, rootProject
)
}
Expand All @@ -101,7 +96,7 @@ class AffectedTasksPlugin : Plugin<Project> {
rootProject: Project
) {
registerAffectedTestTask(
"assembleAffectedAndroidTests",
"customAssembleAffectedAndroidTests",
testTasks.assembleAndroidTestTask, null, rootProject
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.dropbox.sample
package com.dropbox.affectedmoduledetector

import com.dropbox.affectedmoduledetector.AffectedModuleDetector
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
Expand All @@ -17,4 +16,4 @@ class AffectedTestsPlugin : Plugin<Project> {
AffectedModuleDetector.configureTaskGuard(task)
}
}
}
}
36 changes: 36 additions & 0 deletions sample/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[versions]
kotlin = "2.3.0"
detekt = "1.23.8"
coreKtx = "1.17.0"
appCompat = "1.7.1"
material = "1.13.0"
constraintlayout = "2.2.1"
junit = "4.13.2"
androidxTestExt = "1.3.0"
espressoCore = "3.7.0"
androidGradlePlugin = "8.13.2"
affectedModuleDetector = "0.6.2"
ktlint = "14.0.1"
mockitoKotlin = "1.6.0"
googleTruth = "1.4.5"

[libraries]
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appCompat" }
android-material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxTestExt" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
affected-module-detector = { module = "com.dropbox.affectedmoduledetector:affectedmoduledetector", version.ref = "affectedModuleDetector" }
mockito-kotlin = { group = "com.nhaarman", name = "mockito-kotlin", version.ref = "mockitoKotlin" }
google-truth = { group = "com.google.truth", name = "truth", version.ref = "googleTruth" }

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
affected-module-detector = { id = "com.dropbox.affectedmoduledetector", version.ref = "affectedModuleDetector" }
2 changes: 1 addition & 1 deletion sample/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading