Kevin Lee IBM Rational Software SCM23

Similar documents
Lukáš Asník. Software Development & Monitoring Tools (NSWI126)

Ant. Originally ANT = Another Neat Tool. Created by James Duncan Davidson Now an Apache open-source project

An Introduction to Ant

CSE 403 Lecture 11. Static Code Analysis. Reading: IEEE Xplore, "Using Static Analysis to Find Bugs"

Software Building (Sestavování aplikací)

Core XP Practices with Java and Eclipse: Part 1

Quality-Driven Build Scripts for Java Applications. Duy (uu-eee) B. Vo Graduate Student San José State University Department of Computer Science

Package Management and Build Tools

The Major Mutation Framework

MAVEN SUCKS NO(W) REALLY

Abstract. Avaya Solution & Interoperability Test Lab

Software Development. COMP220/COMP285 Seb Coope Ant: Structured Build

Getting It Right COMS W4115. Prof. Stephen A. Edwards Spring 2007 Columbia University Department of Computer Science

JAVA V Tools in JDK Java, winter semester ,2017 1

JEUS Webservice 구성 (ant)

S A M P L E C H A P T E R

Baselining Requirements Assets with Rational RequisitePro and Rational ClearCase. A Rational Software White Paper

Build automation. CSE260, Computer Science B: Honors Stony Brook University

GWT in Action by Robert Hanson and Adam Tacy

Team Support and Versioning with ClearCase and CVS in WebSphere Business Modeler V7

B O NU S C H A P T E R

Javadocing in Netbeans (rev )

Directory structure and development environment set up

Deployment Tools and Techniques

Practical Java. Using ant, JUnit and log4j. LearningPatterns, Inc. Collaborative Education Services

Alternate Workflow: Setting Up a ClearCase UCM Environment

BEAWebLogic. Server. Beehive Integration in BEA WebLogic Server

Gant as Ant and Maven Replacement

An Integrated Approach to Managing Windchill Customizations. Todd Baltes Lead PLM Technical Architect SRAM

System Testing. Contents. Steven J Zeil. April 9, 2013

Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit

Embedding Graphics in JavaDocs (netbeans IDE)

One suite that suits them all

The Intel VTune Performance Analyzer: Insights into Converting a GUI from Windows* to Eclipse*

JAVA V Annotations Java, winter semester ,2016 1

Software Development and Deployment

ATL TRANSFORMATION EXAMPLE

[ Team LiB ] Table of Contents Index Reviews Examples Reader Reviews Errata Java Extreme Programming Cookbook By Eric M. Burke, Brian M.

Getting Started with the Cisco Multicast Manager SDK

Unit Tests. Unit Testing. What to Do in Unit Testing? Who Does it? 4 tests (test types) You! as a programmer

Benefits of the Build

Build. System building

COMP220/285 Lab sessions 1-3

Functional Testing (Testování funkčnosti)

The Fénix Framework Detailed Tutorial

Ant: The Definitive Guide

