{"id":845,"date":"2017-09-05T02:44:39","date_gmt":"2017-09-04T19:44:39","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/mobilecenter\/?p=845"},"modified":"2019-02-16T15:30:46","modified_gmt":"2019-02-16T22:30:46","slug":"simple-yet-powerful-how-we-make-our-builds-better","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/appcenter\/simple-yet-powerful-how-we-make-our-builds-better\/","title":{"rendered":"Simple, Yet Powerful: How We Make Our Builds Better"},"content":{"rendered":"<p><em>Visual Studio Mobile Center is now Visual Studio App Center. <a href=\"https:\/\/blogs.msdn.microsoft.com\/vsappcenter\/introducing-visual-studio-app-center\/\" rel=\"noopener\" target=\"_blank\"><em>Learn more here<\/em><\/a>.<\/em>\n&nbsp;\nMobile developers have a lot of challenges, and our goal is to make building and deploying your app the least of your worries. We (the Mobile Center Build team) developed a simple Android and iOS app called <em>PomPom<\/em> to ensure we\u2019re delivering the best developer experience and making continuous integration and delivery easier for our users. In the process, we\u2019ve identified a few ways to optimize our build processes, letting us focus on building more\u2014and better\u2014features.<\/p>\n<p>To highlight some of our favorite simple, yet powerful, tweaks, we\u2019re sharing how we\u2019ve set up and configured <em>PomPom<\/em>\u2019s iOS build processes\u2014maybe even inspiring you to try similar in your own builds.<\/p>\n<p>The project utilizes a classic branching process, where \u201cdevelop\u201d is the branch for beta testing that is distributed to the development team, while \u201cmaster\u201d is the release branch that gets distributed to the broader team.<\/p>\n<p><img decoding=\"async\" src=\"\" alt=\"PomPom Dashboard in Visual Studio Mobile Center.\" width=\"1024\" height=\"587\" class=\"aligncenter wp-image-855 size-large\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Customize Your Build with Build Scripts<\/h3>\n<p>We work on <em>PomPom<\/em> side-by-side with our Mobile Center development cycles, so we\u2019re always using the latest capabilities of the <strong>Build<\/strong> and <strong>Distribution<\/strong> services. This serves two goals: we\u2019re testing out new features on our own projects and, as we work on <em>PomPom<\/em>, we find out where we need or want additional functionality. More often than not, our findings align with the feedback we hear from our users.<\/p>\n<p>To guarantee we\u2019re testing Mobile Center\u2019s latest capabilities, we want to make sure we\u2019re using the most recent Mobile Center SDK, without the help of a dependency manager. Fortunately, Mobile Center supports custom build scripts to help developers accomplish specific tasks, and this is what we use.<\/p>\n<p><em>A <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/en-us\/mobile-center\/build\/custom\/scripts\/\" rel=\"noopener\"><em>build script<\/em><\/a> allows you to add simple or complex scenarios, via Bash or PowerShell, in three pre-defined stages of your build process: post-clone, pre-build, and post-build.<\/em><\/p>\n<p>We include the Mobile Center SDK as a Git submodule in the project\u2019s repository and add a <em>post-clone<\/em> build script named <code>mobile-center-post-clone.sh<\/code> next to the project-level file, which automatically ensures we\u2019re getting the latest version in our builds.<\/p>\n<p><code>#!\/bin\/bash\n# Pull the latest state of the Mobile Center SDK\ncd Vendor\/MobileCenter\ngit checkout develop\ngit pull<\/code><\/p>\n<p>We distribute from two different branches (\u201cdevelop\u201d and \u201cmaster\u201d), and we want it to be easy for us and our testers to quickly determine whether the beta or release version of the app is installed on our phones.<\/p>\n<p>To accomplish this, we use a <em>pre-build script<\/em> named <code>mobile-center-pre-build.sh<\/code> to update the name for each non-master branch release, appending \u201cBeta\u201d to the bundle name by modifying the CFBundleName in the Info.plist.<\/p>\n<p><code>#!\/bin\/bash\n# Change the bundle name of an iOS app for all non-master branches\nif [ \u201c$MOBILECENTER_BRANCH\u201d != \u201cmaster\u201d ];\nthen\nplutil -replace CFBundleName -string \u201c$(PRODUCT_NAME) Beta\u201d $MOBILECENTER_SOURCE_DIRECTORY\/MyApp\/Info.plist\nfi<\/code><\/p>\n<p><em><strong>Note<\/strong>: When you push your build scripts to the repository for the first time, or if you\u2019ve moved them to a different location, verify that they show up in your build configuration and make sure to save the new configuration. After applying the changes, the scripts will run with your next build.<\/em><\/p>\n<p><img decoding=\"async\" src=\"\" alt=\"Mobile Center Build Service UI\" width=\"1024\" height=\"587\" class=\"aligncenter wp-image-865 size-large\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Auto-Increment Your Build Numbers<\/h3>\n<p>When setting up any branch that will be distributed to users, each build needs a unique version. Because of this, we\u2019ve simplified version incrementing by having it managed by Mobile Center. Android and Windows require incremental version numbers to allow users to install new builds without needing to manually delete the previously installed version, and as you know, they\u2019re useful throughout the whole development process, regardless of the platform.<\/p>\n<p>This doesn\u2019t require any scripts. Simply turn on \u201cautomatically increment build number\u201d as you configure your build and Mobile Center takes it from there. Incremental versions streamline feedback and bug collection, since users can reference specific versions when they report issues, make suggestions, or find bugs. If the Mobile Center SDK captures a crash, we can associate the issue with the respective build.<\/p>\n<h3>Launch Test: Distribute to Your Users with Confidence<\/h3>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"\" alt=\"Mobile Center Build Service UI: Launch Test and Distribution in a few clicks.\" width=\"1024\" height=\"587\" class=\"aligncenter wp-image-875 size-large\" \/><\/p>\n<p>We want to make sure that our newest version of <em>PomPom<\/em> launches smoothly before we send a new release to the team, so we run an automated test on a real device for each build with Mobile Center\u2019s <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/en-us\/mobile-center\/build\/build-test-integration\" rel=\"noopener\"><em>launch test<\/em><\/a>* feature. The test captures the first screen that users see when \u201claunching\u201d (opening) the app. If the test fails, the build will fail as well, and we can investigate and solve the issue.<\/p>\n<p>Once we\u2019re confident that our build is stable, we distribute PomPom to the broader Mobile Center team and everyone automatically receives an email that a new version is available.<\/p>\n<p><em>*<a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/en-us\/mobile-center\/build\/build-test-integration\" rel=\"noopener\"><em>Launch test<\/em><\/a> uses Mobile Center\u2019s Test service, selecting one random device from our Mobile Center Test device lab. After signing up for Mobile Center, any mobile developer can use the Launch Test capability <strong>without<\/strong> writing any additional lines of code. Mobile Center Test service can also be used to run more robust UI test scripts, automatically testing apps on thousands of real devices and hundreds of operating system, hardware, and device configurations.<\/em><\/p>\n<h3>Wrapping Up<\/h3>\n<p>These are just three ways we use to customize and improve our build process based on our specific needs to help us work faster. <em>PomPom<\/em> will continue to be our companion app as we add new features to Mobile Center, and we welcome <em>your<\/em> suggestions about how we can help you get more out of your build process.<\/p>\n<p>Happy building!<\/p>\n<h4>Get started<\/h4>\n<p><strong>Log in to <a target=\"_blank\" href=\"https:\/\/mobile.azure.com\/login\" rel=\"noopener\"><strong>Mobile Center<\/strong><\/a> or <a target=\"_blank\" href=\"https:\/\/www.visualstudio.com\/vs\/mobile-center\/\" rel=\"noopener\"><strong>create your free account<\/strong><\/a> today.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visual Studio Mobile Center is now Visual Studio App Center. Learn more here. &nbsp; Mobile developers have a lot of challenges, and our goal is to make building and deploying your app the least of your worries. We (the Mobile Center Build team) developed a simple Android and iOS app called PomPom to ensure we\u2019re [&hellip;]<\/p>\n","protected":false},"author":42,"featured_media":38034,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-845","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mobiledev"],"acf":[],"blog_post_summary":"<p>Visual Studio Mobile Center is now Visual Studio App Center. Learn more here. &nbsp; Mobile developers have a lot of challenges, and our goal is to make building and deploying your app the least of your worries. We (the Mobile Center Build team) developed a simple Android and iOS app called PomPom to ensure we\u2019re [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts\/845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/comments?post=845"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/posts\/845\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/media\/38034"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/media?parent=845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/categories?post=845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/appcenter\/wp-json\/wp\/v2\/tags?post=845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}