将 Gradle Android Plugin 版本从 1.5.0 升级到 2.2.1 之后,其中有些 Task 也有相应变化,如 uploadArchives 默认不输出上传的 url 。

升级之前运行 ./gradlew clean upload 输出的日志包含:

:com.example.android.video:uploadArchives
Uploading: com/example/android/ARTIFACT-testing/3.14_17447/ARTIFACT-testing-3.14_17447.apk to repository remote at http://10.0.251.224:8081/nexus/content/repositories/releases
Transferring 8698K from remote
Uploaded 8698K
Uploading: com/example/android/ARTIFACT-testing/3.14_17447/ARTIFACT-testing-3.14_17447.map to repository remote at http://10.0.251.224:8081/nexus/content/repositories/releases
Transferring 4540K from remote
Uploaded 4540K

在 Jenkins Job 中通过添加 Post-build Actions 将上传的 url 进行拼接给 QA 提供相应的下载地址。

Set build description
Regular expression: Uploading: ([^\s]*)/(ARTIFACT.*)apk to repository remote at ([^\s]*)
Description:        Download APK:<br/> <a href="\3/\1/\2apk">\2apk</a><br> Download map:<br/><a href="\3/\1/\2map">\2map</a>

但在升级后,默认 uploadArchives 不将上传的地址打印,解决办法:

→ ~/android (develop) $./gradlew clean upload --info

Kind of trick, but it works :)