Studio Team Services Visual(VSTS. Formerly known as: Visual Studio online is the online service provided to developers or teams to assist in the development of the work. It provides like project management, version control, build automatically, automatic testing, deployment issue management, and other functions, and supports a variety of languages, development platform or IDE tools such as if it is below the five team can be free to use. (Detailed features and prices can refer to this page description)
This article to complete the task, is to Android project as an example, and the use ofGitHubFor the version control tool (of course, can also be VSTS for version control, also supports GIT), and the protagonist VSTS is used to set to automatically build the project work according to the automatically generated build good APK files for subsequent issue deployment.
Examples in this paper areStudio AndroidProduced by the structure of the project as an example, here don't have to do any special set or modify, as generally like to use it to establish the project can, while VSTS built-in Android build model is to use the script gradle. So if set about the establishment, can modify the content can be build.gradle archives.
Currently in VSTS Android build environment, part of the JDK support to 8, and the Android build tools support to API level 22, and does not support the Android support repository and Android support library. If you need these libraries, reference another article [to establish an exclusive server] (coming soon), a text.
The project setting is compilerSdkVersion: 19, buildToolsVersion: "19.1.0", minSdkVersion: 19, targetSdkVersion: 19, no use of Support Repository Android and Support Library Android.
The original code of the project will be released to the GitHub can also be the default Studio Android generated by the project structure, like this:
Set the VSTS implementation rules
After logging in to VSTS, you first create a project because there is no special reference to project management and version control, so you can set your preferences.
After the establishment of a good project, in the project page to switch to the BUILD page:
You have to start setting for scripts in the BUILD page, click create new script button:
Then select the Empty template to start building:
Select the empty template press next to a basic set, here because we are to GitHub, for example, so part of the repository type choose GitHub; part of the agent queue on the choice of hosted used VSTS build environment; and below the continuous integration hook choice, every time the code check-in GitHub will drive to build, if unchecked, can then be set to manually build or build on a regular basis. Upon completion, press Create to complete the build.
After the build definition, the first thing is the repository is set (to see it rendered the red exclamation point), first in the connection bar to the right of the press manage to set the username and password to GitHub that VSTS to build the program to connect to your GitHub account.
In the management of the service page, choose to add a Service Endpoint GitHub:
Then, press authorize button in the dialog box, then will jump out of a window (note is the browser block off) to your GitHub account access authorization, after the completion of the mandate, to connect the take a name and press the OK button to complete the set.
After the completion of the set to build definition repository page set, here choose to link to GitHub repository, take which branch to build, and every time they are clean and build. Finally, press the Save button at the top of the storage, will also allow you to modify the build definition name.
Repository after the completion of the set to build page, we want to here to join build work, press the add build step... Button to select the work.
VSTS establishment is free, you can pick a lot of work connected in series, here we can first select Android build on it.
After adding an Android build in the build definition, the simplest setting is to Gradle wrapper set if it is used VSTS build environment and not self built machines, it is necessary to select a gradlew.bat driven by it to the gradle the build commands. The other fields can not be set at first, and set the same as the Save button to press the toolbar button to save the settings.
Set work here is finished, the most basic establishment, if you earlier set each checkin executes the establishment can try to commit a new version to drive, or press the toolbar queue build... Button to manually, press will start schedule using the VSTS build environment, according to the setting of the establishment of one by one.
When the build starts execution, you will see a console displays the establishment of doing things, or is printed out the information that can help you examine the establishment work is carried out smoothly. In this example, it will first to set the repository code to catch back, then starts the execution of the gradlew.bat build (based on the previous set) instructions to build.
If you see build SUCCEED and in the console is not what error message, Congratulations, build automatically set has been able to normal operation!
Start after the establishment
A step forward will automatically build the mechanism just finished, the building after the APK how to get? In fact according to the preset gradle script and Android build the establishment and implementation of the APK file will be placed in app/build/outputs/apk/app-debug.apk the path so you can then select a build work connected with the Android build, see is to use what way to transmit to the release of the platform, or in combination with other tasks (such as signing or testing, etc.), here demonstration is will build APK file reached azure blob storage body.
Add a new work in construction work:
And then set to upload files, as stated earlier, the source column to fill in the app/build/outputs/apk/app-debug.apk; left is to set the azure account, and upload to which azure blob storage account, and storage containers and path.
After setting, when construction work starts, will complete the Android Build and Azure File Copy work.
Through this setting, Android development projects only focusing the development in the application, each when code check-in to GitHub (or other version control systems), it will automatically trigger this series of automatic work, for quick delivery requirements or tasks, will be able to minimize the error and use automation to to accelerate the entire job.