Reputation: 15635
My Android Gradle project uses a combination of buildTypes
(DEV,TEST,LIVE - in accordance with our staging process) and productFlavors
(Different flavours of our app) to create multiple APKs with different signing certificates and Proguard configuration. This works fine so far, as the output of the different flavours is separated in different folders when building with $ gradlew assemble
(without specifying a specific flavour and/or buildType).
Sample build/outputs directory after build:
/app/build/outputs/
apk/
app-flavor1-LIVE-0.0.1-SNAPSHOT.apk
app-flavor2-LIVE-0.0.1-SNAPSHOT.apk
app-flavor3-LIVE-0.0.1-SNAPSHOT.apk
app-flavor1-DEV-0.0.1-SNAPSHOT.apk
...
lint-results-flavor1LIVE-fatal_files/...
lint-results-flavor2LIVE-fatal_files/...
...
proguard/
flavor1/
LIVE/...
TEST/...
flavor2/
LIVE/...
...
The question remains, how can this build output be archived (as an artifact or something) during a Jenkins-Build. Jenkins allows the selection of files for archiving, but the folder hierarchy gets deleted during this process.
Long story short: How do I archive the whole build/outputs
directory in Jenkins?
Upvotes: 2
Views: 2499
Reputation: 84784
You need to add a post build action Archive the artifacts and in Files to archive input field add a pattern (relative to project root):
build/**/*.apk
Upvotes: 1