build system

16
СИСТЕМЫ СБОРКИ Краткий обзор

Upload: andrey-subbota

Post on 26-Jan-2015

118 views

Category:

Technology


6 download

DESCRIPTION

Краткий обзор популярных систем сборки.

TRANSCRIPT

Page 1: Build system

СИСТЕМЫ СБОРКИКраткий обзор

Page 2: Build system

ЧТО МОЖНО СОБРАТЬ?Зачем что-то собирать?

Page 3: Build system

MAKE

• 100500 реализаций на различных языках

•Основной файл: Makefile

• 46742 repo@github

Page 4: Build system

MAKE

variable = value

target: componentA componentB commandA commandB

targetB: componentC componentD commandA commandB

Page 5: Build system

MAKE

BACKUP_DAY = `date "+%Y.%m%d%"`

release: clean backup

backup: tar -czvf /backup/$(BACKUP_DAY).tar.gz build

clean: rm -f tmp/*

Page 6: Build system

ANT

• Напиан на Java

• Независит от платформы

•Основной файл: build.xml

• 6346 repo@github

Page 7: Build system

ANT

<?xml version="1.0"?><project default="release"> <target name="release" depends="backup,clean" /> <target name="backup" description="Clean all"> <exec executable="tar"> <arg value="-czvf" /> <arg value="/backup/${current.day}.tar.gz" /> </exec> </target> <target name="clean" description="Clean all"> <delete dir="tmp" /> </target></project>

Page 8: Build system

MAVEN

• Написан на Java

•Основной файл: pom.xml

• 7161 @github.com

•Maven - это просто *SARCASM*[email protected] archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app \-DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Page 9: Build system

MAVEN

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>my.app</groupId> <artifactId>my-app-name</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>my-app-name</name> <url>https://github.com/mylogin/myapp</url></project>

Page 10: Build system

MAVEN

<build> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </build>

Page 11: Build system

MAVEN

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  <modelVersion>4.0.0</modelVersion>  <groupId>com.javaetmoi.maven</groupId>  <version>1.1-SNAPSHOT</version>  <artifactId>maven-config-github-cloudbees</artifactId>  <name>JavaEtMoi Maven :: ${project.artifactId} - ${project.packaging}</name>  <packaging>pom</packaging>  <description>Maven configuration example pom.xml file for working with GitHub and the CloudBees maven repository</description>  <inceptionYear>2012</inceptionYear>  <url>https://github.com/arey/maven-config-github-cloudbees</url>

  <developers>    <developer>      <id>arey</id>      <name>Antoine Rey</name>      <email>[email protected]</email>      <url>http://javaetmoi.com</url>      <timezone>+1</timezone>      <roles>        <role>Java Developer</role>      </roles>    </developer>  </developers>

  <!-- Continuous Integration build hosted by CloudBees -->  <ciManagement>    <system>jenkins</system>    <url>https://javaetmoi.ci.cloudbees.com/job/Maven-Configuration-for-GitHub/</url>  </ciManagement>  <issueManagement>    <system>github</system>    <url>https://github.com/arey/maven-config-github-cloudbees/issues</url>  </issueManagement>

  <!-- GitHub Software Configuration Management -->  <scm>    <url>https://github.com/arey/maven-config-github-cloudbees</url>    <connection>scm:git:ssh://[email protected]/arey/maven-config-github-cloudbees.git</connection>

    <developerConnection>scm:git:ssh://[email protected]/arey/maven-config-github-cloudbees.git</developerConnection>  </scm>

  <build>    <extensions>      <!-- Extension required to deploy a snapshot or a release to the CloudBees remote maven repository using Webdav -->      <extension>        <groupId>org.apache.maven.wagon</groupId>        <artifactId>wagon-webdav</artifactId>        <version>1.0-beta-2</version>      </extension>    </extensions>

    <plugins>      <!-- Plugin used to process release using the command line: mvn release:prepare release:perform -->      <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-release-plugin</artifactId>        <version>2.2.2</version>      </plugin>

      <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-source-plugin</artifactId>        <version>2.1.2</version>        <configuration>          <encoding>UTF-8</encoding>        </configuration>      </plugin>      <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-javadoc-plugin</artifactId>        <version>2.7</version>      </plugin>      <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-deploy-plugin</artifactId>        <version>2.7</version>      </plugin>    </plugins>  </build>

  <!-- Deploy releases and snapshots to the CloudBees maven repositories -->  <distributionManagement>

    <downloadUrl>https://github.com/arey/maven-config-github-cloudbee</downloadUrl>    <repository>      <id>javaetmoi-cloudbees-release</id>      <name>javaetmoi-cloudbees-release</name>      <!-- Webdav repository url are prefixed with dav: -->      <url>dav:https://repository-javaetmoi.forge.cloudbees.com/release/</url>    </repository>    <snapshotRepository>      <id>javaetmoi-cloudbees-snapshot</id>      <name>javaetmoi-cloudbees-snapshot</name>      <url>dav:https://repository-javaetmoi.forge.cloudbees.com/snapshot/</url>    </snapshotRepository>  </distributionManagement>

  <repositories>    <!-- Cloudbees maven repositories for releases and snapshots -->    <repository>      <id>javaetmoi-cloudbees-release</id>      <name>javaetmoi-cloudbees-release</name>      <url>https://repository-javaetmoi.forge.cloudbees.com/release/</url>      <releases>        <enabled>true</enabled>      </releases>      <snapshots>        <enabled>false</enabled>      </snapshots>    </repository>    <repository>      <id>javaetmoi-cloudbees-snapshot</id>      <name>javaetmoi-cloudbees-snapshot</name>      <url>https://repository-javaetmoi.forge.cloudbees.com/snapshot/</url>      <releases>        <enabled>false</enabled>      </releases>      <snapshots>        <enabled>true</enabled>      </snapshots>    </repository>  </repositories>

</project>

7

ЕЩЁ XML!

БОЛЬШЕ XML!

Page 12: Build system

ANT + IVY

• Теперь ant почти как maven!

•Основной файл: ivy.xml

• добавляет секцию dependencies

Page 13: Build system

GRADLE

• Написан на Java

•Основной файл: build.gradle

• Сборка описывается на Groovy (Java с DSL)

• Умеет исполнять рецепты ant и ivy/maven

• 432 repo@github :)

Page 14: Build system

GRADLE

task release(dependsOn: [‘clean’,’backup’])

task backup << { def cmd="tar -czvf /backup/backup.tar.gz build" cmd.execute()}

task clean << { def dir = new File("tmp") dir.deleteDir()}

Page 15: Build system

ЧТО ЕЩЁ

• SCons (Python), 229 repo@github

• Phing (Ant на php)

• _Первая буква вашего любимого языка_ ake

• IncrediBuild for Visual Studio

Page 16: Build system

THE END