I have a Gradle task which generate .jar file for my library as well as Javadocs:
apply plugin: 'com.android.library'
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(project.android.getBootClasspath())
destinationDir = file("$output javadoc/")
//Suppress warnings that can cause fail build on continuous integration tools
failOnError false
}
task clearJar(type: Delete) {
delete "$output $filename"
}
task makeJar(type: Copy) {
from('build/intermediates/bundles/release/')
into("$output")
include('classes.jar')
rename('classes.jar', "$filename")
}
//Dependent tasks will be executed first before executing requested task
makeJar.dependsOn(javadoc, clearJar, ':app:packageReleaseJar')
In the continues integration framework (ship.io) which I am using, after finishing makeJar task, I receive all the following from /app/build/
in Artifacts:
tmp.zip Zip Archive
intermediates.zip Zip Archive
generated.zip Zip Archive
myLib.jar
classes.jar
But I just want to have a zip file includes mylib.jar and javadocs
. Intermediated, generated, classes and temp is not desired. Do you know any solution for that?
Addenda:
I add another task to delete unwanted folders:
task releaseLib(type: Delete, dependsOn: makeJar) {
delete 'build/generated/'
delete 'build/intermediates/'
delete 'build/outputs/'
delete 'build/tmp/'
}
This solves problem, but if you have better suggestion, please let me know.
My name is Edwin, and I'm an engineer with Ship.io.
Your understanding of how we build artifacts is exactly correct. We upload artifacts as soon as the Gradle task completes. If you want to clean up the artifacts, you'll need to do so exactly as you describe before the Gradle runs.
Feel free to reply here or in the support ticket you filed if you have any other questions.