Index: Jenkins/Distribute
===================================================================
--- Jenkins/Distribute	(revision 4011b985be2d258647c84ecba0bc5dcceb410d26)
+++ Jenkins/Distribute	(revision 4011b985be2d258647c84ecba0bc5dcceb410d26)
@@ -0,0 +1,125 @@
+#!groovy
+
+import groovy.transform.Field
+
+// For skipping stages
+import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
+
+import Jenkins.tools
+
+//===========================================================================================================
+// Main loop of the compilation
+//===========================================================================================================
+
+node('master') {
+	// Globals
+	BuildDir  = pwd tmp: true
+	SrcDir    = pwd tmp: false
+	Settings  = null
+	Tools = load "Jenkins/tools.groovy"
+
+	// Local variables
+	def err = null
+	def log_needed = false
+
+	currentBuild.result = "SUCCESS"
+
+	try {
+		//Wrap build to add timestamp to command line
+		wrap([$class: 'TimestamperBuildWrapper']) {
+
+			(build_no, ref) = prepare_build()
+
+			node('x64') {
+				BuildDir  = pwd tmp: true
+				SrcDir    = pwd tmp: false
+
+				clean()
+
+				// checkout()
+			}
+
+			// Update the build directories when exiting the node
+			BuildDir  = pwd tmp: true
+			SrcDir    = pwd tmp: false
+		}
+	}
+
+	//If an exception is caught we need to change the status and remember to
+	//attach the build log to the email
+	catch (Exception caughtError) {
+		// //rethrow error later
+		// err = caughtError
+
+		// echo err.toString()
+
+		// //An error has occured, the build log is relevent
+		// log_needed = true
+
+		// //Store the result of the build log
+		// currentBuild.result = "${StageName} FAILURE".trim()
+	}
+
+	finally {
+		// //Send email with final results if this is not a full build
+		// email(log_needed)
+
+		// echo 'Distribution Completed'
+
+		// /* Must re-throw exception to propagate error */
+		// if (err) {
+		// 	throw err
+		// }
+	}
+}
+
+//===========================================================================================================
+// Main compilation routines
+//===========================================================================================================
+def clean() {
+	build_stage('Cleanup', true) {
+		// clean the build by wipping the build directory
+		dir(BuildDir) {
+			deleteDir()
+		}
+	}
+}
+
+//Compilation script is done here but environnement set-up and error handling is done in main loop
+// def checkout() {
+// 	build_stage('Checkout', true) {
+// 		//checkout the source code and clean the repo
+// 		final scmVars = checkout scm
+// 		Settings.GitNewRef = scmVars.GIT_COMMIT
+// 		Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT
+
+// 		echo GitLogMessage()
+// 	}
+// }
+
+//===========================================================================================================
+// Helper classes/variables/routines
+//===========================================================================================================
+def prepare_build() {
+	// prepare the properties
+	properties ([ 													\
+		buildDiscarder(logRotator(										\
+			artifactDaysToKeepStr: '',									\
+			artifactNumToKeepStr: '',									\
+			daysToKeepStr: '730',										\
+			numToKeepStr: '1000'										\
+		)),														\
+		[$class: 'ParametersDefinitionProperty', 								\
+			parameterDefinitions: [ 									\
+				[$class: 'IntergerParameterDefinition',						\
+					description: 'The build number to put in the version',		\
+					name: 'Build',									\
+				],												\
+			],
+		]])
+
+	currentBuild.description = "Distributing Binaries"
+	echo "Distributing build ${params.Build}"
+
+	return params.Build
+
Index: Jenkins/tools.groovy
===================================================================
--- Jenkins/tools.groovy	(revision 91aa5abceb6e76ba04053c577ff0f443669ec410)
+++ Jenkins/tools.groovy	(revision 4011b985be2d258647c84ecba0bc5dcceb410d26)
@@ -20,3 +20,15 @@
 }
 
+//===========================================================================================================
+// Common compilation routines
+//===========================================================================================================
+def clean() {
+	Tools.BuildStage('Cleanup', true) {
+		// clean the build by wipping the build directory
+		dir(BuildDir) {
+			deleteDir()
+		}
+	}
+}
+
 return this;
