build system
DESCRIPTION
Краткий обзор популярных систем сборки.TRANSCRIPT
СИСТЕМЫ СБОРКИКраткий обзор
ЧТО МОЖНО СОБРАТЬ?Зачем что-то собирать?
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*[email protected] 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" 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!
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