Skip to content

Commit

Permalink
Create withMediaPipe variant only if AAR is present
Browse files Browse the repository at this point in the history
This should fix running `./gradlew clean test` if MediaPipe hasn't been built, for example.

PiperOrigin-RevId: 452033698
  • Loading branch information
andrewlewis authored and marcbaechinger committed May 31, 2022
1 parent b6b2826 commit 14ed32c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions demos/transformer/README.md
Expand Up @@ -57,8 +57,9 @@ manual steps.
${TRANSFORMER_DEMO_ROOT}/src/withMediaPipe/assets
```

1. Select the `withMediaPipe` build variant in Android Studio, then build and
run the demo app and select a MediaPipe-based effect.
1. In Android Studio, gradle sync and select the `withMediaPipe` build variant
(this will only appear if the AAR is present), then build and run the demo
app and select a MediaPipe-based effect.

[Transformer]: https://exoplayer.dev/transforming-media.html
[MediaPipe]: https://google.github.io/mediapipe/
Expand Down
10 changes: 10 additions & 0 deletions demos/transformer/build.gradle
Expand Up @@ -56,6 +56,16 @@ android {
dimension "mediaPipe"
}
}

// Ignore the withMediaPipe variant if the MediaPipe AAR is not present.
if (!project.file("libs/edge_detector_mediapipe_aar.aar").exists()) {
variantFilter { variant ->
def names = variant.flavors*.name
if (names.contains("withMediaPipe")) {
setIgnore(true)
}
}
}
}

dependencies {
Expand Down

0 comments on commit 14ed32c

Please sign in to comment.