{"id":22351,"date":"2016-05-30T03:01:26","date_gmt":"2016-05-29T17:01:26","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=22351"},"modified":"2016-05-30T19:27:23","modified_gmt":"2016-05-30T09:27:23","slug":"jenkins-and-xcode-c-project-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/jenkins-and-xcode-c-project-primer-tutorial\/","title":{"rendered":"Jenkins and Xcode C++ Project Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/index3.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Jenkins and Xcode C++ Project Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/jenkins_xcode-339of.jpg\" title=\"Jenkins and NetBeans Maven Project Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Jenkins and Xcode C++ Project Primer Tutorial<\/p><\/div>\n<p>A scenario suiting today&#8217;s <a target=_blank title='Jenkins landing page' href='https:\/\/jenkins.io\/'>Jenkins<\/a> is &#8230;<\/p>\n<ul>\n<li>You&#8217;re a Jenkins web application and Xcode IDE C++ analyst\/programmer creating a Mac OS X command line desktop application &#8230;<\/li>\n<li>You&#8217;re responsible for coding, unit testing and sending updated desktop software to the <a target=_blank title='Git remote repository' href='https:\/\/github.com\/rjmprogramming-com-au\/xcode-cpp-testregardingjenkins'>remote Git repository &#8230;<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/jenkins_xcode-341of.jpg\" title='Git remote repository'><\/img><\/a><br \/>\n&#8230;for your project &#8230;<\/li>\n<li>That remote Git repository for your project is accessible by all of your team, none of whom necessarily (but perhaps they also) change project code (nor even have to know of its existence, perhaps), in a variety of hosts with a similar Jenkins web application and Xcode environment installed &#8230;<\/li>\n<li>Those Jenkins web applications are all polling the remote Git repository for changes to the software and automate a rebuild of an Xcode workspace copy to create a &#8230;<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/jenkins_xcode-348of.jpg\" title='Xcode executable automatically built via Jenkins'><\/img><br \/>\n&#8230;new Mac OS X executable<\/li>\n<\/ul>\n<p> &#8230; which sounds to me like a good software automation scenario, with the <i>checks and balances<\/i> required to stop unauthorized practices, by involving that central remote Git repository, and the ssh security its <i>writing to<\/i> involves.<\/p>\n<p>This is the power of Jenkins, and even though the C++ coding scenario we share with you today is very simple, and we use that simplicity with less generic settings than would be desired &#8230; as you can see from the Build -&gt; Execute Shell -&gt; Command &#8230;<\/p>\n<p><code><br \/>\nif [ ! -d \"TestRegardingJenkins\" ]; then<br \/>\n  mkdir TestRegardingJenkins<br \/>\nfi<br \/>\ncp main.cpp TestRegardingJenkins<br \/>\ncp WebApplication.h TestRegardingJenkins<br \/>\nxcodebuild<br \/>\n<\/code><\/p>\n<p> &#8230; this bears no relation to the flexibility of Jenkins to handle vastly more complex scenarios.  Ring a bell?  Yes, Ansible and Jenkins give you this feel of simplicity and scalability to your deployment solutions.  And it is easy to see why we talk about them, because no one is going to give much time to a deployment solution that doesn&#8217;t work, nor probably to one that is too complex.<\/p>\n<p>And so you can see that various IDEs can interface to Jenkins, as its design and methodologies are quite generic by nature.  Yesterday we showed NetBeans IDE interface to Jenkins with our <a target=_blank title='Jenkins and NetBeans Maven Project Primer Tutorial' href='#janmppt'>Jenkins and NetBeans Maven Project Primer Tutorial<\/a> as shown below.<\/p>\n<p>To read more about the Xcode and C++ project of today&#8217;s work, in isolation, before Jenkins interfacing, we based it on the code presented with <a target=_blank title='Xcode C++ Web Applications Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/xcode-c-web-applications-primer-tutorial\/'>Xcode C++ Web Applications Primer Tutorial<\/a>.<\/p>\n<p>We again recommend you acquire <i>Jenkins: The Definitive Guide<\/i> by John Ferguson Smart for great detailed information to get the most out of Jenkins, and you can see the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/index3.html\" title='Click picture'>slideshow<\/a> of today&#8217;s work, as well.<\/p>\n<hr>\n<p id='janmppt'>Previous relevant <a target=_blank title='Jenkins and NetBeans Maven Project Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/jenkins-and-netbeans-maven-project-primer-tutorial\/'>Jenkins and NetBeans Maven Project Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/index.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Jenkins and NetBeans Maven Project Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/jenkins-5of.jpg\" title=\"Jenkins and NetBeans Maven Project Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Jenkins and NetBeans Maven Project Primer Tutorial<\/p><\/div>\n<p>Today we are installing <a target=_blank title='Jenkins landing page' href='https:\/\/jenkins.io\/'>Jenkins<\/a> onto our MacBook Pro laptop.  So what is Jenkins?  Well, we quote from the Jenkins landing page below &#8230;<\/p>\n<blockquote cite='https:\/\/jenkins.io\/'><p>\nAs an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project.<br \/>\n<b><\/b><br \/>\nJenkins is a self-contained Java-based program, ready to run out-of-the-box, with packages for Windows, Mac OS X and other Unix-like operating systems.\n<\/p><\/blockquote>\n<p> &#8230; and more explanation from Wikipedia &#8230;<\/p>\n<blockquote cite='https:\/\/en.wikipedia.org\/wiki\/Jenkins_%28software%29'><p>\nJenkins is an open source continuous integration tool written in Java. The project was forked from Hudson after a dispute with Oracle.<br \/>\n<b><\/b><br \/>\nJenkins provides continuous integration services for software development. It is a server-based system running in a servlet container such as Apache Tomcat. It supports SCM tools including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, Clearcase and RTC, and can execute Apache Ant and Apache Maven based projects as well as arbitrary shell scripts and Windows batch commands. The primary developer of Jenkins is Kohsuke Kawaguchi.[2] Released under the MIT License, Jenkins is free software.[3]<br \/>\n<b><\/b><br \/>\nBuilds can be started by various means, including being triggered by commit in a version control system, by scheduling via a cron-like mechanism, by building when other builds have completed, and by requesting a specific build URL.\n<\/p><\/blockquote>\n<p> &#8230; and via really useful <a target=_blank title='Useful link' href='https:\/\/chromatichq.com\/blog\/automated-servers-and-deployments-ansible-jenkins'>link<\/a> &#8230;<\/p>\n<blockquote cite='https:\/\/chromatichq.com\/blog\/automated-servers-and-deployments-ansible-jenkins'><p>\nJenkins is an award-winning application that monitors executions of repeated jobs, such as building a software project or jobs run by cron.\n<\/p><\/blockquote>\n<p> &#8230; and we think it will be a great tool to use for software deployment purposes, as we start out learning about Jenkins today after the preparatory &#8230;<\/p>\n<ul>\n<li>creating a Mac OS X new user &#8220;jenkins&#8221; in group &#8220;applications&#8221; for future use (that we talked about with <a target=_blank title='Mac OS X Users and Groups Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-users-and-groups-primer-tutorial\/'>Mac OS X Users and Groups Primer Tutorial<\/a><\/li>\n<li>set up <a target=_blank title='GitHub source control' href='https:\/\/github.com\/'>Git<\/a> for a new remote Jenkins usage username <a target=_blank title='Git rjmprogramming-com-au' href='https:\/\/github.com\/rjmprogramming-com-au\/tictactoe-nimh\/'><img title='Git rjmprogramming-com-au' src='http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/jenkins-08of.jpg'><\/img><i>rjmprogramming-com-au<\/i><\/a> to interface to Jenkins (and\/or NetBeans) later, including the creation of &#8220;jenkins&#8221; user ssh public and private keyfiles via <a target=_blank title='ssh-keygen information' href='https:\/\/help.github.com\/articles\/generating-an-ssh-key\/'><i>ssh-keygen<\/i><\/a><\/li>\n<li>installing Jenkins via its <a target=_blank title='Jenkins landing page' href='https:\/\/jenkins.io\/'>landing page<\/a> with a first &#8220;warts &#8216;n all&#8221; &#8220;not quite there&#8221; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/index2.html\">earlier try<\/a> at interfacing to a freestyle Xcode C++ project (which we&#8217;ll probably return to now that we know a lot more via the wonderful book <i>Jenkins: The Definitive Guide<\/i> by John Ferguson Smart that we highly recommend, and is almost solely the reason for some success below, and that we cannot hope to show as much detail as is there)<\/li>\n<\/ul>\n<p> &#8230; and then &#8230;<\/p>\n<p><!--ul>\n\n\n<li>researching Jenkins a bit first<\/li>\n\n\n\n\n<li>installing in on a Mac OS X MacBook Pro laptop<\/li>\n\n\n\n\n<li>installing and updating plugins, in particular to incorporate Git source control functionality<\/li>\n\n\n\n\n<li>use it in conjunction with an Xcode command line OSX C++ project using the default Git source code repository Xcode provides on the MacBook Pro hard disk ... like a \"Hello World\" scenario<\/li>\n\n\n<\/ul-->\n<ul>\n<li>consider interfacing Jenkins to a <a target=_blank title='NetBeans home page' href='https:\/\/netbeans.org\/'>NetBeans<\/a> IDE project we talked about with <a target=_blank title='Netbeans Maven Java Web Application Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/netbeans-maven-java-web-application-primer-tutorial\/'>Netbeans Maven Java Web Application Primer Tutorial<\/a> that used the NetBeans IDE and a GlassFish web server to create a Java web application &#8230;<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/jenkins-7of.jpg\"><\/img><br \/>\n &#8230; whose Git source control we are presenting at our <a target=_blank title='Git tictactoe-nimh' href='https:\/\/github.com\/rjmprogramming-com-au\/tictactoe-nimh\/'>TicTacToe Nimh Git repository<\/a><\/p>\n<p><b><i>Did you know?<\/i><\/b><\/p>\n<p>Perhaps you noticed the use of http:\/\/localhost:9190 for the Glassfish server today, inferring the use of port 9190, rather than the default 8080 port that is the default, but clashes with Jenkins&#8217;s default port 8080?  How we got the two to live together was to change the web server HTTP port of Glassfish to be 9190, via, command &#8230;<\/p>\n<p><code><br \/>\nsudo vi \/Applications\/NetBeans\/glassfish-4.1\/glassfish\/domains\/domain1\/config\/domain.xml<br \/>\n<\/code><\/p>\n<p>&#8230; and changing all (two) references to <i>8080<\/i> to be <i>9190<\/i>.<\/p>\n<\/li>\n<li>so, armed with the incredible <i>Jenkins: The Definitive Guide<\/i> by John Ferguson Smart we follow lots of the advice there to present you with screenshots there that &#8230;\n<ol>\n<li>set up Jenkins System Configuration &#8230;<\/li>\n<li>set up Jenkins Manage Plugins (for today) where <b><i>all<\/i><\/b> (and we mean <b><i>all<\/i><\/b>, unlike what the &#8220;warts &#8216;n all&#8221; link above may show) we asked for was the <i>Git Plugin<\/i> (and its dependencies flow on from that) &#8230;<\/li>\n<li>in Jenkins add a New Item which is a new Maven Project (interface) setup that will end up polling for changes at a crontab 1 minute interval &#8230;<br \/>\n<img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/jenkins-18of.jpg\"><\/img><br \/>\n&#8230; for changes, and rebuild the Java web application via the brilliance of <a target=_blank title='Maven landing page' href='https:\/\/maven.apache.org\/'>Maven<\/a> by Apache<\/li>\n<li> &#8230; all the while getting ready for Git source control &#8220;friendliness&#8221;<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>We hope you like the resulting <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Mac\/Jenkins\/index.html\" title='Click picture'>slideshow<\/a>, as more food for thought, along with <a target=_blank title='Ansible landing page' href='https:\/\/www.ansible.com\/'>Ansible<\/a> (we last talked about with <a target=_blank title='Ansible Dynamic Inventory Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/ansible-dynamic-inventory-tutorial\/'>Ansible Dynamic Inventory Tutorial<\/a>), for some deployment and development tools of huge value.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d22308' onclick='var dv=document.getElementById(\"d22308\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/netbeans\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22308' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d22351' onclick='var dv=document.getElementById(\"d22351\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/xcode\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22351' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A scenario suiting today&#8217;s Jenkins is &#8230; You&#8217;re a Jenkins web application and Xcode IDE C++ analyst\/programmer creating a Mac OS X command line desktop application &#8230; You&#8217;re responsible for coding, unit testing and sending updated desktop software to the &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/jenkins-and-xcode-c-project-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,33,37,40],"tags":[119,176,241,274,1768,494,495,585,1894,1772,997,999,1893,1190,1319,1411,1473],"class_list":["post-22351","post","type-post","status-publish","format-standard","hentry","category-elearning","category-software","category-tutorials","category-xcode","tag-automation","tag-c","tag-compile","tag-crontab","tag-deployment","tag-git","tag-github","tag-ide","tag-jenkins","tag-port","tag-programming","tag-project","tag-schedule","tag-ssh","tag-tutorial","tag-web-server","tag-xcode"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22351"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=22351"}],"version-history":[{"count":4,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22351\/revisions"}],"predecessor-version":[{"id":22375,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22351\/revisions\/22375"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=22351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=22351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=22351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}