Skip to main content
Jump to: navigation, search

Difference between revisions of "Tycho/Reproducible Version Qualifiers"

(New page: === "Executive" summary === * Only produce new artifact version when there are changes. * Generate the same version qualifier when building from the same git commit. * Guarantee consiste...)
 
m
Line 89: Line 89:
 
Do not use -SNAPSHOT dependencies resolved from Maven repositories. This is a good idea in general. For Tycho projects
 
Do not use -SNAPSHOT dependencies resolved from Maven repositories. This is a good idea in general. For Tycho projects
 
that use reproducible version qualifier this will allow calling any build a fully reproducible release build.
 
that use reproducible version qualifier this will allow calling any build a fully reproducible release build.
 +
 +
 +
[[Category:Tycho]]

Revision as of 09:02, 6 July 2012

"Executive" summary

  • Only produce new artifact version when there are changes.
  • Generate the same version qualifier when building from the same git commit.
  • Guarantee consistent artifact id, version and contents.

Configuration (just copy&paste!)

   <pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.eclipse.tycho</groupId>
         <artifactId>tycho-packaging-plugin</artifactId>
         <version>${tycho.version}</version>
         <dependencies>
           <dependency>
             <groupId>org.eclipse.tycho.extras</groupId>
             <artifactId>tycho-buildtimestamp-jgit</artifactId>
             <version>${tycho-extras.version}</version>
           </dependency>
         </dependencies>
         <configuration>
           <timestampProvider>jgit</timestampProvider>
           <jgit.ignore>
             pom.xml
           </jgit.ignore>
         </configuration>
       </plugin>
       <plugin>
         <groupId>org.eclipse.tycho</groupId>
         <artifactId>tycho-p2-plugin</artifactId>
         <version>${tycho.version}</version>
         <configuration>
           <baselineRepositories>
             <repository>
               <url>[some url]</url>
             </repository>
           </baselineRepositories>
         </configuration>
       </plugin>
   </pluginManagement>

What does this actually do?

Version qualifier is calculated based on timestamp of the most recent commit that touches any file under project base directory. This produces stable version qualifier when building projects from HEAD of a branch and when building projects from a tagged or any commit in general. To put it differently, version qualifier reflects build contents, not build timestamp. Although as of 2012-06-30 this is only implemented for git, it should be possible to provide implementation for other modern version control systems.

Generated artifacts are then compared to artifacts available from configured baseline repositories. If baseline repositories contain artifacts with the same id and version and equal contents, the generated artifacts are replaced with baseline version. If baseline repositories contain artifacts with the same id and version but different contents, depending on <stringBaseline> configuration parameter the build will either fail or generated artifacts will be replaced with baseline version. If the base repository does not contain artifact with the same id and version, the generated artifacts are used. In all three cases the same artifact id/version are guaranteed to represent the same artifact contents.

The end result is that build output contains new versions of the artifacts that did change and baseline version of the artifacts that did not.

Rebuilding from tag or, in fact, any commit

Use -Dtycho.baseline.replace=none command line parameter to make sure Tycho does not replace build artifacts with their corresponding baseline version. Tycho will still validate new build artifacts match corresponding artifacts from original build and depending on tycho.baseline configuration will either warn or fail the build if there are any discrepancies.


Feature version qualifiers

For feature projects, version qualifiers are generated from the last of the timestamp of the most recent common that touches any file under feature project basedir and timestamps of directly included bundles and features. Timestamps of included bundles and features and derived from their version qualifiers and any qualifier that cannot be interpreted as timestamp is ignored.

For the majority of feature projects that generates stable version qualifier that changes when feature contents changes, however manual "bump-version" commit in feature project will be necessary if included bundle/feature changes but its version qualifier cannot be interpreted and therefor ignored.

Other notes and hints.

Do not use -SNAPSHOT dependencies resolved from Maven repositories. This is a good idea in general. For Tycho projects that use reproducible version qualifier this will allow calling any build a fully reproducible release build.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.