Skip to content

Commit

Permalink
Merge pull request #233 from dropbox/jfein/fix-non-existant-path
Browse files Browse the repository at this point in the history
Add check to see if task exists on project before adding dependency
  • Loading branch information
joshafeinberg authored Aug 11, 2023
2 parents 72d1308 + 1741ca9 commit a2a77a9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/ci_test_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ jobs:
uses: actions/checkout@v2

- name: Set up our JDK environment
uses: actions/setup-java@v1.4.3
uses: actions/setup-java@v3
with:
java-version: 1.8
distribution: 'zulu'
java-version: '11'

- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel
Expand All @@ -49,21 +50,27 @@ jobs:
fail-fast: false
matrix:
api-level:
- 29
- 31

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up our JDK environment
uses: actions/setup-java@v1.4.3
uses: actions/setup-java@v3
with:
java-version: 1.8
distribution: 'zulu'
java-version: '11'
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./gradlew assemble testCoverage
api-level: 31
profile: Nexus 6
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew assemble testCoverage
env:
API_LEVEL: ${{ matrix.api-level }}
- name: Upload code coverage
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/sample_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up our JDK environment
uses: actions/setup-java@v1.4.3
uses: actions/setup-java@v3
with:
java-version: 1.8
distribution: 'zulu'
java-version: '11'
- name: Build sample
run: |
./gradlew :affectedmoduledetector:publishToMavenLocal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,12 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {

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

project.tasks.findByPath(path)?.onlyIf { task ->
pathOrNull?.onlyIf { task ->
when {
!AffectedModuleDetector.isProjectEnabled(task.project) -> true
else -> AffectedModuleDetector.isProjectAffected(task.project)
Expand Down
6 changes: 0 additions & 6 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ buildscript {
}
}

plugins {
id("io.gitlab.arturbosch.detekt") version "1.20.0"
}

apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: "com.dropbox.affectedmoduledetector"

Expand All @@ -47,8 +43,6 @@ affectedModuleDetector {
}

allprojects {
apply plugin: Dependencies.Libs.DETEKT_PLUGIN

repositories {
google()
mavenCentral()
Expand Down
1 change: 1 addition & 0 deletions sample/sample-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import com.dropbox.sample.Dependencies
plugins {
id 'com.android.library'
id 'kotlin-android'
id("io.gitlab.arturbosch.detekt") version "1.20.0"
}

affectedTestConfiguration {
Expand Down

0 comments on commit a2a77a9

Please sign in to comment.