Index. Symbols. /**, symbol, 73 >> symbol, 21

What s New in Borland JBuilder 8

Der Java-Experten-Kurs

Introduction to Software Engineering: Tools and Environments. Session 9. Oded Lachish

This document covers the most frequently used procedures in ClearCase. It contains the following sections:

JPA Tools Guide (v5.0)

Outline. Configuration management. Main Phases MOTIVATION

JDO Tools Guide (v5.1)

Getting Started with Java Development and Testing: Netbeans IDE, Ant & JUnit

Please see the docs for latest release in 1.99.* Some of the information below might be outdated

Abstract. Avaya Solution & Interoperability Test Lab

Global Administration April 24, :46:42 PM CEST

JSR 168 Portlet Spec

S A M P L E C H A P T E R

Integrating IBM Rational Build Forge with IBM Rational ClearCase and IBM Rational ClearQuest

Development Practice and Quality Assurance. Version Control. The first thing you should be told when you start a new job - Steve Freeman

Thomas Pelaia II, Ph.D. XAL Workshop 2012 December 13, 2012 Managed by UT-Battelle for the Department of Energy

Programming Tools for Group Projects. Richard Smith

TP731A 09/02. IBM Rational ClearCase Integration with IBM WebSphere Studio

Stress-free Deployment

NetRexx on the Big Iron

Platforms. Table of contents

Construction: version control and system building

IBM Rational Software

JUnit Howto. Blaine Simpson

IBM Rational ClearQuest and IBM Rational ClearCase CCRC/UCM Environment Operations Guide V1.0

J A D E Te s t S u i t e

Documentum Foundation Classes Installation Guide

Oracle Developer Day

gradle : Building Android Apps Mobel Meetup

Packaging and Deploying Java Based Solutions to WebSphere Message Broker V7

I Got My Mojo Workin'

Getting Started With Tornado

Beyond Unit Testing. About Us. Steve Loughran Julio Guijarro HP Laboratories, Bristol, UK. steve.loughran at hpl.hp.com julio.guijarro at hpl.hp.

Creating Flex Applications with IntelliJ IDEA

Show all text and icon decorations Preferences->Team->IBM Rational ClearTeam Explorer->ClearCase decorations: Enable Text and Icon Decorations

JavaSE: First Simple Module Exercise

Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p.

USING THE OOSIML/JAVA COMPILER. With the Command Window

S AMPLE CHAPTER IN ACTION. Benjamin Muschko. FOREWORD BY Hans Dockter MANNING

ClearCase VOB Database Troubleshooting

Introduction to CVS. Sivan Toledo Tel-Aviv University

Developing Web Services. with Axis. Web Languages Course 2009 University of Trento

TIBCO Silver Fabric Enabler for TIBCO BusinessEvents Developer Guide

Development tools: Version control, build tools, and integrated development environments 1

Mastering WDK Developer Tips and Tricks. A.J. Whitney

SDK Developer s Guide

Sams Teach Yourself ASP.NET in 24 Hours

6.170 Laboratory in Software Engineering Eclipse Reference for 6.170

Working in Base ClearCase

RASP Library for Java Version 2.0.0

Introduction: Manual Testing :

IBM C Rational Functional Tester for Java. Download Full Version :

Selenium Testing Course Content

Transcription:

Accelerating and Automating the Build Process with IBM Rational ClearCase and Ant Kevin Lee IBM Rational Software kevin.lee@uk.ibm.com

Agenda Overview of Ant What is Ant The Ant build file Typical Ant sequence Overview of the Ant integration with ClearCase ClearCase Ant Patterns Demo

What is Ant? What is Ant? Java-based build tool De-facto standard for building Java projects Why use Ant? Cross-platform Java domain smart Fast, extensible, integrated

The Ant build file XML format Default name: build.xml Typically in project root directory Defines a single project A project contains targets Targets contain tasks

Typical Ant sequence project <?xml version="1.0"?> <project name="rationaldemo" default="compile"> <target name="init"> </target> <target name="clean" description="remove generated files"> </target> targets tasks <target name="compile" depends="init" description="compile source code"> <javac /> </target> <target name="dist" depends="compile" description="create distribution jar file"> <jar /> </target> </project>

ClearCase Ant Tasks Ant has a number of tasks for integration with ClearCase These tasks interface with cleartool command Current commands (in Ant 1.6.1): cccheckin cccheckout cclock ccmkattr ccmkdir ccmkelem ccmkbl ccmklabel ccmklbtype ccrmtype ccuncheckout ccunlock ccupdate

ClearCase Ant Tasks cont These tasks do not cover all the actions you might want to carry out as part of the build, particularly if using UCM. However, it is easy to extend and create new tasks. For example: ccchbl ccdiffbl ccmkactivity ccsetactivity clearauditant clearauditjarcr

Example Ant ClearCase sequence <target name="clearcase-pre" depends="init" description="execute ClearCase pre compile commands"> </target> <!-- update snapshot view --> <ccupdate viewpath="${user.dir}\.." graphical="false" overwrite="true" currenttime="true" rename="false"/> <!-- lock the build branch --> <cclock objsel="brtype:project_int" replace="true" nusers="ccadm"/> <!-- checkout files to be updated --> <cccheckout viewpath= src\com\ratlbank\model\bank.java" reserved="true" notco="false" />

ClearCase Ant Patterns Some examples and proven scenarios of how to use the features of Ant and ClearCase to get accelerate the build process

1. Baseline Java tools as a single unit Problem: Users are unsure of which versions of Java tools to use, i.e. which version of junit, log4j, checkstyle, ant itself should I be using? Not strictly Ant specific Solution: Place all the tools under version control and baseline them as a unit In UCM create a component for it ff

2. Referencing Java tools libraries Problem: We want to define a (multi-platform) classpath which includes our Java tools libraries Solution: Define a path id and convert to O/S specific format Implementation: Define path id based on relative location: <path id="project.classpath"> <pathelement location="${dir.build}"/> <!-- include java tools --> <fileset dir="${user.dir}\..\javatools\lib"> <include name="*.jar"/> </fileset> </path>

3. Utilizing a Properties File Problem: Project specific references mean build.xml file needs reworking for each new project Solution: Maintain a build.properties file at the same level as the build.xml file Also means users can override them, if necessary Implementation: Example build.properties file: # build properties name.project-vob = RationalProjects name.project = RatlBankModel name.build.prefix = RATLBNK-MODEL name.build.admin = ccadm name.build.branch = RatlBankModel_Integration file.main.class = com.ratlbank.main.bankmain

3. Utilizing a Properties File cont Implementation cont Loading the properties file: <property file="build.properties" prefix="bp" /> Referencing the properties: <cclock objsel="brtype:${bp.name.build.branch}" replace="true" nusers="${bp.name.build.admin}"/>

4. Generating build labels Problem: Need to automatically generate a suitable ClearCase baseline/label and include it in the code or jar manifest file Solution: Use ant s buildnumber tag Implementation: In build.properties file, make reference a buildinfo file (the file that will store the build number) and the source file which should be updated to include the build number: file.build.info = buildinfo.properties file.build.referer = src/com/ratlbank/model/bank.java

4. Generating a BuildInfo file cont Implementation cont Include string to replace in source file: private final static String version = "@(#)<label> (on:<date>)@"; Generate the buildinfo.properties file with build number and date in: <propertyfile file="${bp.file.build.info}" </propertyfile> comment="build Information File - DO NOT CHANGE" > <entry key="build.num" type="int default="0000" operation="+" pattern="0000" /> <entry key="build.date" type="date" value="now" pattern="dd.mm.yyyy HH:mm" /> Update the specific source file with this version number: <replaceregexp file="${bp.file.build.referer}" match="@\(#\).*@ replace="@(#)$ {bp.name.build.prefix}-${build.num} (on: ${build.date})@" />

5. Generating good baselines Problem: How can we make sure that the baseline we apply is good and suitable for further development Solution: Generate the baseline before the build, use junit to run some basic acceptance tests and promote the baseline (UCM only) after the successful build. Implementation: Lock down the integration stream, set into a build activity and apply the baseline: <!-- lock the integration branch --> <cclock objsel="brtype:${bp.name.build.branch}" replace="true" nusers="${bp.name.build.admin}"/> <! set into the build activity --> <ccsetactivity activityselector="${bp.name.build.activity}"/> <!- apply the baseline --> <ccmkbl baselinerootname="${bp.name.build.prefix}-${build.num}" identical="yes" full="yes" viewpath=". " />

5. Generating good baselines cont Implementation cont Run the junit tests:... <junit printsummary="on" fork="no" haltonfailure="false" failureproperty="tests.failed showoutput="true"> <classpath refid="project.classpath"/> <formatter type="xml"/> <batchtest todir="${dir.build}"> <fileset dir="${dir.src}"> <include name="**/test*.java"/> </fileset> </batchtest> </junit> If the build succeeds, promote the baseline to BUILT : <ccchbl baselineselector="${bp.name.build.prefix}-${build.num}" level="built" nrecurse="true" />

