我一直在寻找Android版Travis CI文档,因此我可以学习如何开始在我的Android库中使用Travis。但是,我对文档中所说的内容并不了解...
到目前为止,我了解的是:
language: android # this means the project will be built in an Android environment
android:
components:
- tools # will be built with latest version of Android SDK tools
- platform-tools # ''
- build-tools-23.0.1 # build tools version of my project
- android-23 # Android SDK version of my project
Travis CI文档还显示了可以使用的其他组件:
# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-19
它在这里提供了更完整的清单。
但是这些“附加组件”是做什么的?我猜想该extra-android-support
组件可能意味着该项目将使用Android支持库构建,但其他组件又如何呢?
我看了一下特拉维斯试验摇篮,但我见过的其他项目使用script: ./gradlew check
,script: ./gradlew clean build check
,script: "./gradlew build"
,和一些没有script
在所有。这一切是什么意思?
使用您的.travis.yml
文件,您正在配置要构建和运行代码的计算机。在此文件中,您必须指定所需的所有组件。
该文档显示了所有可用的(预先安装的)SDK组件。除非您要强制重新安装此组件,否则无需在.travis.yml文件中指定它们。
相反,您必须指定未预先安装的组件。
例如build-tools 21.1.1
,列表上仅存在。这是团队的决定,因为该组件的版本更新更加频繁。
这些“附加组件”做什么/意味着什么?
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
这些是支持库存储库(必须使用SDK Manager进行更新),gradle将从中下载在build.gradle
文件的依赖项块中添加的支持库。
要获取可用的确切组件名称和描述的列表,请运行命令android list sdk --no-ui --all --extended
。
您会得到类似的东西:
# Check Android SDK tools: http://developer.android.com/tools/sdk/tools-notes.html
# Check Android SDK Platform-tools: http://developer.android.com/tools/revisions/platforms.html
tools
platform-tools
# Check BuildTools: http://developer.android.com/tools/revisions/build-tools.html
build-tools-23.0.1
# The API to be used to compile
# Check APIs: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
android-23
android-22
android-21
android-20
android-19
android-18
android-17
android-16
....
# The system images if you need to run emulator during your tests
sys-img-armeabi-v7a-android-23
sys-img-x86-android-23
....
# Google repository from which download the dependencies
# Check extras: http://developer.android.com/sdk/installing/adding-packages.html#GetSupportLib
extra-android-m2repository
extra-android-support
# Check more extras: http://developer.android.com/sdk/installing/adding-packages.html#GetGoogle
extra-google-m2repository
extra-google-google_play_services
extra-google-admob_ads_sdk
extra-google-analytics_sdk_v2
extra-google-gcm
extra-google-google_play_services_froyo
.....
# Source file
source-23
source-22
source-21
...
与您一起,.travis.yml
您必须告诉travis如何检查您的BUILD是否成功。通过该script
块,您可以指定用于检查构建的命令。
如果您的项目build.gradle
在存储库根目录中有一个文件,则将使用Gradle来构建它。对于您来说就足够了,这取决于您的项目。
gradle使用的默认命令是:
./gradlew build connectedCheck
但是您可以通过指定脚本块来覆盖它。
更多信息在这里。
如果您希望在travis-ci中看到输出,可以检查this。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句