Release a library using ship.io (continues integra

2019-08-18 17:39发布

I have following tasks in build.gradle under app module in order to release a library as a jar file as well as javadoc.

apply plugin: 'com.android.library'

def filename = 'myLib.jar'
def output = "build/Lib-MobileFramework-Android.${version}/"

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')

task copyApk(type: Copy, dependsOn: ':test:assembleRelease') {
    from(project(':test').file('build/outputs/apk/'))
    into("${output}TestApp/")
    include('test-release.apk')
    rename('test-release.apk', 'TestApp.apk')
}

task releaseLib(type: Delete, dependsOn: [makeJar, copyApk]) {
   delete project(':test').file('build/generated/')
   delete project(':test').file('build/outputs/')
   delete project(':test').file('build/tmp/')
   delete project(':test').file('build/intermediates/')
   delete 'build/generated/'
   delete 'build/intermediates/'
   delete 'build/outputs/'
   delete 'build/tmp/'
}

By executing ReleaseLib task using Gradle wrapper from terminal, I will have Lib-MobileFramework-Android folder includes javadoc and myLib.jar. That is exactly what I expected.

MobileFramework-Android.zip -> javadoc, myLib.jar, MyApp -> TestApp.apk

I use ship.io as continues integration framework. When I execute releaseLib task from there, javadoc is under MobileFramework-Android folder as expected, but .jar file is not under folder rather outside it. So I have following:

MobileFramework-Android.zip -> javadoc, TestApp (Empty folder)
myLib.jar
TestApp.apk

Why is that and what is the solution?

1条回答
贪生不怕死
2楼-- · 2019-08-18 18:22

We do move some files to the artifacts directory, including the .jar file. I confirmed this in the most recent build on your account, the 'libMobileTagging.jar' file is in the artifacts directory. If you're interested in moving it to a specific location, you can run a command in your gradle task to move create/move the directory you want to save.

Let me know if this helps.

查看更多
登录 后发表回答