Skip to content

Instantly share code, notes, and snippets.

@brettwold
Created June 15, 2016 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettwold/b4db797e08f0152462e7fbb861b91681 to your computer and use it in GitHub Desktop.
Save brettwold/b4db797e08f0152462e7fbb861b91681 to your computer and use it in GitHub Desktop.
Gradle script to create a distribution archive (zip) file from a multi-module project
task distArchive(type: Zip, dependsOn: ['App1:build', 'App2:build', 'Lib1:build', 'JavaLib2:build']) {
from(["Lib1/build/outputs/aar", "JavaLib2/build/libs"]) {
include "*-release-${project.version}.aar"
include "*.jar"
into "libs/"
rename { filename ->
filename.replace 'release-', ''
}
}
from(["App1/build/outputs/apk", "App2/build/outputs/apk"]) {
include "*-release-${project.version}.apk"
into "apps/"
rename { filename ->
filename.replace 'release-', ''
}
}
from 'artifacts/'
baseName = "MyProject-${project.version}"
destinationDir = new File("release/")
}
@brettwold
Copy link
Author

The script above assumes that the project output artifacts have been augmented with the version number. This can be done using a script similar to artifacts.gradle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment