Software Building (Sestavování aplikací)

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

Core XP Practices with Java and Eclipse: Part 1

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

An Introduction to Ant

Software Building (Sestavování aplikací)

Getting Started with the Cisco Multicast Manager SDK

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

These steps may include:

What s NetBeans? Like Eclipse:

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

Beginner s guide to continuous integration

Software Building (Sestavování aplikací)

Functional Testing (Testování funkčnosti)

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

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

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

BEAWebLogic. Server. Beehive Integration in BEA WebLogic Server

Kevin Lee IBM Rational Software SCM23

Construction: version control and system building

Build Tools. Software Engineering SS A tool was needed. Agenda for today. Build tools. Software complexity. Build tools

Build Tools. Software Engineering SS 2007

Build. System building

Abstract. Avaya Solution & Interoperability Test Lab

USING THE OOSIML/JAVA. With a Terminal Window

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

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

Gant as Ant and Maven Replacement

Der Java-Experten-Kurs

CSE 390 Lecture 8. Large Program Management: Make; Ant

ATL TRANSFORMATION EXAMPLE

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

JDO Tools Guide (v5.1)

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

Install Instructions for SAS Clinical Standards Toolkit in SAS V9.1.3

Automation Deployment Guide

JEUS Webservice 구성 (ant)

Ant: The Definitive Guide

Build Automation Kurt Christensen

Construction: version control and system building

We d like to hear your suggestions for improving our indexes. Send to

gradle : Building Android Apps Mobel Meetup

This tutorial explains how you can use Gradle as a build automation tool for Java as well as Groovy projects.

The Fénix Framework Detailed Tutorial

COMP220/285 Lab sessions 1-3

JSR 168 Portlet Spec

Auto-Generating Documentation & Source Code

JPA Tools Guide (v5.0)

Outline. Configuration management. Main Phases MOTIVATION

Package Management and Build Tools

Apache Axis2. Tooling with Axis2

B O NU S C H A P T E R

USING THE OOSIML/JAVA COMPILER. With the Command Window

Benefits of the Build

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

How To Guide Using and Developing Custom Phases in IKAN ALM

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

Hello Gradle. TestNG, Eclipse, IntelliJ IDEA. Óbuda University, Java Enterprise Edition John von Neumann Faculty of Informatics Lab 2.

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

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

Maven Introduction to Concepts: POM, Dependencies, Plugins, Phases

NetBeans IDE Java Quick Start Tutorial

System Administrator s Guide Release 7.3.5

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

TIBCO StreamBase 10.2 Building and Running Applications in Studio, Studio Projects and Project Structure. November 2017

Class Dependency Analyzer CDA Developer Guide

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

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

Directory structure and development environment set up

Ibis Communication Library User s Guide

Ibis RMI User s Guide

Getting Started. Table of contents

Why switch exist-db from Ant to Maven?

<put document name here> 1/13

The Major Mutation Framework

Atelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

ewon Flexy JAVA J2SE Toolkit User Guide

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

C++ Binary Dependency Management with Gradle. Hugh Greene

JBoss Tattletale 1.1 Developer's Guide

AppFactory User Guide

spotbugs Documentation

Abstract. Avaya Solution & Interoperability Test Lab

Deployment Tools and Techniques

Topics covered. Introduction to Maven Maven for Dependency Management Maven Lifecycles and Plugins Hands on session. Maven 2

Restructuring AZDBLab

JAVA V Annotations Java, winter semester ,2016 1

Master's Theses and Graduate Research

JASPERREPORTS - INTERNATIONALIZATION

Embedding Graphics in JavaDocs (netbeans IDE)

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists

Maven POM project modelversion groupid artifactid packaging version name

Introductory Text for Intermediate Programming

... Fisheye Crucible Bamboo

Tim O'Brien (Sonatype, Inc.), John Casey (Sonatype, Inc.), Brian Fox (Sonatype, Inc.), Bruce Snyder (Sonatype, Inc.), Jason Van Zyl (Sonatype, Inc.

CSE 421 Course Overview and Introduction to Java

Developer Walkthrough

Overview License Features Ant task XML elements... 3

NetBeans IDE Field Guide

Text Processing. with Java 6

spotbugs Documentation

Transcription:

