Created
June 15, 2016 12:32
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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