СИСТЕМЫ СБОРКИ
    Краткий обзор
ЧТО МОЖНО СОБРАТЬ?
     Зачем что-то собирать?
MAKE


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

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

• 46742   repo@github
MAKE

variable = value

target: componentA componentB
    commandA
    commandB

targetB: componentC componentD
    commandA
    commandB
MAKE

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

release: clean backup

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

clean:
  rm -f tmp/*
ANT


• Напиан   на Java

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

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

• 6346   repo@github
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>
MAVEN

• Написан     на Java

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

• 7161   @github.com

• Maven
      - это просто *SARCASM*
 maven@5.minute
 mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app 
 -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
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>
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>
MAVEN
<project xmlns="http://maven.apache.org/POM/4.0.0"                    <developerConnection>scm:git:ssh://git@github.com/arey/         <downloadUrl>https://github.com/arey/maven-config-github-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"             maven-config-github-cloudbees.git</developerConnection>         cloudbee</downloadUrl>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://       </scm>                                                            <repository>
maven.apache.org/maven-v4_0_0.xsd">                                                                                                     <id>javaetmoi-cloudbees-release</id>
  <modelVersion>4.0.0</modelVersion>                                <build>                                                             <name>javaetmoi-cloudbees-release</name>
  <groupId>com.javaetmoi.maven</groupId>                              <extensions>                                                      <!-- Webdav repository url are prefixed with dav: -->
  <version>1.1-SNAPSHOT</version>                                       <!-- Extension required to deploy a snapshot or a               <url>dav:https://repository-



                                                                   ЕЩЁ XML!
  <artifactId>maven-config-github-cloudbees</artifactId>          release to the CloudBees remote maven repository using Webdav   javaetmoi.forge.cloudbees.com/release/</url>
  <name>JavaEtMoi Maven :: ${project.artifactId} - $              -->                                                                 </repository>
{project.packaging}</name>                                              <extension>                                                   <snapshotRepository>
  <packaging>pom</packaging>                                              <groupId>org.apache.maven.wagon</groupId>                     <id>javaetmoi-cloudbees-snapshot</id>
  <description>Maven configuration example pom.xml file for               <artifactId>wagon-webdav</artifactId>                         <name>javaetmoi-cloudbees-snapshot</name>
working with GitHub and the CloudBees maven repository</                  <version>1.0-beta-2</version>                                 <url>dav:https://repository-
description>                                                            </extension>                                              javaetmoi.forge.cloudbees.com/snapshot/</url>
  <inceptionYear>2012</inceptionYear>                                 </extensions>                                                   </snapshotRepository>
  <url>https://github.com/arey/maven-config-github-cloudbees</                                                                      </distributionManagement>
url>                                                                  <plugins>
                                                                        <!-- Plugin used to process release using the command       <repositories>



                                                                 БОЛЬШЕ XML!
  <developers>                                                    line: mvn release:prepare release:perform -->                       <!-- Cloudbees maven repositories for releases and
    <developer>                                                         <plugin>                                                  snapshots -->
      <id>arey</id>                                                       <groupId>org.apache.maven.plugins</groupId>                 <repository>
      <name>Antoine Rey</name>                                            <artifactId>maven-release-plugin</artifactId>                 <id>javaetmoi-cloudbees-release</id>
      <email>antoine@javaetmoi.com</email>                                <version>2.2.2</version>                                      <name>javaetmoi-cloudbees-release</name>
      <url>http://javaetmoi.com</url>                                   </plugin>                                                       <url>https://repository-javaetmoi.forge.cloudbees.com/
      <timezone>+1</timezone>                                                                                                     release/</url>
      <roles>                                                           <plugin>                                                        <releases>
        <role>Java Developer</role>                                       <groupId>org.apache.maven.plugins</groupId>                     <enabled>true</enabled>
      </roles>                                                            <artifactId>maven-source-plugin</artifactId>                  </releases>
    </developer>                                                          <version>2.1.2</version>                                      <snapshots>
  </developers>                                                           <configuration>                                                 <enabled>false</enabled>
                                                                            <encoding>UTF-8</encoding>                                  </snapshots>
  <!-- Continuous Integration build hosted by CloudBees -->               </configuration>                                            </repository>
  <ciManagement>                                                        </plugin>                                                     <repository>
    <system>jenkins</system>                                            <plugin>                                                        <id>javaetmoi-cloudbees-snapshot</id>
    <url>https://javaetmoi.ci.cloudbees.com/job/Maven-                    <groupId>org.apache.maven.plugins</groupId>                   <name>javaetmoi-cloudbees-snapshot</name>
Configuration-for-GitHub/</url>                                           <artifactId>maven-javadoc-plugin</artifactId>                 <url>https://repository-javaetmoi.forge.cloudbees.com/
  </ciManagement>                                                         <version>2.7</version>                                  snapshot/</url>
  <issueManagement>                                                     </plugin>                                                       <releases>
    <system>github</system>                                             <plugin>                                                          <enabled>false</enabled>
    <url>https://github.com/arey/maven-config-github-                     <groupId>org.apache.maven.plugins</groupId>                   </releases>
cloudbees/issues</url>                                                    <artifactId>maven-deploy-plugin</artifactId>                  <snapshots>
  </issueManagement>                                                      <version>2.7</version>                                          <enabled>true</enabled>
                                                                        </plugin>                                                       </snapshots>
                                                                      </plugins>                                                      </repository>
  <!-- GitHub Software Configuration Management -->                 </build>                                                        </repositories>
  <scm>
    <url>https://github.com/arey/maven-config-github-               <!-- Deploy releases and snapshots to the CloudBees maven
cloudbees</url>                                                   repositories -->                                                </project>
    <connection>scm:git:ssh://git@github.com/arey/maven-            <distributionManagement>
config-github-cloudbees.git</connection>                                                                                          7
ANT + IVY


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

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

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

• Написан   на Java

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

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

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

• 432   repo@github :)
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()
}
ЧТО ЕЩЁ


• SCons    (Python), 229 repo@github

• Phing   (Ant на php)

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

• IncrediBuild   for Visual Studio
THE END

Build system

  • 1.
    СИСТЕМЫ СБОРКИ Краткий обзор
  • 2.
    ЧТО МОЖНО СОБРАТЬ? Зачем что-то собирать?
  • 3.
    MAKE • 100500 реализаций на различных языках • Основной файл: Makefile • 46742 repo@github
  • 4.
    MAKE variable = value target:componentA componentB commandA commandB targetB: componentC componentD commandA commandB
  • 5.
    MAKE BACKUP_DAY = `date"+%Y.%m%d%"` release: clean backup backup: tar -czvf /backup/$(BACKUP_DAY).tar.gz build clean: rm -f tmp/*
  • 6.
    ANT • Напиан на Java • Независит от платформы • Основной файл: build.xml • 6346 repo@github
  • 7.
    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>
  • 8.
    MAVEN • Написан на Java • Основной файл: pom.xml • 7161 @github.com • Maven - это просто *SARCASM* maven@5.minute mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  • 9.
    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>
  • 10.
    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>
  • 11.
    MAVEN <project xmlns="http://maven.apache.org/POM/4.0.0"     <developerConnection>scm:git:ssh://git@github.com/arey/     <downloadUrl>https://github.com/arey/maven-config-github- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" maven-config-github-cloudbees.git</developerConnection> cloudbee</downloadUrl> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://   </scm>     <repository> maven.apache.org/maven-v4_0_0.xsd">       <id>javaetmoi-cloudbees-release</id>   <modelVersion>4.0.0</modelVersion>   <build>       <name>javaetmoi-cloudbees-release</name>   <groupId>com.javaetmoi.maven</groupId>     <extensions>       <!-- Webdav repository url are prefixed with dav: -->   <version>1.1-SNAPSHOT</version>       <!-- Extension required to deploy a snapshot or a       <url>dav:https://repository- ЕЩЁ XML!   <artifactId>maven-config-github-cloudbees</artifactId> release to the CloudBees remote maven repository using Webdav javaetmoi.forge.cloudbees.com/release/</url>   <name>JavaEtMoi Maven :: ${project.artifactId} - $ -->     </repository> {project.packaging}</name>       <extension>     <snapshotRepository>   <packaging>pom</packaging>         <groupId>org.apache.maven.wagon</groupId>       <id>javaetmoi-cloudbees-snapshot</id>   <description>Maven configuration example pom.xml file for         <artifactId>wagon-webdav</artifactId>       <name>javaetmoi-cloudbees-snapshot</name> working with GitHub and the CloudBees maven repository</         <version>1.0-beta-2</version>       <url>dav:https://repository- description>       </extension> javaetmoi.forge.cloudbees.com/snapshot/</url>   <inceptionYear>2012</inceptionYear>     </extensions>     </snapshotRepository>   <url>https://github.com/arey/maven-config-github-cloudbees</   </distributionManagement> url>     <plugins>       <!-- Plugin used to process release using the command   <repositories> БОЛЬШЕ XML!   <developers> line: mvn release:prepare release:perform -->     <!-- Cloudbees maven repositories for releases and     <developer>       <plugin> snapshots -->       <id>arey</id>         <groupId>org.apache.maven.plugins</groupId>     <repository>       <name>Antoine Rey</name>         <artifactId>maven-release-plugin</artifactId>       <id>javaetmoi-cloudbees-release</id>       <email>antoine@javaetmoi.com</email>         <version>2.2.2</version>       <name>javaetmoi-cloudbees-release</name>       <url>http://javaetmoi.com</url>       </plugin>       <url>https://repository-javaetmoi.forge.cloudbees.com/       <timezone>+1</timezone> release/</url>       <roles>       <plugin>       <releases>         <role>Java Developer</role>         <groupId>org.apache.maven.plugins</groupId>         <enabled>true</enabled>       </roles>         <artifactId>maven-source-plugin</artifactId>       </releases>     </developer>         <version>2.1.2</version>       <snapshots>   </developers>         <configuration>         <enabled>false</enabled>           <encoding>UTF-8</encoding>       </snapshots>   <!-- Continuous Integration build hosted by CloudBees -->         </configuration>     </repository>   <ciManagement>       </plugin>     <repository>     <system>jenkins</system>       <plugin>       <id>javaetmoi-cloudbees-snapshot</id>     <url>https://javaetmoi.ci.cloudbees.com/job/Maven-         <groupId>org.apache.maven.plugins</groupId>       <name>javaetmoi-cloudbees-snapshot</name> Configuration-for-GitHub/</url>         <artifactId>maven-javadoc-plugin</artifactId>       <url>https://repository-javaetmoi.forge.cloudbees.com/   </ciManagement>         <version>2.7</version> snapshot/</url>   <issueManagement>       </plugin>       <releases>     <system>github</system>       <plugin>         <enabled>false</enabled>     <url>https://github.com/arey/maven-config-github-         <groupId>org.apache.maven.plugins</groupId>       </releases> cloudbees/issues</url>         <artifactId>maven-deploy-plugin</artifactId>       <snapshots>   </issueManagement>         <version>2.7</version>         <enabled>true</enabled>       </plugin>       </snapshots>     </plugins>     </repository>   <!-- GitHub Software Configuration Management -->   </build>   </repositories>   <scm>     <url>https://github.com/arey/maven-config-github-   <!-- Deploy releases and snapshots to the CloudBees maven cloudbees</url> repositories --> </project>     <connection>scm:git:ssh://git@github.com/arey/maven-   <distributionManagement> config-github-cloudbees.git</connection> 7
  • 12.
    ANT + IVY •Теперь ant почти как maven! • Основной файл: ivy.xml • добавляет секцию dependencies
  • 13.
    GRADLE • Написан на Java • Основной файл: build.gradle • Сборка описывается на Groovy (Java с DSL) • Умеет исполнять рецепты ant и ivy/maven • 432 repo@github :)
  • 14.
    GRADLE task release(dependsOn: [‘clean’,’backup’]) taskbackup << { def cmd="tar -czvf /backup/backup.tar.gz build" cmd.execute() } task clean << { def dir = new File("tmp") dir.deleteDir() }
  • 15.
    ЧТО ЕЩЁ • SCons (Python), 229 repo@github • Phing (Ant на php) • _Первая буква вашего любимого языка_ ake • IncrediBuild for Visual Studio
  • 16.