Build Tools Software Engineering SS 2007

Slides:



Advertisements
Similar presentations
Overview This presentation will be answering these main questions about AutoDoc: What does it do? What is it? How does it do it? Starting from the finish.
Advertisements

Introduction to Maven 2.0 An open source build tool for Enterprise Java projects Mahen Goonewardene.
Software Development Tools COMP220/COMP285 Seb Coope Ant and XML: Getting Started These slides are mainly based on “Java Development with Ant” - E. Hatcher.
® IBM Software Group © 2010 IBM Corporation What’s New in Profiling & Code Coverage RAD V8 April 21, 2011 Kathy Chan
ANT: Another Nice Tool Ali Beyad October 1, 2003.
ANT: Another Nice Tool Ali Beyad October 1, 2003.
1 Ant – Another Neat Tool Representation and Management of Data on the Internet.
Winter 2005Jason Prideaux1 Apache ANT A platform independent build tool for Java programs.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
Introduction to Java.
Android 4: Creating Contents Kirk Scott 1. Outline 4.1 Planning Contents 4.2 GIMP and Free Sound Recorder 4.3 Using FlashCardMaker to Create an XML File.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
CSE 403 Lecture 11 Static Code Analysis Reading: IEEE Xplore, "Using Static Analysis to Find Bugs" slides created by Marty Stepp
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Introduction Use of makefiles to manage the build process Declarative, imperative and relational rules Environment variables, phony targets, automatic.
INFSOM-RI Juelich, 10 June 2008 ETICS - Maven From competition, to collaboration.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Ant Build Tools.  Creating a product from source may take several steps: Compile Link Copy files to various directories Remove intermediate files Generate.
How to Run a Java Program CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
July 2011CMSC 341 CVS/Ant 1 CMSC 341 Java Packages Ant CVS Project Submission.
Introduction Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Software Development COMP220/COMP285 Seb Coope Introducing Ant These slides are mainly based on “Java Development with Ant” - E. Hatcher & S.Loughran.
Chapter 1 Introducing Ant. What is ant? Ant is a build tool  Automate the tasks of compiling code, running test, and packaging the results for redistribution.
Threaded Programming Lecture 2: Introduction to OpenMP.
Build Systems Presentation December 14, 2015 Noon-1pm Kathy Lee Simunich Bldg. 203/ D120 Brought to you by: Argonne Java.
Build Tools 1. Building a program for a large project is usually managed by a build tool that controls the various steps involved. These steps may include:
How to configure, build and install Trilinos November 2, :30-9:30 a.m. Jim Willenbring.
An Introduction to Ant. What is Ant? How do you use it? Why would you want to?
Development Environment
Large Program Management: Make; Ant
Essentials of UrbanCode Deploy v6.1 QQ147
CSE 303 Lecture 17 Makefiles reading: Programming in C Ch. 15
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
CSCI-235 Micro-Computer Applications
SOFTWARE DESIGN AND ARCHITECTURE
Brian Leonard ブライアン レオナルド
Large Program Management: Make; Ant
CMPE 152: Compiler Design ANTLR 4 and C++
Makefile Tutorial CIS5027 Prof: Dr. Shu-Ching Chen
Instructor: Prasun Dewan (FB 150,
Prof: Dr. Shu-Ching Chen TA: Yimin Yang
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Ant.
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Makefiles and the make utility
How to Run a Java Program
Large Program Management: Make; Ant
Introduction CSC 111.
CSE 390 Lecture 8 Large Program Management: Make; Ant
How to Run a Java Program
JENKINS TIPS Ideas for making your life with Jenkins easier
Overview Unit testing Building Version control.
Large Program Management: Make; Ant
Nilanjan Banerjee Java Packages Ant CVS Project Submission
(Computer fundamental Lab)
CS 240 – Advanced Programming Concepts
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Large Program Management: Make; Ant
Makefiles and the make utility
Review of Previous Lesson
Continuous Integration
CSE 390 Lecture 8 Large Program Management: Make; Ant
SPL – PS1 Introduction to C++.
Software Engineering and Architecture
Large Program Management: Make; Ant
Large Program Management: Make, Ant
Presentation transcript:

Build Tools Software Engineering SS 2007

Agenda for today Build Tools 1. Motivation 2. Key Concepts 3. Tools Available 4. Presentation 5. Discussion Objectives - Use modern build systems for software Software Engineering, lecture #: Topic 2

Build tools 1. Motivation 2. Key Concepts 3. Tools 4. Exercise 5. Discussion Software Engineering, lecture #: Topic 3

Software complexity Software moved from a monolithic implementation to a highly dynamic and modular implementation Software grew in size and complexity Different languages Different stages of file transformation Many dependencies to keep track Portability of the software became a problem Building of the software also got complex Shell scripts got extremely fragile Set up the situation that would call for constructing a tool such as Make Comment: content good, but to much text. Use colors or figure Software Engineering, lecture #: Topic 4

A tool was needed Quality Assurance became a necessity Such that every build was reproducible on different platforms Portability between different platforms Let the tool master the environment, instead of the developer Incremental builds to speed up the development time Ensuring the build produces the same results as a full clean build Comment: Use free space to separate text Software Engineering, lecture #: Topic 5

Build tools 1. Motivation 2. Key Concepts 3. Tools 4. Exercise 5. Discussion Software Engineering, lecture #: Topic 6

File transformation The building of software consists of transforming files from one format to another hello_world.c  hello_world Must instruct the appropriate tool to perform the transformation cc –c –o hello_world.o hello_world.c Must check that all dependencies of the target have been also successfully transformed cc –o hello_world hello_world.o Comment: suggest a diagram for this and for the dependency tracking. Comment: Use figure to explain Software Engineering, lecture #: Topic 7

Dependency tracking Files may depend on other files For a successful transformation, the dependencies are required to be available and transformed Usually done by a time stamp on the file Before we compile hello_world, we must first check that hello_world.o is newer than our source file, hello_world.c If it is not, we must recompile hello_world.o Comment: Use figure to explain Software Engineering, lecture #: Topic 8

External instrumentation It is the purpose of the build tool to instruct external tools in the appropriate order to perform the file transformations However, build tools may not know all the possible tools it may be used with Most build tools use either a shell scripting language or allow for a plug-in framework Tools contain some predefined rules for common tasks, like compilation Ant and Java Make and Fortran, C Software Engineering, lecture #: Topic 9

Build tools 1. Motivation 2. Key Concepts 3. Tools 4. Exercise 5. Discussion Software Engineering, lecture #: Topic 10

General idea Allow the developer to define targets, dependencies, and rules. Dependencies may either be files, or other targets When a target is performed, then the dependencies are checked to ensure a correct transformation Some tools support incremental builds If the dependencies have not changed since the last transformation, then we do not need to re-transform them Software Engineering, lecture #: Topic 11

Make Created by Stuart Feldman in 1977 at Bell Labs 2003, he received the ACM Software System Award for the Make tool Arguably, the single most important step in the direction of modern build environments Still the de-facto standard for software builds on Unix systems Easy to compile and install Unix based applications make make install A bit of history of Make Comment: Move 14 and 15 after this slide Software Engineering, lecture #: Topic 12

Modern versions BSD Make Derived from Adam de Boor’s work on a version of make capable of building targets in parallel. Includes conditionals and iterative loops applied to parsing stage. Generation of targets at runtime GNU Make Used in GNU/Linux installations Allows for pattern-matching in dependency graphs and build targets Heavy use of external macros Just to express that there isn’t just one Make in the world. Software Engineering, lecture #: Topic 13

Make example helloworld: helloworld.o $(CC) $(CPPFLAGS) $(LDFLAGS) –o $@ $< helloworld.o: helloword.c $(CC) –c $(CPPFLAGS) $(CFLAGS) –o $@ $< .PHONY: clean clean: $(RM) helloworld helloworld.o Don’t Forget about the Tab! All actions must be tabbed (\t) ! Make file format for this. Target: dependency command Where $@ represents the text of the target And $< represents the text of the dependency $(CC) is the default c compiler $(CPPFLAGS) is the c pre processor flags $(CFLAGS) is the c compile flags $(LDFLAGS) are the link loader flags for libraries $(RM) is the standard rm for make (overrides any user based aliases) .PHONY declares clean to not produce any files. Software Engineering, lecture #: Topic 14

Extensions of make Make files also have machine dependencies Compiler options, alternate command names This became extremely hard for developers to support various platforms IMake Generates Make files from templates and macro functions GNU Automake Successor of IMake Generates Make files from a higher level language Dynamic dependency tracking Automake also takes care of automatically generating the dependency information, so that when a source file is modified, the next invocation of the make command will know which source files need to be recompiled. If the compiler allows it, Automake tries to make the dependency system dynamic: whenever a source file is compiled, that file's dependencies are updated by asking the compiler to regenerate the file's dependency list. In other words, dependency tracking is a side effect of the compilation process. This attempts to avoid the problem with some static dependency systems, where the dependencies are detected only once when the programmer starts working on the project. In such a case, if a source file gains a new dependency (e.g., if the programmer adds a new #include directive in a C source file), then a discrepancy is introduced between the real dependencies and those that are used by the compilation system. The programmer should then regenerate the dependencies, but runs the risk of forgetting to do so. Software Engineering, lecture #: Topic 15

Apache ant Similar as Make, but Java language specific Uses an XML file for build description Primary goal was to solve Make’s portability problem Make targets depend on a Unix shell Ant’s built-in functionality will usually behave identical on all platforms Transition from Make to Ant. Comment: Use free space to separate text Software Engineering, lecture #: Topic 16

Apache ant Created by James Duncan Davidson from Sun Microsystems Officially released as a stand alone tool July 2000 Easy to integrate JUnit tests and other external processes However, Ant has limitations XML format does not allow for complex build tasks, requires a Java plug-in that encodes the task Limited fault handling rules Developer must make explicit incremental builds History and shortcomings of Ant Software Engineering, lecture #: Topic 17

Ant example <project default=“compile”> <target name=“compile”> <mkdir dir=“build” /> <javac srcdir=“source” destdir=“build”/> </target> <target name=“package” depends=“compile”> <jar jarfile=“helloworld.jar” basedir=“build”/> <target name = “clean”> <delete dir=“build”/> </project> A small ant example for our hello world class. We have to use the directories for simplicity. i.e. source/hello_world.java The rest should be pretty straight forward. Should make some pretty colors. Comment: Use colors to highlight keywords or most interesting elements Software Engineering, lecture #: Topic 18

Apache maven Dependencies are hard to maintain in Java programs Apache ant could not address the problem Maven was created with dependency control as the prominent feature Uses concept of a Project Object Model Description of software project and external dependencies External dependencies not available, will be downloaded automatically Transition from Ant to Maven Software Engineering, lecture #: Topic 19

Maven example Maven 2 will be recommended in this course A simple hello world example mvn archetype:create \ -DgroupId=ch.ethz.HelloWorld \ -DartifactId=hello-world And Maven creates a skeleton for our project Project Object Model file Main source directory Test source directory Adheres to best practices A simple Maven example Comment: Maven commands with a different font Software Engineering, lecture #: Topic 20

Extensions of Apache maven Maven has a rich plug-in framework Default installation includes many powerful plug-ins Build statistics exported to a website Integration with continuous testing Deployment of web applications through .war files SCM integration for deployment of systems Software metrics TODO list generation Export to Netbeans or Eclipse And many, many more The TODO list generation comes from the @todo or TODO that programmer’s often put in source code I thought this was a bit of a clever one. Software Engineering, lecture #: Topic 21

Build tools 1. Motivation 2. Key Concepts 3. Tools 4. Exercise 5. Discussion Software Engineering, lecture #: Topic 22

Ant exercise Still the de facto for industrial builds After the initial set up of Ant we will Set some standard project properties Configure the appropriate class path Write the targets to make and deploy our system Produce javadoc from our source code This will be the first part to the exercises. First we have them do the build system in Ant, then in Maven. This will give them the basic required for the course, and allow them to see the differences between the two systems. Software Engineering, lecture #: Topic 23

Maven exercise For this course Maven is a good choice building our project From the initial setup of Maven we will Set some standard tags in the POM file Add our dependencies to our project Make and deploy our project And if time permits, use our maven build system within the Netbeans platform We suggest to use maven for the build system of their projects. Start by creating a new project, moving their source code into the project, and how to configure it for deployment and external dependencies. See the included file (CVS) on the full presentation. Software Engineering, lecture #: Topic 24

Build tools 1. Motivation 2. Key Concepts 3. Tools 4. Exercise 5. Discussion Software Engineering, lecture #: Topic 25

Concluding remarks Necessary to include build tools in Configuration Management Automake 1.4 does not produce the same results as 1.9 Change of machine dependencies will usually not trigger a re-transformation May lead to deployment of software with the wrong compile flags Change of machine dependencies may also produce different results Compilation on Java 1.5 may produce different run-time behaviors than Java 1.4 One important point of build tools is that you have a build process encoded in say Make, but if you change the compiler, you may still not have the same resulting output. Various version of virtual machines depend on which you use, may produce different results and run-time behaviors . A CPP flag change will not trigger a re-compile in most versions of Make. Some versions however, do take this into account. Software Engineering, lecture #: Topic 26

References Make http://www.gnu.org/ http://www.bsd.org Ant http://ant.apache.org Maven http://maven.apache.org http://codehaus.org Software Engineering, lecture #: Topic 27