6. System versus user build Problem: We don t want users to carry out a full system build (i.e. generating build numbers, applying baselines etc), but don t want to maintain separate build.xml files. Solution: Create a system build target which invokes the system build operations. Implementation: <target name="system" description="generate system build"> </target> <antcall target="update-buildinfo" /> <antcall target="junit-all" /> <antcall target="baseline" /> <antcall target="dist" /> <antcall target="javadoc" />

7. Automatically generating build reports Problem: We want to automatically generate a build log, junit test log and also a ClearCase report of what went into the build, i.e. file versions or UCM activities. Solution: Use the ant XML logger, the junitreport task and the ccdiffbl task. Implementation: Start off the build directing the output to the XML logger: C:\>ant -logger org.apache.tools.ant.xmllogger -logfile build \log.xml <target> (You can specify the stylesheet to use on the command line or in the build.xml file itself)

7. Automatically generating build reports cont Implementation cont Run the junitreport task to create a junit test log: <junitreport todir="${dir.build}"> <fileset dir="${dir.build}"> <include name="test-*.xml"/> </fileset> <report format="noframes" todir="${dir.build}"/> </junitreport> Run the ccdiffbl task to generate the ClearCase contents report <record name="${dir.build}\clearcase.txt" action="start" /> <ccdiffbl baselineselector="${bp.name.build.prefix}-${build.num}" predecessor="true" versions="true" /> <record name="${dir.build}\clearcase.txt" action="stop" />

8. Performing a ClearCase audit Problem Solution Implementation

Other tips Some other ideas Use the ClearCase scheduler for scheduling automating builds

Example reports

The Easy Way

Summary Ant very powerful tool Careful consideration to get the most out of ClearCae

References

Kevin Lee kevin.lee@uk.ibm.com