firmware_tools/install/installhelper.groovy
2018-11-16 14:04:56 +00:00

42 lines
No EOL
2.5 KiB
Groovy

// Given details about artifacts to import and details of installers to build, import artifacts that are required
def artifactsImporter(artifactDetails, installerDetails) {
artifactFetched = [:]
for (installer in toBuild) {
def artifactKey = installerDetails.get(installer)[0]
//echo "To build: ${installer} use artifactKey: ${artifactKey}"
(sourceProject, destFolder, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey)
env.importDest = destFolder
if (artifactFetched.get(artifactKey) == null) {
//echo "Artifact info: ${artifactInfo}"
copyArtifacts excludes: notToCopy, filter: toCopy, fingerprintArtifacts: true, projectName: "${sourceProject}", selector: lastSuccessful(), target: "${destFolder}"
def componentVersionFolder = "${WORKSPACE}\\version\\version_${artifactKey}"
def folderToCopy = "${destFolder}\\version"
echo "Copying from: ${folderToCopy} to: ${componentVersionFolder}"
fileOperations([folderCopyOperation(destinationFolderPath: componentVersionFolder, sourceFolderPath: folderToCopy)])
//fileOperations([fileCopyOperation(excludes: '', flattenFiles: false, includes: filesToCopy, targetLocation: componentVersionFolder )])
def gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
artifactVersion = gh.getSHAFromVersion("${destFolder}/version")
artifactFetched.put(artifactKey, artifactVersion)
}
}
return artifactFetched
}
// Export any required binaries to the <WORKSPACE>/bin folder
def exportBinaries(artifactDetails, installerDetails) {
for (installer in toBuild) {
(artifactSet, targetFolder, executionPath, ISMprojectFile, installerVariant, exportBinaries) = installerDetails.get(installer)
if (exportBinaries) {
(artifactsSourceProject, destinationFolder, artifactsToCopy, artifactsToNotCopy, binariesFolders) = artifactDetails.get(artifactSet)
for (binaryFolder in binariesFolders) {
binariesSourceFolder = "${destinationFolder}/${binaryFolder}"
binariesDestFolder = "${WORKSPACE}/bin/${artifactSet}/${binaryFolder}"
echo "Copying from: ${binariesSourceFolder} to: ${binariesDestFolder}"
fileOperations([folderCopyOperation(destinationFolderPath: binariesDestFolder, sourceFolderPath: binariesSourceFolder)])
}
}
}
}
return this;