Gradle任务发布/上传android apk到Http Server [英] Gradle task to publish / upload android apk to Http Server
问题描述
curl -k -F app = @ $ apk_dir-Frelease_notes = @ $ release_notes_filehttps://ourserver.com/apps/internal/app/$app_dir/$version
而应用程序目录由Android Manifest中的一些参数组装
app_dir =$ {app_name} - $ {some_other_manifest_meta_data}
正如我现在开始切换到Gradle我想把它移到gradle构建文件中。
我想到了一个依赖于Android插件汇编任务的任务,并将汇编后的apk,发行说明和proguard文件上传到Http服务器。
不幸的是官方的Gradle文档和大多数链接只是描述了如何上传到Maven或Ivy服务器。
如果有人能够提供代码或至少提示如何这样做。
谢谢
最简单的端口方式上传Gradle的任务是使用一个 Exec
任务。
您的任务可能会看起来像这样:
任务上传(类型:Exec){
可执行文件/ bin / sh
args-c,curl - k -F [...]
}
}
So far we used Jenkins with Ant to build our Android APKs. The built APK, the proguard mappings.txt and some release notes get uploaded to a Http Server using curl
curl -k -F "app=@$apk_dir" -F "release_notes=@$release_notes_file" "https://ourserver.com/apps/internal/app/$app_dir/$version"
whereas app dir is assembled by some parameters from the Android Manifest
app_dir="${app_name}-${some_other_manifest_meta_data}"
As I now start switching to Gradle I want to move this to the gradle build file. I thought of a task that depends on the Android plugin assemble task and uploads the assembled apk, the release notes and the proguard file onto the Http Server.
Unfortunately the official Gradle doc and most links just describe how to upload to Maven or Ivy servers.
Would be great if someone could provide me code or at least hints on how to do this.
Thanks
The most straightforward way to port your upload task to Gradle would be to use an Exec
task.
Your task might end up looking something like this:
task upload(type:Exec) {
executable "/bin/sh"
args "-c", "curl -k -F [...]"
}
}
这篇关于Gradle任务发布/上传android apk到Http Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!