diff --git a/.github/workflows/ci_test_and_publish.yml b/.github/workflows/ci_test_and_publish.yml index 44086bc7..40e6c44e 100644 --- a/.github/workflows/ci_test_and_publish.yml +++ b/.github/workflows/ci_test_and_publish.yml @@ -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 @@ -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 diff --git a/.github/workflows/sample_app.yml b/.github/workflows/sample_app.yml index e3ae941d..8d031745 100644 --- a/.github/workflows/sample_app.yml +++ b/.github/workflows/sample_app.yml @@ -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 diff --git a/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt index 0f563d58..fd6cc2b5 100644 --- a/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt @@ -171,11 +171,12 @@ class AffectedModuleDetectorPlugin : Plugin { 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) diff --git a/sample/build.gradle b/sample/build.gradle index c1ee6c4c..035333d4 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -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" @@ -47,8 +43,6 @@ affectedModuleDetector { } allprojects { - apply plugin: Dependencies.Libs.DETEKT_PLUGIN - repositories { google() mavenCentral() diff --git a/sample/sample-core/build.gradle b/sample/sample-core/build.gradle index 76769f0c..b724fe2c 100644 --- a/sample/sample-core/build.gradle +++ b/sample/sample-core/build.gradle @@ -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 {