Software Building (Sestavování aplikací) http://d3s.mff.cuni.cz Pavel Parízek parizek@d3s.mff.cuni.cz CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics

What is software building Transforming source code (tree of files) into executable binary code C/C++, C# Win32 exe, Linux elf Java, Scala class files (bytecode) More generally LaTeX source files PDF documents Nástroje pro vývoj software Software Building 2

Nástroje pro vývoj software Software Building 3 Requirements Automation Minimal input from the developer Portability Support for multiple platforms Efficiency Process each source code file once Reuse previously built fragments Robustness Try building as much as possible Generality Not only for a particular application Easy to use How to easily define the build script

Nástroje pro vývoj software Software Building 4 Challenges Dependencies Building files in the correct order first binary object files (.o) and then executable Recompile after modification header file (.h) source code file (.c) How to identify them properly Pre-processor directives ( #include in C) Source code analysis (bytecode for Java) Metadata and debug symbols in binaries Correct order Logical dependencies between sources (.c,.java) and intermediate results (.o)

Other problems solved by build tools Packaging (distribution) generated binary files, metadata, documentation Running selected unit tests Generating documentation Nástroje pro vývoj software Software Building 5

Build tools Java world: Ant, Maven, Gradle Unix (C/C++): Make, Autotools Windows (.NET): MSBuild, (GUI) Nástroje pro vývoj software Software Building 6

Ant Nástroje pro vývoj software Software Building 7

Nástroje pro vývoj software Software Building 8 Ant Build tool mostly for Java projects Wide support of tools and frameworks common in the Java world (JUnit, JSP/Servlets, EJB,...) Highly extensible Plug-ins written in Java Very portable scripting Scripts written in XML Default file name: build.xml

Nástroje pro vývoj software Software Building 9 Build file structure <project name="myproject" default="dist" basedir="."> <property name="src.dir" value="./src"/> <property name="build.dir" value="./build"/> <target name="init"> <mkdir dir="${build.dir}"/> </target> <target name="compile" depends="init"> <javac srcdir="${src.dir}" destdir="${build.dir}"/> </target> <target name="clean"> <delete dir="${build.dir}"/> </target> </project>

Nástroje pro vývoj software Software Building 10 Terminology Task Specific action to be performed during the build process execute the Java compiler, create new directory Target Goal required for building (compilation, packaging, running tests, generating documentation) Set of tasks that must be executed to fulfill the goal May have dependencies on other targets Project Set of targets relevant for the application Property name-value pair (strings) usage: ${prop.name}

Nástroje pro vývoj software Software Building 11 Dependencies between targets Build script <target name= A /> <target name= B depends= A /> <target name= C depends= B /> <target name= D depends= A,C /> <target name= E depends= D,C,A /> Execution order E D,C,A,E D,C,A,E A,C,D,C,A,E A,C,D,C,A,E A,B,C,D,C,A,E A,B,C,D,C,A,E A,A,B,C,D,C,A,E A,A,B,C,D,C,A,E A,A,B,C,D,A,B,C,A,E A,A,B,C,D,A,B,C,A,E A,B,C,D,E

Nástroje pro vývoj software Software Building 12 Basic tasks Compilation of Java source files <javac srcdir="${src.dir}" destdir="./build" debug="on" deprecation="on"/> Running an external Java program <java classname="myapp.main" fork="true"> <arg value="nswi154"/> <jvmarg value="-xmx512m"/> </java> Packaging class files in JAR archive <jar destfile="myapp.jar" basedir="./build"> <manifest> <attribute name="main-class" value="..."/> </manifest> </jar>

Online documentation http://ant.apache.org/manual/index.html Important concepts (properties, filesets, paths) List of core tasks (javac, java, file management) Nástroje pro vývoj software Software Building 13

Nástroje pro vývoj software Software Building 14 Example 1 Download the APISign package http://d3s.mff.cuni.cz/teaching/software_development_tools/files/apisign.tgz Contains two simple tools for generating and verifying file signatures Taken from http://docs.oracle.com/javase/tutorial/security/apisign/ Write the build script for APISign Compilation All source code files written in Java Packaging Create an archive sign.jar with the main class GenSig Execution Runs the archive sign.jar on a file name given as a command-line argument Use properties where it makes sense, typical directory layout (./src,./build), and standard targets (compile, build, init, clean, dist) Specify reasonable dependencies between targets Running Ant Command-line: ant <target name>

File management Tasks <mkdir> <delete> <copy> <move> Nástroje pro vývoj software Software Building 15

Nástroje pro vývoj software Software Building 16 Path-like structures <path id="myapp.classpath"> <pathelement path="${classpath}"/> <fileset dir="lib"> <include name="**/*.jar"/> </fileset> <pathelement location="classes"/> <dirset dir="${build.dir}"> <include name="apps/**/classes"/> <exclude name="apps/**/*test*"/> </dirset> <pathelement location="third_party/util.jar"/> </path> <javac...> <classpath refid="myapp.classpath"/> </javac> This is a modified version of an example from the Apache Ant documentation

Properties defined externally Create the file build.properties src.dir=./src build.dir=./build lib.dir=./lib... and include the file in build.xml <property file="build.properties"/> Nástroje pro vývoj software Software Building 17

Nástroje pro vývoj software Software Building 18 Example 2 Download the CoCoME package http://d3s.mff.cuni.cz/teaching/software_development_tools/files/cocome.tgz It is a model of a trading system developed for research purposes The package contains also few external libraries Write similar build.xml as in the first example compilation, packaging, directory layout, target clean, properties, dependencies Improve the build script Define classpath properly and use in tasks like <javac> Use an external file to define properties

Dependencies between source files Recompile everything from scratch We can probably recommend this approach Use task <depend> Deletes all obsolete.class files (modified sources) Re-use of some previously compiled class files Limitation: cannot discover some dependencies Example <depend srcdir=./src destdir= ${build.dir} /> Nástroje pro vývoj software Software Building 19

Conditional processing of targets Property value is set/unset <property name="my-cond" value="..."/> <target name="..." if="my-cond"> <target name="..." unless="my-cond"> File availability <available file="./lib" property="have_lib"/> <target name="copy-libs" if="have_lib"> <copy...> </target> Nástroje pro vývoj software Software Building 20

Boolean conditions <condition property="config_debug"> <and> <available file="./config"/> <or> <istrue value="debug_mode"/> <istrue value="testing"/> </or> </and> </condition> Nástroje pro vývoj software Software Building 21

Explicit processing of targets <target name="dist" depends="build-main,build-test"> <antcall name="prepare-dist"> <param name="release" value="2.1-rc3"/> <param name="website" value="http://..."/> </antcall> </target> Nástroje pro vývoj software Software Building 22

Example 3 Play with advanced features Conditional processing of targets based on property values Boolean conditions (setting properties) Explicitly trigger processing of some target Nástroje pro vývoj software Software Building 23

Scripting <parallel> task 1 <sequential> task 2 task 3 </sequential> task 4 </parallel> Nástroje pro vývoj software Software Building 24

Nástroje pro vývoj software Software Building 25 Scripting Loops http://d3s.mff.cuni.cz/teaching/software_development_tools/files/antcontrib-1.0b3.jar Taken from: Ant-Contrib Tasks (http://ant-contrib.sourceforge.net) Example <taskdef resource="net/sf/antcontrib/antlib.xml"> <classpath> <pathelement location="ant-contrib-1.0b3.jar"/> </classpath> </taskdef> <for list="1,2,5,10" param="count"> <sequential> <java classname="myapp"> <arg value="@{count}"/> </java> </sequential> </for>

Nástroje pro vývoj software Software Building 26 Other useful tasks Executing arbitrary system commands <exec executable="cmd.exe" timeout="1000" output="log.txt" errorproperty="error.msg"> <arg value="some_data"/> </exec> Creating archives: <zip>, <tar> Setting properties that contain the current date and time <tstamp/> Printing messages <echo message="error: ${error.msg}">

MSBuild XML syntax of build scripts ( Makefiles ) Used internally by Visual Studio 20xx-15 Syntax evolving (non-trivial differences) Familiar concepts: task, target, property Homepage http://msdn.microsoft.com/en-us/library/dd393574.aspx Nástroje pro vývoj software Software Building 27

Homework Assignment http://d3s.mff.cuni.cz/~parizek/teaching/sdt/ Deadline 30.10.2017 / 2.11.2017 Nástroje pro vývoj software Software Building 28