使用ship.io发布库(继续集成框架)

时间:2015-09-14 07:42:16

标签: android gradle continuous-integration

我在app模块下的build.gradle中执行了以下任务,以便将库释放为jar file以及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/'
}

通过终端使用ReleaseLib执行Gradle wrapper任务,我会让Lib - MobileFramework-Android文件夹包含javadocmyLib.jar。这正是我的预期。

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

我使用ship.io作为持续集成框架。当我从那里执行releaseLib任务时,javadoc正如预期的那样位于MobileFramework-Android文件夹下,但.jar文件不在文件夹下而是在它之外。所以我有以下内容:

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

为什么会这样,解决方案是什么?

1 个答案:

答案 0 :(得分:1)

我们确实将一些文件移动到artifacts目录,包括.jar文件。我在您帐户的最新版本中确认了这一点,'libMobileTagging.jar'文件位于artifacts目录中。如果您对将其移动到特定位置感兴趣,可以在gradle任务中运行命令来移动创​​建/移动要保存的目录。

如果有帮助,请告诉我。