Skip to main content
Version: QB14

Read Version from File

Situation

Control build version with a text file stored in SCM.

Demonstration

  1. Run the demo configuration.
  2. Navigate to workspace area of the configuration and check content of version.txt. Version of the newly generated build will remain the same as content of this file.

Resolution

Check general setting of the demo configuration, the next version is defined as below:

${groovy:
import com.pmease.quickbuild.util.FileUtils
FileUtils.createDir(configuration.workspaceDir)
def repo = repositories.get("repo")
repo.takeSnapshot()
return repo.sourceViewSupport.readSourceAsString("build/version.txt")
}

This tells QuickBuild to read content of file /demos/componentA/trunk/version.txt from SCM repository and return it as version of next build.