Skip to content

Commit a2a77a9

Browse files
Merge pull request #233 from dropbox/jfein/fix-non-existant-path
Add check to see if task exists on project before adding dependency
2 parents 72d1308 + 1741ca9 commit a2a77a9

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

.github/workflows/ci_test_and_publish.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ jobs:
2020
uses: actions/checkout@v2
2121

2222
- name: Set up our JDK environment
23-
uses: actions/setup-java@v1.4.3
23+
uses: actions/setup-java@v3
2424
with:
25-
java-version: 1.8
25+
distribution: 'zulu'
26+
java-version: '11'
2627

2728
- name: Upload Artifacts
2829
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel
@@ -49,21 +50,27 @@ jobs:
4950
fail-fast: false
5051
matrix:
5152
api-level:
52-
- 29
53+
- 31
5354

5455
steps:
5556
- name: Checkout
5657
uses: actions/checkout@v2
5758

5859
- name: Set up our JDK environment
59-
uses: actions/setup-java@v1.4.3
60+
uses: actions/setup-java@v3
6061
with:
61-
java-version: 1.8
62+
distribution: 'zulu'
63+
java-version: '11'
6264
- name: Run tests
6365
uses: reactivecircus/android-emulator-runner@v2
6466
with:
65-
api-level: 29
66-
script: ./gradlew assemble testCoverage
67+
api-level: 31
68+
profile: Nexus 6
69+
arch: x86_64
70+
force-avd-creation: false
71+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
72+
disable-animations: true
73+
script: ./gradlew assemble testCoverage
6774
env:
6875
API_LEVEL: ${{ matrix.api-level }}
6976
- name: Upload code coverage

.github/workflows/sample_app.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v2
1919
- name: Set up our JDK environment
20-
uses: actions/setup-java@v1.4.3
20+
uses: actions/setup-java@v3
2121
with:
22-
java-version: 1.8
22+
distribution: 'zulu'
23+
java-version: '11'
2324
- name: Build sample
2425
run: |
2526
./gradlew :affectedmoduledetector:publishToMavenLocal

affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,12 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
171171

172172
project.pluginManager.withPlugin(pluginId) {
173173
getAffectedPath(testType, project)?.let { path ->
174-
if (AffectedModuleDetector.isProjectProvided(project) && !isExcludedModule(config, path)) {
174+
val pathOrNull = project.tasks.findByPath(path)
175+
if (AffectedModuleDetector.isProjectProvided(project) && !isExcludedModule(config, path) && pathOrNull != null) {
175176
task.dependsOn(path)
176177
}
177178

178-
project.tasks.findByPath(path)?.onlyIf { task ->
179+
pathOrNull?.onlyIf { task ->
179180
when {
180181
!AffectedModuleDetector.isProjectEnabled(task.project) -> true
181182
else -> AffectedModuleDetector.isProjectAffected(task.project)

sample/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ buildscript {
1919
}
2020
}
2121

22-
plugins {
23-
id("io.gitlab.arturbosch.detekt") version "1.20.0"
24-
}
25-
2622
apply plugin: "org.jlleitschuh.gradle.ktlint"
2723
apply plugin: "com.dropbox.affectedmoduledetector"
2824

@@ -47,8 +43,6 @@ affectedModuleDetector {
4743
}
4844

4945
allprojects {
50-
apply plugin: Dependencies.Libs.DETEKT_PLUGIN
51-
5246
repositories {
5347
google()
5448
mavenCentral()

sample/sample-core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import com.dropbox.sample.Dependencies
33
plugins {
44
id 'com.android.library'
55
id 'kotlin-android'
6+
id("io.gitlab.arturbosch.detekt") version "1.20.0"
67
}
78

89
affectedTestConfiguration {

0 commit comments

Comments
 (0)