Use ahb-km-1024a autobuild scripts as starting point
17
Common_scripts/.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Common Build Scripts</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
8
Common_scripts/.pydevproject
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||
<path>/${PROJECT_DIR_NAME}</path>
|
||||
</pydev_pathproperty>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python35</pydev_property>
|
||||
</pydev_project>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//versionnumbering/versioninfo.py=utf-8
|
||||
22
Common_scripts/artifacts/metaexport.groovy
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
// Take a list of Sub-job descriptors and output folder pairs, copy the artifacts, while filling in a string of artifact folders
|
||||
def combineSubjobArtifacts(meta, importer, subJobs) {
|
||||
def ArrayList<String> artifactFolders = new ArrayList<String>()
|
||||
for (subJob in subJobs) {
|
||||
def subJobObject = subJob[0]
|
||||
if (subJobObject != null) {
|
||||
def subJobName = subJobObject.getProjectName()
|
||||
def subJobNumber = subJobObject.getNumber()
|
||||
def destFolder = subJob[1]
|
||||
def boolean incrementversionnumber = subJob[2]
|
||||
dir(destFolder) {
|
||||
deleteDir()
|
||||
}
|
||||
importer.artifactimport(meta, subJobName, subJobNumber, destFolder, incrementversionnumber)
|
||||
artifactFolders.add("${destFolder}/**")
|
||||
}
|
||||
}
|
||||
return artifactFolders
|
||||
}
|
||||
|
||||
return this;
|
||||
131
Common_scripts/autobuilder.groovy
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
// Assume that WORKSPACE environment variable is set
|
||||
|
||||
autobuildroot = 'autobuild'
|
||||
commonscriptsroot = "${autobuildroot}/Common_scripts"
|
||||
metafolderscript = null
|
||||
|
||||
def conditionalclean(doclean = "${CLEAN_WORKSPACE}" == "true") {
|
||||
if (doclean) {
|
||||
echo "Cleaning workspace"
|
||||
// Save any script files that were loaded into the workspace at first and are required after cleaning the workspace
|
||||
def stashname = 'Clean workspace stash'
|
||||
stash(allowEmpty: true,
|
||||
includes: "${autobuildroot}/**,${autobuildroot}/.git/**",
|
||||
name: stashname,
|
||||
useDefaultExcludes: false
|
||||
)
|
||||
cleanWs()
|
||||
unstash name: stashname
|
||||
}
|
||||
else {
|
||||
echo "Not cleaning workspace"
|
||||
}
|
||||
}
|
||||
|
||||
def commonscripts() {
|
||||
return commonscriptsroot
|
||||
}
|
||||
|
||||
def getautobuildpath() {
|
||||
return autobuildroot
|
||||
}
|
||||
|
||||
def getmetafolderscript() {
|
||||
return metafolderscript
|
||||
}
|
||||
|
||||
def alterreleaserepo(String releaserepo, String releaserepovariantsuffix) {
|
||||
def String altered = releaserepo.trim()
|
||||
|
||||
if (releaserepovariantsuffix?.trim()) {
|
||||
altered = altered.replace("-RELEASE_REPO_VARIANT_SUFFIX-", releaserepovariantsuffix)
|
||||
}
|
||||
return altered
|
||||
}
|
||||
|
||||
// Start up boilerplate
|
||||
def startbuild(
|
||||
script,
|
||||
String productname = PRODUCT_NAME,
|
||||
String subcomponentname = SUBCOMPONENT_NAME,
|
||||
String releaserepo = RELEASE_REPO,
|
||||
String productvariant = '',
|
||||
String autobuildpath = autobuildroot,
|
||||
String commonscriptspath = commonscriptsroot
|
||||
) {
|
||||
echo "Starting...."
|
||||
|
||||
autobuildroot = autobuildpath
|
||||
commonscriptsroot = commonscriptspath
|
||||
metafolderscript = load("${commonscripts()}/meta/folder.groovy")
|
||||
|
||||
conditionalclean()
|
||||
|
||||
def meta = getmetafolderscript().metareset(script)
|
||||
echo "Product name: ${productname} Subcomponent name: ${subcomponentname}"
|
||||
meta.productinfo.set(productname, subcomponentname, productvariant)
|
||||
def now = new Date()
|
||||
now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC'))
|
||||
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
|
||||
|
||||
def rr = load("${commonscripts()}/release/registerrepo.groovy")
|
||||
def String alteredreleaserepo = alterreleaserepo(releaserepo, productvariant)
|
||||
|
||||
echo "Release repo: ${alteredreleaserepo}"
|
||||
rr.registerrepo(meta, alteredreleaserepo)
|
||||
|
||||
def ch = load("${commonscripts()}/configuration/configuration.groovy")
|
||||
ch.registerPipelineScriptConfiguration(meta)
|
||||
|
||||
return meta
|
||||
}
|
||||
|
||||
// DEPRECATED Metod, Use StartBuild Instead.
|
||||
def start(
|
||||
script,
|
||||
String productname = PRODUCT_NAME,
|
||||
String subcomponentname = SUBCOMPONENT_NAME,
|
||||
String jirakey = JIRA_KEY,
|
||||
String releaserepo = RELEASE_REPO,
|
||||
String repoRootSuffix = "",
|
||||
String autobuildpath = autobuildroot,
|
||||
String commonscriptspath = commonscriptsroot
|
||||
) {
|
||||
echo "DEPRECATED method: start(script, String productname = PRODUCT_NAME, subcomponentname = SUBCOMPONENT_NAME, jirakey = JIRA_KEY, ...)"
|
||||
return startbuild(script, productname, subcomponentname, releaserepo, autobuildpath, commonscriptspath)
|
||||
}
|
||||
|
||||
// Start up boilderplate
|
||||
def startnonbuild(
|
||||
script,
|
||||
autobuildpath = autobuildroot,
|
||||
commonscriptspath = commonscriptsroot
|
||||
) {
|
||||
echo "Starting non-build job...."
|
||||
|
||||
autobuildroot = autobuildpath
|
||||
commonscriptsroot = commonscriptspath
|
||||
metafolderscript = load("${commonscripts()}/meta/folder.groovy")
|
||||
|
||||
conditionalclean()
|
||||
|
||||
def meta = getmetafolderscript().metareset(script)
|
||||
meta.productinfo.set("Non-build-product", "Non-build-subcomponent")
|
||||
def now = new Date()
|
||||
now.format("yyMMdd.HHmm", TimeZone.getTimeZone('UTC'))
|
||||
meta.jenkinsbuildinfo.set(JOB_NAME, BUILD_ID.toInteger(), NODE_NAME, now.toString())
|
||||
|
||||
def ch = load("${commonscripts()}/configuration/configuration.groovy")
|
||||
ch.registerPipelineScriptConfiguration(meta)
|
||||
|
||||
return meta
|
||||
}
|
||||
|
||||
def configurationhelper() {
|
||||
return load("${commonscripts()}/configuration/configuration.groovy")
|
||||
}
|
||||
|
||||
// Everyone wants to know this
|
||||
autobuilder = this
|
||||
|
||||
return this;
|
||||
86
Common_scripts/check/build_meta.groovy
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
"${WORKSPACE}/build_artifacts",
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Get build artifact meta') {
|
||||
steps {
|
||||
script {
|
||||
BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts"
|
||||
copyArtifacts(
|
||||
projectName: BUILD_JOB,
|
||||
selector: [
|
||||
$class: 'ParameterizedBuildSelector',
|
||||
parameterName: BUILD_JOB_SELECTOR
|
||||
],
|
||||
target: BUILD_ARTIFACTS
|
||||
)
|
||||
def mfs = autobuilderscript.getmetafolderscript()
|
||||
buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Check components') {
|
||||
steps {
|
||||
script {
|
||||
def checker = load("${autobuilder.commonscripts()}/check/do_meta.groovy")
|
||||
(summarystring, markunstable, unstablereason) = checker.checkhierarchy(buildmeta, MAX_META_DEPTH, BUILD_ARTIFACTS)
|
||||
if (markunstable) {
|
||||
env.unstablereason = unstablereason
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts()
|
||||
archiveArtifacts "summary/**,${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Summarise') {
|
||||
steps {
|
||||
script {
|
||||
echo "Summary:\n${summarystring}\n"
|
||||
if (env.unstablereason) {
|
||||
echo "Instability reason: ${env.unstablereason}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
77
Common_scripts/check/do_meta.groovy
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
markunstable = false
|
||||
unstablereason = ""
|
||||
|
||||
summaryfolder = "${WORKSPACE}/summary"
|
||||
summaryfile = "${summaryfolder}/summary.txt"
|
||||
summarystring = ""
|
||||
releaserepofolder = "${WORKSPACE}/releaserepos"
|
||||
sourcerepofolder = "${WORKSPACE}/sourcerepos"
|
||||
tempfolder = "${WORKSPACE}/temp"
|
||||
gitrevparseoutputfile = "${tempfolder}/gitrevparse.out"
|
||||
|
||||
metascript = autobuilder.getmetafolderscript()
|
||||
|
||||
def resetfolders() {
|
||||
dir(summaryfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(releaserepofolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(tempfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
def preconditions() {
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
summarystring = ""
|
||||
writeFile(file: summaryfile, text: "Release summary: \n")
|
||||
}
|
||||
|
||||
def setunstable(String reason) {
|
||||
markunstable = true
|
||||
unstablereason += reason + "\n"
|
||||
echo "Marked build as unstable: Reason: ${reason}"
|
||||
}
|
||||
|
||||
def summaryappend(String summary) {
|
||||
def String currentsummarycontents = readFile(file: summaryfile)
|
||||
writeFile(file: summaryfile, text: currentsummarycontents + summary)
|
||||
summarystring += summary
|
||||
}
|
||||
|
||||
def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) {
|
||||
int md = maxdepth.toInteger()
|
||||
resetfolders()
|
||||
preconditions()
|
||||
|
||||
// Walk the meta information to a max depth
|
||||
def buildinfo = buildmeta.releasewalker(md)
|
||||
echo "All components:"
|
||||
def String componentinfo = ""
|
||||
for (entry in buildinfo) {
|
||||
def name = entry.meta.componentversionuniqueidentifier()
|
||||
def offsetpath = entry.offsetpath
|
||||
def abspath = "${buildpathroot}/${offsetpath}"
|
||||
componentinfo += "Name: ${name} \t\t\t\tPath: ${offsetpath} \t\t\t\tFile exists in import: ${fileExists(abspath)}\n"
|
||||
}
|
||||
echo componentinfo
|
||||
|
||||
// Walk the meta information to a max depth
|
||||
def componentReleaseInfo = buildmeta.releasewalkerunique(md)
|
||||
echo "Unique components:"
|
||||
def String versioncomponent = ""
|
||||
for (key in componentReleaseInfo.keySet()) {
|
||||
def buildinfo2 = componentReleaseInfo[key]
|
||||
def offsetpath = buildinfo2.offsetpath
|
||||
def abspath = "${buildpathroot}/${offsetpath}"
|
||||
versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n"
|
||||
}
|
||||
echo versioncomponent
|
||||
|
||||
return [summarystring, markunstable, unstablereason]
|
||||
}
|
||||
|
||||
return this;
|
||||
15
Common_scripts/checksum/utils.groovy
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
// Generate a checksum file of from a list of files/directories relative to workspace
|
||||
def generatelist(meta, checksummable) {
|
||||
for (filepath in checksummable) {
|
||||
def checksumset = meta.checksuminfo.addChecksumSet(filepath)
|
||||
def files = findFiles(glob: filepath)
|
||||
for (file in files) {
|
||||
echo "Checksumming: ${file.path}"
|
||||
def sum = sha1(file: file.path).trim()
|
||||
checksumset.addChecksumPair(file.path, sum)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
10
Common_scripts/clean/clean.groovy
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
def clean(folderlist) {
|
||||
for (folder in folderlist) {
|
||||
dir(folder) {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
12
Common_scripts/commandline/commandline.groovy
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
String getCommandOutput(String cmd) {
|
||||
if (isUnix()) {
|
||||
return sh(returnStdout: true, script: '#!/bin/sh -e\n' + cmd).trim()
|
||||
} else {
|
||||
return powershell(returnStdout: true, script: """
|
||||
${cmd}
|
||||
"""
|
||||
).trim()
|
||||
}
|
||||
}
|
||||
|
||||
return this
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
// Disable parallel make builds - which may be causing autobuild issues
|
||||
def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
# Looks for "<builder*parallelBuildOn="true"* in all .cproject files and replaces the "true" with "false"
|
||||
find "${rootSearchFolder}" -iname ".cproject" | xargs -iXX sed -i "s@\\(<builder.*parallelBuildOn=\\"\\)true\\(\\"\\)@\\1false\\2@g" XX
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
172
Common_scripts/compile/eclipsebuild/eclipseSTM8build.groovy
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
def doDisplayLeftovers() {
|
||||
}
|
||||
|
||||
def doKillLeftovers() {
|
||||
}
|
||||
|
||||
def doCheck(checkpathlist, build_variant = "") {
|
||||
def result = 0
|
||||
for (checkpath in checkpathlist) {
|
||||
echo "Checking file at: ${checkpath}"
|
||||
script {
|
||||
echo "Build variant is ${build_variant}"
|
||||
if (build_variant) {
|
||||
def srcFile = "${WORKSPACE}\${checkpath}"
|
||||
def srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
// Print out dependencies of the built file
|
||||
echo "Showing dependencies of ${srcFileExpanded}"
|
||||
if (srcFileExpanded.endsWith(".elf")) {
|
||||
result = bat ( script: """
|
||||
${CYGWINDIR}/bin/readelf -hS ${srcFileExpanded}
|
||||
if errorlevel 1 EXIT /b 1
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
}
|
||||
if (result != 0) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") {
|
||||
def result = 0
|
||||
def destFolder = ""
|
||||
def srcFile = ""
|
||||
def srcFileExpanded = ""
|
||||
for (exportpath in exportpathlist) {
|
||||
echo "Export path at: ${exportpath}"
|
||||
script {
|
||||
if (build_variant) {
|
||||
echo "Build variant is ${build_variant}"
|
||||
srcFile = "${WORKSPACE}\\${exportpath}"
|
||||
srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
}
|
||||
else {
|
||||
echo "No build variant"
|
||||
srcFileExpanded = "${WORKSPACE}\\${exportpath}"
|
||||
}
|
||||
destFolder = "${exportfolder}"
|
||||
if (partdest) {
|
||||
destFolder += "\\" + partdest
|
||||
}
|
||||
}
|
||||
def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
dir (destFolderExpanded) {
|
||||
echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\""
|
||||
result = bat( script: """
|
||||
copy "${srcFileExpanded}" "${destFolderExpanded}"
|
||||
if errorlevel 1 EXIT /b 1
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
if (result != 0) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Import all eclipse projects in a given folder
|
||||
def doImportProjects(ds5folder, ds5shellcommand, buildcommand, sourcefolder) {
|
||||
bat """
|
||||
"${ds5shellcommand}" ${buildcommand} -no-indexer -importAll "${sourcefolder}"
|
||||
"""
|
||||
}
|
||||
|
||||
def doBuildAndExportProject(String ds5folder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) {
|
||||
echo "Doing build and export project: ${project} : ${doexport}"
|
||||
for (build_variant in variants) {
|
||||
retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing)
|
||||
try {
|
||||
if (toBuild.contains(build_variant)) {
|
||||
doDisplayLeftovers()
|
||||
echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build ${project}/${build_variant}\'"
|
||||
timeout(time: 20, unit: 'MINUTES') {
|
||||
bat """
|
||||
"${ds5shellcommand}" ${buildcommand} -no-indexer -build ${project}/${build_variant}
|
||||
"""
|
||||
}
|
||||
result = doCheck(exportpathlist, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to check files...."
|
||||
}
|
||||
echo "Doing export: ${doexport}"
|
||||
if (doexport) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "Not building ${build_variant} variant of project: ${project}"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while"
|
||||
sleep(time: 4, unit: 'SECONDS')
|
||||
error "Build failed..."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) {
|
||||
echo "Doing export only project: ${project} : ${doexport}"
|
||||
if (doexport) {
|
||||
if (!variants) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
} else {
|
||||
for (build_variant in variants) {
|
||||
if (toBuild.contains(build_variant)) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build and export files
|
||||
def doBuild(apps, ds5folder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}") {
|
||||
toBuild = []
|
||||
if (variantstobuild) {
|
||||
toBuildUntrimmed = variantstobuild.split(',')
|
||||
toBuildUntrimmed.each {
|
||||
toBuild.add(it.trim())
|
||||
}
|
||||
}
|
||||
// The lock is being used because it was being found that the doKillLeftovers was affecting other builds
|
||||
lock(resource: "eclipsebuild_${env.NODE_NAME}") {
|
||||
try {
|
||||
timeout(time: 5, unit: 'MINUTES') {
|
||||
doImportProjects(ds5folder, ds5shellcommand, buildcommand, sourcefolder)
|
||||
}
|
||||
for (appInfo in apps) {
|
||||
def Boolean build
|
||||
def Boolean doexport
|
||||
(build, doexport, project, variants, exportpathlist, destpart) = appInfo
|
||||
if (build) {
|
||||
doBuildAndExportProject(ds5folder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
else {
|
||||
doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// doKillLeftovers()
|
||||
error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
252
Common_scripts/compile/eclipsebuild/eclipseds5build.groovy
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
def doDisplayLeftovers() {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
# Killing any processes that may interfere with the next build
|
||||
# The build system must be setup to do more than one eclipse build concurrently
|
||||
# Don't return an error if the processes don't exist
|
||||
USER=`whoami`
|
||||
ps aux | grep "eclipse"
|
||||
ps aux | grep "make"
|
||||
ps aux | grep "arm-linux"
|
||||
# ps aux | grep "sh"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def doKillLeftovers() {
|
||||
if (isUnix()) {
|
||||
doDisplayLeftovers()
|
||||
sh """
|
||||
# Killing any processes that may interfere with the next build
|
||||
# The build system must be setup to do more than one eclipse build concurrently
|
||||
# Don't return an error if the processes don't exist
|
||||
USER=`whoami`
|
||||
pkill -U "${USER}" -9 eclipse || true
|
||||
pkill -U "${USER}" -9 make || true
|
||||
pkill -U "${USER}" -9 ".*arm-linux.*" || true
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def doCheck(checkpathlist, build_variant = "") {
|
||||
def result = 0
|
||||
for (checkpath in checkpathlist) {
|
||||
echo "Checking file at: ${checkpath}"
|
||||
script {
|
||||
echo "Build variant is ${build_variant}"
|
||||
if (build_variant) {
|
||||
def srcFile = "${WORKSPACE}/${checkpath}"
|
||||
def srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
// Print out dependencies of the built file
|
||||
echo "Showing dependencies of ${srcFileExpanded}"
|
||||
result = sh( script: """
|
||||
readelf -d "${srcFileExpanded}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
if (result != 0) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") {
|
||||
def result = 0
|
||||
def destFolder = ""
|
||||
def srcFile = ""
|
||||
def srcFileExpanded = ""
|
||||
for (exportpath in exportpathlist) {
|
||||
echo "Export path at: ${exportpath}"
|
||||
script {
|
||||
if (build_variant) {
|
||||
echo "Build variant is ${build_variant}"
|
||||
srcFile = "${WORKSPACE}/${exportpath}"
|
||||
srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
}
|
||||
else {
|
||||
echo "No build variant"
|
||||
srcFileExpanded = "${WORKSPACE}/${exportpath}"
|
||||
}
|
||||
destFolder = "${exportfolder}"
|
||||
if (partdest) {
|
||||
destFolder += "/" + partdest
|
||||
}
|
||||
}
|
||||
def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}")
|
||||
dir (destFolderExpanded) {
|
||||
echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\""
|
||||
if (isUnix()) {
|
||||
result = sh( script: """
|
||||
cp -v --no-dereference --preserve=links -r "${srcFileExpanded}" "${destFolderExpanded}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
if (result != 0) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = bat( script: """
|
||||
copy "${srcFileExpanded}" "${destFolderExpanded}"
|
||||
if errorlevel 1 EXIT /b 1
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
if (result != 0) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Register toolchain
|
||||
def doRegisterToolchain(ds5folder, toolchainfolder) {
|
||||
// Register toolchain (if it is not already)
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
"${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}"
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"%ds5folder%\\bin\\add_toolchain" --non-interactive "%toolchainfolder%"
|
||||
"""
|
||||
}
|
||||
echo "Path is: ${PATH}"
|
||||
}
|
||||
|
||||
// Add toolchain to path
|
||||
def addToolchainPath(toolchainfolder) {
|
||||
// Register toolchain (if it is not already)
|
||||
if (isUnix()) {
|
||||
env.PATH = toolchainfolder + ":" + env.PATH
|
||||
}
|
||||
else {
|
||||
env.PATH = toolchainfolder + ";" + env.PATH
|
||||
}
|
||||
echo "Path is: ${PATH}"
|
||||
}
|
||||
|
||||
// Import all eclipse projects in a given folder
|
||||
def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) {
|
||||
doRegisterToolchain(ds5folder, toolchainfolder)
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
${ds5shellcommand} \'${buildcommand} -no-indexer -importAll "${sourcefolder}"\'
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat '%ds5shellcommand% %buildcommand% -no-indexer -importAll "%sourcefolder%"'
|
||||
}
|
||||
}
|
||||
|
||||
def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) {
|
||||
echo "Doing build and export project: ${project} : ${doexport}"
|
||||
for (build_variant in variants) {
|
||||
retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing)
|
||||
try {
|
||||
if (toBuild.contains(build_variant)) {
|
||||
doDisplayLeftovers()
|
||||
doRegisterToolchain(ds5folder, toolchainfolder)
|
||||
echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'"
|
||||
timeout(time: 20, unit: 'MINUTES') {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
echo Start time: `date`
|
||||
${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'
|
||||
echo End time: `date`
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
"%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
result = doCheck(exportpathlist, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to check files...."
|
||||
}
|
||||
echo "Doing export: ${doexport}"
|
||||
if (doexport) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo "Not building ${build_variant} variant of project: ${project}"
|
||||
}
|
||||
} catch (Exception e) {
|
||||
echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while"
|
||||
sleep(time: 4, unit: 'SECONDS')
|
||||
error "Build failed..."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) {
|
||||
echo "Doing export only project: ${project} : ${doexport}"
|
||||
if (doexport) {
|
||||
if (!variants) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
} else {
|
||||
for (build_variant in variants) {
|
||||
if (toBuild.contains(build_variant)) {
|
||||
result = doExport(exportfolder, exportpathlist, destpart, build_variant)
|
||||
if (result != 0) {
|
||||
error "Failed to copy...."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build and export files
|
||||
def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") {
|
||||
toBuild = []
|
||||
if (variantstobuild) {
|
||||
toBuildUntrimmed = variantstobuild.split(',')
|
||||
toBuildUntrimmed.each {
|
||||
toBuild.add(it.trim())
|
||||
}
|
||||
}
|
||||
// The lock is being used because it was being found that the doKillLeftovers was affecting other builds
|
||||
lock(resource: "eclipsebuild_${env.NODE_NAME}") {
|
||||
try {
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
addToolchainPath(toolchainfolder)
|
||||
doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder)
|
||||
}
|
||||
for (appInfo in apps) {
|
||||
def Boolean build
|
||||
def Boolean doexport
|
||||
(build, doexport, project, variants, exportpathlist, destpart) = appInfo
|
||||
if (build) {
|
||||
doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
else {
|
||||
doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart)
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// doKillLeftovers()
|
||||
error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
116
Common_scripts/compile/eclipsebuild/eclipseniosbuild.groovy
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
// Gets the debug and optimization flags.
|
||||
// Arg1 is "app" or "lib". Returns flags.
|
||||
// Restore the debug and optimization levels, in case this is a dev machine.
|
||||
// Arg1 is "app" or "lib". Arg2-3 is flags from getFlags. Returns nothing.
|
||||
def setFlagsToRelease(NIOSEDS, project, wdir) {
|
||||
if ( project == "app" ) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -x
|
||||
cd "${wdir}"
|
||||
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-app-update-makefile --app-dir=. --set-optimization=-O2 --set-debug-level=
|
||||
"""
|
||||
}
|
||||
}
|
||||
else if ( project == "lib" ) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -x
|
||||
cd "${wdir}"
|
||||
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-lib-update-makefile --lib-dir=. --set-optimization=-O2 --set-debug-level=
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def remake_and_check(NIOSEDS, wdir) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -x
|
||||
cd "${wdir}"
|
||||
|
||||
# Use the makefile to clean and build
|
||||
"${NIOSEDS}/nios2_command_shell.sh" make clean
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Set the debug and optimization levels to production values
|
||||
"${NIOSEDS}/nios2_command_shell.sh" make -j12 all
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def generate_bsp(NIOSEDS, bspfolder) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -x
|
||||
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-bsp-generate-files --bsp-dir "${bspfolder}" --log "${bspfolder}/bsp.log" --settings "${bspfolder}/settings.bsp"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def modifylib(NIOSEDS, bspfolder, buildconfig, wdir) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -x
|
||||
|
||||
cd "${wdir}"
|
||||
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-lib-update-makefile --lib-dir=. --set-bsp-dir "${bspfolder}" --set-active-build-config "${buildconfig}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def modifyapp(NIOSEDS, bspfolder, wdir) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -x
|
||||
|
||||
cd "${wdir}"
|
||||
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-app-update-makefile --app-dir=. --set-bsp-dir "${bspfolder}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
def dump_elf_info(NIOSEDS, elffile, meta, custominfokeyprefix) {
|
||||
if (isUnix()) {
|
||||
def cpu_name = sh(script: """#!/bin/bash
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --cpu_name
|
||||
""",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
meta.addCustomInfo("${custominfokeyprefix}_cpu_name", cpu_name)
|
||||
def sidp = sh(script: """#!/bin/bash
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sidp
|
||||
""",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
meta.addCustomInfo("${custominfokeyprefix}_sidp", sidp)
|
||||
def id = sh(script: """#!/bin/bash
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --id
|
||||
""",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
meta.addCustomInfo("${custominfokeyprefix}_id", id)
|
||||
def timestamp = sh(script: """#!/bin/bash
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --timestamp
|
||||
""",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
meta.addCustomInfo("${custominfokeyprefix}_timestamp", timestamp)
|
||||
/*
|
||||
def sopcinfo = sh(script: """#!/bin/bash
|
||||
"${NIOSEDS}/nios2_command_shell.sh" nios2-elf-query "${elffile}" --sopcinfo
|
||||
""",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
meta.addCustomInfo("${custominfokeyprefix}_sopcinfo", sopcinfo)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
18
Common_scripts/configuration/configuration.groovy
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
def registerConfigurationInfo(meta, String configurationName, String configurationURL, String configurationVersion, String configurationSHA) {
|
||||
meta.addConfigurationInfo(configurationName, configurationURL, configurationVersion, configurationSHA)
|
||||
}
|
||||
|
||||
def registerPipelineScriptConfiguration(meta) {
|
||||
registerConfigurationInfo(meta, 'pipeline script', '-', '-', gh.getGitInfo(autobuilder.getautobuildpath()))
|
||||
}
|
||||
|
||||
def gitCheckoutAndRegister(meta, String tool, String gitURL, String revision, String targetDir, String repoRoot = "", int cloneDepth = 1, boolean shallowClone = true, String filter = '') {
|
||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(filter)
|
||||
gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone)
|
||||
|
||||
registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir))
|
||||
}
|
||||
|
||||
return this
|
||||
86
Common_scripts/copy/all.groovy
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
IMPORTS = 'imports'
|
||||
cleanfolders = [
|
||||
IMPORTS,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Import source artifacts') {
|
||||
steps {
|
||||
script {
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
def copyoptions = importer.getNewImportOptions()
|
||||
copyoptions.source(
|
||||
SOURCE_ARTIFACT_LOCATION,
|
||||
SOURCE_ARTIFACT_BUILD_JOB,
|
||||
SOURCE_ARTIFACT_BUILD_SELECTOR,
|
||||
SOURCE_ARTIFACT_RELEASE_REPO,
|
||||
SOURCE_ARTIFACT_RELEASE_REVISION)
|
||||
echo "Nested: ${NESTED_COPY}"
|
||||
copyoptions.setnested(NESTED_COPY == 'true')
|
||||
importer.artifactimport(meta, copyoptions, IMPORTS)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copy source artifacts') {
|
||||
steps {
|
||||
script {
|
||||
dir(IMPORTS) {
|
||||
fileOperations([
|
||||
fileCopyOperation(excludes: '',
|
||||
flattenFiles: false,
|
||||
includes: '**/*',
|
||||
targetLocation: WORKSPACE)
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def includes = '**/*'
|
||||
def excludes = "${IMPORTS}/*"
|
||||
echo "Archiving artifacts: Includes: ${includes} Excludes: ${excludes}"
|
||||
// This does not work: archiveArtifacts artifacts: includes, excludes: excludes
|
||||
// so
|
||||
cleanfolders = [
|
||||
IMPORTS,
|
||||
'autobuild',
|
||||
]
|
||||
cleaner.clean(cleanfolders)
|
||||
archiveArtifacts artifacts: includes
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Common_scripts/copy/esw.groovy
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
env.ESW = 'esw'
|
||||
env.ESWDEST = "${WORKSPACE}/${ESW}"
|
||||
env.ESWEXPORT = 'embedded_software'
|
||||
cleanfolders = [
|
||||
ESWDEST,
|
||||
ESWEXPORT,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying embedded software artifacts') {
|
||||
steps {
|
||||
script {
|
||||
importer.artifactimport(meta, ESW_ARTIFACT_LOCATION, ESW_ARTIFACT_BUILD_JOB, ESW_ARTIFACT_BUILD_SELECTOR, ESW_ARTIFACT_RELEASE_REPO, ESW_ARTIFACT_RELEASE_REVISION, ESWDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["${ESWEXPORT}/**"])
|
||||
sh """
|
||||
rm -v -rf diff
|
||||
rm -v -rf meta
|
||||
mv -v "${ESW}"/* .
|
||||
"""
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Common_scripts/copy/filtered.groovy
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
pipeline {
|
||||
agent { label AGENT_LABEL }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean') {
|
||||
steps {
|
||||
script {
|
||||
env.IMPORT = "${WORKSPACE}/import"
|
||||
env.FILTEREDDEST = "${WORKSPACE}/filtered"
|
||||
cleanfolders = [
|
||||
FILTEREDDEST,
|
||||
IMPORT,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Import artifacts') {
|
||||
steps {
|
||||
script {
|
||||
importer.artifactimport(meta, ARTIFACT_LOCATION, ARTIFACT_PROJECT, ARTIFACT_BUILD_SELECTOR, RELEASE_REPO, RELEASE_REVISION, IMPORT)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Filtered copy') {
|
||||
steps {
|
||||
script {
|
||||
dir(IMPORT) {
|
||||
fileOperations([
|
||||
fileCopyOperation(excludes: EXCLUDES,
|
||||
flattenFiles: FLATTENOUTPUT,
|
||||
includes: INCLUDES,
|
||||
targetLocation: FILTEREDDEST)])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["filtered/**"])
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
64
Common_scripts/copy/logic.groovy
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
env.LOGICDEST = "${WORKSPACE}/logic"
|
||||
cleanfolders = [
|
||||
LOGICDEST,
|
||||
"${WORKSPACE}/embedded_logic",
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying logic artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def logicoptions = importer.getNewImportOptions()
|
||||
logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION)
|
||||
importer.artifactimport(meta, logicoptions, LOGICDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["embedded_logic/**"])
|
||||
sh """
|
||||
rm -v -rf meta
|
||||
# The following is removing a deprecated folder
|
||||
rm -v -rf diff
|
||||
mv -v "logic"/* .
|
||||
"""
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Common_scripts/differences/.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Release_difference</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
8
Common_scripts/differences/.pydevproject
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||
<path>/${PROJECT_DIR_NAME}</path>
|
||||
</pydev_pathproperty>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.0</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||
</pydev_project>
|
||||
836
Common_scripts/differences/dometahierarchy.groovy
Normal file
|
|
@ -0,0 +1,836 @@
|
|||
import groovy.json.JsonSlurper
|
||||
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
|
||||
summaryfolder = "${WORKSPACE}/summary"
|
||||
summaryfile = "${summaryfolder}/summary.txt"
|
||||
summarystring = ""
|
||||
|
||||
sourcerepofolder = "${WORKSPACE}/sourcerepos"
|
||||
tempfolder = "${WORKSPACE}/temp"
|
||||
|
||||
reportfolder = "${WORKSPACE}/reports"
|
||||
|
||||
class JiraTicketInfo {
|
||||
String jiranumber
|
||||
String uri
|
||||
|
||||
JiraTicketInfo() {
|
||||
jiranumber = ''
|
||||
uri = ''
|
||||
}
|
||||
|
||||
def String dump() {
|
||||
return "jiranumber: ${jiranumber} uri: ${uri}"
|
||||
}
|
||||
}
|
||||
|
||||
class DifferenceRecord {
|
||||
String productname
|
||||
String subcomponentname
|
||||
|
||||
String rawdifferencetext
|
||||
String sha
|
||||
String type
|
||||
String mergeinfo
|
||||
String squashinfo
|
||||
List<JiraTicketInfo> jiraticketinfo
|
||||
String comment
|
||||
|
||||
DifferenceRecord() {
|
||||
productname = ""
|
||||
subcomponentname = ""
|
||||
|
||||
rawdifferencetext = ""
|
||||
sha = ""
|
||||
type = ""
|
||||
mergeinfo = ""
|
||||
squashinfo = ""
|
||||
jiraticketinfo = []
|
||||
comment = ""
|
||||
}
|
||||
|
||||
def String dump() {
|
||||
String jiraticketstring = ''
|
||||
for (j in jiraticketinfo) {
|
||||
jiraticketstring += j.dump() + " "
|
||||
}
|
||||
return "Difference Record:\nproductname: ${productname}\nsubcomponentname: ${subcomponentname}\nrawdifferencetext: ${rawdifferencetext}\nsha: ${sha}\ntype: ${type}\nmergeinfo: ${mergeinfo}\njiraticketinfo: ${jiraticketstring}\ncomment: ${comment}"
|
||||
}
|
||||
}
|
||||
|
||||
def resetfolders() {
|
||||
dir(summaryfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(tempfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(reportfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
def preconditions() {
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
summarystring = ""
|
||||
writeFile(file: summaryfile, text: "Release summary: \n")
|
||||
}
|
||||
|
||||
def setunstable(String reason) {
|
||||
markunstable = true
|
||||
unstablereason += reason + "\n"
|
||||
echo "Marked build as unstable: Reason: ${reason}"
|
||||
}
|
||||
|
||||
def summaryappend(String summary) {
|
||||
def String currentsummarycontents = readFile(file: summaryfile)
|
||||
writeFile(file: summaryfile, text: currentsummarycontents + summary)
|
||||
summarystring += summary
|
||||
}
|
||||
|
||||
def showmetaitems(metaitems) {
|
||||
String info = ''
|
||||
for (key in metaitems.keySet()) {
|
||||
def relatedmetainfo = metaitems[key]
|
||||
def offsetpath = relatedmetainfo.offsetpath
|
||||
info += "Name: ${key}\t\t\t\tPath: ${offsetpath}\n"
|
||||
}
|
||||
echo info
|
||||
}
|
||||
|
||||
def boolean checkoutsourcerepo(buildmeta, String checkoutfolder) {
|
||||
boolean checkedout = false
|
||||
def String sourcerepo = buildmeta.gitinfo.remoteurl
|
||||
if (sourcerepo?.trim()) {
|
||||
echo "Updating source repo: ${sourcerepo} in folder: ${checkoutfolder}"
|
||||
if (sourcerepo) {
|
||||
// Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component
|
||||
if (fileExists(checkoutfolder)) {
|
||||
dir(checkoutfolder) {
|
||||
sh("""
|
||||
git reset --hard
|
||||
git clean -fdx
|
||||
git pull
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
else {
|
||||
dir(sourcerepofolder) {
|
||||
sh("git clone ${sourcerepo} ${checkoutfolder}")
|
||||
}
|
||||
}
|
||||
}
|
||||
checkedout = true
|
||||
}
|
||||
return checkedout
|
||||
}
|
||||
|
||||
def String getcomponent(meta) {
|
||||
def String uniquefolder = "${meta.productinfo.productname}_${meta.productinfo.subcomponentname}"
|
||||
def String uniquefoldertemp = "${tempfolder}/${uniquefolder}"
|
||||
def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}"
|
||||
|
||||
boolean checkedout = checkoutsourcerepo(meta, uniquefolderforsourcerepo)
|
||||
|
||||
return [checkedout, uniquefolderforsourcerepo]
|
||||
}
|
||||
|
||||
def getgitlogdifferences(String gitrootfolder, String earlyrevision, String laterrevision, boolean tripledot = false) {
|
||||
def String releaseexpression
|
||||
if (tripledot) {
|
||||
releaseexpression = earlyrevision + "..." + laterrevision
|
||||
} else {
|
||||
releaseexpression = earlyrevision + ".." + laterrevision
|
||||
}
|
||||
def String differencetext
|
||||
dir(gitrootfolder) {
|
||||
differencetext = sh(returnStdout: true, script: "git --no-pager log --oneline ${releaseexpression}").trim()
|
||||
}
|
||||
return differencetext
|
||||
}
|
||||
|
||||
def extractsha(String line) {
|
||||
def pattern = ~"^(\\p{XDigit}*) (.*)"
|
||||
def match = (line =~ pattern)
|
||||
match.find()
|
||||
|
||||
def sha = match.group(1)
|
||||
def restofline = match.group(2)
|
||||
|
||||
//echo "Sha filtering: line: ${line} sha: ${sha} therest: ${restofline}"
|
||||
|
||||
return [sha.trim(), restofline.trim()]
|
||||
}
|
||||
|
||||
def extractsquashes(String line) {
|
||||
def pattern1 = "^(.*)(Squashed .*)"
|
||||
def match1 = (line =~ pattern1)
|
||||
if (match1.find()) {
|
||||
return [true, match1.group(2)]
|
||||
}
|
||||
|
||||
return [false, line]
|
||||
}
|
||||
|
||||
def extractmerges(String line) {
|
||||
def pattern1 = "^(.*)(Merge branch .*)"
|
||||
def match1 = (line =~ pattern1)
|
||||
if (match1.find()) {
|
||||
return [true, match1.group(2)]
|
||||
}
|
||||
|
||||
def pattern2 = "^(.*)(Merge remote-tracking branch .*)"
|
||||
def match2 = (line =~ pattern2)
|
||||
if (match2.find()) {
|
||||
return [true, match2.group(2)]
|
||||
}
|
||||
|
||||
def pattern3 = "^(.*)(Merge commit .*)"
|
||||
def match3 = (line =~ pattern3)
|
||||
if (match3.find()) {
|
||||
return [true, match3.group(2)]
|
||||
}
|
||||
|
||||
def pattern4 = "^(.*)(Add .* from commit .*)"
|
||||
def match4 = (line =~ pattern4)
|
||||
if (match4.find()) {
|
||||
return [true, match4.group(2)]
|
||||
}
|
||||
|
||||
return [false, line]
|
||||
}
|
||||
|
||||
def jiraticketexists(String jiraticket) {
|
||||
def String URI = "${JIRA_URI}/browse/${jiraticket}"
|
||||
def String RestfulURI = "${JIRA_URI}/rest/api/latest/issue/${jiraticket}?fields=summary"
|
||||
def get = new URL(RestfulURI).openConnection();
|
||||
get.setRequestProperty( 'X-AUSERNAME', "${JIRA_USERNAME}" )
|
||||
get.setRequestProperty( 'Authorization', "Basic ${JIRA_ENCODED_PASSWORD}" )
|
||||
get.setRequestProperty( 'User-Agent', 'groovy-2.4.4' )
|
||||
get.setRequestProperty( 'Accept', 'application/json' )
|
||||
def getRC = get.getResponseCode();
|
||||
|
||||
def String redirectedjiraticket = jiraticket
|
||||
if(!getRC.equals(200)) {
|
||||
return [false, '', jiraticket]
|
||||
} else {
|
||||
def jsonresponse = new JsonSlurper().parseText(get.inputStream.getText('UTF-8'))
|
||||
redirectedjiraticket = jsonresponse['key']
|
||||
}
|
||||
return [true, URI, redirectedjiraticket]
|
||||
}
|
||||
|
||||
def extractjiraticketinfo(String line) {
|
||||
def List jiratickets = []
|
||||
boolean exists = false
|
||||
String URI = ''
|
||||
|
||||
while (true) {
|
||||
line = line.trim()
|
||||
def commapattern = '^\\s*,(.*)' // Consume separating commas at the beginning of the line
|
||||
def commamatch = (line =~ commapattern)
|
||||
if (commamatch.find()) {
|
||||
line = commamatch.group(1).trim()
|
||||
}
|
||||
def pattern1 = '^(\\w+-\\d+)(.*)' //GIS-1234 hmbxr5601-1234
|
||||
def match1 = (line =~ pattern1)
|
||||
if (match1.find()) {
|
||||
jiraticket = match1.group(1)
|
||||
(exists, URI, jiraticket) = jiraticketexists(jiraticket)
|
||||
if (exists) {
|
||||
def JiraTicketInfo j = new JiraTicketInfo()
|
||||
j.jiranumber = jiraticket
|
||||
j.uri = URI
|
||||
jiratickets.add(j)
|
||||
line = match1.group(2)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
def pattern2 = '^(\\w+)(\\d+)(.*)' //GIS1234 smb1234
|
||||
def match2 = (line =~ pattern2)
|
||||
if (match2.find()) {
|
||||
jiraticket = match2.group(1) + "-" + match2.group(2)
|
||||
(exists, URI, jiraticket) = jiraticketexists(jiraticket)
|
||||
if (exists) {
|
||||
def JiraTicketInfo j = new JiraTicketInfo()
|
||||
j.jiranumber = jiraticket
|
||||
j.uri = URI
|
||||
jiratickets.add(j)
|
||||
line = match2.group(3)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
def pattern3 = '^(\\w+)\\s(\\d+)(.*)' //GIS 1234 smb 1234
|
||||
def match3 = (line =~ pattern3)
|
||||
if (match3.find()) {
|
||||
jiraticket = match3.group(1) + "-" + match3.group(2)
|
||||
(exists, URI, jiraticket) = jiraticketexists(jiraticket)
|
||||
if (exists) {
|
||||
def JiraTicketInfo j = new JiraTicketInfo()
|
||||
j.jiranumber = jiraticket
|
||||
j.uri = URI
|
||||
jiratickets.add(j)
|
||||
line = match3.group(3)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean result = jiratickets.size() > 0
|
||||
return [result, jiratickets, line]
|
||||
}
|
||||
|
||||
def extractreverts(String line) {
|
||||
boolean result = true
|
||||
|
||||
def pattern1 = '^(.*)Revert \"(.*)\"'
|
||||
def match1 = (line =~ pattern1)
|
||||
if (match1.find()) {
|
||||
def line2 = match1.group(2)
|
||||
(result, originaljiraticketinfo, originalcomment) = extractjiraticketinfo(line2)
|
||||
return [true, originaljiraticketinfo, originalcomment]
|
||||
}
|
||||
|
||||
def pattern2 = '^(.*)Partial Revert \"(.*)\"'
|
||||
def match2 = (line =~ pattern2)
|
||||
if (match2.find()) {
|
||||
def line2 = match2.group(2)
|
||||
(result, originaljiraticketinfo, originalcomment) = extractjiraticketinfo(line2)
|
||||
return [true, originaljiraticketinfo, originalcomment]
|
||||
}
|
||||
|
||||
return [false, [], line]
|
||||
}
|
||||
|
||||
def getgitlogdifferencesfromsquash(String gitrootfolder, String squashedrevision) {
|
||||
def String differencetext
|
||||
dir(gitrootfolder) {
|
||||
differencetext = sh(returnStdout: true, script: "git --no-pager log --oneline ${squashedrevision}").trim()
|
||||
}
|
||||
return differencetext
|
||||
}
|
||||
|
||||
def List fillsquashrecords(String sourcepath, String sha) {
|
||||
def List differencerecords = []
|
||||
|
||||
String squashloglines = getgitlogdifferencesfromsquash(sourcepath, sha)
|
||||
int count = 0
|
||||
squashloglines.split('\n').each {
|
||||
if (count > 0) { // Ignore first line
|
||||
def line = it
|
||||
if (line?.trim()) {
|
||||
def List drs = fillrecord(meta, line.trim(), sourcepath)
|
||||
differencerecords.addAll(drs)
|
||||
//echo "${dr.dump()}"
|
||||
}
|
||||
}
|
||||
count += 1
|
||||
}
|
||||
return differencerecords
|
||||
}
|
||||
|
||||
def List fillrecord(meta, line, String sourcepath) {
|
||||
def List differencerecords = []
|
||||
def DifferenceRecord dr = new DifferenceRecord()
|
||||
|
||||
dr.productname = meta.productinfo.productname
|
||||
dr.subcomponentname = meta.productinfo.subcomponentname
|
||||
|
||||
dr.rawdifferencetext = line
|
||||
|
||||
// Example of raw text to process:
|
||||
// 76056562e4 GIS-1621 - Removing redundant lines and effects of this - Restore nuget_version_edit.py
|
||||
|
||||
(sha, line2) = extractsha(line)
|
||||
dr.sha = sha
|
||||
|
||||
(result, squashinfo) = extractsquashes(line2)
|
||||
if (result) {
|
||||
dr.type = "Squash"
|
||||
dr.squashinfo = squashinfo
|
||||
squashrecords = fillsquashrecords(sourcepath, sha)
|
||||
differencerecords.addAll(squashrecords)
|
||||
} else {
|
||||
(result, mergeinfo) = extractmerges(line2)
|
||||
if (result) {
|
||||
dr.type = "Merge"
|
||||
dr.mergeinfo = mergeinfo
|
||||
} else {
|
||||
(result, jiraticketinfo, comment) = extractreverts(line2)
|
||||
if (result) {
|
||||
dr.type = "Revert"
|
||||
dr.jiraticketinfo = jiraticketinfo
|
||||
dr.comment = comment
|
||||
} else {
|
||||
(result, jiraticketinfo, comment) = extractjiraticketinfo(line2)
|
||||
if (result) {
|
||||
dr.type = "Ticketed"
|
||||
dr.jiraticketinfo = jiraticketinfo
|
||||
dr.comment = comment
|
||||
} else {
|
||||
dr.type = "Unticketed"
|
||||
dr.comment = line2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
differencerecords.add(dr)
|
||||
return differencerecords
|
||||
}
|
||||
|
||||
def List processtext(meta, String text, String sourcepath) {
|
||||
def List differencerecords = []
|
||||
|
||||
text.split('\n').each {
|
||||
def line = it
|
||||
if (line?.trim()) {
|
||||
def List drs = fillrecord(meta, line.trim(), sourcepath)
|
||||
differencerecords.addAll(drs)
|
||||
//echo "${dr.dump()}"
|
||||
}
|
||||
}
|
||||
return differencerecords
|
||||
}
|
||||
|
||||
def getdifferencerecords(earlymeta, latermeta, String sourcepath) {
|
||||
boolean result = true;
|
||||
def List differencerecords = []
|
||||
|
||||
def earlygitinfo = earlymeta.gitinfo
|
||||
def latergitinfo = latermeta.gitinfo
|
||||
|
||||
if (earlygitinfo.remoteurl == latergitinfo.remoteurl) {
|
||||
def earlyrevision = earlygitinfo.gitrevision
|
||||
def laterrevision = latergitinfo.gitrevision
|
||||
echo "Comparing early revision: ${earlyrevision} with: ${laterrevision} Working copy path: ${sourcepath}"
|
||||
summaryappend("Early revision: ${earlyrevision} Later revision: ${laterrevision}")
|
||||
def String differencetext = getgitlogdifferences(sourcepath, earlyrevision, laterrevision)
|
||||
differencerecords = processtext(earlymeta, differencetext, sourcepath)
|
||||
if (earlyrevision == laterrevision) {
|
||||
summaryappend(" No change")
|
||||
}
|
||||
} else {
|
||||
summaryappend("The early and later git urls don't match")
|
||||
echo "The early and later git urls don't match"
|
||||
result = false;
|
||||
setunstable("The early and later git urls don't match in: ${earlymeta.componentidentifier()}")
|
||||
}
|
||||
|
||||
return [result, differencerecords]
|
||||
}
|
||||
|
||||
def deletedcomponent(earlymetaitems, key) {
|
||||
echo "Component ${key} has been deleted in later version"
|
||||
summaryappend("Deleted ")
|
||||
}
|
||||
|
||||
def addedcomponent(latermetaitems, key) {
|
||||
echo "Component ${key} has been added in later version"
|
||||
summaryappend("Added ")
|
||||
}
|
||||
|
||||
class SquashReportRecord {
|
||||
String comment
|
||||
int duplicates
|
||||
|
||||
SquashReportRecord() {
|
||||
comment = ''
|
||||
duplicates = 0
|
||||
}
|
||||
}
|
||||
|
||||
def squashreport(String reportsubfolder, String title, LinkedHashMap<String, SquashReportRecord> squashes, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String squashlist = "${title}\nSquash list:\n"
|
||||
def squashessorted = squashes.sort()
|
||||
for (asquash in squashessorted) {
|
||||
def SquashReportRecord s = asquash.value
|
||||
squashlist += "${s.comment} (${s.duplicates})\n"
|
||||
}
|
||||
writeFile(file: "squashlist.txt", text: squashlist)
|
||||
}
|
||||
}
|
||||
|
||||
class MergeReportRecord {
|
||||
String comment
|
||||
int duplicates
|
||||
|
||||
MergeReportRecord() {
|
||||
comment = ''
|
||||
duplicates = 0
|
||||
}
|
||||
}
|
||||
|
||||
def mergereport(String reportsubfolder, String title, LinkedHashMap<String, MergeReportRecord> merges, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String mergelist = "${title}\nMerge list:\n"
|
||||
def mergessorted = merges.sort()
|
||||
for (amerge in mergessorted) {
|
||||
def MergeReportRecord m = amerge.value
|
||||
mergelist += "${m.comment} (${m.duplicates})\n"
|
||||
}
|
||||
writeFile(file: "mergelist.txt", text: mergelist)
|
||||
}
|
||||
}
|
||||
|
||||
class CommentsRecord {
|
||||
String comment
|
||||
int duplicates
|
||||
|
||||
CommentsRecord() {
|
||||
comment = ''
|
||||
duplicates = 0
|
||||
}
|
||||
}
|
||||
|
||||
class RevertsReportRecord {
|
||||
String jiraticket
|
||||
String ticketURI
|
||||
LinkedHashMap<String, CommentsRecord> commentscollection
|
||||
|
||||
RevertsReportRecord() {
|
||||
jiraticket = ''
|
||||
ticketURI = ''
|
||||
commentscollection = new LinkedHashMap<String, CommentsRecord>()
|
||||
}
|
||||
}
|
||||
|
||||
def revertsreport(String reportsubfolder, String title, LinkedHashMap<String, RevertsReportRecord> reverts, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String revertlist = "${title}\nRevert list:\n"
|
||||
def revertssorted = reverts.sort()
|
||||
for (arevert in revertssorted) {
|
||||
def RevertsReportRecord r = arevert.value
|
||||
revertlist += "${r.jiraticket} (${r.ticketURI}):\n"
|
||||
def commentscollection = r.commentscollection
|
||||
def sortedcommentscollection = commentscollection.sort()
|
||||
for (commentrecord in sortedcommentscollection) {
|
||||
def CommentsRecord c = commentrecord.value
|
||||
revertlist += "${c.comment} (${c.duplicates})\n"
|
||||
}
|
||||
revertlist += "\n"
|
||||
}
|
||||
writeFile(file: "revertlist.txt", text: revertlist)
|
||||
}
|
||||
}
|
||||
|
||||
class TicketedReportRecord {
|
||||
String jiraticket
|
||||
String ticketURI
|
||||
LinkedHashMap<String, CommentsRecord> commentscollection
|
||||
|
||||
TicketedReportRecord() {
|
||||
jiraticket = ''
|
||||
ticketURI = ''
|
||||
commentscollection = new LinkedHashMap<String, CommentsRecord>()
|
||||
}
|
||||
}
|
||||
|
||||
def ticketedreport(String reportsubfolder, String title, LinkedHashMap<String, TicketedReportRecord> ticketed, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String ticketedlist = "${title}\nTicketed list:\n"
|
||||
def ticketedsorted = ticketed.sort()
|
||||
for (aticketed in ticketedsorted) {
|
||||
def TicketedReportRecord r = aticketed.value
|
||||
ticketedlist += "${r.jiraticket} (${r.ticketURI}):\n"
|
||||
def commentscollection = r.commentscollection
|
||||
def sortedcommentscollection = commentscollection.sort()
|
||||
for (commentrecord in sortedcommentscollection) {
|
||||
def CommentsRecord c = commentrecord.value
|
||||
ticketedlist += "${c.comment} (${c.duplicates})\n"
|
||||
}
|
||||
ticketedlist += "\n"
|
||||
}
|
||||
writeFile(file: "ticketedlist.txt", text: ticketedlist)
|
||||
}
|
||||
}
|
||||
|
||||
class UnticketedReportRecord {
|
||||
String comment
|
||||
int duplicates
|
||||
|
||||
UnticketedReportRecord() {
|
||||
comment = ''
|
||||
duplicates = 0
|
||||
}
|
||||
}
|
||||
|
||||
def unticketedreport(String reportsubfolder, String title, LinkedHashMap<String, UnticketedReportRecord> unticketed, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
def String unticketedlist = "${title}\nUnticketed list:\n"
|
||||
def unticketedsorted = unticketed.sort()
|
||||
for (anunticketed in unticketedsorted) {
|
||||
UnticketedReportRecord u = anunticketed.value
|
||||
unticketedlist += "${u.comment} (${u.duplicates})\n"
|
||||
}
|
||||
writeFile(file: "unticketedlist.txt", text: unticketedlist)
|
||||
}
|
||||
}
|
||||
|
||||
class TicketsReportRecord {
|
||||
String jiraticket
|
||||
String ticketURI
|
||||
int duplicates
|
||||
|
||||
TicketsReportRecord() {
|
||||
jiraticket = ''
|
||||
ticketURI = ''
|
||||
duplicates = 0
|
||||
}
|
||||
}
|
||||
|
||||
def ticketsreport(String reportsubfolder, String title, tickets, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
String ticketlist = "${title}\nTicket list:\n"
|
||||
ticketssorted = tickets.sort()
|
||||
for (ticketnumber in ticketssorted) {
|
||||
TicketsReportRecord t = ticketnumber.value
|
||||
ticketlist += "${t.jiraticket} (${t.ticketURI}) (${t.duplicates})\n"
|
||||
}
|
||||
writeFile(file: "ticketlist.txt", text: ticketlist)
|
||||
}
|
||||
}
|
||||
|
||||
def differencerecordsreport(String reportsubfolder, String title, differencerecords, boolean iscomponent = true) {
|
||||
dir(reportsubfolder) {
|
||||
String recordlist = "${title}\n"
|
||||
for (dr in differencerecords) {
|
||||
recordlist += dr.dump() + "\n\n"
|
||||
}
|
||||
writeFile(file: "recordlist.txt", text: recordlist)
|
||||
}
|
||||
}
|
||||
|
||||
def boolean report(meta, title, differencerecords, boolean iscomponent = true) {
|
||||
def Map ticketed = [:]
|
||||
def Map squashes = [:]
|
||||
def Map merges = [:]
|
||||
def Map reverts = [:]
|
||||
def Map unticketed = [:]
|
||||
def Map tickets = [:]
|
||||
|
||||
for (dr in differencerecords) {
|
||||
if (dr.type == "Squash") {
|
||||
def SquashReportRecord s
|
||||
if (!squashes.containsKey(dr.mergeinfo)) {
|
||||
s = new SquashReportRecord()
|
||||
s.comment = dr.squashinfo
|
||||
s.duplicates = 1
|
||||
} else {
|
||||
s = squashes[dr.squashinfo]
|
||||
s.duplicates += 1
|
||||
}
|
||||
squashes[dr.squashinfo] = s
|
||||
}
|
||||
if (dr.type == "Merge") {
|
||||
def MergeReportRecord m
|
||||
if (!merges.containsKey(dr.mergeinfo)) {
|
||||
m = new MergeReportRecord()
|
||||
m.comment = dr.mergeinfo
|
||||
m.duplicates = 1
|
||||
} else {
|
||||
m = merges[dr.mergeinfo]
|
||||
m.duplicates += 1
|
||||
}
|
||||
merges[dr.mergeinfo] = m
|
||||
}
|
||||
if (dr.type == "Revert") {
|
||||
def RevertsReportRecord r
|
||||
for (ticket in dr.jiraticketinfo) {
|
||||
JiraTicketInfo j = ticket
|
||||
if (!reverts.containsKey(j.jiranumber)) {
|
||||
r = new RevertsReportRecord()
|
||||
r.jiraticket = j.jiranumber
|
||||
r.ticketURI = j.uri
|
||||
CommentsRecord c = new CommentsRecord()
|
||||
c.comment = dr.comment
|
||||
c.duplicates = 1
|
||||
r.commentscollection[dr.comment] = c
|
||||
} else {
|
||||
r = reverts[j.jiranumber]
|
||||
def CommentsRecord c
|
||||
if (!r.commentscollection.containsKey(dr.comment)) {
|
||||
c = new CommentsRecord()
|
||||
c.comment = dr.comment
|
||||
c.duplicates = 1
|
||||
r.commentscollection[dr.comment] = c
|
||||
} else {
|
||||
c = r.commentscollection[dr.comment]
|
||||
c.duplicates += 1
|
||||
}
|
||||
r.commentscollection[dr.comment] = c
|
||||
}
|
||||
reverts[j.jiranumber] = r
|
||||
def TicketsReportRecord t
|
||||
if (!tickets.containsKey(j.jiranumber)) {
|
||||
t = new TicketsReportRecord()
|
||||
t.jiraticket = j.jiranumber
|
||||
t.ticketURI = j.uri
|
||||
t.duplicates = 1
|
||||
} else {
|
||||
t = tickets[j.jiranumber]
|
||||
t.duplicates += 1
|
||||
}
|
||||
tickets[j.jiranumber] = t
|
||||
}
|
||||
}
|
||||
if (dr.type == "Ticketed") {
|
||||
def TicketedReportRecord t
|
||||
for (ticket in dr.jiraticketinfo) {
|
||||
JiraTicketInfo j = ticket
|
||||
if (!ticketed.containsKey(j.jiranumber)) {
|
||||
t = new TicketedReportRecord()
|
||||
t.jiraticket = j.jiranumber
|
||||
t.ticketURI = j.uri
|
||||
CommentsRecord c = new CommentsRecord()
|
||||
c.comment = dr.comment
|
||||
c.duplicates = 1
|
||||
t.commentscollection[dr.comment] = c
|
||||
} else {
|
||||
t = ticketed[j.jiranumber]
|
||||
def CommentsRecord c
|
||||
if (!t.commentscollection.containsKey(dr.comment)) {
|
||||
c = new CommentsRecord()
|
||||
c.comment = dr.comment
|
||||
c.duplicates = 1
|
||||
t.commentscollection[dr.comment] = c
|
||||
} else {
|
||||
c = t.commentscollection[dr.comment]
|
||||
c.duplicates += 1
|
||||
}
|
||||
t.commentscollection[dr.comment] = c
|
||||
}
|
||||
ticketed[j.jiranumber] = t
|
||||
def TicketsReportRecord ti
|
||||
if (!tickets.containsKey(j.jiranumber)) {
|
||||
ti = new TicketsReportRecord()
|
||||
ti.jiraticket = j.jiranumber
|
||||
ti.ticketURI = j.uri
|
||||
ti.duplicates = 1
|
||||
} else {
|
||||
ti = tickets[j.jiranumber]
|
||||
ti.duplicates += 1
|
||||
}
|
||||
tickets[j.jiranumber] = ti
|
||||
}
|
||||
}
|
||||
if (dr.type == "Unticketed") {
|
||||
UnticketedReportRecord u
|
||||
if (!unticketed.containsKey(dr.comment)) {
|
||||
u = new UnticketedReportRecord()
|
||||
u.comment = dr.comment
|
||||
u.duplicates = 1
|
||||
} else {
|
||||
u = unticketed[dr.comment]
|
||||
u.duplicates += 1
|
||||
}
|
||||
unticketed[dr.comment] = u
|
||||
}
|
||||
}
|
||||
String reportsubfolder = ""
|
||||
if (iscomponent) {
|
||||
reportsubfolder = "${reportfolder}/${meta.componentidentifier()}"
|
||||
} else {
|
||||
reportsubfolder = "${reportfolder}/Combined"
|
||||
}
|
||||
mergereport(reportsubfolder, title, merges, iscomponent)
|
||||
squashreport(reportsubfolder, title, squashes, iscomponent)
|
||||
revertsreport(reportsubfolder, title, reverts, iscomponent)
|
||||
ticketedreport(reportsubfolder, title, ticketed, iscomponent)
|
||||
unticketedreport(reportsubfolder, title, unticketed, iscomponent)
|
||||
ticketsreport(reportsubfolder, title, tickets, iscomponent)
|
||||
differencerecordsreport(reportsubfolder, title, differencerecords, iscomponent)
|
||||
}
|
||||
|
||||
def title(earlymeta, latermeta) {
|
||||
return """
|
||||
Differences in:
|
||||
Product: ${earlymeta.productinfo.productname} Subcomponent: ${earlymeta.productinfo.subcomponentname}
|
||||
between:
|
||||
then:
|
||||
Build date: ${earlymeta.jenkinsbuildinfo.builddate} Build stamp: ${earlymeta.buildstampinfo.buildstamp} Git revision: ${earlymeta.gitinfo.gitrevision}
|
||||
now:
|
||||
Build date: ${latermeta.jenkinsbuildinfo.builddate} Build stamp: ${latermeta.buildstampinfo.buildstamp} Git revision: ${latermeta.gitinfo.gitrevision}
|
||||
"""
|
||||
}
|
||||
|
||||
def compare(earlymetaitems, latermetaitems, key) {
|
||||
boolean result = true;
|
||||
echo "Collecting changes between early and later versions of component: ${key}"
|
||||
|
||||
def earlymeta = earlymetaitems[key].meta
|
||||
def latermeta = latermetaitems[key].meta
|
||||
|
||||
summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: Changed: ")
|
||||
|
||||
def boolean repoavailable
|
||||
def String uniquefolderforsourcerepo
|
||||
(repoavailable, uniquefolderforsourcerepo) = getcomponent(earlymeta)
|
||||
|
||||
List differencerecords = []
|
||||
if (repoavailable) {
|
||||
(result, differencerecords) = getdifferencerecords(earlymeta, latermeta, uniquefolderforsourcerepo)
|
||||
|
||||
summaryappend(" Items: ${differencerecords.size()} ")
|
||||
report(earlymeta, title(earlymeta, latermeta), differencerecords)
|
||||
} else {
|
||||
summaryappend(" No source repo ")
|
||||
}
|
||||
summaryappend("\n")
|
||||
|
||||
return [result, differencerecords];
|
||||
}
|
||||
|
||||
def comparehierarchy(meta, String earlymetafolder, String latermetafolder, String maxdepth, String summaryfolder) {
|
||||
def List differencerecords = []
|
||||
|
||||
def int md = maxdepth.toInteger()
|
||||
resetfolders()
|
||||
preconditions()
|
||||
|
||||
echo "Comparing product meta hierarchy from folders: ${earlymetafolder} and ${latermetafolder} to a depth of ${md}. Exporting summary to ${summaryfolder}"
|
||||
|
||||
def earlymeta = meta.importrelated(true, earlymetafolder)
|
||||
def latermeta = meta.importrelated(true, latermetafolder)
|
||||
|
||||
def earlymetaitems = earlymeta.releasewalkerunique(md)
|
||||
def latermetaitems = latermeta.releasewalkerunique(md)
|
||||
|
||||
echo "Early items:"
|
||||
showmetaitems(earlymetaitems)
|
||||
|
||||
echo "Later items:"
|
||||
showmetaitems(latermetaitems)
|
||||
|
||||
for (key in earlymetaitems.keySet()) {
|
||||
if (latermetaitems.containsKey(key)) {
|
||||
(result, componentdifferencerecords) = compare(earlymetaitems, latermetaitems, key)
|
||||
differencerecords = differencerecords + componentdifferencerecords
|
||||
} else {
|
||||
summaryappend("${earlymeta.productinfo.productname} ${earlymeta.productinfo.subcomponentname}: ")
|
||||
deletedcomponent(earlymetaitems, key)
|
||||
summaryappend("\n")
|
||||
}
|
||||
}
|
||||
for (key in latermetaitems.keySet()) {
|
||||
if (!earlymetaitems.containsKey(key)) {
|
||||
summaryappend("${latermeta.productinfo.productname} ${latermeta.productinfo.subcomponentname}: ")
|
||||
addedcomponent(latermetaitems, key)
|
||||
summaryappend("\n")
|
||||
}
|
||||
}
|
||||
report(meta, title(earlymeta, latermeta), differencerecords, false)
|
||||
return [summarystring, markunstable, unstablereason]
|
||||
}
|
||||
|
||||
return this;
|
||||
23
Common_scripts/differences/file.groovy
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) {
|
||||
def wsparameter = "-w"
|
||||
if (!ignorewhitespace) {
|
||||
wsparameter = ""
|
||||
}
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
diff -c ${wsparameter} "${importedfile}" "${currentfile}"
|
||||
"""
|
||||
}
|
||||
else {
|
||||
// diffutils can be installed on windows with chocolatey
|
||||
powershell """
|
||||
# echo Checking utilities exist
|
||||
# where diff
|
||||
# if errorlevel 1 EXIT /b 1
|
||||
|
||||
diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
51
Common_scripts/differences/json.groovy
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
def comparefiles(importedjsonfile, currentjsonfile) {
|
||||
echo "Comparing file: ${importedjsonfile} with: ${currentjsonfile}"
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
which jq
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
# jq -S sorts json output
|
||||
diff -c <(jq -S . "${importedjsonfile}") <(jq -S . "${currentjsonfile}")
|
||||
"""
|
||||
}
|
||||
else {
|
||||
// Jq and diffutils can be installed on windows with chocolatey
|
||||
powershell """
|
||||
# echo Checking utilities exist
|
||||
# set
|
||||
# echo %PATH%
|
||||
try {
|
||||
if (Get-Command jq) {}
|
||||
}
|
||||
catch {
|
||||
echo "jq is unavailable"
|
||||
exit \$false
|
||||
}
|
||||
try {
|
||||
if (Get-Command diff) {}
|
||||
}
|
||||
catch {
|
||||
echo "diff is unavailable"
|
||||
exit \$false
|
||||
}
|
||||
|
||||
# echo Sorting json in files to compare
|
||||
# jq -S sorts json output
|
||||
jq -S . "${importedjsonfile}" > temp1.txt
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
jq -S . "${currentjsonfile}" > temp2.txt
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
|
||||
# echo Diffing sorted json files
|
||||
diff.exe -c temp1.txt temp2.txt
|
||||
\$lec = \$lastexitcode
|
||||
|
||||
Remove-Item temp1.txt
|
||||
Remove-Item temp2.txt
|
||||
|
||||
if (\$lec -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
91
Common_scripts/differences/metahierarchy.groovy
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
SUMMARYDIR = "${WORKSPACE}/summary"
|
||||
REPORTDIR = "${WORKSPACE}/reports"
|
||||
EARLYROOTDIR = 'early'
|
||||
EARLYDIR = "${WORKSPACE}/${EARLYROOTDIR}"
|
||||
LATERROOTDIR = 'later'
|
||||
LATERDIR = "${WORKSPACE}/${LATERROOTDIR}"
|
||||
|
||||
cleanfolders = [
|
||||
"${WORKSPACE}/build_artifacts",
|
||||
"${EARLYDIR}",
|
||||
"${LATERDIR}",
|
||||
"${SUMMARYDIR}",
|
||||
"${REPORTDIR}",
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Obtain top level meta') {
|
||||
steps {
|
||||
script {
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
|
||||
SOURCEURL = TOP_LEVEL_META_REPOSITORY.trim()
|
||||
importer.artifactimport(meta, EARLY_SOURCE, EARLY_BUILD_JOB, EARLY_BUILD_SELECTOR, SOURCEURL, RELEASE_EARLY_REVISION, EARLYROOTDIR, false, 'meta/**')
|
||||
importer.artifactimport(meta, LATER_SOURCE, LATER_BUILD_JOB, LATER_BUILD_SELECTOR, SOURCEURL, RELEASE_LATER_REVISION, LATERROOTDIR, false, 'meta/**')
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Diff components') {
|
||||
steps {
|
||||
script {
|
||||
def comparator = load("${autobuilder.commonscripts()}/differences/dometahierarchy.groovy")
|
||||
(summarystring, markunstable, unstablereason) = comparator.comparehierarchy(meta, EARLYDIR, LATERDIR, MAX_META_DEPTH, SUMMARYDIR)
|
||||
if (markunstable) {
|
||||
env.unstablereason = unstablereason
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts()
|
||||
archiveArtifacts "summary/**,reports/**,${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Summarise') {
|
||||
steps {
|
||||
script {
|
||||
echo "Summary:\n${summarystring}\n"
|
||||
if (env.unstablereason) {
|
||||
echo "Instability reason: ${env.unstablereason}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
80
Common_scripts/documentation/doxygen_deploy.groovy
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean imports') {
|
||||
steps {
|
||||
script {
|
||||
env.DOXYGEN = "doxygen"
|
||||
cleanfolders = [
|
||||
DOXYGEN,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Import doxygen artifacts') {
|
||||
steps {
|
||||
script {
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
def importoptions = importer.getNewImportOptions()
|
||||
|
||||
importoptions.jenkinsjob(BUILD_JOB_WITH_DOXYGEN_ARTIFACTS, BUILD_JOB_WITH_DOXYGEN_ARTIFACTS_SELECTOR)
|
||||
importoptions.setfilter(ARTIFACT_PATH_TO_DOXYGEN_ROOT + '/**')
|
||||
doxygenmeta = importer.artifactimportfrombuildjob(meta, importoptions, DOXYGEN)
|
||||
|
||||
productname = doxygenmeta.productinfo.productname
|
||||
buildstampprefix = doxygenmeta.buildstampinfo.buildstampprefix
|
||||
|
||||
echo "Doyxgen imported for product: ${productname} and build stamp prefix: ${buildstampprefix}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copy doxygen to server') {
|
||||
steps {
|
||||
script {
|
||||
doxygensource = "${DOXYGEN}/${ARTIFACT_PATH_TO_DOXYGEN_ROOT}"
|
||||
pathonserver = "${ROOT_PATH_ON_SERVER.trim()}/${productname}/${buildstampprefix}"
|
||||
echo "Copying from ${doxygensource} to ${pathonserver}"
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
rm -rfv "${pathonserver}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
mkdir -pv "${pathonserver}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo mv -v "${doxygensource}"/ "${pathonserver}"
|
||||
mv -v "${doxygensource}"/ "${pathonserver}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
} else {
|
||||
error("This job does not run on Windows at the moment")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
333
Common_scripts/import/importer.groovy
Normal file
|
|
@ -0,0 +1,333 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
versiongenerator = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
|
||||
class ImportOptions {
|
||||
def m_script // Script to use if wanting to execute script commands (eg. echo -> script.echo)
|
||||
|
||||
boolean m_incrementversionnumber // If true, increment the parent's (4th) version number with the (4th) version number of this object being imported
|
||||
String m_filter // Only import files/paths/folders that match the filter
|
||||
String m_excludes // Exclude files/paths/folders that match the exclude filter
|
||||
boolean m_fingerprint // Do Jenkins fingerprinting on imported artifacts
|
||||
boolean m_nested // Import all child artifacts too (identified in the related meta info
|
||||
boolean m_flatten // Flatten files and folders imported
|
||||
boolean m_includemetainfilter // Make sure meta is also included in filter
|
||||
boolean m_clean // Clean import folder before obtaining artifacts
|
||||
boolean m_appendtoparentmeta // Append to parent meta
|
||||
String m_sourceselect // Where are the artifacts coming from
|
||||
|
||||
String m_jobname
|
||||
def m_buildnumberorselector
|
||||
|
||||
String m_repo
|
||||
String m_revision
|
||||
|
||||
ImportOptions(script,
|
||||
String sourceselect = 'Jenkins job artifact',
|
||||
boolean incrementversionnumber = true,
|
||||
String filter = '',
|
||||
String excludes = '',
|
||||
boolean fingerprint = false,
|
||||
boolean nested = false,
|
||||
boolean flatten = false,
|
||||
boolean includemetainfilter = true,
|
||||
boolean clean = true,
|
||||
appendtoparentmeta = true) {
|
||||
m_script = script
|
||||
m_sourceselect = sourceselect.trim()
|
||||
m_incrementversionnumber = incrementversionnumber
|
||||
m_filter = filter.trim()
|
||||
m_excludes = excludes.trim()
|
||||
m_fingerprint = fingerprint
|
||||
m_nested = nested
|
||||
m_flatten = flatten
|
||||
m_includemetainfilter = includemetainfilter
|
||||
m_clean = clean
|
||||
m_appendtoparentmeta = appendtoparentmeta
|
||||
}
|
||||
|
||||
void setsourceselect(String sourceselect) {
|
||||
sourceselect = sourceselect.trim()
|
||||
switch (sourceselect) {
|
||||
case 'Jenkins job artefact':
|
||||
m_sourceselect = 'Jenkins job artifact'
|
||||
break
|
||||
case 'Jenkins job artifact':
|
||||
case 'Release repository':
|
||||
m_sourceselect = sourceselect
|
||||
break
|
||||
default:
|
||||
error("Unknown type of artifact source select: ${m_sourceselect}")
|
||||
}
|
||||
}
|
||||
|
||||
void setincrementversionnumber(boolean incrementversionnumber = true) {
|
||||
m_incrementversionnumber = incrementversionnumber
|
||||
}
|
||||
|
||||
void setfilter(String filter) {
|
||||
m_filter = filter.trim()
|
||||
}
|
||||
|
||||
void setexcludes(String excludes) {
|
||||
m_excludes = excludes.trim()
|
||||
}
|
||||
|
||||
void setfingerprint(boolean fingerprint = true) {
|
||||
m_fingerprint = fingerprint
|
||||
}
|
||||
|
||||
void setnested(boolean nested = true) {
|
||||
m_nested = nested
|
||||
}
|
||||
|
||||
void flattenimports(boolean flatten = true) {
|
||||
m_flatten = flatten
|
||||
}
|
||||
|
||||
void includemetainfilter(boolean includemetainfilter = true) {
|
||||
m_includemetainfilter = includemetainfilter
|
||||
}
|
||||
|
||||
void clean(boolean clean = true) {
|
||||
m_clean = clean
|
||||
}
|
||||
|
||||
void setappendtoparentmeta(boolean appendtoparentmeta) {
|
||||
m_appendtoparentmeta = appendtoparentmeta
|
||||
}
|
||||
|
||||
void jenkinsjob(String jobname, String buildnumberorselector) {
|
||||
m_jobname = jobname.trim()
|
||||
m_buildnumberorselector = buildnumberorselector.trim()
|
||||
setsourceselect('Jenkins job artifact')
|
||||
}
|
||||
|
||||
void releaserepo(String repo, String revision) {
|
||||
m_repo = repo.trim()
|
||||
m_revision = revision.trim()
|
||||
setsourceselect('Release repository')
|
||||
}
|
||||
|
||||
void source(String sourceselect, String jobname, String buildnumberorselector, String repo, String revision) {
|
||||
jenkinsjob(jobname, buildnumberorselector)
|
||||
releaserepo(repo, revision)
|
||||
setsourceselect(sourceselect)
|
||||
}
|
||||
}
|
||||
|
||||
ImportOptions getNewImportOptions() {
|
||||
return new ImportOptions(this)
|
||||
}
|
||||
|
||||
def formFilter(ImportOptions importoptions) {
|
||||
def String filter = importoptions.m_filter
|
||||
if (filter != '') {
|
||||
if (importoptions.m_includemetainfilter) {
|
||||
filter = 'meta/**,' + filter
|
||||
}
|
||||
}
|
||||
echo "Import options filter is: ${filter}"
|
||||
return filter
|
||||
}
|
||||
|
||||
def conditionalClean(ImportOptions importoptions, String destpath) {
|
||||
if (importoptions.m_clean) {
|
||||
echo "Cleaning ${destpath}"
|
||||
dir(destpath) {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def artifactimportfrombuildjob(meta, importoptions, String destpath) {
|
||||
if (importoptions.m_sourceselect != 'Jenkins job artifact') {
|
||||
error("Import options settings have not been set for: Jenkins job artifact")
|
||||
return
|
||||
}
|
||||
|
||||
conditionalClean(importoptions, destpath)
|
||||
|
||||
copyArtifacts(
|
||||
filter: formFilter(importoptions),
|
||||
excludes: importoptions.m_excludes,
|
||||
fingerprintArtifacts: importoptions.m_fingerprint,
|
||||
projectName: importoptions.m_jobname,
|
||||
selector: [
|
||||
$class: 'ParameterizedBuildSelector',
|
||||
parameterName: importoptions.m_buildnumberorselector
|
||||
],
|
||||
flatten: importoptions.m_flatten,
|
||||
target: destpath
|
||||
)
|
||||
def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath)
|
||||
if (importoptions.m_incrementversionnumber) {
|
||||
meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision))
|
||||
}
|
||||
return importedmeta
|
||||
}
|
||||
|
||||
def rewritemetafileasreleased(meta, String filepath) {
|
||||
// Modify the meta info to say that is has already been released
|
||||
meta.markreleased()
|
||||
meta.saveJsonSerialised(filepath)
|
||||
}
|
||||
|
||||
def hierarchyartifactimportfromrepo(meta, importoptions, String destpath) {
|
||||
if (importoptions.m_sourceselect != 'Release repository') {
|
||||
error("Import options settings have not been set for: Release repository")
|
||||
return
|
||||
}
|
||||
|
||||
def rooturl = importoptions.m_repo
|
||||
def rootrevision = importoptions.m_revision
|
||||
echo "Cloning root release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}"
|
||||
|
||||
conditionalClean(importoptions, destpath)
|
||||
|
||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(formFilter(importoptions))
|
||||
gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist)
|
||||
|
||||
def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath))
|
||||
|
||||
relatedimportinfo = importedmeta.getassociated()
|
||||
echo "Cloning associated repos"
|
||||
for(relatedmetainfo in relatedimportinfo) {
|
||||
def relatedmeta = relatedmetainfo.meta
|
||||
def relatedoffsetpath = relatedmetainfo.offsetpath
|
||||
def cloneurl = relatedmeta.releaseinfo.releaserepoURL
|
||||
def clonerevision = "refs/tags/${relatedmeta.releasetag()}"
|
||||
def clonepath = "${destpath}/${relatedoffsetpath}"
|
||||
echo "Cloning release repo: ${cloneurl}, revision: ${clonerevision} at folder: ${clonepath}"
|
||||
|
||||
gh.gitCheckoutAlt(cloneurl, clonerevision, clonepath, "", 1, true, [])
|
||||
|
||||
gh.stripgithistory(clonepath)
|
||||
|
||||
def metafilepath = "${clonepath}/${relatedmeta.metafilepath()}"
|
||||
echo "Marking related meta as released and rewriting meta file: ${metafilepath}"
|
||||
rewritemetafileasreleased(relatedmeta, metafilepath)
|
||||
}
|
||||
gh.stripgithistory(destpath)
|
||||
def metafilepath = "${destpath}/${meta.metafilepath()}"
|
||||
echo "Marking root meta as released and rewriting meta file: ${metafilepath}"
|
||||
rewritemetafileasreleased(importedmeta, metafilepath)
|
||||
|
||||
if (importoptions.m_incrementversionnumber) {
|
||||
meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision))
|
||||
}
|
||||
return importedmeta
|
||||
}
|
||||
|
||||
def artifactimportfromrepo(meta, importoptions, String destpath) {
|
||||
if (importoptions.m_sourceselect != 'Release repository') {
|
||||
error("Import options settings have not been set for: Release repository")
|
||||
return
|
||||
}
|
||||
|
||||
conditionalClean(importoptions, destpath)
|
||||
|
||||
def rooturl = importoptions.m_repo
|
||||
def rootrevision = importoptions.m_revision
|
||||
echo "Cloning release repo: ${rooturl}, revision: ${rootrevision} at folder: ${destpath}"
|
||||
|
||||
def ArrayList<String> sparseitemlist = gh.convertSparseItemsString(formFilter(importoptions))
|
||||
gh.gitCheckoutAlt(rooturl, rootrevision, destpath, "", 1, true, sparseitemlist)
|
||||
|
||||
def importedmeta = meta.importrelated(importoptions.m_appendtoparentmeta, destpath, rooturl, rootrevision, gh.getGitInfo(destpath))
|
||||
|
||||
gh.stripgithistory(destpath)
|
||||
def metafilepath = "${destpath}/${meta.metafilepath()}"
|
||||
echo "Marking meta as released and rewriting meta file: ${metafilepath}"
|
||||
rewritemetafileasreleased(importedmeta, metafilepath)
|
||||
|
||||
if (importoptions.m_incrementversionnumber) {
|
||||
meta.buildstampinfo.changerevision(versiongenerator.incrementrevision(meta.buildstampinfo.revision, importedmeta.buildstampinfo.revision))
|
||||
}
|
||||
return importedmeta
|
||||
}
|
||||
|
||||
def artifactimport(meta, importoptions, String destpath) {
|
||||
switch (importoptions.m_sourceselect) {
|
||||
case 'Jenkins job artifact':
|
||||
case 'Jenkins job artefact':
|
||||
return artifactimportfrombuildjob(meta, importoptions, destpath)
|
||||
case 'Release repository':
|
||||
if (importoptions.m_nested) {
|
||||
return hierarchyartifactimportfromrepo(meta, importoptions, destpath)
|
||||
}
|
||||
return artifactimportfromrepo(meta, importoptions, destpath)
|
||||
default:
|
||||
error("Unknown type of artifact source: ${source}")
|
||||
}
|
||||
return meta
|
||||
}
|
||||
|
||||
// Deprecated (use above)
|
||||
def artifactimport(meta,
|
||||
String sourceselect,
|
||||
String jenkinsjob,
|
||||
buildnumberorselector,
|
||||
String repo,
|
||||
String revision,
|
||||
String destpath,
|
||||
boolean incrementversionnumber = true,
|
||||
String filter = '',
|
||||
String excludes = '',
|
||||
boolean fingerprint = false,
|
||||
boolean nested = false) {
|
||||
echo "DEPRECATED method: artifactimport(meta, String source, String jenkinsjob, buildnumberorselector, String repo, String revision, String destpath ...)"
|
||||
def importoptions = getNewImportOptions()
|
||||
|
||||
importoptions.source(sourceselect, jenkinsjob, buildnumberorselector, repo, revision)
|
||||
importoptions.setincrementversionnumber(incrementversionnumber)
|
||||
importoptions.setfilter(filter)
|
||||
importoptions.setexcludes(excludes)
|
||||
importoptions.setfingerprint(fingerprint)
|
||||
importoptions.setnested(nested)
|
||||
|
||||
return artifactimport(meta, importoptions, destpath)
|
||||
}
|
||||
|
||||
// Deprecated (use above)
|
||||
def artifactimport(meta,
|
||||
String buildjob,
|
||||
int buildnumber,
|
||||
String destpath,
|
||||
boolean incrementversionnumber = true,
|
||||
String filter = '**',
|
||||
String excludes = '',
|
||||
boolean fingerprint = false) {
|
||||
echo "DEPRECATED method: artifactimport(meta, String buildjob, int buildnumber, String destpath, ...)"
|
||||
def importoptions = getNewImportOptions()
|
||||
|
||||
importoptions.jenkinsjob(buildjob, "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${buildnumber}</buildNumber></SpecificBuildSelector>")
|
||||
importoptions.setincrementversionnumber(incrementversionnumber)
|
||||
importoptions.setfilter(filter)
|
||||
importoptions.setexcludes(excludes)
|
||||
importoptions.setfingerprint(fingerprint)
|
||||
|
||||
return artifactimport(meta, importoptions, destpath)
|
||||
}
|
||||
|
||||
// Deprecated (use above)
|
||||
def artifactimport(meta,
|
||||
String buildjob,
|
||||
buildnumberorselector,
|
||||
String destpath,
|
||||
boolean incrementversionnumber = true,
|
||||
String filter = '',
|
||||
String excludes = '',
|
||||
boolean fingerprint = false) {
|
||||
echo "DEPRECATED method: artifactimport(meta, String buildjob, buildnumberorselector, String destpath, ...)"
|
||||
def importoptions = getNewImportOptions()
|
||||
|
||||
importoptions.jenkinsjob(buildjob, buildnumberorselector)
|
||||
importoptions.setincrementversionnumber(incrementversionnumber)
|
||||
importoptions.setfilter(filter)
|
||||
importoptions.setexcludes(excludes)
|
||||
importoptions.setfingerprint(fingerprint)
|
||||
|
||||
return artifactimport(meta, importoptions, destpath)
|
||||
}
|
||||
|
||||
return this;
|
||||
117
Common_scripts/install/installhelper.groovy
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
import hudson.FilePath
|
||||
|
||||
// Transfer file from intermediate position to final position;
|
||||
// creating necessary folders on the way;
|
||||
// deleting intermediate file
|
||||
def copyToFinalPosition(String pathToIntermediate, String finalBaseFolder, String finalFilename) {
|
||||
def channel = Jenkins.getInstance().getComputer(env['NODE_NAME']).getChannel()
|
||||
|
||||
def String abs_exports_root_path = "${WORKSPACE}/${finalBaseFolder}"
|
||||
def String abs_export_out = "${abs_exports_root_path}/${finalFilename}"
|
||||
def export_filepath = new hudson.FilePath(channel, abs_export_out)
|
||||
def export_out_folder = export_filepath.getParent()
|
||||
def export_out_folder_string = export_out_folder.toString()
|
||||
def export_out_file = export_filepath.getName()
|
||||
|
||||
echo "Creating folder ${export_out_folder_string}"
|
||||
export_out_folder.mkdirs()
|
||||
|
||||
echo "Copying from ${pathToIntermediate} to ${abs_export_out}"
|
||||
def intermediate_filepath = new hudson.FilePath(channel, pathToIntermediate)
|
||||
intermediate_filepath.copyTo(export_filepath)
|
||||
intermediate_filepath.delete()
|
||||
}
|
||||
|
||||
// Given details about artifacts to import and details of installers to build, import artifacts that are required
|
||||
def Map artifactsImporter(meta, importer, artifactDetails, installerDetails) {
|
||||
artifactFetched = [:]
|
||||
|
||||
def importoptions = importer.getNewImportOptions()
|
||||
for (installer in toBuild) {
|
||||
def artifactKeys = installerDetails.get(installer)[1]
|
||||
if (artifactKeys instanceof java.lang.String) {
|
||||
artifactKeys = [ artifactKeys ]
|
||||
}
|
||||
for (artifactKey in artifactKeys) {
|
||||
(sourceProject, sourceselector, destFolder, incrementversionnumber, toCopy, notToCopy, binariesFolders) = artifactDetails.get(artifactKey)
|
||||
if (artifactFetched.get(artifactKey) == null) {
|
||||
importoptions.jenkinsjob(sourceProject, sourceselector)
|
||||
importoptions.setincrementversionnumber(incrementversionnumber)
|
||||
importoptions.setfilter(toCopy)
|
||||
importoptions.setexcludes(notToCopy)
|
||||
|
||||
def importmeta = importer.artifactimport(meta, importoptions, destFolder)
|
||||
artifactFetched.put(artifactKey, importmeta)
|
||||
}
|
||||
}
|
||||
}
|
||||
return artifactFetched
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def checkISMfilebackend(String xml) {
|
||||
def String message = ""
|
||||
|
||||
def parsedxml = new XmlParser(true, true, true).parseText(xml)
|
||||
def pathvariableinfo = [:]
|
||||
def exitcode = 0
|
||||
// Load up a map of path variable and path pairs
|
||||
// Ignore blank path definitions
|
||||
// Ignore the workspace definition which should have the only absolute path
|
||||
parsedxml.each{ table ->
|
||||
if (table.@name == "ISPathVariable") {
|
||||
table['row'].each{ row ->
|
||||
def pathname = row['td'][0].value()[0]
|
||||
def path = row['td'][1].value()[0]
|
||||
if (path && pathname != 'WORKSPACE') {
|
||||
pathvariableinfo[pathname] = path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check that each path variable is defined beginning with a path variable or the WORKSPACE one
|
||||
pathvariableinfo.each{ pair ->
|
||||
message += "pair key: ${pair.key} value: ${pair.value}\n"
|
||||
def path = pair.value
|
||||
def pathvarmatcher = path =~ /<(.*)>.*/
|
||||
if (pathvarmatcher.matches()) {
|
||||
def pathvarfound = pathvarmatcher.group(1)
|
||||
if (pathvarfound != 'WORKSPACE') {
|
||||
if (!pathvariableinfo.containsKey(pathvarfound)) {
|
||||
message += "Undefined path variable ${pathvarfound} found\n"
|
||||
exitcode = 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message += "Path: ${path} does not begin with a path variable\n"
|
||||
exitcode = 1
|
||||
}
|
||||
}
|
||||
return [exitcode, message]
|
||||
}
|
||||
|
||||
def checkISMfile(String ISMfile) {
|
||||
echo "Checking ISM file: ${ISMfile}"
|
||||
def xml = readFile(ISMfile)
|
||||
(exitcode, message) = checkISMfilebackend(xml)
|
||||
echo message
|
||||
if (exitcode > 0) {
|
||||
error "ISM file errors found"
|
||||
} else {
|
||||
echo "Checked ISM file - ok"
|
||||
}
|
||||
}
|
||||
|
||||
certificatethumbprints = [:]
|
||||
certificatethumbprints['floreana'] = '0FDEB0A227982C877146CA595091173AC9655479' // Authoring takes place on this machine - so this is what should be in the ISM file already
|
||||
certificatethumbprints['hawaii'] = '49FD1B361CFF35014B81940C5B046543045DD34B'
|
||||
|
||||
def selectSigningCertificate(String nodeName, String ISMfile) {
|
||||
def masterpattern = '0FDEB0A227982C877146CA595091173AC9655479'
|
||||
echo "Substituting occurrences of ${masterpattern} with ${certificatethumbprints[nodeName]} in ISM file: ${ISMfile}"
|
||||
|
||||
textutils_subst = load("${autobuilder.commonscripts()}/textutils/subst.groovy")
|
||||
textutils_subst.substitute(ISMfile, masterpattern, certificatethumbprints[nodeName])
|
||||
}
|
||||
|
||||
return this;
|
||||
793
Common_scripts/meta/folder.groovy
Normal file
|
|
@ -0,0 +1,793 @@
|
|||
import java.nio.file.Paths
|
||||
import java.nio.file.Path
|
||||
import groovy.json.JsonSlurperClassic
|
||||
|
||||
abstract class GISJsonSerialised implements Serializable {
|
||||
def script
|
||||
|
||||
GISJsonSerialised(script) {
|
||||
this.script = script
|
||||
}
|
||||
|
||||
abstract LinkedHashMap serialisationdata()
|
||||
|
||||
abstract void deserialiseJson(rawmeta)
|
||||
|
||||
def saveJsonSerialised(String outputfile, int prettylevel = 4) {
|
||||
def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata())
|
||||
script.writeJSON(file: outputfile, json: outJson, pretty: prettylevel)
|
||||
}
|
||||
}
|
||||
|
||||
class ProductInfo extends GISJsonSerialised {
|
||||
String productname
|
||||
String subcomponentname
|
||||
String variant
|
||||
|
||||
ProductInfo(script, productname = "", subcomponentname = "", variant = "") {
|
||||
super(script)
|
||||
this.productname = productname
|
||||
this.subcomponentname = subcomponentname
|
||||
this.variant = variant
|
||||
}
|
||||
|
||||
void set(String productname, String subcomponentname, String variant = '') {
|
||||
// Make sure the fields can be used in git tags
|
||||
def int pstatus = 0
|
||||
if (script.isUnix()) {
|
||||
pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
pstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${productname}\" 2>&1>\$null", , returnStatus: true)
|
||||
}
|
||||
if (pstatus > 0) {
|
||||
script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name")
|
||||
}
|
||||
def int sstatus = 0
|
||||
if (script.isUnix()) {
|
||||
sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
sstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" 2>&1>\$null", , returnStatus: true)
|
||||
}
|
||||
if (sstatus > 0) {
|
||||
script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name")
|
||||
}
|
||||
if (variant) {
|
||||
def int vstatus = 0
|
||||
if (script.isUnix()) {
|
||||
vstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${variant}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
||||
}
|
||||
else {
|
||||
vstatus = script.powershell(script: "git check-ref-format --normalize \"refs/tags/${variant}\" 2>&1>\$null", , returnStatus: true)
|
||||
}
|
||||
if (vstatus > 0) {
|
||||
script.error("The subcomponent name: ${variant} needs to be renamed as it cannot be used in a git tag name")
|
||||
}
|
||||
}
|
||||
this.productname = productname
|
||||
this.subcomponentname = subcomponentname
|
||||
this.variant = variant
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
productname = rawmeta['productname']
|
||||
subcomponentname = rawmeta['subcomponentname']
|
||||
variant = rawmeta['variant'] ?: ""
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'productname' : productname,
|
||||
'subcomponentname' : subcomponentname,
|
||||
'variant' : variant,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class GitInfo extends GISJsonSerialised {
|
||||
private String sourcepath
|
||||
private String sourcerevision
|
||||
private String gitrevision
|
||||
private String remoteurl
|
||||
private String remoteinfo
|
||||
|
||||
GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") {
|
||||
super(script)
|
||||
this.sourcepath = sourcepath
|
||||
this.sourcerevision = sourcerevision
|
||||
this.gitrevision = gitrevision
|
||||
this.remoteurl = remoteurl
|
||||
this.remoteinfo = remoteinfo
|
||||
}
|
||||
|
||||
void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) {
|
||||
this.sourcepath = sourcepath
|
||||
this.sourcerevision = sourcerevision
|
||||
this.gitrevision = gitrevision
|
||||
this.remoteurl = remoteurl
|
||||
this.remoteinfo = remoteinfo
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
sourcepath = rawmeta['sourcepath']
|
||||
sourcerevision = rawmeta['sourcerevision']
|
||||
gitrevision = rawmeta['gitrevision']
|
||||
remoteurl = rawmeta['remoteurl']
|
||||
remoteinfo = rawmeta['remoteinfo']
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'sourcepath' : sourcepath,
|
||||
'sourcerevision' : sourcerevision,
|
||||
'gitrevision' : gitrevision,
|
||||
'remoteurl' : remoteurl,
|
||||
'remoteinfo' : remoteinfo,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class JenkinsBuildInfo extends GISJsonSerialised {
|
||||
String buildjobname
|
||||
int buildnumber
|
||||
private String buildmachine
|
||||
private String builddate
|
||||
|
||||
JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") {
|
||||
super(script)
|
||||
this.buildjobname = buildjobname
|
||||
this.buildnumber = buildnumber
|
||||
this.buildmachine = buildmachine
|
||||
this.builddate = builddate
|
||||
}
|
||||
|
||||
void set(String buildjobname, int buildnumber, String buildmachine, String builddate) {
|
||||
this.buildjobname = buildjobname
|
||||
this.buildnumber = buildnumber
|
||||
this.buildmachine = buildmachine
|
||||
this.builddate = builddate
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
buildjobname = rawmeta['buildjobname']
|
||||
buildnumber = rawmeta['buildnumber']
|
||||
buildmachine = rawmeta['buildmachine']
|
||||
builddate = rawmeta['builddate']
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'buildjobname' : buildjobname,
|
||||
'buildnumber' : buildnumber,
|
||||
'buildmachine' : buildmachine,
|
||||
'builddate' : builddate,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class BuildStampInfo extends GISJsonSerialised {
|
||||
String buildstampprefix
|
||||
int revision
|
||||
String buildstamp
|
||||
|
||||
BuildStampInfo(script, buildstampprefix = "0.30000.0.", revision = 0, buildstamp = "0.30000.0.0") {
|
||||
super(script)
|
||||
this.buildstampprefix = buildstampprefix
|
||||
this.revision = revision
|
||||
this.buildstamp = buildstamp
|
||||
}
|
||||
|
||||
void set(String buildstampprefix, int revision, String buildstamp) {
|
||||
this.buildstampprefix = buildstampprefix
|
||||
this.revision = revision
|
||||
this.buildstamp = buildstamp
|
||||
}
|
||||
|
||||
void set(BuildStampInfo other) {
|
||||
set(other.buildstampprefix, other.revision, other.buildstamp)
|
||||
}
|
||||
|
||||
String buildstampcommasep() {
|
||||
def String buildstampcommasep = buildstamp.replace(".", ",")
|
||||
return buildstampcommasep
|
||||
}
|
||||
|
||||
void changerevision(int newrevision) {
|
||||
script.echo("Build stamp currently ${buildstamp}")
|
||||
revision = newrevision
|
||||
def List buildstampsplit = buildstamp.split('\\.')
|
||||
buildstampsplit[-1] = newrevision.toString()
|
||||
buildstamp = buildstampsplit.join('.')
|
||||
script.echo("Build stamp now ${buildstamp}")
|
||||
}
|
||||
|
||||
void set(String buildstampprefix, int revision) {
|
||||
buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.'
|
||||
this.buildstampprefix = buildstampprefix
|
||||
this.buildstamp = buildstampprefix + "0"
|
||||
changerevision(revision)
|
||||
}
|
||||
|
||||
void set(String buildstampprefix, String revision = '0') {
|
||||
set(buildstampprefix, revision.toInteger())
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
buildstampprefix = rawmeta['buildstampprefix']
|
||||
revision = rawmeta['revision']
|
||||
buildstamp = rawmeta['buildstamp']
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'buildstampprefix' : buildstampprefix,
|
||||
'revision' : revision,
|
||||
'buildstamp' : buildstamp,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class ReleaseInfo extends GISJsonSerialised {
|
||||
String releaserepoURL
|
||||
ArrayList<String> releaseitems
|
||||
boolean released
|
||||
|
||||
ReleaseInfo(script, String releaserepoURL = "", boolean released = false) {
|
||||
super(script)
|
||||
this.releaserepoURL = releaserepoURL
|
||||
this.releaseitems = new ArrayList<String>()
|
||||
this.released = released
|
||||
}
|
||||
|
||||
void set(String releaserepoURL = "") {
|
||||
this.releaserepoURL = releaserepoURL
|
||||
}
|
||||
|
||||
void addReleaseItem(String releaseitem) {
|
||||
script.echo("Adding release item: ${releaseitem} to release items")
|
||||
releaseitems.add(releaseitem)
|
||||
}
|
||||
|
||||
void markreleased() {
|
||||
this.released = true
|
||||
}
|
||||
|
||||
List releaseitemssserialised() {
|
||||
def items = []
|
||||
for (ri in releaseitems) {
|
||||
items.add(ri)
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
releaserepoURL = rawmeta['releaserepoURL']
|
||||
releaseitems = new ArrayList<String>()
|
||||
for (rawreleaseitem in rawmeta['releaseitems']) {
|
||||
releaseitems.add(rawreleaseitem)
|
||||
}
|
||||
released = rawmeta['released'] ?: false
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'releaserepoURL' : releaserepoURL,
|
||||
'releaseitems' : releaseitemssserialised(),
|
||||
'released' : released
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class ConfigurationInfo extends GISJsonSerialised {
|
||||
private String configurationname
|
||||
private String configurationURL
|
||||
private String configurationversion
|
||||
private String configurationSHA
|
||||
|
||||
ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") {
|
||||
super(script)
|
||||
this.configurationname = configurationname
|
||||
this.configurationURL = configurationURL
|
||||
this.configurationversion = configurationversion
|
||||
this.configurationSHA = configurationSHA
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
configurationname = rawmeta['configurationname']
|
||||
configurationURL = rawmeta['configurationURL']
|
||||
configurationversion = rawmeta['configurationversion']
|
||||
configurationSHA = rawmeta['configurationSHA']
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'configurationname' : configurationname,
|
||||
'configurationURL' : configurationURL,
|
||||
'configurationversion' : configurationversion,
|
||||
'configurationSHA' : configurationSHA,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class ChecksumPair extends GISJsonSerialised {
|
||||
private String filepath
|
||||
private String sum
|
||||
|
||||
ChecksumPair(script, String filepath = "", String sum = "") {
|
||||
super(script)
|
||||
this.filepath = filepath
|
||||
this.sum = sum
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
filepath = rawmeta['filepath']
|
||||
sum = rawmeta['sum']
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'filepath' : filepath,
|
||||
'sum' : sum,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class ChecksumSet extends GISJsonSerialised {
|
||||
private String artifactpath
|
||||
private ArrayList<ChecksumPair> checksumpairs
|
||||
|
||||
ChecksumSet(script, artifactpath = "") {
|
||||
super(script)
|
||||
this.artifactpath = artifactpath
|
||||
checksumpairs = new ArrayList<ChecksumPair>()
|
||||
}
|
||||
|
||||
ChecksumPair addChecksumPair(String filepath, String sum) {
|
||||
def cp = new ChecksumPair(script, filepath, sum)
|
||||
checksumpairs.add(cp)
|
||||
return cp
|
||||
}
|
||||
|
||||
List checksumpairsserialised() {
|
||||
def associated = []
|
||||
for (cp in checksumpairs) {
|
||||
associated.add(cp.serialisationdata())
|
||||
}
|
||||
return associated
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
artifactpath = rawmeta['artifactpath']
|
||||
checksumpairs = new ArrayList<ChecksumPair>()
|
||||
for (rawchecksumpair in rawmeta['checksumpairs']) {
|
||||
def csp = new ChecksumPair(script)
|
||||
csp.deserialiseJson(rawchecksumpair)
|
||||
checksumpairs.add(csp)
|
||||
}
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'artifactpath' : artifactpath,
|
||||
'checksumpairs' : checksumpairsserialised(),
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class ChecksumInfo extends GISJsonSerialised {
|
||||
private ArrayList<ChecksumSet> checksumsets
|
||||
|
||||
ChecksumInfo(script) {
|
||||
super(script)
|
||||
checksumsets = new ArrayList<ChecksumSet>()
|
||||
}
|
||||
|
||||
ChecksumSet addChecksumSet(String artifactpath) {
|
||||
def cs = new ChecksumSet(script, artifactpath)
|
||||
checksumsets.add(cs)
|
||||
return cs
|
||||
}
|
||||
|
||||
List checksumsetsserialised() {
|
||||
def associated = []
|
||||
for (cs in checksumsets) {
|
||||
associated.add(cs.serialisationdata())
|
||||
}
|
||||
return associated
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
checksumsets = new ArrayList<ChecksumSet>()
|
||||
for (rawchecksumset in rawmeta['checksumsets']) {
|
||||
def cs = new ChecksumSet(script)
|
||||
cs.deserialiseJson(rawchecksumset)
|
||||
checksumsets.add(cs)
|
||||
}
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'checksumsets' : checksumsetsserialised(),
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class PublishableInfo extends GISJsonSerialised {
|
||||
private String filepath
|
||||
|
||||
PublishableInfo(script, String filepath = "") {
|
||||
super(script)
|
||||
this.filepath = filepath
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
filepath = rawmeta['filepath']
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'filepath' : filepath,
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
class MetaInfo extends GISJsonSerialised {
|
||||
private static String FORMAT = "0.1"
|
||||
private static String METAFOLDERNAME = "meta"
|
||||
private static String METAFILENAME = "info.json"
|
||||
private static String METAARTIFACTS = "${METAFOLDERNAME}/**"
|
||||
|
||||
class RelatedMetaInfo extends GISJsonSerialised {
|
||||
String offsetpath
|
||||
MetaInfo meta
|
||||
|
||||
RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) {
|
||||
super(script)
|
||||
this.offsetpath = offsetpath
|
||||
this.meta = meta
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
offsetpath = rawmeta['offsetpath']
|
||||
meta = new MetaInfo(script)
|
||||
meta.deserialiseJson(rawmeta['meta'])
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'offsetpath' : offsetpath,
|
||||
'meta' : meta.serialisationdata(),
|
||||
]
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
private String format = FORMAT
|
||||
ProductInfo productinfo
|
||||
GitInfo gitinfo
|
||||
JenkinsBuildInfo jenkinsbuildinfo
|
||||
BuildStampInfo buildstampinfo
|
||||
ReleaseInfo releaseinfo
|
||||
ChecksumInfo checksuminfo
|
||||
private ArrayList<ConfigurationInfo> configurationinfo
|
||||
private ArrayList<PublishableInfo> publishableinfo
|
||||
private LinkedHashMap<String, String> custominfo
|
||||
private ArrayList<RelatedMetaInfo> associatedmeta
|
||||
|
||||
MetaInfo(script) {
|
||||
super(script)
|
||||
productinfo = new ProductInfo(script)
|
||||
gitinfo = new GitInfo(script)
|
||||
jenkinsbuildinfo = new JenkinsBuildInfo(script)
|
||||
buildstampinfo = new BuildStampInfo(script)
|
||||
releaseinfo = new ReleaseInfo(script)
|
||||
checksuminfo = new ChecksumInfo(script)
|
||||
configurationinfo = new ArrayList<ConfigurationInfo>()
|
||||
publishableinfo = new ArrayList<PublishableInfo>()
|
||||
custominfo = new LinkedHashMap<String, String>()
|
||||
associatedmeta = new ArrayList<RelatedMetaInfo>()
|
||||
}
|
||||
|
||||
List getassociated() {
|
||||
return associatedmeta
|
||||
}
|
||||
|
||||
void markreleased() {
|
||||
script.echo("Marking product: ${productinfo.productname} component: ${productinfo.subcomponentname} as released")
|
||||
releaseinfo.markreleased()
|
||||
for (associated in associatedmeta) {
|
||||
associated.meta.releaseinfo.markreleased()
|
||||
}
|
||||
}
|
||||
|
||||
List configurationinfoserialised() {
|
||||
def configuration = []
|
||||
for (configurationitem in configurationinfo) {
|
||||
configuration.add(configurationitem.serialisationdata())
|
||||
}
|
||||
return configuration
|
||||
}
|
||||
|
||||
void addPublishable(String filepath) {
|
||||
def PublishableInfo pi = new PublishableInfo(script, filepath)
|
||||
script.echo("Adding ${filepath} to publishable list")
|
||||
publishableinfo.add(pi)
|
||||
}
|
||||
|
||||
void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) {
|
||||
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
|
||||
script.echo("Adding configuration info: name: ${configurationname} url: ${configurationURL} version: ${configurationversion} sha: ${configurationSHA}")
|
||||
configurationinfo.add(ci)
|
||||
}
|
||||
|
||||
void addCustomInfo(String customId, String customValue) {
|
||||
custominfo.put(customId.trim(), customValue)
|
||||
}
|
||||
|
||||
String getCustomInfo(String customId) {
|
||||
return custominfo.getAt(customId.trim())
|
||||
}
|
||||
|
||||
List publishableinfoserialised() {
|
||||
def publishable = []
|
||||
for (publishableitem in publishableinfo) {
|
||||
publishable.add(publishableitem.serialisationdata())
|
||||
}
|
||||
return publishable
|
||||
}
|
||||
|
||||
List associatedmetaserialised() {
|
||||
def associated = []
|
||||
for (metaitem in associatedmeta) {
|
||||
associated.add(metaitem.serialisationdata())
|
||||
}
|
||||
return associated
|
||||
}
|
||||
|
||||
void deserialiseJson(rawmeta) {
|
||||
if (rawmeta['format'] != FORMAT) {
|
||||
script.error("Unsupported meta format found at ${filepath}")
|
||||
return
|
||||
}
|
||||
productinfo.deserialiseJson(rawmeta['productinfo'])
|
||||
gitinfo.deserialiseJson(rawmeta['gitinfo'])
|
||||
jenkinsbuildinfo.deserialiseJson(rawmeta['jenkinsbuildinfo'])
|
||||
buildstampinfo.deserialiseJson(rawmeta['buildstampinfo'])
|
||||
releaseinfo.deserialiseJson(rawmeta['releaseinfo'])
|
||||
checksuminfo.deserialiseJson(rawmeta['checksuminfo'])
|
||||
for (rawconfig in rawmeta['configuration']) {
|
||||
def cf = new ConfigurationInfo(script)
|
||||
cf.deserialiseJson(rawconfig)
|
||||
configurationinfo.add(cf)
|
||||
}
|
||||
for (rawpublishable in rawmeta['publishableinfo']) {
|
||||
def pb = new PublishableInfo(script)
|
||||
pb.deserialiseJson(rawpublishable)
|
||||
publishableinfo.add(pb)
|
||||
}
|
||||
custominfo = rawmeta['custominfo']
|
||||
for (rawrelatedmeta in rawmeta['associatedmeta']) {
|
||||
def rm = new RelatedMetaInfo(script)
|
||||
rm.deserialiseJson(rawrelatedmeta)
|
||||
associatedmeta.add(rm)
|
||||
}
|
||||
}
|
||||
|
||||
def deserialiseJson(String filepath) {
|
||||
script.echo("Deserialising JSON at file: ${filepath}")
|
||||
def rawmeta = script.readJSON(file: filepath)
|
||||
deserialiseJson(rawmeta)
|
||||
}
|
||||
|
||||
def deserialiseJsonSlurper(String filepath) {
|
||||
File jsonfile = new File(filepath)
|
||||
def jsonfiletext = jsonfile.getText()
|
||||
def rawmeta = new JsonSlurperClassic().parseText(jsonfiletext)
|
||||
deserialiseJson(rawmeta)
|
||||
}
|
||||
|
||||
String relativize(String mypath) {
|
||||
String pathRelative
|
||||
script.echo("Seeing if ${mypath} begins with ${script.WORKSPACE}")
|
||||
if (mypath.startsWith(script.WORKSPACE)) {
|
||||
pathRelative = mypath.minus(script.WORKSPACE)
|
||||
script.echo("Extracted ${pathRelative} from ${script.WORKSPACE} and ${mypath}")
|
||||
} else {
|
||||
pathRelative = mypath
|
||||
script.echo("Path relative is unchanged: ${pathRelative}")
|
||||
}
|
||||
// Convert \ with /
|
||||
pathRelative = pathRelative.tokenize('\\').join('/')
|
||||
// Strip leading / if any
|
||||
pathRelative = pathRelative.replaceAll('^/+', '')
|
||||
|
||||
script.echo("Path relative is ${pathRelative}")
|
||||
|
||||
return pathRelative
|
||||
}
|
||||
|
||||
static String metafilepath() {
|
||||
return METAFOLDERNAME + "/" + METAFILENAME
|
||||
}
|
||||
|
||||
MetaInfo importrelated(boolean appendtoparentmeta, String destpath, String givenRepo = 'Unknown', String givenRevision = 'Unknown', String givenSHA = 'Unknown') {
|
||||
MetaInfo mi = new MetaInfo(script)
|
||||
|
||||
def String adjustedpath = relativize(destpath)
|
||||
def importedmetafile = adjustedpath + "/" + metafilepath()
|
||||
if (script.fileExists(importedmetafile)) {
|
||||
mi.deserialiseJson(importedmetafile)
|
||||
} else {
|
||||
script.echo("Could not deserialise meta at file: ${importedmetafile} (destpath: ${destpath})- Does not exist")
|
||||
mi.addConfigurationInfo('', givenRepo, givenRevision, givenSHA)
|
||||
}
|
||||
|
||||
RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi)
|
||||
if (appendtoparentmeta) {
|
||||
associatedmeta.add(rmi)
|
||||
}
|
||||
|
||||
return mi
|
||||
}
|
||||
|
||||
LinkedHashMap serialisationdata() {
|
||||
def data = [
|
||||
'format' : format,
|
||||
'productinfo' : productinfo.serialisationdata(),
|
||||
'gitinfo' : gitinfo.serialisationdata(),
|
||||
'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(),
|
||||
'buildstampinfo' : buildstampinfo.serialisationdata(),
|
||||
'releaseinfo' : releaseinfo.serialisationdata(),
|
||||
'configuration' : configurationinfoserialised(),
|
||||
'checksuminfo' : checksuminfo.serialisationdata(),
|
||||
'publishableinfo' : publishableinfoserialised(),
|
||||
'custominfo' : custominfo,
|
||||
'associatedmeta' : associatedmetaserialised(),
|
||||
]
|
||||
return data
|
||||
}
|
||||
|
||||
static String folder() {
|
||||
return METAFOLDERNAME
|
||||
}
|
||||
|
||||
String generateartifacts(ArrayList<String> releasedfromhere = new ArrayList<String>(), // These items are recorded in meta as released from here
|
||||
ArrayList<String> releasedfromsubmeta = new ArrayList<String>(), // These items are not recorded in meta as released from here
|
||||
String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}"
|
||||
) {
|
||||
def String artifactlist = METAARTIFACTS
|
||||
releaseinfo.addReleaseItem(METAARTIFACTS)
|
||||
for (releaseitem in releasedfromhere) {
|
||||
artifactlist += "," + releaseitem
|
||||
releaseinfo.addReleaseItem(releaseitem)
|
||||
}
|
||||
for (releaseitem in releasedfromsubmeta) {
|
||||
artifactlist += "," + releaseitem
|
||||
}
|
||||
saveJsonSerialised(metafilepath)
|
||||
return artifactlist
|
||||
}
|
||||
|
||||
// Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java
|
||||
private ArrayList<RelatedMetaInfo> releasewalkerp(int maxdepth, ArrayList<RelatedMetaInfo> releasemetacollection, String pathsofar) {
|
||||
if (maxdepth > 0) {
|
||||
if (releaseinfo.releaserepoURL) {
|
||||
RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this)
|
||||
releasemetacollection.add(rmi)
|
||||
}
|
||||
if (pathsofar) {
|
||||
pathsofar += "/"
|
||||
}
|
||||
for (relatedmetainfo in associatedmeta) {
|
||||
MetaInfo othermeta = relatedmetainfo.meta
|
||||
String newpathsofar = pathsofar + relatedmetainfo.offsetpath
|
||||
releasemetacollection = othermeta.releasewalkerp(maxdepth - 1, releasemetacollection, newpathsofar)
|
||||
}
|
||||
}
|
||||
return releasemetacollection
|
||||
}
|
||||
|
||||
ArrayList<RelatedMetaInfo> releasewalker(int maxdepth, String startpath = "") {
|
||||
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
||||
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
||||
return releasemetacollection
|
||||
}
|
||||
|
||||
String componentidentifier() {
|
||||
return productinfo.productname + "_" + productinfo.subcomponentname
|
||||
}
|
||||
|
||||
String componentversionuniqueidentifier() {
|
||||
return componentidentifier() + "_" + buildstampinfo.buildstamp
|
||||
}
|
||||
|
||||
String globalreleasetag() {
|
||||
return componentversionuniqueidentifier() + "_" + jenkinsbuildinfo.buildnumber
|
||||
}
|
||||
|
||||
String releasetag() {
|
||||
return buildstampinfo.buildstamp + "_" + jenkinsbuildinfo.buildnumber
|
||||
}
|
||||
|
||||
String releasetagfordebpackage() {
|
||||
return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber
|
||||
}
|
||||
|
||||
Map<String, RelatedMetaInfo> putwithshortestoffsetpath(Map<String, RelatedMetaInfo> releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) {
|
||||
if (releasemetacollection.containsKey(uniquestring)) {
|
||||
def existingentry = releasemetacollection[uniquestring]
|
||||
if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) {
|
||||
releasemetacollection.put(uniquestring, relatedmetainfo)
|
||||
}
|
||||
} else {
|
||||
releasemetacollection.put(uniquestring, relatedmetainfo)
|
||||
}
|
||||
return releasemetacollection
|
||||
}
|
||||
|
||||
Map<String, RelatedMetaInfo> releasewalkerunique(int maxdepth, String startpath = "") {
|
||||
def ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
||||
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
||||
|
||||
def Map<String, RelatedMetaInfo> releasemetauniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
|
||||
for (relatedmetainfo in releasemetacollection) {
|
||||
def String uniquestring = relatedmetainfo.meta.componentidentifier()
|
||||
releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo)
|
||||
}
|
||||
|
||||
return releasemetauniquecollection
|
||||
}
|
||||
|
||||
Map<String, RelatedMetaInfo> releasewalkerversionunique(int maxdepth, String startpath = "") {
|
||||
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
||||
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
||||
|
||||
def Map<String, RelatedMetaInfo> releasemetaversionuniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
|
||||
for (relatedmetainfo in releasemetacollection) {
|
||||
def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier()
|
||||
releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo)
|
||||
}
|
||||
|
||||
return releasemetaversionuniquecollection
|
||||
}
|
||||
|
||||
MetaInfo getNewMetaObject(script) {
|
||||
return new MetaInfo(script)
|
||||
}
|
||||
}
|
||||
|
||||
MetaInfo metareset(script) {
|
||||
echo "Resetting meta folder"
|
||||
def mi = new MetaInfo(script)
|
||||
|
||||
dir(mi.folder()) {
|
||||
deleteDir()
|
||||
}
|
||||
|
||||
return mi
|
||||
}
|
||||
|
||||
MetaInfo metafromfolder(String folder = "") {
|
||||
MetaInfo buildmeta = new MetaInfo(this)
|
||||
buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}")
|
||||
return buildmeta
|
||||
}
|
||||
|
||||
MetaInfo metafromfolderSlurper(String folder = "") {
|
||||
MetaInfo buildmeta = new MetaInfo(this)
|
||||
buildmeta.deserialiseJsonSlurper("${folder}/${MetaInfo.metafilepath()}")
|
||||
return buildmeta
|
||||
}
|
||||
|
||||
return this;
|
||||
107
Common_scripts/packaging/debian.groovy
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
class DebRootDefinition {
|
||||
String ROOTPATH
|
||||
String PACKAGE_PREFIX
|
||||
String PACKAGE_FOLDER_NAME
|
||||
String PACKAGE_NAME
|
||||
String UNIQUE_PACKAGE_NAME
|
||||
|
||||
String PACKAGE_SOURCE_ROOT
|
||||
String PACKAGE_SOURCE_FOLDER_NAME
|
||||
String DEBPATH
|
||||
|
||||
String ETC
|
||||
String GIS_OPT_BIN
|
||||
String GIS_OPT_LIB
|
||||
String GIS_OPT_SCRIPTS_APP
|
||||
String GIS_OPT_SCRIPTS_EL
|
||||
String GIS_OPT_SCRIPTS_CONTROL
|
||||
String GIS_OPT_WWW
|
||||
String GIS_OPT_OTHER
|
||||
String GIS_OPT_KERNEL
|
||||
String GIS_OPT_LOGIC
|
||||
String GIS_OPT_PRINTHEAD
|
||||
|
||||
String USR_BIN
|
||||
String USR_LIB_ARCH
|
||||
String LIB_FIRMWARE
|
||||
String HTTP_DEV_DIV
|
||||
String LIB_SYSTEMD
|
||||
|
||||
DebRootDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix) {
|
||||
ROOTPATH = rootpath
|
||||
PACKAGE_PREFIX = packageprefix
|
||||
PACKAGE_FOLDER_NAME = packageprefix
|
||||
PACKAGE_NAME = packageprefix + "_armhf.deb"
|
||||
UNIQUE_PACKAGE_NAME = packageprefix + "_" + buildstamp + "_armhf.deb"
|
||||
|
||||
PACKAGE_SOURCE_ROOT = packagesourceroot
|
||||
PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}"
|
||||
DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}"
|
||||
|
||||
ETC = "${DEBPATH}/etc" + inpackagepathsuffix
|
||||
GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + inpackagepathsuffix
|
||||
GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + inpackagepathsuffix
|
||||
GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + inpackagepathsuffix
|
||||
GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + inpackagepathsuffix
|
||||
GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" + inpackagepathsuffix
|
||||
GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + inpackagepathsuffix
|
||||
GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + inpackagepathsuffix
|
||||
GIS_OPT_KERNEL = "${DEBPATH}/opt/gis/kernel" + inpackagepathsuffix
|
||||
GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + inpackagepathsuffix
|
||||
GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + inpackagepathsuffix
|
||||
|
||||
USR_BIN = "${DEBPATH}/usr/bin" + inpackagepathsuffix
|
||||
USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + inpackagepathsuffix
|
||||
LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + inpackagepathsuffix
|
||||
HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + inpackagepathsuffix
|
||||
LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + inpackagepathsuffix
|
||||
}
|
||||
}
|
||||
|
||||
def DebRootDefinition debDefinition(String rootpath, String packagesourceroot, String packageprefix, String buildstamp, String inpackagepathsuffix = '') {
|
||||
return new DebRootDefinition(rootpath, packagesourceroot, packageprefix, buildstamp, inpackagepathsuffix)
|
||||
}
|
||||
|
||||
def buildPackage(String packageout, String uniquepackageout, DebRootDefinition packagedefs, String password) {
|
||||
try {
|
||||
sh """#!/bin/bash
|
||||
# Exit if any command fails
|
||||
set -xe
|
||||
|
||||
echo "${password}" | sudo -S echo
|
||||
|
||||
cp -v -r "${packagedefs.PACKAGE_SOURCE_ROOT}/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}"
|
||||
|
||||
sudo chown -v -R root: "${packagedefs.DEBPATH}"
|
||||
|
||||
mkdir -v -p "${packageout}"
|
||||
echo "Building package:"
|
||||
dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}"
|
||||
|
||||
mkdir -v -p "${uniquepackageout}"
|
||||
cp "${packageout}/${packagedefs.PACKAGE_NAME}" "${uniquepackageout}/${packagedefs.UNIQUE_PACKAGE_NAME}"
|
||||
|
||||
echo "Showing package:"
|
||||
dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}"
|
||||
echo "Showing package contents:"
|
||||
dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}"
|
||||
|
||||
echo "Showing package lintian output:"
|
||||
lintian --suppress-tags dir-or-file-in-opt "${packageout}/${packagedefs.PACKAGE_NAME}" || true
|
||||
|
||||
sudo chown -R ${USER}: "${packagedefs.DEBPATH}"
|
||||
"""
|
||||
}
|
||||
catch (Exception e) {
|
||||
echo "Exception occurred"
|
||||
sh """#!/bin/bash -v
|
||||
echo "${password}" | sudo -S echo
|
||||
|
||||
sudo chown -R ${USER}: "${packagedefs.DEBPATH}"
|
||||
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
5
Common_scripts/platform/lineendings.groovy
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
// Put ${nl} into strings when wanting a newline
|
||||
nl = System.properties['line.separator']
|
||||
|
||||
return this;
|
||||
9
Common_scripts/publish/.classpath
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry excluding="publish.groovy" kind="src" path=""/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||
<classpathentry kind="lib" path="/home/dan/.sdkman/candidates/groovy/2.5.6/lib/groovy-json-2.5.6.jar"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
||||
7
Common_scripts/publish/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/do$_publish_closure4.class
|
||||
/do$_resetfolders_closure1.class
|
||||
/do$_resetfolders_closure2.class
|
||||
/do$_resetfolders_closure3.class
|
||||
/do$_stripgithistory_closure5.class
|
||||
/do.class
|
||||
/publish_item_select.class
|
||||
18
Common_scripts/publish/.project
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>publish_item_select</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
eclipse.preferences.version=1
|
||||
groovy.compiler.level=25
|
||||
groovy.script.filters=**/*.dsld,y,**/*.gradle,n
|
||||
174
Common_scripts/publish/do.groovy
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
import groovy.io.FileType
|
||||
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
|
||||
summaryfolder = "${WORKSPACE}/summary"
|
||||
summaryfile = "${summaryfolder}/summary.txt"
|
||||
summarystring = ""
|
||||
releaserepofolder = "${WORKSPACE}/releaserepos"
|
||||
filteredreleaserepofolder = "${WORKSPACE}/filteredreleaserepos"
|
||||
|
||||
def resetfolders() {
|
||||
dir(summaryfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(releaserepofolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(filteredreleaserepofolder) {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
def productuniquefolder(releasemeta) {
|
||||
return "${releasemeta.productinfo.productname}_${releasemeta.productinfo.subcomponentname}"
|
||||
}
|
||||
|
||||
def uniquereleasefolder(String productline, String softwarerelease, releasemeta) {
|
||||
return "Software/${productline} ${softwarerelease}/${productuniquefolder(releasemeta)}"
|
||||
}
|
||||
|
||||
def uniqueabsoluterreleasefolder(String productline, String releaserepofolder, String softwarerelease, releasemeta) {
|
||||
return "${releaserepofolder}/${uniquereleasefolder(productline, softwarerelease, releasemeta)}"
|
||||
}
|
||||
|
||||
def preconditions() {
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
summarystring = ""
|
||||
writeFile(file: summaryfile, text: "Publish summary: \n")
|
||||
}
|
||||
|
||||
def setunstable(String reason) {
|
||||
markunstable = true
|
||||
unstablereason = reason
|
||||
}
|
||||
|
||||
def summaryappend(String summary) {
|
||||
def String currentsummarycontents = readFile(file: summaryfile)
|
||||
writeFile(file: summaryfile, text: currentsummarycontents + summary)
|
||||
summarystring += summary
|
||||
}
|
||||
|
||||
def guessreporootsuffix(componentURL) {
|
||||
def guess = componentURL.replaceFirst(/.*\/(.*).git/, '$1')
|
||||
return guess
|
||||
}
|
||||
|
||||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
def getcomponentartifacts(releaseinfo, String repofolder, itempathstopublish) {
|
||||
summaryappend("Artifacts: ")
|
||||
|
||||
def releasemeta = releaseinfo.meta
|
||||
def String componentURL = releasemeta.releaseinfo.releaserepoURL
|
||||
def String revision = "refs/tags/${releasemeta.buildstampinfo.buildstamp}_${releasemeta.jenkinsbuildinfo.buildnumber}"
|
||||
def publishableitems = releasemeta.publishableinfo
|
||||
|
||||
def ArrayList<String> publishablepaths = new ArrayList<String>()
|
||||
if (publishableitems.size() > 0) {
|
||||
for (publishableitem in publishableitems) {
|
||||
def String productuniquepublishableitem = "${productuniquefolder(releasemeta)}/${publishableitem.filepath}"
|
||||
echo "publishableitem: ${productuniquepublishableitem}"
|
||||
if (itempathstopublish.size() == 0 || productuniquepublishableitem in itempathstopublish) {
|
||||
publishablepaths.add(publishableitem.filepath)
|
||||
summaryappend("${publishableitem.filepath},")
|
||||
}
|
||||
}
|
||||
}
|
||||
if (publishablepaths.size() > 0) {
|
||||
def reporootsuffix = guessreporootsuffix(componentURL)
|
||||
gh.gitCheckoutAlt(componentURL, revision, repofolder, reporootsuffix, 1, true, publishablepaths) // Shallow clone
|
||||
}
|
||||
else {
|
||||
summaryappend("None ")
|
||||
}
|
||||
}
|
||||
|
||||
def publish(hostedftpsiteinfo, String customer, String finalreleaserepofolder = releaserepofolder) {
|
||||
summaryappend(" FTP operations: ")
|
||||
|
||||
def String ftproot = "${hostedftpsiteinfo.workingdirectory}${customer}"
|
||||
dir(finalreleaserepofolder) {
|
||||
summaryappend("FTP operations: Transferring to ${ftproot}")
|
||||
sh """#!/bin/bash
|
||||
ncftpput -u ${hostedftpsiteinfo.username} -p ${hostedftpsiteinfo.password} -R ${hostedftpsiteinfo.url} "${ftproot}" .
|
||||
"""
|
||||
summaryappend(", Transferred ")
|
||||
}
|
||||
}
|
||||
|
||||
def copydirectory(File dirFrom, File dirTo) {
|
||||
if (!dirTo.exists()) {
|
||||
dirTo.mkdirs();
|
||||
}
|
||||
dirFrom.eachFile(FileType.FILES) { File source ->
|
||||
File target = new File(dirTo, source.getName())
|
||||
target.bytes = source.bytes
|
||||
}
|
||||
dirFrom.eachFile(FileType.DIRECTORIES) { File source ->
|
||||
File target = new File(dirTo, source.getName())
|
||||
copyLargeDir(source, target)
|
||||
}
|
||||
}
|
||||
|
||||
def recallcomponent(String productline, releaseinfo, String softwarerelease, itempathstopublish) {
|
||||
def releasemeta = releaseinfo.meta
|
||||
def String uniquefolderforrepo = uniqueabsoluterreleasefolder(productline, releaserepofolder, softwarerelease, releasemeta)
|
||||
|
||||
summaryappend("${releasemeta.productinfo.productname} ${releasemeta.productinfo.subcomponentname}: ")
|
||||
|
||||
getcomponentartifacts(releaseinfo, uniquefolderforrepo, itempathstopublish)
|
||||
|
||||
summaryappend("\n")
|
||||
}
|
||||
|
||||
def convertitemstopublish(String itemstopublishstring) {
|
||||
def List paths = []
|
||||
|
||||
def String[] items = itemstopublishstring.split(',')
|
||||
def String allpaths = ""
|
||||
for(String item : items) {
|
||||
def String[] pathitems = item.split('#')
|
||||
def String path = "${pathitems[0]}_${pathitems[1]}/${pathitems[2]}"
|
||||
paths.add(path)
|
||||
allpaths += "${path}\n"
|
||||
}
|
||||
echo "Selected item to publish:\n${allpaths}"
|
||||
return paths
|
||||
}
|
||||
|
||||
// Publish selected items from a release to the customer folder on the ftp site
|
||||
// itemstopublishstring is a comma-seperated set of strings in this format <ProductName>#<ComponentName>#<PathToPublishableItem>
|
||||
def publishhierarchy(hostedftpsiteinfo, releasemeta, String itemstopublishstring, String customer, String softwarerelease, String maxdepth) {
|
||||
int md = maxdepth.toInteger()
|
||||
resetfolders()
|
||||
preconditions()
|
||||
|
||||
def productline = releasemeta.productinfo.productname
|
||||
// Walk the meta information to a max depth, looking for artifacts to publish
|
||||
def componentReleaseInfoVersionUnique = releasemeta.releasewalkerversionunique(md)
|
||||
|
||||
echo "Version unique components:"
|
||||
def String versionuniquecomponent = ""
|
||||
for (key in componentReleaseInfoVersionUnique.keySet()) {
|
||||
versionuniquecomponent += "${key}\n"
|
||||
}
|
||||
echo versionuniquecomponent
|
||||
|
||||
def itempathstopublish = convertitemstopublish(itemstopublishstring)
|
||||
for (key in componentReleaseInfoVersionUnique.keySet()) {
|
||||
def releaseinfo = componentReleaseInfoVersionUnique[key]
|
||||
recallcomponent(productline, releaseinfo, softwarerelease, itempathstopublish)
|
||||
}
|
||||
gh.stripgithistory(releaserepofolder)
|
||||
publish(hostedftpsiteinfo, customer)
|
||||
|
||||
return [summarystring, markunstable, unstablereason]
|
||||
}
|
||||
|
||||
def publishhierarchy(hostedftpsiteinfo, releasemeta, String customer, String softwarerelease, String maxdepth) {
|
||||
return publishhierarchy(hostedftpsiteinfo, releasemeta, "", customer, softwarerelease, maxdepth)
|
||||
}
|
||||
|
||||
return this;
|
||||
176
Common_scripts/publish/package.groovy
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = "origin/3.6.3_linux"
|
||||
}
|
||||
else {
|
||||
PYTHONBRANCH = "origin/3.6.3_windows"
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
PYTHONROOTDIR = 'python'
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR)
|
||||
if (isUnix()) {
|
||||
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
|
||||
}
|
||||
else {
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
PACKAGEDEST = "${WORKSPACE}/package"
|
||||
cleanfolders = [
|
||||
PACKAGEDEST,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying package artifacts') {
|
||||
steps {
|
||||
script {
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
packagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGEDEST)
|
||||
PACKAGE_FOLDER = "${PACKAGEDEST}/package"
|
||||
UNIQUE_PACKAGE_FOLDER = "${PACKAGEDEST}/uniquepackage"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Aptly environment') {
|
||||
steps {
|
||||
script {
|
||||
echo "Aptly config file is ${APTLY_CONFIG_FILE}"
|
||||
sh """#!/bin/bash -v
|
||||
aptly config show
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create repo - if not already there') {
|
||||
steps {
|
||||
script {
|
||||
echo "Repo name is ${REPO_NAME}"
|
||||
sh """#!/bin/bash -v
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then
|
||||
echo "aptly repo ${REPO_NAME} does not exist; Creating it"
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" create "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
fi
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" -with-packages show "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Drop published repo - if any') {
|
||||
steps {
|
||||
script {
|
||||
sh """#!/bin/bash -v
|
||||
# This errors if the published repo exists already; Ignore it
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" drop "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}"
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" list
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Add/update package in repo') {
|
||||
steps {
|
||||
script {
|
||||
echo "Unique package folder is ${UNIQUE_PACKAGE_FOLDER}"
|
||||
sh """#!/bin/bash -v
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" add "${REPO_NAME}" "${UNIQUE_PACKAGE_FOLDER}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly repo -config="${APTLY_CONFIG_FILE}" show -with-packages "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create snapshot') {
|
||||
steps {
|
||||
script {
|
||||
echo "Snapshot name is ${SNAPSHOT_NAME}"
|
||||
FULL_SNAPSHOT_NAME = "${REPO_NAME}_${SNAPSHOT_NAME}"
|
||||
PACKAGE_VERSION_PREFIX = packagemeta.buildstampinfo.buildstampprefix
|
||||
echo "Full Snapshot name is ${FULL_SNAPSHOT_NAME} containing packages of versions beginning with: ${PACKAGE_VERSION_PREFIX}"
|
||||
// Convert prefix to regular expression
|
||||
PACKAGE_VERSION_PREFIX_SPLIT = PACKAGE_VERSION_PREFIX.split("[.]")
|
||||
PACKAGE_VERSION_REGEX = ''
|
||||
i = 0
|
||||
while(true) {
|
||||
if (i == PACKAGE_VERSION_PREFIX_SPLIT.size() - 1) {
|
||||
PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i]
|
||||
break;
|
||||
}
|
||||
PACKAGE_VERSION_REGEX += PACKAGE_VERSION_PREFIX_SPLIT[i]
|
||||
PACKAGE_VERSION_REGEX += '\\.'
|
||||
i++
|
||||
}
|
||||
sh """#!/bin/bash -v
|
||||
# This errors if the snapshot exists already; Ignore it
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "${FULL_SNAPSHOT_NAME}"
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" drop "All_${FULL_SNAPSHOT_NAME}"
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" create "All_${FULL_SNAPSHOT_NAME}" from repo "${REPO_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
aptly snapshot filter -config="/home/repos/gis-aptly-config/gis.conf" "All_${FULL_SNAPSHOT_NAME}" "${FULL_SNAPSHOT_NAME}" 'Version (~ .*${PACKAGE_VERSION_REGEX}.*)'
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly snapshot -config="${APTLY_CONFIG_FILE}" -with-packages show "${FULL_SNAPSHOT_NAME}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Publish snapshot') {
|
||||
steps {
|
||||
script {
|
||||
sh """#!/bin/bash -v
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" -distribution="${DISTRIBUTION}" -component="${COMPONENT}" -gpg-key="${GPG_KEY_ID}" snapshot "${FULL_SNAPSHOT_NAME}" "${PUBLISH_PATH_PREFIX}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" list
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
aptly publish -config="${APTLY_CONFIG_FILE}" show "${DISTRIBUTION}" "${PUBLISH_PATH_PREFIX}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
179
Common_scripts/publish/promptingpublish.groovy
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean folders') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout release repo') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
SOURCEURL = RELEASE_REPO
|
||||
SOURCEREVISION = "origin/master"
|
||||
SOURCEDIR = "${WORKSPACE}/whole"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Identify customer to publish to') {
|
||||
steps {
|
||||
script {
|
||||
hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy")
|
||||
def List<String> customers = hostedftb.getCustomerList()
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
customer = input(
|
||||
message: 'Please select customer to publish to',
|
||||
ok: 'Ok',
|
||||
parameters: [
|
||||
choice(name: 'customer', choices: customers, description: 'Which customer?')
|
||||
]
|
||||
)
|
||||
echo "Chosen customer is: ${customer}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Identify software release to publish') {
|
||||
steps {
|
||||
script {
|
||||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
def allreleases = gh.gettaglist(SOURCEDIR)
|
||||
def releases = new ArrayList<String>()
|
||||
if (FILTER_REDUNDANT_RELEASES == 'false') {
|
||||
echo("Showing all releases")
|
||||
releases = allreleases
|
||||
} else {
|
||||
echo("Showing filtered releases")
|
||||
for (release in allreleases) {
|
||||
if (!release.toLowerCase().startsWith("superceded") &&
|
||||
!release.toLowerCase().startsWith("erroneous") &&
|
||||
!release.toLowerCase().startsWith("faulty") &&
|
||||
!release.toLowerCase().startsWith("ignore") &&
|
||||
!release.toLowerCase().startsWith("inmainline")) {
|
||||
echo("Showing release: ${release}")
|
||||
releases.add(release)
|
||||
} else {
|
||||
echo("Not showing release: ${release}")
|
||||
}
|
||||
}
|
||||
}
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
release = input(
|
||||
message: 'Please select the software version',
|
||||
ok: 'Ok',
|
||||
parameters: [
|
||||
choice(name: 'release', choices: releases, description: 'Which software release?')
|
||||
]
|
||||
)
|
||||
echo "Chosen software version is: ${release}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout release repo at selected software version') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEURL = RELEASE_REPO
|
||||
SOURCEREVISION = "refs/tags/${release}"
|
||||
SOURCEDIR = "${WORKSPACE}/whole"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Get release artifact info') {
|
||||
steps {
|
||||
script {
|
||||
def mfs = autobuilderscript.getmetafolderscript()
|
||||
releasemeta = mfs.metafromfolder(SOURCEDIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Select which items from software release to publish') {
|
||||
steps {
|
||||
script {
|
||||
publishitems = load("${autobuilder.commonscripts()}/publish/publishitems.groovy")
|
||||
timeout(time: 10, unit: 'MINUTES') {
|
||||
def itemsobject = publishitems.createItemSelector(
|
||||
'Select software items',
|
||||
'Software items',
|
||||
releasemeta,
|
||||
ITEMSDEFAULTLIST,
|
||||
MAX_META_DEPTH,
|
||||
'20',
|
||||
'PT_MULTI_SELECT')
|
||||
selecteditems = input(
|
||||
message: 'Select which items from the release are to be published',
|
||||
ok: 'Ok',
|
||||
parameters: [
|
||||
itemsobject.multiSelect()
|
||||
]
|
||||
)
|
||||
echo "Chosen items are: ${selecteditems}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Publish components') {
|
||||
steps {
|
||||
script {
|
||||
def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy")
|
||||
def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo()
|
||||
(summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, selecteditems, customer, release, MAX_META_DEPTH)
|
||||
if (markunstable) {
|
||||
env.unstablereason = unstablereason
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts()
|
||||
archiveArtifacts "summary/**,${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Summarise') {
|
||||
steps {
|
||||
script {
|
||||
echo "Summary:\n${summarystring}\n"
|
||||
if (env.unstablereason) {
|
||||
echo "Instability reason: ${env.unstablereason}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
91
Common_scripts/publish/publish.groovy
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean folders') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout release repo') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
SOURCEURL = RELEASE_REPO
|
||||
SOURCEREVISION = "refs/tags/${SOFTWARE_RELEASE}"
|
||||
SOURCEDIR = "${WORKSPACE}/whole"
|
||||
SOURCEROOTDIR = 'whole'
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'whole', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Get release artifact meta') {
|
||||
steps {
|
||||
script {
|
||||
def mfs = autobuilderscript.getmetafolderscript()
|
||||
releasemeta = mfs.metafromfolder(SOURCEDIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Publish components') {
|
||||
steps {
|
||||
script {
|
||||
def publisher = load("${autobuilder.commonscripts()}/publish/do.groovy")
|
||||
def hostedftb = load("${autobuilder.commonscripts()}/remoteaccess/hostedftp.groovy")
|
||||
def hostedftpsiteinfo = hostedftb.getHostedFTPSiteInfo()
|
||||
(summarystring, markunstable, unstablereason) = publisher.publishhierarchy(hostedftpsiteinfo, releasemeta, ITEMS_TO_PUBLISH, CUSTOMER, SOFTWARE_RELEASE, MAX_META_DEPTH)
|
||||
if (markunstable) {
|
||||
env.unstablereason = unstablereason
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts()
|
||||
archiveArtifacts "summary/**,${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Summarise') {
|
||||
steps {
|
||||
script {
|
||||
echo "Summary:\n${summarystring}\n"
|
||||
if (env.unstablereason) {
|
||||
echo "Instability reason: ${env.unstablereason}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
127
Common_scripts/publish/publishitems.groovy
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition
|
||||
|
||||
class PublishableItemsSelection {
|
||||
def script
|
||||
def ArrayList<String> preselectedmenuitems
|
||||
def ArrayList<String> menuitemdescriptions
|
||||
def ArrayList<String> menuitemsfull
|
||||
def ExtendedChoiceParameterDefinition multiselect
|
||||
|
||||
PublishableItemsSelection(script) {
|
||||
this.script = script
|
||||
preselectedmenuitems = new ArrayList<String>()
|
||||
menuitemdescriptions = new ArrayList<String>()
|
||||
menuitemsfull = new ArrayList<String>()
|
||||
}
|
||||
|
||||
def init(
|
||||
String name,
|
||||
String description,
|
||||
releasemeta,
|
||||
String preselectedext,
|
||||
String metalevelsstringext,
|
||||
String visibleItemCountExt,
|
||||
String controltype) {
|
||||
outputSelectionfromPreselect(preselectedmenuitems, preselectedext)
|
||||
def Integer metalevelsext = metalevelsstringext.toInteger()
|
||||
def Integer visibleItemCount = visibleItemCountExt.toInteger()
|
||||
def metaitems = releasemeta.releasewalkerunique(metalevelsext)
|
||||
for (key in metaitems.keySet()) {
|
||||
def releaseinfo = metaitems[key]
|
||||
outputDescription(menuitemdescriptions, releaseinfo)
|
||||
outputSelection(menuitemsfull, releaseinfo)
|
||||
}
|
||||
|
||||
script.echo("name is: ${name}")
|
||||
script.echo("description is: ${description}")
|
||||
script.echo("menuitemsfull is: ${menuitemsfull}")
|
||||
script.echo("preselectedmenuitems is: ${preselectedmenuitems}")
|
||||
script.echo("menuitemdescriptions is: ${menuitemdescriptions}")
|
||||
script.echo("visibleItemCount is: ${visibleItemCount}")
|
||||
script.echo("controltype is: ${controltype}")
|
||||
|
||||
def seperator = ","
|
||||
visibleItemCount = Math.min(visibleItemCount, menuitemsfull.size())
|
||||
script.echo("visibleItemCount is now: ${visibleItemCount}")
|
||||
|
||||
multiselect = new ExtendedChoiceParameterDefinition(
|
||||
name, // String name
|
||||
controltype, // String type
|
||||
menuitemsfull.join(seperator), // String value
|
||||
"project name", // String projectName
|
||||
"", // String propertyFile
|
||||
"", // String groovyScript
|
||||
"", // String groovyScriptFile
|
||||
"", // String bindings
|
||||
"", // String groovyClasspath
|
||||
"", // String propertyKey
|
||||
preselectedmenuitems.join(seperator),// String defaultValue
|
||||
"", // String defaultPropertyFile
|
||||
"", // String defaultGroovyScript
|
||||
"", // String defaultGroovyScriptFile
|
||||
"", // String defaultBindings
|
||||
"", // String defaultGroovyClasspath
|
||||
"", // String defaultPropertyKey
|
||||
menuitemdescriptions.join(seperator),// String descriptionPropertyValue
|
||||
"", // String descriptionPropertyFile
|
||||
"", // String descriptionGroovyScript
|
||||
"", // String descriptionGroovyScriptFile
|
||||
"", // String descriptionBindings
|
||||
"", // String descriptionGroovyClasspath
|
||||
"", // String descriptionPropertyKey
|
||||
"", // String javascriptFile
|
||||
"", // String javascript
|
||||
false, // boolean saveJSONParameterToFile
|
||||
false, // boolean quoteValue
|
||||
visibleItemCount, // int visibleItemCount
|
||||
description, // String description
|
||||
seperator) // String multiSelectDelimiter
|
||||
}
|
||||
|
||||
def outputSelectionfromPreselect(menuitems, preselectedext) {
|
||||
script.echo ("preselectext: ${preselectedext}")
|
||||
def menuitemstemp = preselectedext.split(',')
|
||||
script.echo ("Menuitemstemp: ${menuitemstemp}")
|
||||
|
||||
for (menuitem in menuitemstemp) {
|
||||
menuitems.add(menuitem.trim())
|
||||
}
|
||||
}
|
||||
|
||||
def outputDescription(menuitems, releaseinfo) {
|
||||
def meta = releaseinfo.meta
|
||||
|
||||
for (publishableitem in meta.publishableinfo) {
|
||||
menuitems.add("${meta.productinfo.productname} ${meta.productinfo.subcomponentname} ${publishableitem.filepath}")
|
||||
}
|
||||
}
|
||||
|
||||
def outputSelection(menuitems, releaseinfo) {
|
||||
def meta = releaseinfo.meta
|
||||
|
||||
for (publishableitem in meta.publishableinfo) {
|
||||
menuitems.add("${meta.productinfo.productname}#${meta.productinfo.subcomponentname}#${publishableitem.filepath}")
|
||||
}
|
||||
}
|
||||
|
||||
def multiSelect() {
|
||||
return multiselect
|
||||
}
|
||||
}
|
||||
|
||||
PublishableItemsSelection createItemSelector(
|
||||
String name,
|
||||
String description,
|
||||
releasemeta,
|
||||
String preselectedext,
|
||||
String metalevelsstringext,
|
||||
String visibleItemCountExt = '20',
|
||||
String type = 'PT_CHECKBOX') { // Could also be "PT_MULTI_SELECT"
|
||||
PublishableItemsSelection pis = new PublishableItemsSelection(this)
|
||||
|
||||
pis.init(name, description, releasemeta, preselectedext, metalevelsstringext, visibleItemCountExt, type)
|
||||
|
||||
return pis
|
||||
}
|
||||
|
||||
return this;
|
||||
27
Common_scripts/publishing/utils.groovy
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
|
||||
// The filepath must end in "<folder>/**" or "<folder>/" - Glob wildcard - as a git sparse checkout
|
||||
def allowed(String filepath) {
|
||||
if (filepath.endsWith('/**') || filepath.endsWith('/')) {
|
||||
def files = findFiles glob: filepath
|
||||
if (files.length > 0) {
|
||||
return
|
||||
} else {
|
||||
error "There are no files/folders under the publishable item: ${filepath}"
|
||||
}
|
||||
}
|
||||
error "The publishable item: ${filepath} does not end in <folder>/** or <folder>/ (for git sparse checkouts)"
|
||||
}
|
||||
|
||||
// Generate a list of artifact files that are publishable to outside parties
|
||||
def generatelist(meta, publishable) {
|
||||
filelist = []
|
||||
for (filepath in publishable) {
|
||||
if (filepath != meta.METAARTIFACTS) {
|
||||
allowed(filepath)
|
||||
}
|
||||
meta.addPublishable(filepath)
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
442
Common_scripts/release/do.groovy
Normal file
|
|
@ -0,0 +1,442 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
|
||||
summaryfolder = "${WORKSPACE}/summary"
|
||||
summaryfile = "${summaryfolder}/summary.txt"
|
||||
summarystring = ""
|
||||
repoandtagsfile = "${summaryfolder}/repoandtags.txt"
|
||||
repoandtagsstring = ""
|
||||
releaserepofolder = "${WORKSPACE}/releaserepos"
|
||||
sourcerepofolder = "${WORKSPACE}/sourcerepos"
|
||||
tempfolder = "${WORKSPACE}/temp"
|
||||
gitrevparseoutputfile = "${tempfolder}/gitrevparse.out"
|
||||
|
||||
metascript = autobuilder.getmetafolderscript()
|
||||
|
||||
def resetfolders() {
|
||||
dir(summaryfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(releaserepofolder) {
|
||||
deleteDir()
|
||||
}
|
||||
dir(tempfolder) {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
def preconditions() {
|
||||
markunstable = false
|
||||
unstablereason = ""
|
||||
summarystring = ""
|
||||
writeFile(file: summaryfile, text: "Release summary: \n")
|
||||
repoandtagsstring = ""
|
||||
writeFile(file: repoandtagsfile, text: "Repository summary: \n")
|
||||
}
|
||||
|
||||
def setunstable(String reason) {
|
||||
markunstable = true
|
||||
unstablereason += reason + "\n"
|
||||
echo "Marked build as unstable: Reason: ${reason}"
|
||||
}
|
||||
|
||||
def summaryappend(String summary) {
|
||||
def String currentsummarycontents = readFile(file: summaryfile)
|
||||
writeFile(file: summaryfile, text: currentsummarycontents + summary)
|
||||
summarystring += summary
|
||||
}
|
||||
|
||||
def repoandtagsappend(String summary) {
|
||||
def String repoandtagscontents = readFile(file: repoandtagsfile)
|
||||
writeFile(file: repoandtagsfile, text: repoandtagscontents + summary)
|
||||
repoandtagsstring += summary
|
||||
}
|
||||
|
||||
def getpreviousreleasemeta(buildmeta, String checkoutfolder) {
|
||||
def previousreleasemeta = buildmeta.getNewMetaObject(this)
|
||||
// See if there is meta data file from the current release
|
||||
def String releasemetafolderpath = "${checkoutfolder}/${buildmeta.folder()}"
|
||||
if (fileExists(releasemetafolderpath)) {
|
||||
previousreleasemeta = metascript.metafromfolder(checkoutfolder)
|
||||
}
|
||||
return previousreleasemeta
|
||||
}
|
||||
|
||||
def checkoutreleaserepo(buildmeta, String checkoutfolder) {
|
||||
def String releaserepo = buildmeta.releaseinfo.releaserepoURL
|
||||
// Get the latest head revision of the release repo without checking out working copy; Check out to a folder unique to component; Extract any meta
|
||||
repoandtagsappend(" Release repo: ${releaserepo}")
|
||||
def previousreleasemeta = buildmeta.getNewMetaObject(this)
|
||||
dir(releaserepofolder) {
|
||||
sh("git clone ${releaserepo} ${checkoutfolder}")
|
||||
}
|
||||
previousreleasemeta = getpreviousreleasemeta(buildmeta, checkoutfolder)
|
||||
dir(checkoutfolder) {
|
||||
// Clear all existing files - Note that this does not remove .git*
|
||||
sh("git rm -r *")
|
||||
}
|
||||
return previousreleasemeta
|
||||
}
|
||||
|
||||
def checkoutsourcerepo(buildmeta, String checkoutfolder) {
|
||||
def String sourcerepo = buildmeta.gitinfo.remoteurl
|
||||
if (sourcerepo) {
|
||||
repoandtagsappend(" Source repo: ${sourcerepo}")
|
||||
// Get the latest revision of the source repo without checking out working copy; Check out to a folder unique to component
|
||||
if (fileExists(checkoutfolder)) {
|
||||
dir(checkoutfolder) {
|
||||
sh("""
|
||||
git reset --hard
|
||||
git clean -fdx
|
||||
git pull
|
||||
# Remove all tags that are not already on the remote
|
||||
git tag -l | xargs git tag -d >/dev/null
|
||||
git fetch -t >/dev/null
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
else {
|
||||
dir(sourcerepofolder) {
|
||||
sh("git clone ${sourcerepo} ${checkoutfolder}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
repoandtagsappend(" Source repo: None")
|
||||
}
|
||||
}
|
||||
|
||||
def boolean getcomponentartifacts(toplevelbuildmeta, buildinfo, String repofolder, String tempfolder) {
|
||||
// Copy relevant artifacts to temp folder
|
||||
summaryappend("Artifacts: ")
|
||||
def boolean result = true
|
||||
for (artifactfilter in buildinfo.meta.releaseinfo.releaseitems) {
|
||||
def filterpath = artifactfilter
|
||||
if (buildinfo.offsetpath) {
|
||||
filterpath = buildinfo.offsetpath + '/' + artifactfilter
|
||||
}
|
||||
// Copy relevant artifacts to temp folder
|
||||
echo "Copying artifacts: ${filterpath} to ${tempfolder}"
|
||||
try {
|
||||
copyArtifacts(
|
||||
filter: filterpath,
|
||||
projectName: toplevelbuildmeta.jenkinsbuildinfo.buildjobname,
|
||||
selector: [
|
||||
$class: 'ParameterizedBuildSelector',
|
||||
parameterName: "<SpecificBuildSelector plugin='copyartifact@1.41'><buildNumber>${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}</buildNumber></SpecificBuildSelector>"
|
||||
],
|
||||
target: tempfolder
|
||||
)
|
||||
} catch (Exception e) {
|
||||
echo "Exception occurred while copying artifacts from ${toplevelbuildmeta.jenkinsbuildinfo.buildjobname}: ${e.getMessage()}"
|
||||
result = false
|
||||
summaryappend("Does not exist:")
|
||||
}
|
||||
if (result) {
|
||||
// Move relevant artifacts from temp folder to release position
|
||||
def originalrootdir = tempfolder + "/" + buildinfo.offsetpath
|
||||
dir(originalrootdir) {
|
||||
sh("mv * ${repofolder}")
|
||||
}
|
||||
}
|
||||
summaryappend("${artifactfilter},")
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
def releasegitadd() {
|
||||
// Add anything new
|
||||
sh("git add .")
|
||||
summaryappend("Add,")
|
||||
}
|
||||
|
||||
def releasegitreset() {
|
||||
// Add anything new
|
||||
sh("git reset --hard")
|
||||
sh("git clean -fdx")
|
||||
summaryappend("Reset,")
|
||||
}
|
||||
|
||||
def releasegitcommit(String buildstamp) {
|
||||
sh("git commit -a -m ${buildstamp}")
|
||||
summaryappend("Commit,")
|
||||
}
|
||||
|
||||
// Determine if there has been a change by comparing the sha code in previous release meta and the build meta
|
||||
def boolean checkforchange(buildmeta, previousreleasemeta) {
|
||||
String buildsha = buildmeta.gitinfo.gitrevision
|
||||
String previoussha = previousreleasemeta.gitinfo.gitrevision
|
||||
|
||||
def boolean shachanged = (buildsha != previoussha)
|
||||
echo "buildsha: ${buildsha} previoussha: ${previoussha} changed: ${shachanged}"
|
||||
|
||||
String buildstamp = buildmeta.buildstampinfo.buildstamp
|
||||
String previousbuildstamp = previousreleasemeta.buildstampinfo.buildstamp
|
||||
|
||||
def boolean buildstampchanged = (buildstamp != previousbuildstamp)
|
||||
echo "buildstamp: ${buildstamp} previousbuildstamp: ${previousbuildstamp} changed: ${buildstampchanged}"
|
||||
|
||||
def boolean changed = (shachanged | buildstampchanged)
|
||||
echo "changed: ${changed}"
|
||||
|
||||
return changed
|
||||
}
|
||||
|
||||
def ArrayList<String> maketaglist(buildmeta, String buildstamp, String otherreleasetags) {
|
||||
def ArrayList<String> taglist = new ArrayList<String>()
|
||||
taglist.add(buildstamp)
|
||||
|
||||
def ArrayList<String> othertaglist = otherreleasetags.split(',')
|
||||
for (othertagitem in othertaglist) {
|
||||
if (othertagitem?.trim()) {
|
||||
def componentothertagitem = "${othertagitem.trim()}_${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}"
|
||||
taglist.add(componentothertagitem)
|
||||
}
|
||||
}
|
||||
return taglist
|
||||
}
|
||||
|
||||
def String releasegitgetshacode(String tag) {
|
||||
def existingshacode = ""
|
||||
// Check if tag exists already
|
||||
def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" >\"${gitrevparseoutputfile}\" 2>/dev/null", returnStatus: true)
|
||||
if (gitrevparsestatus == 0) { // Tag exists
|
||||
existingshacode = readFile(file: gitrevparseoutputfile).trim()
|
||||
}
|
||||
return existingshacode
|
||||
}
|
||||
|
||||
def boolean releasegittag(String postcommitshacode, String tag) {
|
||||
def boolean tagadded = false
|
||||
// Check if tag exists already
|
||||
def String existingshacode = releasegitgetshacode(tag)
|
||||
if (existingshacode) { // Tag exists
|
||||
if (existingshacode != postcommitshacode) { // If the existing tag is not associated with the one expected
|
||||
// This is a problem - The tag is already at another position in git repo
|
||||
setunstable("The release tag ${tag} has been used at another commit other than one expected - You must decide what to do with it - Not good practice to delete it or move it (Existing sha code: ${existingshacode} Post commit sha code: ${postcommitshacode})")
|
||||
summaryappend("(${tag} - Could not add!)")
|
||||
} else {
|
||||
summaryappend("(${tag} - Already added)")
|
||||
}
|
||||
} else { // If tag does not exist already
|
||||
// Tag
|
||||
sh("git tag \"${tag}\"")
|
||||
summaryappend("(${tag})")
|
||||
tagadded = true
|
||||
}
|
||||
return tagadded
|
||||
}
|
||||
|
||||
def boolean releasegittags(String postcommitshacode, ArrayList<String> taglist) {
|
||||
boolean tagadded = false
|
||||
|
||||
summaryappend("Rel Tag ")
|
||||
for (tag in taglist) {
|
||||
if (releasegittag(postcommitshacode, tag)) {
|
||||
tagadded = true
|
||||
}
|
||||
}
|
||||
return tagadded
|
||||
}
|
||||
|
||||
def boolean sourcegittag(String shacode, String tag) {
|
||||
def boolean tagadded = false
|
||||
// Check if tag exists already
|
||||
def int gitrevparsestatus = sh(script: "git rev-parse \"${tag}\" >\"${gitrevparseoutputfile}\" 2>/dev/null", returnStatus: true)
|
||||
if (gitrevparsestatus == 0) { // Tag exists
|
||||
def existingshacode = readFile(file: gitrevparseoutputfile).trim()
|
||||
if (existingshacode != shacode) { // If the existing tag is not associated with HEAD
|
||||
// This is a problem - The tag is already at another position in git repo
|
||||
setunstable("The source tag ${tag} has been used at another commit (${existingshacode}) - You must decide what to do with it - Not good practice to delete it or move it (Existing sha code: ${existingshacode} Post commit sha code: ${shacode})")
|
||||
summaryappend("(${tag} - Could not add!)")
|
||||
}
|
||||
else {
|
||||
summaryappend("(${tag} - Already added)")
|
||||
}
|
||||
}
|
||||
else { // If tag does not exist already
|
||||
// Tag
|
||||
sh("git tag \"${tag}\" ${shacode}")
|
||||
summaryappend("(${tag})")
|
||||
tagadded = true
|
||||
}
|
||||
return tagadded
|
||||
}
|
||||
|
||||
def sourcegittags(String buildsha, List taglist) {
|
||||
boolean tagadded = false
|
||||
|
||||
summaryappend(",Src Tag ")
|
||||
for (tag in taglist) {
|
||||
if (sourcegittag(buildsha, tag)) {
|
||||
tagadded = true
|
||||
}
|
||||
}
|
||||
return tagadded
|
||||
}
|
||||
|
||||
def releasegitpush(String dryrunpush ) {
|
||||
sh("git remote -v")
|
||||
if (dryrunpush == "true") {
|
||||
sh("git push -n --tags origin master")
|
||||
summaryappend(",Dry-Run-Push")
|
||||
setunstable("The artifact(s) have not been pushed/saved (\"Dry run push\" parameter/option is selected)")
|
||||
}
|
||||
else {
|
||||
sh("git push --tags origin master")
|
||||
summaryappend(",Push")
|
||||
}
|
||||
}
|
||||
|
||||
def sourcegitpush(String dryrunpush ) {
|
||||
sh("git remote -v")
|
||||
if (dryrunpush == "true") {
|
||||
sh("git push -n --tags")
|
||||
summaryappend(",Src-Dry-Run-Push")
|
||||
setunstable("The source tag(s) have not been pushed/saved (\"Dry run push\" parameter/option is selected)")
|
||||
}
|
||||
else {
|
||||
sh("git push --tags")
|
||||
summaryappend(",Src Push")
|
||||
}
|
||||
}
|
||||
|
||||
def boolean isalreadyreleased(buildmeta, tag) {
|
||||
def boolean alreadyreleased = buildmeta.releaseinfo.released
|
||||
if (alreadyreleased) {
|
||||
echo "Component is already marked as released: ${alreadyreleased}"
|
||||
} else {
|
||||
String commitshacode = releasegitgetshacode(tag)
|
||||
if (commitshacode) {
|
||||
echo "Tag: ${tag} already exists in this repo therefore marking as already released"
|
||||
alreadyreleased = true
|
||||
} else {
|
||||
alreadyreleased = false
|
||||
}
|
||||
}
|
||||
return alreadyreleased
|
||||
}
|
||||
|
||||
def gitrelease(buildmeta, previousreleasemeta, String releaserepo, String sourcerepo, String otherreleasetags, String dryrunpush) {
|
||||
summaryappend(" Git operations: ")
|
||||
def String buildstamptag = buildmeta.releasetag()
|
||||
|
||||
dir(releaserepo) {
|
||||
def String precommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim()
|
||||
echo "Pre commit sha code: ${precommitshacode}"
|
||||
|
||||
def boolean alreadyreleased = isalreadyreleased(buildmeta, buildstamptag)
|
||||
|
||||
def String postcommitshacode
|
||||
def boolean changed = false
|
||||
if (alreadyreleased) {
|
||||
summaryappend("Already-released,")
|
||||
postcommitshacode = releasegitgetshacode(buildstamptag)
|
||||
echo "Previous release sha code: ${postcommitshacode}"
|
||||
} else {
|
||||
releasegitadd()
|
||||
|
||||
changed = checkforchange(buildmeta, previousreleasemeta)
|
||||
if (changed) {
|
||||
releasegitcommit(buildstamptag)
|
||||
} else {
|
||||
releasegitreset()
|
||||
summaryappend("No-commit,")
|
||||
}
|
||||
|
||||
postcommitshacode = sh(script: "git rev-parse --verify HEAD", returnStdout: true).trim()
|
||||
echo "Post commit sha code: ${postcommitshacode}"
|
||||
}
|
||||
|
||||
ArrayList<String> taglist = maketaglist(buildmeta, buildstamptag, otherreleasetags)
|
||||
def tagadded = releasegittags(postcommitshacode, taglist)
|
||||
|
||||
if (changed || tagadded) {
|
||||
releasegitpush(dryrunpush)
|
||||
}
|
||||
}
|
||||
dir(sourcerepo) {
|
||||
def String srcbuildstamptag = buildmeta.globalreleasetag()
|
||||
def String buildsha = buildmeta.gitinfo.gitrevision
|
||||
|
||||
if (buildsha) {
|
||||
def ArrayList<String> srctaglist = maketaglist(buildmeta, srcbuildstamptag, otherreleasetags)
|
||||
def tagadded = sourcegittags(buildsha, srctaglist)
|
||||
if (tagadded) {
|
||||
sourcegitpush(dryrunpush)
|
||||
}
|
||||
} else {
|
||||
summaryappend(",No Src ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def releasecomponent(toplevelbuildmeta, buildinfo, String otherreleasetags, String dryrunpush) {
|
||||
def buildmeta = buildinfo.meta
|
||||
def uriconverted = gh.uniquereporootname(buildmeta.gitinfo.remoteurl)
|
||||
def String uniquefolder = "${buildmeta.productinfo.productname}_${buildmeta.productinfo.subcomponentname}_${uriconverted}"
|
||||
def String uniquefolderforrepo = "${releaserepofolder}/${uniquefolder}"
|
||||
def String uniquefoldertemp = "${tempfolder}/${uniquefolder}"
|
||||
def String uniquefolderforsourcerepo = "${sourcerepofolder}/${uniquefolder}"
|
||||
|
||||
summaryappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ")
|
||||
repoandtagsappend("${buildmeta.productinfo.productname} ${buildmeta.productinfo.subcomponentname}: ")
|
||||
def previousreleasemeta = checkoutreleaserepo(buildmeta, uniquefolderforrepo)
|
||||
|
||||
checkoutsourcerepo(buildmeta, uniquefolderforsourcerepo)
|
||||
|
||||
if (getcomponentartifacts(toplevelbuildmeta, buildinfo, uniquefolderforrepo, uniquefoldertemp)) {
|
||||
gitrelease(buildmeta, previousreleasemeta, uniquefolderforrepo, uniquefolderforsourcerepo, otherreleasetags, dryrunpush)
|
||||
}
|
||||
|
||||
summaryappend("\n")
|
||||
repoandtagsappend("\n")
|
||||
}
|
||||
|
||||
def releasehierarchy(buildmeta, String maxdepth, String otherreleasetags, String dryrunpush) {
|
||||
def int md = maxdepth.toInteger()
|
||||
resetfolders()
|
||||
preconditions()
|
||||
|
||||
// Walk the meta information to a max depth, looking for components to release
|
||||
def componentReleaseInfo = buildmeta.releasewalkerunique(md)
|
||||
echo "Unique components:"
|
||||
def String versioncomponent = ""
|
||||
for (key in componentReleaseInfo.keySet()) {
|
||||
versioncomponent += "${key}\n"
|
||||
}
|
||||
echo versioncomponent
|
||||
|
||||
// Walk the meta information to a max depth, looking for components to release
|
||||
def componentReleaseInfoVersionUnique = buildmeta.releasewalkerversionunique(md)
|
||||
echo "Version unique components:"
|
||||
def String versionuniquecomponent = ""
|
||||
for (key in componentReleaseInfoVersionUnique.keySet()) {
|
||||
versionuniquecomponent += "${key}\n"
|
||||
}
|
||||
echo versionuniquecomponent
|
||||
|
||||
if (DO_INTEGRITY_CHECK == "true") {
|
||||
if (componentReleaseInfo.size() != componentReleaseInfoVersionUnique.size()) {
|
||||
error "There are 2 or more versions of the same component being used in this hierarchy: Is this correct?"
|
||||
}
|
||||
}
|
||||
|
||||
def toplevelid = buildmeta.componentidentifier()
|
||||
// For each component
|
||||
for (key in componentReleaseInfo.keySet()) {
|
||||
def buildinfo = componentReleaseInfo[key]
|
||||
if (toplevelid != key) {
|
||||
releasecomponent(buildmeta, buildinfo, otherreleasetags, dryrunpush)
|
||||
}
|
||||
}
|
||||
// Do the top level last
|
||||
def toplevelbuildinfo = componentReleaseInfo[toplevelid]
|
||||
releasecomponent(buildmeta, toplevelbuildinfo, otherreleasetags, dryrunpush)
|
||||
|
||||
return [summarystring, markunstable, unstablereason]
|
||||
}
|
||||
|
||||
return this;
|
||||
12
Common_scripts/release/registerrepo.groovy
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
vc = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
// Prove the existence of the release repo - otherwise there is a large wait to cycle the build to correct the meta data
|
||||
def registerrepo(meta, String releaserepo) {
|
||||
if (releaserepo?.trim()) {
|
||||
vc.checkRepoExists(releaserepo)
|
||||
}
|
||||
meta.releaseinfo.set(releaserepo)
|
||||
}
|
||||
|
||||
return this;
|
||||
88
Common_scripts/release/release.groovy
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
autobuilderscript = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy")
|
||||
meta = autobuilderscript.startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
"${WORKSPACE}/build_artifacts",
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Get build artifact meta') {
|
||||
steps {
|
||||
script {
|
||||
BUILD_ARTIFACTS = "${WORKSPACE}/build_artifacts"
|
||||
copyArtifacts(
|
||||
filter: 'meta/**',
|
||||
projectName: BUILD_JOB,
|
||||
selector: [
|
||||
$class: 'ParameterizedBuildSelector',
|
||||
parameterName: BUILD_JOB_SELECTOR
|
||||
],
|
||||
target: BUILD_ARTIFACTS
|
||||
)
|
||||
def mfs = autobuilderscript.getmetafolderscript()
|
||||
buildmeta = mfs.metafromfolder(BUILD_ARTIFACTS)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Release components') {
|
||||
steps {
|
||||
script {
|
||||
def releaser = load("${autobuilder.commonscripts()}/release/do.groovy")
|
||||
// Place the top level build stamp on all
|
||||
OTHER_RELEASE_TAGS = "${buildmeta.globalreleasetag()},${OTHER_RELEASE_TAGS}"
|
||||
(summarystring, markunstable, unstablereason) = releaser.releasehierarchy(buildmeta, MAX_META_DEPTH, OTHER_RELEASE_TAGS, DRY_RUN_PUSH)
|
||||
if (markunstable) {
|
||||
env.unstablereason = unstablereason
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts()
|
||||
archiveArtifacts "summary/**,${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Summarise') {
|
||||
steps {
|
||||
script {
|
||||
echo "Summary:\n${summarystring}\n"
|
||||
if (env.unstablereason) {
|
||||
echo "Instability reason: ${env.unstablereason}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Common_scripts/remoteaccess/ftp.groovy
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import org.apache.commons.net.ftp.FTPClient
|
||||
|
||||
class FTPSiteInfo {
|
||||
String url
|
||||
String username
|
||||
String password
|
||||
String workingdirectory
|
||||
|
||||
FTPSiteInfo(String url, String username, String password, String workingdirectory) {
|
||||
this.url = url
|
||||
this.username = username
|
||||
this.password = password
|
||||
this.workingdirectory = workingdirectory
|
||||
}
|
||||
}
|
||||
|
||||
FTPSiteInfo createFTPSiteInfo(String url, String username, String password, String workingdirectory) {
|
||||
FTPSiteInfo ftpsiteinfo = new FTPSiteInfo(url, username, password, workingdirectory)
|
||||
return ftpsiteinfo
|
||||
}
|
||||
|
||||
FTPClient createFTPClient(FTPSiteInfo ftpsiteinfo) {
|
||||
FTPClient ftpclient = new FTPClient()
|
||||
ftpclient.connect(ftpsiteinfo.url)
|
||||
ftpclient.enterLocalPassiveMode()
|
||||
ftpclient.login(ftpsiteinfo.username, ftpsiteinfo.password)
|
||||
ftpclient.changeWorkingDirectory(ftpsiteinfo.workingdirectory)
|
||||
|
||||
return ftpclient
|
||||
}
|
||||
|
||||
return this;
|
||||
28
Common_scripts/remoteaccess/hostedftp.groovy
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy")
|
||||
|
||||
def getHostedFTPSiteInfo() {
|
||||
hostedftpsiteinfo =
|
||||
ftpremote.createFTPSiteInfo("ftp.hostedftp.com",
|
||||
"ftp@globalinkjetsystems.com",
|
||||
"ramshorn42",
|
||||
"/Customers/")
|
||||
return hostedftpsiteinfo
|
||||
}
|
||||
|
||||
def getCustomerList() {
|
||||
def List<String> customerfilenames = new ArrayList<String>()
|
||||
def List<String> customers = new ArrayList<String>()
|
||||
|
||||
def ftpsiteinfo = getHostedFTPSiteInfo()
|
||||
def ftpclient = ftpremote.createFTPClient(ftpsiteinfo)
|
||||
|
||||
customerfilenames = ftpclient.listNames()
|
||||
for(customer in customerfilenames) {
|
||||
def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8")
|
||||
customers.add(converted)
|
||||
}
|
||||
ftpclient.disconnect()
|
||||
return customers
|
||||
}
|
||||
|
||||
return this;
|
||||
119
Common_scripts/staticanalysis/ccm.groovy
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
PYTHONBRANCH = 'origin/3.6.3_windows'
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
|
||||
CCMURL = 'git@hydra:tools/ccm.git'
|
||||
CCMBRANCH = 'origin/master'
|
||||
CCMDIR = "${WORKSPACE}/ccm"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'ccm', CCMURL, CCMBRANCH, CCMDIR)
|
||||
CCM = "${CCMDIR}/bin/CCM.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEREVISION = "${SOURCE_REVISION}"
|
||||
SOURCEDIR = "${WORKSPACE}/source"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
SOURCE_PATH = "${SOURCEDIR}"
|
||||
env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Clean exports") {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
cleanfolders = [
|
||||
STATICANALYSIS,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
def CCMOLDER = "${STATICANALYSIS}/ccm"
|
||||
dir(CCMOLDER) {
|
||||
echo "Executing: ${CCM} ${SRC} /xml /nummetrics=100 > ccm.xml"
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
find "${SRC}" -type f ! -name "*.cpp" -a ! -name "*.h" -a ! -name "*.hpp" -a ! -name "*.c" -exec rm -r {} \\;
|
||||
# Uses mono
|
||||
"${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
"${CCM}" "${SRC}" /xml /nummetrics=100 > ccm.xml
|
||||
"""
|
||||
}
|
||||
}
|
||||
recordIssues(tools: [
|
||||
ccm(pattern: "**/ccm.xml", reportEncoding: 'UTF-8'),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
151
Common_scripts/staticanalysis/cpd.groovy
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
pipeline {
|
||||
agent { label AGENT_LABEL }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = 'origin/3.6.3_linux'
|
||||
} else {
|
||||
PYTHONBRANCH = 'origin/3.6.3_windows'
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
|
||||
JAVAURL = 'git@hydra:tools/openjdk.git'
|
||||
if (isUnix()) {
|
||||
JAVABRANCH = 'origin/openjdk-11.0.2_linux-x64_bin'
|
||||
} else {
|
||||
JAVABRANCH = 'origin/openjdk-11.0.2_windows-x64_bin'
|
||||
}
|
||||
JAVADIR = "${WORKSPACE}/java"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'java', JAVAURL, JAVABRANCH, JAVADIR)
|
||||
JAVA = "${JAVADIR}/ver/bin"
|
||||
if (isUnix()) {
|
||||
env.PATH = JAVA + ':' + PATH
|
||||
} else {
|
||||
env.PATH = JAVA + ';' + PATH
|
||||
}
|
||||
|
||||
PPDURL = 'git@hydra:tools/pmd.git'
|
||||
PPDBRANCH = 'origin/master'
|
||||
PPDDIR = "${WORKSPACE}/ppd"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'ppd', PPDURL, PPDBRANCH, PPDDIR)
|
||||
PPD = "${PPDDIR}/bin"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEREVISION = "${SOURCE_REVISION}"
|
||||
SOURCEDIR = "${WORKSPACE}/source"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
SOURCE_PATH = "${SOURCEDIR}"
|
||||
SRC = "${SOURCE_PATH}"
|
||||
if (SOURCE_OFFSET_PATH) {
|
||||
SRC += "/${SOURCE_OFFSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Clean exports") {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
cleanfolders = [
|
||||
STATICANALYSIS,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
def PPDFOLDER = "${STATICANALYSIS}/ppd"
|
||||
def EXCLUDE_PARAM = ''
|
||||
if (EXCLUDE_PATHS) {
|
||||
EXCLUDE_PARAM = '--exclude "'
|
||||
def exclude_path_list = EXCLUDE_PATHS.split(',')
|
||||
for (exclude_path in exclude_path_list) {
|
||||
EXCLUDE_PARAM += "${SRC}/${exclude_path.trim()},"
|
||||
}
|
||||
EXCLUDE_PARAM += '"'
|
||||
}
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -ev
|
||||
|
||||
mkdir -p "${PPDFOLDER}"
|
||||
export PMD_JAVA_OPTS=-Xmx65536m
|
||||
"${PPD}/run.sh" cpd --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml"
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
mkdir -p "${PPDFOLDER}"
|
||||
set PMD_JAVA_OPTS=-Xmx2048m
|
||||
"${PPD}/cpd.bat" --minimum-tokens 100 --files "${SRC}" --language cpp --format xml ${EXCLUDE_PARAM} --failOnViolation false > "${PPDFOLDER}/cpd.xml"
|
||||
"""
|
||||
}
|
||||
recordIssues(tools: [
|
||||
cpd(pattern: "**/cpd.xml", reportEncoding: 'UTF-8'),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
113
Common_scripts/staticanalysis/cppcheck.groovy
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
PYTHONBRANCH = 'origin/3.6.3_windows'
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEREVISION = "${SOURCE_REVISION}"
|
||||
SOURCEDIR = "${WORKSPACE}/source"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
SOURCE_PATH = "${SOURCEDIR}"
|
||||
env.SRC = "${SOURCE_PATH}/${SOURCE_OFFSET_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Clean exports") {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
cleanfolders = [
|
||||
STATICANALYSIS,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
def CPPCHECKFOLDER = "${STATICANALYSIS}/cppcheck"
|
||||
dir(CPPCHECKFOLDER) {
|
||||
echo "Executing: ${CPPCHECK} --xml --xml-version=2 ${SRC} 2> cppcheck.xml"
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
set -e
|
||||
|
||||
"${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml
|
||||
"""
|
||||
} else {
|
||||
bat """
|
||||
"${CPPCHECK}" --xml --xml-version=2 "${SRC}" 2> cppcheck.xml
|
||||
"""
|
||||
}
|
||||
}
|
||||
recordIssues(tools: [
|
||||
cppCheck(pattern: "**/cppcheck.xml", reportEncoding: 'UTF-8'),
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
ArrayList<String> itemsForRelease = ["${STATICANALYSIS}/**"]
|
||||
def artifactlist = meta.generateartifacts(itemsForRelease)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Common_scripts/textutils/subst.groovy
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
def substitute(String filepath, pattern, String subst) {
|
||||
fileText = readFile(file: filepath, encoding: 'UTF-8')
|
||||
def converted = fileText.replaceAll(pattern, subst)
|
||||
writeFile(file: filepath, text: converted, encoding: 'UTF-8')
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedDesktop",
|
||||
"Microsoft.VisualStudio.Workload.NativeDesktop",
|
||||
"Microsoft.VisualStudio.Workload.NetWeb",
|
||||
"Microsoft.VisualStudio.Workload.NetCoreTools",
|
||||
"microsoft.net.componentgroup.targetingpacks.common",
|
||||
"microsoft.componentgroup.blend",
|
||||
"microsoft.visualstudio.component.entityframework",
|
||||
"microsoft.visualstudio.component.debugger.justintime",
|
||||
"microsoft.visualstudio.component.wcf.tooling",
|
||||
"microsoft.visualstudio.component.vc.diagnostictools",
|
||||
"microsoft.visualstudio.component.vc.cmake.project",
|
||||
"microsoft.visualstudio.component.vc.testadapterforboosttest",
|
||||
"microsoft.visualstudio.component.vc.testadapterforgoogletest",
|
||||
"microsoft.visualstudio.component.vc.atlmfc",
|
||||
"microsoft.visualstudio.component.appinsights.tools",
|
||||
"microsoft.visualstudio.component.diagnostictools",
|
||||
"microsoft.visualstudio.componentgroup.web.cloudtools",
|
||||
"microsoft.visualstudio.component.aspnet45",
|
||||
"microsoft.visualstudio.component.webdeploy",
|
||||
"microsoft.visualstudio.component.nuget.buildtools"
|
||||
]
|
||||
}
|
||||
377
Common_scripts/versioncontrol/git.groovy
Normal file
|
|
@ -0,0 +1,377 @@
|
|||
import hudson.plugins.git.*
|
||||
import hudson.plugins.git.extensions.*
|
||||
import hudson.plugins.git.extensions.impl.*
|
||||
|
||||
clh = load("${autobuilder.commonscripts()}/commandline/commandline.groovy")
|
||||
|
||||
def boolean isShallowClonedRepo(String gitrootpath) {
|
||||
def boolean isshallowclone = true
|
||||
|
||||
dir( gitrootpath) {
|
||||
if (isUnix()) {
|
||||
isshallowclone = sh(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean()
|
||||
}
|
||||
else {
|
||||
isshallowclone = powershell(returnStdout: true, script: "git rev-parse --is-shallow-repository").trim().toBoolean()
|
||||
}
|
||||
echo "Repo at ${gitrootpath} is shallow cloned: ${isshallowclone}"
|
||||
}
|
||||
return isshallowclone
|
||||
}
|
||||
|
||||
String getGitInfo(String workingSetRootPath) {
|
||||
dir(workingSetRootPath) {
|
||||
return clh.getCommandOutput('git rev-parse HEAD')
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<String> gettaglist(String workingSetRootPath) {
|
||||
ArrayList<String> taglist = new ArrayList<String>()
|
||||
dir(workingSetRootPath) {
|
||||
def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname')
|
||||
taglist = tagliststring.split('\\n')
|
||||
}
|
||||
return taglist
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def ArrayList<SparseCheckoutPath> sparsecheckoutconfig(ArrayList<String> paths) {
|
||||
ArrayList<SparseCheckoutPath> sparsecheckoutpaths = new ArrayList<SparseCheckoutPath>()
|
||||
for (path in paths) {
|
||||
sparsecheckoutpaths.add(new SparseCheckoutPath(path))
|
||||
}
|
||||
return sparsecheckoutpaths
|
||||
}
|
||||
|
||||
def String uniquereporootname(String gitURL) {
|
||||
def uniquename = gitURL.replaceAll("[^A-Za-z0-9]", "_")
|
||||
echo "Unique reporoot name for URL: ${gitURL} is: ${uniquename}"
|
||||
return uniquename
|
||||
}
|
||||
|
||||
// The REPO_ROOT is a folder where a cache of git checkouts can be kept - each subfolder name is unique to a particular git repo
|
||||
def String checkouttoreporoot(String gitURL) {
|
||||
def String reporootsubfolder
|
||||
def String reporootenv = env.REPO_ROOT
|
||||
if (!reporootenv) {
|
||||
reporootsubfolder = ""
|
||||
echo "To improve Git performance: Define the REPO_ROOT enviroment to a path where a cache of git repositories can be placed on this slave"
|
||||
} else {
|
||||
def reporootname = uniquereporootname(gitURL)
|
||||
reporootsubfolder = "${reporootenv}/${reporootname}"
|
||||
|
||||
if (!fileExists(reporootsubfolder)) {
|
||||
echo "Checking out ${gitURL} to ${reporootsubfolder}"
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
userRemoteConfigs: [
|
||||
[url: gitURL]
|
||||
],
|
||||
branches: [
|
||||
[name: 'origin/master']
|
||||
],
|
||||
doGenerateSubmoduleConfigurations: false,
|
||||
extensions: [
|
||||
[$class: 'GitLFSPull'],
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CheckoutOption', timeout: 180],
|
||||
[$class: 'RelativeTargetDirectory', relativeTargetDir: reporootsubfolder],
|
||||
],
|
||||
submoduleCfg: [],
|
||||
])
|
||||
} else {
|
||||
echo "Found ${gitURL} checked out at ${reporootsubfolder}"
|
||||
/*
|
||||
dir(reporootsubfolder) {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
git status
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
} else {
|
||||
powershell """
|
||||
git status
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
return reporootsubfolder
|
||||
}
|
||||
|
||||
def checkgitlfsinstall() {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
git lfs install
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
|
||||
} else {
|
||||
powershell """
|
||||
git lfs install
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
//No credentials specified
|
||||
//Cloning the remote Git repository
|
||||
//Cloning repository git@hydra:print-server-releases/print_server_whole.git
|
||||
//> git init /home/jenkins_user/jenkins/jobs/Print_Server_publish_to_customer/ws/whole # timeout=10
|
||||
//Using reference repository: /home/jenkins_user/reporoot/git_hydra_print_server_releases_print_server_whole_git
|
||||
//Fetching upstream changes from git@hydra:print-server-releases/print_server_whole.git
|
||||
// > git --version # timeout=10
|
||||
// > git fetch --tags --progress git@hydra:print-server-releases/print_server_whole.git +refs/heads/*:refs/remotes/origin/* # timeout=120
|
||||
// > git config remote.origin.url git@hydra:print-server-releases/print_server_whole.git # timeout=10
|
||||
// > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
|
||||
// > git config remote.origin.url git@hydra:print-server-releases/print_server_whole.git # timeout=10
|
||||
// Cleaning workspace
|
||||
// > git rev-parse --verify HEAD # timeout=10
|
||||
// No valid HEAD. Skipping the resetting
|
||||
// > git clean -fdx # timeout=10
|
||||
// Fetching upstream changes from git@hydra:print-server-releases/print_server_whole.git
|
||||
// > git fetch --tags --progress git@hydra:print-server-releases/print_server_whole.git +refs/heads/*:refs/remotes/origin/* # timeout=120
|
||||
// > git rev-parse refs/tags/2.10180.7389.21125_7^{commit} # timeout=10
|
||||
// > git rev-parse refs/remotes/origin/refs/tags/2.10180.7389.21125_7^{commit} # timeout=10
|
||||
// Checking out Revision 64cac35e9a7603c060135f61f91b3f809bbdf160 (refs/tags/2.10180.7389.21125_7)
|
||||
// Enabling Git LFS pull
|
||||
// > git config core.sparsecheckout # timeout=10
|
||||
// > git checkout -f 64cac35e9a7603c060135f61f91b3f809bbdf160 # timeout=120
|
||||
// > git config --get remote.origin.url # timeout=10
|
||||
// > git lfs pull origin # timeout=120
|
||||
// Commit message: "2.10180.7389.21125_7"
|
||||
// > git rev-list --no-walk 64cac35e9a7603c060135f61f91b3f809bbdf160 # timeout=10
|
||||
|
||||
|
||||
// > git rev-parse --is-inside-work-tree # timeout=10
|
||||
// Fetching changes from the remote Git repository
|
||||
// > git config remote.origin.url git@hydra:releases/print-server-installer.git # timeout=10
|
||||
// Cleaning workspace
|
||||
// > git rev-parse --verify HEAD # timeout=10
|
||||
// Resetting working tree
|
||||
// > git reset --hard # timeout=10
|
||||
// > git clean -fdx # timeout=10
|
||||
// Using shallow fetch with depth 1
|
||||
// Fetching upstream changes from git@hydra:releases/print-server-installer.git
|
||||
// > git --version # timeout=10
|
||||
// > git fetch --tags --progress git@hydra:releases/print-server-installer.git +refs/heads/*:refs/remotes/origin/* --depth=1 # timeout=120
|
||||
// > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
|
||||
// > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
|
||||
// Checking out Revision d0788d22622862e441c5995a22629846573c39f3 (refs/remotes/origin/master)
|
||||
// Enabling Git LFS pull
|
||||
// > git config core.sparsecheckout # timeout=10
|
||||
// > git read-tree -mu HEAD # timeout=10
|
||||
// > git checkout -f d0788d22622862e441c5995a22629846573c39f3 # timeout=120
|
||||
// > git config --get remote.origin.url # timeout=10
|
||||
// > git lfs pull origin # timeout=120
|
||||
// Commit message: "2.10180.7389.21125_3"
|
||||
// > git rev-list --no-walk d0788d22622862e441c5995a22629846573c39f3 # timeout=10
|
||||
|
||||
def String lfsinstallandreporoot(String gitURL) {
|
||||
checkgitlfsinstall()
|
||||
return checkouttoreporoot(gitURL)
|
||||
}
|
||||
|
||||
def showsparseitemlist(ArrayList<String> sparseitemlist = new ArrayList<String>()) {
|
||||
if (!sparseitemlist.isEmpty()) {
|
||||
def itemstring = "Items in sparse item list:\n"
|
||||
for (item in sparseitemlist) {
|
||||
itemstring += item + "\n"
|
||||
}
|
||||
echo itemstring
|
||||
}
|
||||
}
|
||||
|
||||
def docheckout(String gitURL, String revision, int cloneDepth, String reporootpath, boolean shallowClone, String targetDir, sparseitemlist) {
|
||||
echo "Git: Checking out: URL: ${gitURL} Revision: ${revision} to: ${targetDir}"
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
userRemoteConfigs: [
|
||||
[url: gitURL]
|
||||
],
|
||||
branches: [
|
||||
[name: revision]
|
||||
],
|
||||
doGenerateSubmoduleConfigurations: false,
|
||||
extensions: [
|
||||
[$class: 'GitLFSPull'],
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', depth: cloneDepth, noTags: false, reference: reporootpath, shallow: shallowClone, timeout: 120],
|
||||
[$class: 'CheckoutOption', timeout: 120],
|
||||
[$class: 'RelativeTargetDirectory', relativeTargetDir: targetDir],
|
||||
[$class: 'SparseCheckoutPaths', sparseCheckoutPaths: sparsecheckoutconfig(sparseitemlist)],
|
||||
],
|
||||
submoduleCfg: [],
|
||||
])
|
||||
}
|
||||
|
||||
// gitCheckout (below) cannot handle sparse checkout and lfs at the moment - see https://issues.jenkins-ci.org/browse/JENKINS-43427 - see gitCheckoutAlt()
|
||||
def gitCheckout(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
|
||||
def String reporootpath = lfsinstallandreporoot(gitURL)
|
||||
showsparseitemlist(sparseitemlist)
|
||||
docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist)
|
||||
}
|
||||
|
||||
def gitinit(String targetDir, String reporootpath) {
|
||||
if (!fileExists("${targetDir}/.git")) { // Git folder does not already exist
|
||||
echo "git init ${targetDir}"
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
git init "${targetDir}"
|
||||
"""
|
||||
} else {
|
||||
powershell """
|
||||
git init "${targetDir}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
echo "Writing ${reporootpath}/.git/objects to ${targetDir}/.git/objects/info/alternates"
|
||||
dir("${targetDir}/.git/objects/info") {
|
||||
writeFile(file: 'alternates', text: "${reporootpath}/.git/objects")
|
||||
}
|
||||
}
|
||||
|
||||
def setlfsfetchinclude(String targetDir, ArrayList<String> sparseitemlist) {
|
||||
def String sparseitemliststring = ""
|
||||
if (!sparseitemlist.isEmpty()) {
|
||||
for (item in sparseitemlist) {
|
||||
sparseitemliststring += "${item},"
|
||||
}
|
||||
echo "git config lfs.fetchinclude ${sparseitemliststring}"
|
||||
dir(targetDir) {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
git config lfs.fetchinclude "${sparseitemliststring}"
|
||||
"""
|
||||
} else {
|
||||
powershell """
|
||||
git config lfs.fetchinclude "${sparseitemliststring}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def gitsparserestore(String targetDir) {
|
||||
echo "Clean out full fetch; Force a sparse fetch"
|
||||
dir(targetDir) {
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
git rm -rf . > /dev/null
|
||||
git clean -fxd > /dev/null
|
||||
git reset --hard > /dev/null
|
||||
"""
|
||||
} else {
|
||||
powershell """
|
||||
git rm -rf . 2> nul
|
||||
git clean -fxd 2> nul
|
||||
git reset --hard 2> nul
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def List convertSparseItemsString(String itemstopublish) {
|
||||
def List sparsepaths = []
|
||||
|
||||
boolean nonempty = itemstopublish?.trim()
|
||||
if (nonempty) {
|
||||
def String[] items = itemstopublish.trim().split(',')
|
||||
def String allpaths = ""
|
||||
for(String item : items) {
|
||||
sparsepaths.add(item)
|
||||
allpaths += "${item}\n"
|
||||
}
|
||||
echo "Selected item to publish:\n${allpaths}"
|
||||
}
|
||||
return sparsepaths
|
||||
}
|
||||
|
||||
def gitCheckoutAlt(String gitURL, String revision, String targetDir, String repoRootSuffix = "", int cloneDepth = 1, boolean shallowClone = true, ArrayList<String> sparseitemlist = new ArrayList<String>()) {
|
||||
echo "Performing alternative checkout"
|
||||
def String reporootpath = lfsinstallandreporoot(gitURL)
|
||||
showsparseitemlist(sparseitemlist)
|
||||
if (!sparseitemlist.isEmpty()) {
|
||||
gitinit(targetDir, reporootpath)
|
||||
setlfsfetchinclude(targetDir, sparseitemlist)
|
||||
}
|
||||
docheckout(gitURL, revision, cloneDepth, reporootpath, shallowClone, targetDir, sparseitemlist)
|
||||
if (!sparseitemlist.isEmpty()) {
|
||||
gitsparserestore(targetDir)
|
||||
}
|
||||
}
|
||||
|
||||
def checkRepoExists(String gitURL) {
|
||||
def int result = 0
|
||||
if (isUnix()) {
|
||||
result = sh( script: """
|
||||
git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
} else {
|
||||
result = powershell( script: """
|
||||
git ls-remote "${gitURL}" CHECK_GIT_REMOTE_URL_REACHABILITY
|
||||
""",
|
||||
returnStatus: true
|
||||
)
|
||||
}
|
||||
echo "git ls-remote return result: ${result}"
|
||||
if (result > 0) {
|
||||
error("The release repo: ${gitURL} cannot be found. Please ensure this exists before building")
|
||||
} else {
|
||||
echo "The release repo: ${gitURL} exists"
|
||||
}
|
||||
}
|
||||
|
||||
String getSHAFromVersion(String versionFolder) {
|
||||
dir (versionFolder) {
|
||||
srcRevision = readFile("gitrevision.txt").trim()
|
||||
}
|
||||
return srcRevision
|
||||
}
|
||||
|
||||
boolean checkAllVersionsAgree(java.util.LinkedHashMap versions) {
|
||||
def keys = versions.keySet()
|
||||
if (keys.size() < 1) {
|
||||
return false
|
||||
}
|
||||
if (keys.size() == 1) {
|
||||
return true
|
||||
}
|
||||
else {
|
||||
version = ""
|
||||
for (key in keys) {
|
||||
nextversion = versions.get(key)
|
||||
if (version == "") {
|
||||
version = nextversion
|
||||
}
|
||||
if (nextversion != version) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
def stripgithistory(String rootfolder) {
|
||||
echo "Stripping git history out of ${rootfolder}"
|
||||
dir(rootfolder) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
pwd
|
||||
find . -type d -name ".git" | xargs -iXX rm -rf XX
|
||||
find . -name ".gitignore" | xargs -iXX rm -rf XX
|
||||
find . -name ".gitmodules" | xargs -iXX rm -rf XX
|
||||
find . -iname ".gitattributes" | xargs -iXX rm -rf XX
|
||||
find . -iname "*@tmp" | xargs -iXX rm -rf XX
|
||||
"""
|
||||
} else {
|
||||
echo "Not supporting git stripping in Windows at the moment"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this
|
||||
23
Common_scripts/versionnumbering/do.groovy
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
def stamp(convertdetails) {
|
||||
for (convertdetail in convertdetails) {
|
||||
def filetoconvert = convertdetail[0]
|
||||
def pattern = convertdetail[1]
|
||||
def replacement = convertdetail[2]
|
||||
echo "Converting any instances of pattern: ${pattern} with replacement: ${replacement} in file: ${filetoconvert}"
|
||||
def stampscript = "${autobuilder.commonscripts()}/versionstamping/versionstamper.py"
|
||||
echo "Using python: ${PYTHON} and script: ${stampscript}"
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
"${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
|
||||
"""
|
||||
}
|
||||
else {
|
||||
powershell """
|
||||
& "${PYTHON}" -u "${stampscript}" -f "${filetoconvert}" -p "${pattern}" -s "${replacement}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
169
Common_scripts/versionnumbering/generate.groovy
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy")
|
||||
|
||||
def int maxversionnumber() {
|
||||
def int MAXVERSIONNUMBER = 65535
|
||||
return MAXVERSIONNUMBER
|
||||
}
|
||||
|
||||
int incrementrevision(int current, int increment) {
|
||||
def int newrevision = (current + increment) % (maxversionnumber() + 1)
|
||||
echo "Current revision: ${current} Increment: ${increment} New revision: ${newrevision}"
|
||||
return newrevision
|
||||
}
|
||||
|
||||
def getGitRevision(String gitrootpath, int basebuildnumber) {
|
||||
def int adjustedchangecount
|
||||
def String gitrevision
|
||||
def String remoteinfo
|
||||
def String remoteurl
|
||||
|
||||
def boolean isShallowCloned = gh.isShallowClonedRepo(gitrootpath)
|
||||
if (isShallowCloned) {
|
||||
error("Cannot generate a version number from a shallow cloned repo at ${gitrootpath}")
|
||||
}
|
||||
|
||||
dir( gitrootpath) {
|
||||
def int changecount = 0
|
||||
if (isUnix()) {
|
||||
changecount = sh(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
||||
}
|
||||
else {
|
||||
changecount = powershell(returnStdout: true, script: "git rev-list HEAD --count").trim().toInteger()
|
||||
}
|
||||
echo "Change count: ${changecount}"
|
||||
def int mvnp1 = maxversionnumber() + 1
|
||||
basebuildnumber = (basebuildnumber < 0) ? mvnp1 - (basebuildnumber.abs() % mvnp1) : basebuildnumber
|
||||
adjustedchangecount = incrementrevision(changecount, basebuildnumber)
|
||||
echo "Adjusted change count: ${adjustedchangecount}"
|
||||
if (isUnix()) {
|
||||
gitrevision = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||
}
|
||||
else {
|
||||
gitrevision = powershell(returnStdout: true, script: "git rev-parse HEAD").trim()
|
||||
}
|
||||
echo "Revision: ${gitrevision}"
|
||||
if (isUnix()) {
|
||||
remoteinfo = sh(returnStdout: true, script: "git remote show origin").trim()
|
||||
}
|
||||
else {
|
||||
remoteinfo = powershell(returnStdout: true, script: "git remote show origin").trim()
|
||||
}
|
||||
echo "Remote info: ${remoteinfo}"
|
||||
if (isUnix()) {
|
||||
remoteurl = sh(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
||||
}
|
||||
else {
|
||||
remoteurl = powershell(returnStdout: true, script: "git config --get remote.origin.url").trim()
|
||||
}
|
||||
echo "Remote URL: ${remoteurl}"
|
||||
}
|
||||
return [adjustedchangecount, gitrevision, remoteinfo, remoteurl]
|
||||
}
|
||||
|
||||
// Handle:
|
||||
// origin/master
|
||||
// origin/2.0.x
|
||||
def getVersionPrefix(String sourcebranch, boolean droptrailingdot = false) {
|
||||
echo "Determining version number prefix from source branch name: ${sourcebranch}"
|
||||
sourcebranch = sourcebranch.toLowerCase()
|
||||
|
||||
def defaultversionprefix = "0.30000.0."
|
||||
def splits = sourcebranch.split('/')
|
||||
if (splits.size() < 1) {
|
||||
echo "Source branch name is invalid. Defaulting to: ${defaultversionprefix}"
|
||||
return defaultversionprefix
|
||||
}
|
||||
|
||||
def mastertypeversionprefix = "0.20000.0."
|
||||
sourcebranch = splits.last()
|
||||
if (sourcebranch.toLowerCase().find("master") != null) {
|
||||
echo "Source branch name has 'master' in it. Defaulting to: ${mastertypeversionprefix}"
|
||||
return mastertypeversionprefix
|
||||
}
|
||||
|
||||
def splits2 = sourcebranch.split('\\.')
|
||||
if (splits2.size() < 1) {
|
||||
def thirdpartyversionprefix = "0.25000.0."
|
||||
echo "Source branch name has no dots in it (eg. 1.9.2). Defaulting to: ${thirdpartyversionprefix}"
|
||||
return thirdpartyversionprefix
|
||||
}
|
||||
|
||||
for (split in splits2) {
|
||||
if (split == "x") {
|
||||
echo "Source branch name has '.x' or 'x.' in it. Defaulting to: ${mastertypeversionprefix}"
|
||||
return mastertypeversionprefix
|
||||
}
|
||||
}
|
||||
|
||||
def integerstrings = sourcebranch.findAll(/\d+/)
|
||||
def integers = []
|
||||
for (integerstring in integerstrings) {
|
||||
int integer = integerstring.toInteger()
|
||||
integer = integer % (maxversionnumber() + 1)
|
||||
integers.add(integer)
|
||||
}
|
||||
|
||||
def versionprefix = ""
|
||||
if (integers.size() < 1) {
|
||||
echo "This source branch name has no numbers in its name so defaulting to: ${defaultversionprefix}"
|
||||
versionprefix = defaultversionprefix
|
||||
}
|
||||
else {
|
||||
def int integernumbercount = 0
|
||||
for (integer in integers) {
|
||||
versionprefix += integer + "."
|
||||
integernumbercount += 1
|
||||
if (integernumbercount > 2) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (integernumbercount == 0) {
|
||||
echo "No leading numbers were found in source branch name so defaulting to: ${defaultversionprefix}"
|
||||
versionprefix = defaultversionprefix
|
||||
}
|
||||
else if (integernumbercount == 1) {
|
||||
versionprefix += "0.0."
|
||||
}
|
||||
else if (integernumbercount == 2) {
|
||||
versionprefix += "0."
|
||||
}
|
||||
}
|
||||
if (droptrailingdot == true) {
|
||||
versionprefix = versionprefix.substring(0, versionprefix.length() - 1);
|
||||
}
|
||||
echo "Determined version prefix to be: ${versionprefix}"
|
||||
return versionprefix
|
||||
}
|
||||
|
||||
String generate(meta, String sourcerevision, String sourcepath, int basebuildnumber = 1000) {
|
||||
def int gitrevisioncount
|
||||
def String gitrevision
|
||||
def String remoteinfo
|
||||
def String remoteurl
|
||||
|
||||
(gitrevisioncount, gitrevision, remoteinfo, remoteurl) = getGitRevision(sourcepath, basebuildnumber)
|
||||
|
||||
def versionprefix = getVersionPrefix(sourcerevision)
|
||||
|
||||
def buildstamp = versionprefix + gitrevisioncount.toString()
|
||||
echo "Build stamp is: ${buildstamp}"
|
||||
|
||||
meta.gitinfo.set(sourcepath, sourcerevision, gitrevision, remoteurl, remoteinfo)
|
||||
meta.buildstampinfo.set(versionprefix, gitrevisioncount, buildstamp)
|
||||
|
||||
return buildstamp
|
||||
}
|
||||
|
||||
String generate(meta, String sourcerevision, String sourcepath, String basebuildnumber) {
|
||||
def int bbn = basebuildnumber.trim().toInteger()
|
||||
return generate(meta, sourcerevision, sourcepath, bbn)
|
||||
}
|
||||
|
||||
String copyfrom(meta, othermeta) {
|
||||
meta.gitinfo = othermeta.gitinfo
|
||||
meta.buildstampinfo = othermeta.buildstampinfo
|
||||
|
||||
return meta.buildstampinfo.buildstamp
|
||||
}
|
||||
|
||||
return this;
|
||||
17
Common_scripts/versionstamping/.project
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>versionstamping</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
8
Common_scripts/versionstamping/.pydevproject
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?><pydev_project>
|
||||
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
|
||||
<path>/${PROJECT_DIR_NAME}</path>
|
||||
</pydev_pathproperty>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 3.0</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python35</pydev_property>
|
||||
</pydev_project>
|
||||
38
Common_scripts/versionstamping/versionstamper.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import argparse
|
||||
import sys
|
||||
import shutil
|
||||
from builtins import FileNotFoundError
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser(description="Look for version number pattern in file and replace with autobuild version number")
|
||||
|
||||
# Call once arguments to allow or disallow something
|
||||
parser.add_argument('-f', '--filetoconvert', help='The file to convert')
|
||||
parser.add_argument('-p', '--pattern', default='0.30000.0.0', help='The pattern to search for and replace')
|
||||
parser.add_argument('-s', '--substitute', help='The new version number that will substitute the pattern')
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
filetoconvert = args.filetoconvert
|
||||
pattern = args.pattern
|
||||
substitute = args.substitute
|
||||
|
||||
print("Converting instances of {0} with {1} in file: {2}\n".format(pattern, substitute, filetoconvert))
|
||||
|
||||
with open(filetoconvert,'r') as c:
|
||||
fileread = c.read()
|
||||
|
||||
count = 0
|
||||
with open(filetoconvert, 'w') as f:
|
||||
print("Detected %s instances of %s pre-conversion"%(fileread.count(pattern),pattern))
|
||||
converted = fileread.replace(pattern, substitute)
|
||||
count = converted.count(substitute)
|
||||
print("Confirmed %s instances of %s post-conversion"%(count,substitute))
|
||||
f.write(converted)
|
||||
|
||||
if count == 0:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
407
build/build_all.groovy
Normal file
|
|
@ -0,0 +1,407 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
|
||||
BOOTSOURCEURL = 'git@hydra:gis-embedded-linux/gis_preloader_uboot.git'
|
||||
BOOTSOURCEREVISION = BOOT_SOURCE_REVISION.trim()
|
||||
BOOTSOURCEDIR = "${WORKSPACE}/boot"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'boot', BOOTSOURCEURL, BOOTSOURCEREVISION, BOOTSOURCEDIR, '', 0, false)
|
||||
|
||||
KERNELSOURCEURL = KERNEL_URL.trim()
|
||||
KERNELSOURCEREVISION = KERNEL_REVISION.trim()
|
||||
KERNELSOURCEDIR = "${WORKSPACE}/kernel"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'kernel', KERNELSOURCEURL, KERNELSOURCEREVISION, KERNELSOURCEDIR, '', 0, false)
|
||||
|
||||
STM8SOURCEURL = 'git@hydra:gis/stm8-embedded.git'
|
||||
STM8SOURCEREVISION = STM8_SOURCE_REVISION.trim()
|
||||
STM8SOURCEDIR = "${WORKSPACE}/stm8-embedded"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'stm8-embedded', STM8SOURCEURL, STM8SOURCEREVISION, STM8SOURCEDIR, '', 0, false)
|
||||
|
||||
SOURCEURL = "git@hydra:ahb-km-1024a-source/ahb-km-1024a-embedded-software-subtree.git"
|
||||
SOURCEREVISION = SOURCE_REVISION.trim()
|
||||
SOURCEDIR = "${WORKSPACE}/esw"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'esw', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
|
||||
CORESOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git"
|
||||
CORESOURCEREVISION = CORE_SOURCE_REVISION.trim()
|
||||
CORESOURCEDIR = "${WORKSPACE}/core"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'core', CORESOURCEURL, CORESOURCEREVISION, CORESOURCEDIR, '', 0, false)
|
||||
|
||||
ROOTFILESYSTEMURL = 'git@hydra:gis-embedded-linux/gis_root_fs.git'
|
||||
ROOTFILESYSTEMREVISION = ROOTFS_REVISION.trim()
|
||||
ROOTFILESYSTEMDIR = "${WORKSPACE}/rootfs"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'rootfs', ROOTFILESYSTEMURL, ROOTFILESYSTEMREVISION, ROOTFILESYSTEMDIR, '', 0, false)
|
||||
|
||||
APTLYURL = 'git@hydra:gis-embedded-linux/gis_aptly_config.git'
|
||||
APTLYREVISION = APTLY_REVISION.trim()
|
||||
APTLYDIR = "${WORKSPACE}/aptly"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'aptly', APTLYURL, APTLYREVISION, APTLYDIR, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCEREVISION, SOURCEDIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build stage') {
|
||||
failFast true
|
||||
parallel {
|
||||
stage('Arm') {
|
||||
stages {
|
||||
stage('Boot, Kernel and STM8') {
|
||||
steps {
|
||||
script {
|
||||
parallel([
|
||||
'Compile Preloader/U-Boot': {
|
||||
boot_build_job = build job: BOOTLOADER_COMPILE_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REVISION', value: BOOTSOURCEREVISION),
|
||||
string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
'Compile Init Preloader/U-Boot': {
|
||||
init_boot_build_job = build job: INIT_BOOTLOADER_COMPILE_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REVISION', value: BOOTSOURCEREVISION),
|
||||
string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
'Compile Kernel': {
|
||||
kernel_build_job = build job: KERNEL_BUILD_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_URL', value: KERNELSOURCEURL),
|
||||
string(name: 'SOURCE_REVISION', value: KERNELSOURCEREVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
'Compile STM8 code': {
|
||||
stm8_build_job = build job: STM8_BUILD_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REVISION', value: STM8SOURCEREVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
'Mark core': {
|
||||
core_mark_job = build job: CORE_MARK_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REVISION', value: CORESOURCEREVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Application and control') {
|
||||
steps {
|
||||
script {
|
||||
parallel([
|
||||
'Application compile': {
|
||||
app_build_job = build job: APPLICATION_COMPILE_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REVISION', value: SOURCEREVISION),
|
||||
string(name: 'CORE_SOURCE_REVISION', value: CORESOURCEREVISION),
|
||||
string(name: 'ARM_GCC_REVISION', value: ARM_GCC_REVISION),
|
||||
string(name: 'ARM_GCC_NAME', value: ARM_GCC_NAME),
|
||||
string(name: 'BOOST_VERSION', value: BOOST_VERSION),
|
||||
string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
string(name: 'BUILD_METHOD', value: BUILD_METHOD),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
'Control package create': {
|
||||
control_package_create_job = build job: CONTROL_PACKAGE_CREATE_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REPO', value: SOURCEURL),
|
||||
string(name: 'SOURCE_REVISION', value: SOURCEREVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Package create') {
|
||||
steps {
|
||||
script {
|
||||
parallel([
|
||||
'Application package': {
|
||||
app_package_create_job = build job: APP_PACKAGE_CREATE_JOB,
|
||||
parameters: [
|
||||
string(name: 'ESW_ARTIFACT_JOB', value: app_build_job.getProjectName()),
|
||||
string(name: 'ESW_ARTIFACT_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${app_build_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'KERNEL_ARTIFACT_JOB', value: kernel_build_job.getProjectName()),
|
||||
string(name: 'KERNEL_ARTIFACT_JOB_NUMBER', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${kernel_build_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'SOURCE_REPO', value: SOURCEURL),
|
||||
string(name: 'SOURCE_REVISION', value: SOURCEREVISION),
|
||||
string(name: 'BA4_LOGIC_ARTIFACT_LOCATION', value: BA4_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'BA4_LOGIC_ARTIFACT_PROJECT', value: BA4_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'BA4_LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA4_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'BA4_LOGIC_ARTIFACT_RELEASE_REPO', value: BA4_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'BA4_LOGIC_ARTIFACT_RELEASE_REVISION', value: BA4_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
string(name: 'BA6_LOGIC_ARTIFACT_LOCATION', value: BA6_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'BA6_LOGIC_ARTIFACT_PROJECT', value: BA6_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'BA6_LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA6_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'BA6_LOGIC_ARTIFACT_RELEASE_REPO', value: BA6_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'BA6_LOGIC_ARTIFACT_RELEASE_REVISION', value: BA6_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
string(name: 'FC5_LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'FC5_LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'FC5_LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'FC5_LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'FC5_LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
string(name: 'BOOTLOADER_ARTIFACT_JOB', value: boot_build_job.getProjectName()),
|
||||
string(name: 'BOOTLOADER_ARTIFACT_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${boot_build_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'STM8_BUILD_JOB', value: stm8_build_job.getProjectName()),
|
||||
string(name: 'STM8_BUILD_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${stm8_build_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'CONTROL_PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()),
|
||||
string(name: 'CONTROL_PACKAGE_CREATE_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${control_package_create_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Package publish') {
|
||||
steps {
|
||||
script {
|
||||
parallel([
|
||||
'Application package publish': {
|
||||
app_publish_package_job = build job: APP_PUBLISH_PACKAGE_JOB,
|
||||
parameters: [
|
||||
string(name: 'REPO_NAME', value: REPO_NAME),
|
||||
string(name: 'SNAPSHOT_NAME', value: SNAPSHOT_NAME),
|
||||
string(name: 'PUBLISH_PATH_PREFIX', value: PUBLISH_PATH_PREFIX),
|
||||
string(name: 'DISTRIBUTION', value: DISTRIBUTION),
|
||||
string(name: 'COMPONENT', value: COMPONENT),
|
||||
string(name: 'PACKAGE_CREATE_JOB', value: app_package_create_job.getProjectName()),
|
||||
string(name: 'PACKAGE_CREATE_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${app_package_create_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
'Control package publish': {
|
||||
control_publish_package_job = build job: CONTROL_PUBLISH_PACKAGE_JOB,
|
||||
parameters: [
|
||||
string(name: 'REPO_NAME', value: REPO_NAME),
|
||||
string(name: 'SNAPSHOT_NAME', value: SNAPSHOT_NAME),
|
||||
string(name: 'PUBLISH_PATH_PREFIX', value: PUBLISH_PATH_PREFIX),
|
||||
string(name: 'DISTRIBUTION', value: DISTRIBUTION),
|
||||
string(name: 'COMPONENT', value: COMPONENT),
|
||||
string(name: 'PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()),
|
||||
string(name: 'PACKAGE_CREATE_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${control_package_create_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
},
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Image create') {
|
||||
steps {
|
||||
script {
|
||||
image_create_job = build job: IMAGE_CREATE_JOB,
|
||||
parameters: [
|
||||
string(name: 'KERNEL_ARTIFACT_JOB', value: kernel_build_job.getProjectName()),
|
||||
string(name: 'KERNEL_ARTIFACT_JOB_NUMBER', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${kernel_build_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'SOURCE_REVISION', value: ROOTFS_REVISION),
|
||||
string(name: 'BOOTLOADER_ARTIFACT_JOB', value: boot_build_job.getProjectName()),
|
||||
string(name: 'BOOTLOADER_ARTIFACT_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${boot_build_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'PACKAGE_CREATE_JOB', value: app_package_create_job.getProjectName()),
|
||||
string(name: 'PACKAGE_CREATE_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${app_package_create_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'CONTROL_PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()),
|
||||
string(name: 'CONTROL_PACKAGE_CREATE_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${control_package_create_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'MIRROR_PREFIX', value: DISTRIBUTION),
|
||||
string(name: 'UBUNTU_DISTRIBUTION', value: DISTRIBUTION),
|
||||
string(name: 'GIS_PACKAGE_MIRROR_PREFIX', value: PUBLISH_PATH_PREFIX),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Init Image create') {
|
||||
steps {
|
||||
script {
|
||||
init_image_create_job = build job: INIT_IMAGE_CREATE_JOB,
|
||||
parameters: [
|
||||
string(name: 'BOOTLOADER_ARTIFACT_JOB', value: init_boot_build_job.getProjectName()),
|
||||
string(name: 'BOOTLOADER_ARTIFACT_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${init_boot_build_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
string(name: 'MAIN_IMAGE_JOB', value: image_create_job.getProjectName()),
|
||||
string(name: 'MAIN_IMAGE_JOB_SELECTOR', value: "<SpecificBuildSelector plugin='copyartifact@1.41'> <buildNumber>${image_create_job.getNumber()}</buildNumber></SpecificBuildSelector>"),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('x86') {
|
||||
stages {
|
||||
stage('Simulator compile') {
|
||||
steps {
|
||||
script {
|
||||
simulator_build_job = build job: SIMULATOR_COMPILE_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REVISION', value: SOURCEREVISION),
|
||||
string(name: 'CORE_SOURCE_REVISION', value: CORESOURCEREVISION),
|
||||
string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Release Documentation') {
|
||||
steps {
|
||||
script {
|
||||
release_notes_job = build job: RELEASE_NOTES_JOB,
|
||||
parameters: [
|
||||
string(name: 'SOURCE_REPO', value: SOURCEURL),
|
||||
string(name: 'SOURCE_REVISION', value: SOURCEREVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('BA4 logic copy') {
|
||||
steps {
|
||||
script {
|
||||
ba4_logic_copy_job = build job: "AHB_KM_1024a_logic_copy",
|
||||
parameters: [
|
||||
string(name: 'LOGIC_ARTIFACT_LOCATION', value: BA4_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'LOGIC_ARTIFACT_PROJECT', value: BA4_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA4_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: BA4_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: BA4_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('BA6 logic copy') {
|
||||
steps {
|
||||
script {
|
||||
ba6_logic_copy_job = build job: "AHB_KM_1024a_logic_copy",
|
||||
parameters: [
|
||||
string(name: 'LOGIC_ARTIFACT_LOCATION', value: BA6_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'LOGIC_ARTIFACT_PROJECT', value: BA6_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: BA6_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: BA6_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: BA6_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('FC5 logic copy') {
|
||||
steps {
|
||||
script {
|
||||
fc5_logic_copy_job = build job: "AHB_KM_1024a_logic_copy",
|
||||
parameters: [
|
||||
string(name: 'LOGIC_ARTIFACT_LOCATION', value: FC5_LOGIC_ARTIFACT_LOCATION),
|
||||
string(name: 'LOGIC_ARTIFACT_PROJECT', value: FC5_LOGIC_ARTIFACT_PROJECT),
|
||||
string(name: 'LOGIC_ARTIFACT_BUILD_SELECTOR', value: FC5_LOGIC_ARTIFACT_BUILD_SELECTOR),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REPO', value: FC5_LOGIC_ARTIFACT_RELEASE_REPO),
|
||||
string(name: 'LOGIC_ARTIFACT_RELEASE_REVISION', value: FC5_LOGIC_ARTIFACT_RELEASE_REVISION),
|
||||
booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Accumulate artifacts') {
|
||||
steps {
|
||||
script {
|
||||
artifacthelper = load("${autobuilder.commonscripts()}/artifacts/metaexport.groovy")
|
||||
subJobs = [
|
||||
//Sub-job variable, Artifact folder Increment Version Number
|
||||
[ boot_build_job, "boot", true, ],
|
||||
[ init_boot_build_job, "init_boot", false, ],
|
||||
[ kernel_build_job, "kernel", true, ],
|
||||
[ stm8_build_job, "stm8", true, ],
|
||||
[ core_mark_job, "core", true, ],
|
||||
[ app_build_job, "app", true, ],
|
||||
[ simulator_build_job, "simulator", false, ],
|
||||
[ control_package_create_job, "control_package", false, ],
|
||||
[ app_package_create_job, "app_package", false, ],
|
||||
[ init_image_create_job, "init_image", false, ],
|
||||
[ image_create_job, "image", true, ],
|
||||
[ ba4_logic_copy_job, "ba4_logic", false, ],
|
||||
[ ba6_logic_copy_job, "ba6_logic", false, ],
|
||||
[ fc5_logic_copy_job, "fc5_logic", false, ],
|
||||
[ release_notes_job, "release_notes", false, ],
|
||||
]
|
||||
artifactFolders = artifacthelper.combineSubjobArtifacts(meta, importer, subJobs)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
'meta/**',
|
||||
]
|
||||
def publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts([], artifactFolders)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
403
buildimage/init.groovy
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
versioninfo = "${WORKSPACE}/versioninfo"
|
||||
IMAGEDIR = "image"
|
||||
IMAGEROOT = "${WORKSPACE}/${IMAGEDIR}"
|
||||
BOOTLOADERDEST = "${WORKSPACE}/boot"
|
||||
MAINIMAGEDEST = "${WORKSPACE}/mainimage"
|
||||
sdcard = "sdcard"
|
||||
cleanfolders = [
|
||||
versioninfo,
|
||||
IMAGEROOT,
|
||||
BOOTLOADERDEST,
|
||||
MAINIMAGEDEST,
|
||||
sdcard,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Main image artifacts') {
|
||||
steps {
|
||||
script {
|
||||
if (MAIN_IMAGE_ARTIFACT_LOCATION == "Jenkins job artifact") {
|
||||
mainimagemeta = importer.artifactimport(meta, MAIN_IMAGE_JOB, MAIN_IMAGE_JOB_SELECTOR, MAINIMAGEDEST)
|
||||
}
|
||||
dir("${MAINIMAGEDEST}/sdcard") {
|
||||
sh """#!/bin/bash
|
||||
md5sum -c "${MAIN_IMAGE_BOARD_NAME}".zip.md5
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
unzip "${MAIN_IMAGE_BOARD_NAME}".zip
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
env.MAINIMAGEUNZIPPEDDEST = "${MAINIMAGEDEST}/sdcard/image/${MAIN_IMAGE_BOARD_NAME}.img"
|
||||
env.MAINIMAGESPLIT = "${MAINIMAGEDEST}/sdcard/image/split"
|
||||
|
||||
// The following makes a set of files of exactly the given size - In this case, the app image is split into equal ram buffer size chunks
|
||||
// (as the bootloader that receives them cannot read their size)
|
||||
dir(MAINIMAGESPLIT) {
|
||||
sh """#!/bin/bash
|
||||
split --verbose -d -b ${SPLITSIZE} "${MAINIMAGEUNZIPPEDDEST}" app_img
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
filecount=0
|
||||
for f in `pwd`/*; do
|
||||
echo "Making sure file: \$f is exactly ${SPLITSIZE}"
|
||||
crc32 \$f
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
truncate -s ${SPLITSIZE} \$f
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
crc32 \$f
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
filecrc=`crc32 \$f`
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
printf "0: %s" \$filecrc | sed -E 's/0: (..)(..)(..)(..)/0: \\4\\3\\2\\1/' | xxd -r -g0 > \$f.crc
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
xxd \$f.crc
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
filecount=\$((filecount+1))
|
||||
done
|
||||
# Output the number of files as a single byte
|
||||
printf "0: %.2x" \$filecount | xxd -r -g0 > appfilescount
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
ls -ls
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.copyfrom(meta, mainimagemeta)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying bootloader artifacts') {
|
||||
steps {
|
||||
script {
|
||||
bootloadermeta = importer.artifactimport(meta, BOOTLOADER_ARTIFACT_JOB, BOOTLOADER_ARTIFACT_JOB_SELECTOR, BOOTLOADERDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Setup environment') {
|
||||
steps {
|
||||
echo 'Setting up environment'
|
||||
script {
|
||||
TOOLS_SCRIPTS = "${WORKSPACE}/buildimage/tools"
|
||||
|
||||
IMAGEFILE="${IMAGEROOT}/${BOARD_NAME}.img"
|
||||
|
||||
PASSWORD = "ramshorn42"
|
||||
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
rm -v -rf "${IMAGEROOT}"
|
||||
mkdir -v "${IMAGEROOT}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Setup loop device') {
|
||||
steps {
|
||||
script {
|
||||
LOOPDEVICEUSED = "${WORKSPACE}/loopdeviceused"
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
rm "${LOOPDEVICEUSED}"
|
||||
|
||||
echo "Image name is: ${IMAGEFILE}"
|
||||
|
||||
# Create null partition of 7GB
|
||||
dd if=/dev/zero of="${IMAGEFILE}" bs=1M count=7168
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Configure the image as a loopback device
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
sudo losetup --find --show "${IMAGEFILE}" > "${LOOPDEVICEUSED}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
VIRTUALDISK = readFile "${LOOPDEVICEUSED}"
|
||||
VIRTUALDISK = "${VIRTUALDISK}".trim()
|
||||
FAT32PARTITION = "${VIRTUALDISK}p1"
|
||||
PRELOADERUBOOTPARTITION = "${VIRTUALDISK}p2"
|
||||
|
||||
echo "Loop device used: ${VIRTUALDISK}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create partitions') {
|
||||
steps {
|
||||
script {
|
||||
env.SFDISKSCRIPT = """label: dos
|
||||
device: ${VIRTUALDISK}
|
||||
|
||||
${PRELOADERUBOOTPARTITION} : start=1M, size=1M, type=a2
|
||||
${FAT32PARTITION} : start=2M, size=5G, type=c
|
||||
"""
|
||||
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo -e "Using sfdisk script: ${SFDISKSCRIPT}"
|
||||
echo "${SFDISKSCRIPT}" > "${IMAGEROOT}/sfdiskscript"
|
||||
echo "${SFDISKSCRIPT}" | sudo sfdisk "${VIRTUALDISK}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sync
|
||||
|
||||
sudo partprobe "${VIRTUALDISK}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo mkfs.fat -F 32 "${FAT32PARTITION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Populate Boot partition') {
|
||||
steps {
|
||||
script {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Copy the boot partition
|
||||
sudo dd if="${BOOTLOADERDEST}/bin/preloader/preloader-mkpimage.bin" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=0
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo dd if="${BOOTLOADERDEST}/bin/uboot/u-boot.img" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=4
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sync
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Populate FAT partition') {
|
||||
steps {
|
||||
script {
|
||||
env.MOUNTEDFATFILESYSTEM = "${WORKSPACE}/fatfs"
|
||||
if (isUnix()) {
|
||||
try {
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo rm -v -rf "${MOUNTEDFATFILESYSTEM}"
|
||||
mkdir -v "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Mounting FAT32 partition ${FAT32PARTITION} to ${MOUNTEDFATFILESYSTEM}"
|
||||
sudo mount -v "${FAT32PARTITION}" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/device_tree/top_system.dtb" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/uboot_images/top_system.scr" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
for f in "${MAINIMAGESPLIT}"/*; do
|
||||
sudo cp -v --preserve=timestamps "\$f" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
done
|
||||
|
||||
sudo umount -v "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
catch (Exception e) {
|
||||
echo "Caught exception: ${e.getMessage()}"
|
||||
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
|
||||
sudo umount "${MOUNTEDFATFILESYSTEM}"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Export preparation') {
|
||||
steps {
|
||||
script {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Save the boot partition image for export
|
||||
# sudo dd if="${PRELOADERUBOOTPARTITION}" of="${IMAGEDIR}/preloaderbootpart.img" bs=1M
|
||||
# if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Save the FAT32 partition image for export
|
||||
# sudo dd if="${FAT32PARTITION}" of="${IMAGEDIR}/fat32part.img" bs=1M
|
||||
# if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sync
|
||||
|
||||
sudo rm -v "${sdcard}"
|
||||
mkdir -v "${sdcard}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo zip -r "${sdcard}/${BOARD_NAME}.zip" "${IMAGEDIR}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
pushd "${sdcard}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
md5sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.md5"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sha256sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.sha256"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
popd
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
"${sdcard}/${BOARD_NAME}.zip",
|
||||
"${sdcard}/${BOARD_NAME}.zip.md5",
|
||||
"${sdcard}/${BOARD_NAME}.zip.sha256",
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
"${sdcard}/**"
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["${sdcard}/**"])
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
echo 'Cleaning Loopback Devices'
|
||||
script {
|
||||
if (isUnix()) {
|
||||
if ("${CLEANUP_LOOP_DEVICES}" == "true") {
|
||||
sh """
|
||||
echo "${PASSWORD}" | sudo -S pwd
|
||||
sudo losetup -d "${VIRTUALDISK}"
|
||||
"""
|
||||
}
|
||||
// Clear up workspace by changing ownership to the running user - for clear up purposes
|
||||
sh """#!/bin/bash
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo chown -R "${USER}": "${WORKSPACE}"/
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
729
buildimage/main.groovy
Normal file
|
|
@ -0,0 +1,729 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
|
||||
APTLYURL = 'git@hydra:gis-embedded-linux/gis_aptly_config.git'
|
||||
APTLYREVISION = APTLY_REVISION.trim()
|
||||
APTLYDIR = "${WORKSPACE}/aptly"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'aptly', APTLYURL, APTLYREVISION, APTLYDIR, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEURL = 'git@hydra:gis-embedded-linux/gis_root_fs.git'
|
||||
SOURCEREVISION = "${SOURCE_REVISION}".trim()
|
||||
SOURCEDIR = "${WORKSPACE}/gis_root_fs"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'gis_root_fs', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
env.SOURCE_PATH = SOURCEDIR
|
||||
echo "Source path is ${SOURCE_PATH}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
versioninfo = "${WORKSPACE}/versioninfo"
|
||||
IMAGEDIR = "image"
|
||||
IMAGEROOT = "${WORKSPACE}/${IMAGEDIR}"
|
||||
BOOTLOADERDEST = "${WORKSPACE}/boot"
|
||||
KERNELDEST = "${WORKSPACE}/kernel"
|
||||
CONTROL_PACKAGE_APP = "${WORKSPACE}/package_control"
|
||||
PACKAGE_APP = "${WORKSPACE}/package_app"
|
||||
sdcard = "sdcard"
|
||||
cleanfolders = [
|
||||
versioninfo,
|
||||
IMAGEROOT,
|
||||
BOOTLOADERDEST,
|
||||
KERNELDEST,
|
||||
CONTROL_PACKAGE_APP,
|
||||
PACKAGE_APP,
|
||||
sdcard,
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying bootloader artifacts') {
|
||||
steps {
|
||||
script {
|
||||
bootloadermeta = importer.artifactimport(meta, BOOTLOADER_ARTIFACT_JOB, BOOTLOADER_ARTIFACT_JOB_SELECTOR, BOOTLOADERDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying Linux kernel artifacts') {
|
||||
steps {
|
||||
script {
|
||||
kernelmeta = importer.artifactimport(meta, KERNEL_ARTIFACT_JOB, KERNEL_ARTIFACT_JOB_SELECTOR, KERNELDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying control package artifacts') {
|
||||
steps {
|
||||
script {
|
||||
controlpackagemeta = importer.artifactimport(meta, CONTROL_PACKAGE_CREATE_JOB, CONTROL_PACKAGE_CREATE_JOB_SELECTOR, CONTROL_PACKAGE_APP)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying package artifacts') {
|
||||
steps {
|
||||
script {
|
||||
apppackagemeta = importer.artifactimport(meta, PACKAGE_CREATE_JOB, PACKAGE_CREATE_JOB_SELECTOR, PACKAGE_APP)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Setup environment') {
|
||||
steps {
|
||||
echo 'Setting up environment'
|
||||
echo "Rootfs path is ${SOURCE_PATH}"
|
||||
script {
|
||||
TOOLS_SCRIPTS = "${WORKSPACE}/buildimage/tools"
|
||||
|
||||
IMAGEFILE="${IMAGEROOT}/${BOARD_NAME}.img"
|
||||
|
||||
PASSWORD = "ramshorn42"
|
||||
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
rm -v -rf "${IMAGEROOT}"
|
||||
mkdir -v "${IMAGEROOT}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Setup loop device') {
|
||||
steps {
|
||||
script {
|
||||
LOOPDEVICEUSED = "${WORKSPACE}/loopdeviceused"
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
rm "${LOOPDEVICEUSED}"
|
||||
|
||||
echo "Image name is: ${IMAGEFILE}"
|
||||
|
||||
# Create null partition of 3GB
|
||||
dd if=/dev/zero of="${IMAGEFILE}" bs=1M count=4096
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Configure the image as a loopback device
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
sudo losetup --find --show "${IMAGEFILE}" > "${LOOPDEVICEUSED}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
VIRTUALDISK = readFile "${LOOPDEVICEUSED}"
|
||||
VIRTUALDISK = "${VIRTUALDISK}".trim()
|
||||
FAT32PARTITION = "${VIRTUALDISK}p1"
|
||||
ROOTFSPARTITION = "${VIRTUALDISK}p2"
|
||||
PRELOADERUBOOTPARTITION = "${VIRTUALDISK}p3"
|
||||
BOARDINFOPARTITION = "${VIRTUALDISK}p4"
|
||||
|
||||
echo "Loop device used: ${VIRTUALDISK}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create partitions') {
|
||||
steps {
|
||||
script {
|
||||
env.SFDISKSCRIPT = """label: dos
|
||||
device: ${VIRTUALDISK}
|
||||
|
||||
${PRELOADERUBOOTPARTITION} : start=1M, size=1M, type=a2
|
||||
${FAT32PARTITION} : start=2M, size=256M, type=c
|
||||
${ROOTFSPARTITION} : start=258M, size=3.2G, type=83
|
||||
${BOARDINFOPARTITION} : start=3.5G, size=100M, type=83
|
||||
"""
|
||||
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo -e "Using sfdisk script: ${SFDISKSCRIPT}"
|
||||
echo "${SFDISKSCRIPT}" > "${IMAGEROOT}/sfdiskscript"
|
||||
echo "${SFDISKSCRIPT}" | sudo sfdisk "${VIRTUALDISK}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sync
|
||||
|
||||
sudo partprobe "${VIRTUALDISK}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo mkfs.fat -F 32 "${FAT32PARTITION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo mkfs -F -t ext3 "${ROOTFSPARTITION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo mkfs -F -t ext3 "${BOARDINFOPARTITION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Populate Boot partition') {
|
||||
steps {
|
||||
script {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Copy the boot partition
|
||||
sudo dd if="${BOOTLOADERDEST}/bin/preloader/preloader-mkpimage.bin" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=0
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo dd if="${BOOTLOADERDEST}/bin/uboot/u-boot.img" of="${PRELOADERUBOOTPARTITION}" bs=64k seek=4
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sync
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Populate FAT partition') {
|
||||
steps {
|
||||
script {
|
||||
env.MOUNTEDFATFILESYSTEM = "${WORKSPACE}/fatfs"
|
||||
if (isUnix()) {
|
||||
try {
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo rm -v -rf "${MOUNTEDFATFILESYSTEM}"
|
||||
mkdir -v "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Mounting FAT32 partition ${FAT32PARTITION} to ${MOUNTEDFATFILESYSTEM}"
|
||||
sudo mount -v "${FAT32PARTITION}" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/device_tree/top_system.dtb" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo cp -v --preserve=timestamps "${BOOTLOADERDEST}/uboot_images/top_system.scr" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo cp -v --preserve=timestamps "${KERNELDEST}/bin/zImage" "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo umount -v "${MOUNTEDFATFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
catch (Exception e) {
|
||||
echo "Caught exception: ${e.getMessage()}"
|
||||
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
|
||||
sudo umount "${MOUNTEDFATFILESYSTEM}"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generate version info folder for image') {
|
||||
steps {
|
||||
script {
|
||||
def metamap = [
|
||||
[ "${versioninfo}/rootfs_bootloader", bootloadermeta ],
|
||||
[ "${versioninfo}/rootfs_kernel", kernelmeta ],
|
||||
[ "${versioninfo}/rootfs_controlpackage", controlpackagemeta ],
|
||||
[ "${versioninfo}/rootfs_apppackage", apppackagemeta ],
|
||||
[ "${versioninfo}/rootfs_image", meta ], // Incomplete until this job ends
|
||||
]
|
||||
for (metaitem in metamap) {
|
||||
(destfolder, componentmeta) = metaitem
|
||||
dir(destfolder) {
|
||||
componentmeta.saveJsonSerialised("meta.json")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Populate Root partition') {
|
||||
steps {
|
||||
script {
|
||||
def MOUNTEDROOTFILESYSTEM = "${WORKSPACE}/virtualrootfs"
|
||||
def CONTROL_SERVICE_PACKAGE_NAME = 'gis-ahb-km-1024a-control-service_armhf'
|
||||
def ESW_EL_PACKAGE_NAME = 'gis-ahb-km-1024a-esw-el_armhf'
|
||||
def PACKAGES_ROOT_DESTINATION = "/opt/gis/packages"
|
||||
def PACKAGES_DESTINATION = "${SOURCE_PATH}/rootfs${PACKAGES_ROOT_DESTINATION}"
|
||||
def MIRROR_SOURCE_LIST = [
|
||||
"deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}/ ${UBUNTU_DISTRIBUTION} main restricted",
|
||||
"deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}/ ${UBUNTU_DISTRIBUTION} universe",
|
||||
"deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_updates/ ${UBUNTU_DISTRIBUTION}-updates main restricted",
|
||||
"deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_updates/ ${UBUNTU_DISTRIBUTION}-updates universe",
|
||||
"deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_security/ ${UBUNTU_DISTRIBUTION}-security main restricted",
|
||||
"deb ${MIRROR_BASE_URL}/${MIRROR_PREFIX}_security/ ${UBUNTU_DISTRIBUTION}-security universe",
|
||||
].join('\n')
|
||||
def GIS_PACKAGE_SOURCE_LIST = [
|
||||
"deb ${MIRROR_BASE_URL}/${GIS_PACKAGE_MIRROR_PREFIX}/ ${UBUNTU_DISTRIBUTION} testing",
|
||||
].join('\n')
|
||||
def ETH0_INITIAL_CONFIG = [
|
||||
"allow-hotplug eth0",
|
||||
"iface eth0 inet dhcp",
|
||||
].join('\n')
|
||||
def ETH1_INITIAL_CONFIG = [
|
||||
"allow-hotplug eth1",
|
||||
"iface eth1 inet dhcp",
|
||||
].join('\n')
|
||||
def DHCP_SERVER_CONFIG = [
|
||||
"subnet 192.168.79.0 netmask 255.255.255.0 {",
|
||||
"authoritative;",
|
||||
"option routers 192.168.79.2;",
|
||||
"option subnet-mask 255.255.255.0;",
|
||||
"",
|
||||
'option domain-search \\\"gislocal.net\\\";',
|
||||
"option domain-name-servers 192.168.79.2, 9.9.9.9;",
|
||||
"option ntp-servers 192.168.79.2;",
|
||||
"default-lease-time 604800;",
|
||||
"max-lease-time 1036800;",
|
||||
"",
|
||||
"range 192.168.79.128 192.168.79.254;",
|
||||
"}",
|
||||
].join('\n')
|
||||
def LO_INITIAL_CONFIG = [
|
||||
"auto lo",
|
||||
"iface lo inet loopback",
|
||||
].join('\n')
|
||||
def HOSTNAME_CONFIG = [ // Needs to be parameterised
|
||||
"hmb",
|
||||
].join('\n')
|
||||
def HOSTS_CONFIG = [ // Needs to be parameterised
|
||||
"127.0.0.1 ahb ahbkm1024a",
|
||||
"192.168.17.253 remoteupdate remoteupdate.gisapps.co.uk",
|
||||
].join('\n')
|
||||
def DHCLIENT_CONFIG = [
|
||||
"timeout 15;",
|
||||
"retry 10;",
|
||||
"reboot 10;",
|
||||
].join('\n')
|
||||
def JOURNAL_CONFIG = [
|
||||
"Storage=volatile",
|
||||
"RunTimeMaxUse=50M",
|
||||
"RunTimeMaxFileSize=2M",
|
||||
].join('\n')
|
||||
if (isUnix()) {
|
||||
try {
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo rm -rf "${MOUNTEDROOTFILESYSTEM}"
|
||||
sudo mkdir -v "${MOUNTEDROOTFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Mounting Root partition ${ROOTFSPARTITION} at ${MOUNTEDROOTFILESYSTEM}"
|
||||
sudo mount -v "${ROOTFSPARTITION}" "${MOUNTEDROOTFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Moving all Root fs files from ${SOURCE_PATH}/rootfs to ${MOUNTEDROOTFILESYSTEM}"
|
||||
sudo mv -v "${SOURCE_PATH}/rootfs"/* "${MOUNTEDROOTFILESYSTEM}"/
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo rmdir -v "${SOURCE_PATH}/rootfs/"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo ln -v -s "${MOUNTEDROOTFILESYSTEM}" "${SOURCE_PATH}/rootfs"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
pushd "${SOURCE_PATH}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Construct root file system with original permissions, empty folders, /dev folder
|
||||
sudo ./git-cache-meta --apply
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
popd
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Installing packages and public key into rootfs"
|
||||
sudo mkdir -v -p "${PACKAGES_DESTINATION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo cp "${APTLYDIR}/gpg/autobuild_public.key" "${PACKAGES_DESTINATION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo cp "${CONTROL_PACKAGE_APP}/package/${CONTROL_SERVICE_PACKAGE_NAME}.deb" "${PACKAGES_DESTINATION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo cp "${PACKAGE_APP}/package/${ESW_EL_PACKAGE_NAME}.deb" "${PACKAGES_DESTINATION}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Set the package source
|
||||
echo "${MIRROR_SOURCE_LIST}" | sudo tee "${SOURCE_PATH}/rootfs/etc/apt/sources.list.d/gismirror.list"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Set the GIS Presto package source
|
||||
echo "${GIS_PACKAGE_SOURCE_LIST}" | sudo tee "${SOURCE_PATH}/rootfs/etc/apt/sources.list.d/gis.list"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Installing packages and keys on root fs"
|
||||
pushd "${SOURCE_PATH}/rootfs"
|
||||
|
||||
sudo "${SOURCE_PATH}/prechrootmount.sh"
|
||||
if [ \$? -ne 0 ]; then popd; exit 1; fi
|
||||
|
||||
sudo chroot . ls "${PACKAGES_ROOT_DESTINATION}"
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Prepare for package updates and installation (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c "apt-key add ${PACKAGES_ROOT_DESTINATION}/autobuild_public.key"
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Do package updates (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c 'apt -yq update'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Install packages (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c 'apt -yq install systemd udev sudo network-manager psmisc python3 python3-zeroconf python3-pip dosfstools dialog'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
if [ "${UBUNTU_DISTRIBUTION}" != "xenial" ]; then
|
||||
sudo chroot . /bin/bash -c 'apt -yq install netplan.io python3-ifaddr'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
fi
|
||||
|
||||
# Install packages (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c 'apt -yq install isc-dhcp-client tcpdump isc-dhcp-server apt-transport-https openssh-client openssh-server openssh-sftp-server apache2'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Install packages (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c 'apt -yq install inetutils-ping inetutils-telnet inetutils-traceroute wget curl ethtool iperf iperf3 tmux nmap nload zip'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
if [ "${UBUNTU_DISTRIBUTION}" != "xenial" ]; then
|
||||
sudo chroot . /bin/bash -c 'apt -yq install ncat'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
fi
|
||||
|
||||
# Install packages (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c 'apt -yq install avahi-discover avahi-utils less net-tools'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Install packages (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c 'apt -yq install ifupdown apt-utils vim nano aptitude diffutils htop locate mc gkrellm gkrellmd lshw usbutils elfutils binutils gdbserver rsync'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Install packages (from GIS mirror)
|
||||
sudo chroot . /bin/bash -c 'apt -yq install libasan6 valgrind'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Do package upgrades
|
||||
sudo chroot . /bin/bash -c 'apt list --upgradable'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'apt -yq upgrade'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'apt list --installed'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Upgrade python modules
|
||||
sudo chroot . /bin/bash -c 'pip3 list'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'pip3 install "zeroconf>=0.28.8"'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'pip3 list'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Remove default apache site
|
||||
sudo chroot . /bin/bash -c 'a2dissite 000-default'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Install GIS packages (which have package dependencies)
|
||||
sudo chroot . /bin/bash -c 'autobuild=1 apt -yq install ${PACKAGES_ROOT_DESTINATION}/${CONTROL_SERVICE_PACKAGE_NAME}.deb'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'autobuild=1 apt -yq install ${PACKAGES_ROOT_DESTINATION}/${ESW_EL_PACKAGE_NAME}.deb'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Create gis user and set password
|
||||
sudo chroot . /bin/bash -c 'mkdir -p /home/gis'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'useradd -d /home/gis -s /bin/bash -G users,sudo gis'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'chown gis: /home/gis'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'echo -e "Presto42\\nPresto42" | passwd gis'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Set up file system
|
||||
sudo chroot . /bin/bash -c 'echo -e "/dev/mmcblk0p1 /mnt/gisdata vfat uid=gis,gid=gis,umask=017 0 1" > /etc/fstab'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Setup gis user password-less login
|
||||
sudo mkdir -pv "${SOURCE_PATH}/rootfs/home/gis/.ssh"
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo cp "${SOURCE_PATH}/ssh_login_keys/id_rsa_hmb.pub" "${SOURCE_PATH}/rootfs/home/gis/.ssh/authorized_keys"
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'chown -R gis: /home/gis/.ssh'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'chmod 0600 /home/gis/.ssh/authorized_keys'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Setup root password-less login
|
||||
sudo mkdir -pv "${SOURCE_PATH}/rootfs/root/.ssh"
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo cp "${SOURCE_PATH}/ssh_login_keys/id_rsa_hmb_root.pub" "${SOURCE_PATH}/rootfs/root/.ssh/authorized_keys"
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
sudo chroot . /bin/bash -c 'chmod 0600 /root/.ssh/authorized_keys'
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
# Set the package source
|
||||
echo "${MIRROR_SOURCE_LIST}" | sudo tee "${SOURCE_PATH}/rootfs/etc/apt/sources.list.d/gismirror.list"
|
||||
if [ \$? -ne 0 ]; then sudo "${SOURCE_PATH}/postchrootumount.sh"; popd; exit 1; fi
|
||||
|
||||
sudo "${SOURCE_PATH}/postchrootumount.sh"
|
||||
if [ \$? -ne 0 ]; then popd; exit 1; fi
|
||||
|
||||
popd
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Set initial networking configuration
|
||||
echo "${ETH0_INITIAL_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/network/interfaces.d/eth0"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${ETH1_INITIAL_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/network/interfaces.d/eth1"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${LO_INITIAL_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/network/interfaces.d/lo"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${DHCP_SERVER_CONFIG}" | sudo tee -a "${SOURCE_PATH}/rootfs/etc/dhcp/dhcpd.conf"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${HOSTNAME_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/hostname"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${HOSTS_CONFIG}" | sudo tee "${SOURCE_PATH}/rootfs/etc/hosts"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${DHCLIENT_CONFIG}" | sudo tee -a "${SOURCE_PATH}/rootfs/etc/dhcp/dhclient.conf"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Deal with the DHCP server settings
|
||||
sudo sed -i 's/INTERFACESv4=""/INTERFACESv4="eth0"/g' "${SOURCE_PATH}/rootfs/etc/default/isc-dhcp-server"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "${JOURNAL_CONFIG}" | sudo tee -a "${SOURCE_PATH}/rootfs/etc/systemd/journald.conf"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo rm -v -rf "${PACKAGES_DESTINATION}/autobuild_public.key"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo mkdir -v -p "${MOUNTEDROOTFILESYSTEM}/opt/gis/other"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo cp -rv "${versioninfo}" "${MOUNTEDROOTFILESYSTEM}/opt/gis/other"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo mkdir -v -p "${MOUNTEDROOTFILESYSTEM}/home/gis"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Changing permissions on gis folder content"
|
||||
sudo chmod -v -R 775 "${MOUNTEDROOTFILESYSTEM}/home/gis"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo "Assign gis content to correct group."
|
||||
sudo chown -v -R 1000:1000 "${MOUNTEDROOTFILESYSTEM}/home/gis"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo umount -v "${MOUNTEDROOTFILESYSTEM}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
catch (Exception e) {
|
||||
echo "Exception occurred: ${e.getMessage()}"
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
|
||||
unlink "${SOURCE_PATH}/rootfs"
|
||||
|
||||
sudo umount -v "${MOUNTEDROOTFILESYSTEM}"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Export preparation') {
|
||||
steps {
|
||||
script {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Save the boot partition image for export
|
||||
# sudo dd if="${PRELOADERUBOOTPARTITION}" of="${IMAGEDIR}/preloaderbootpart.img" bs=1M
|
||||
# if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Save the FAT32 partition image for export
|
||||
# sudo dd if="${FAT32PARTITION}" of="${IMAGEDIR}/fat32part.img" bs=1M
|
||||
# if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Save the Root FS partition image for export
|
||||
# sudo dd if="${ROOTFSPARTITION}" of="${IMAGEDIR}/rootfspart.img" bs=1M
|
||||
# if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sync
|
||||
|
||||
sudo rm -v "${sdcard}"
|
||||
mkdir -v "${sdcard}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sudo zip -r "${sdcard}/${BOARD_NAME}.zip" "${IMAGEDIR}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
pushd "${sdcard}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
md5sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.md5"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
sha256sum "${BOARD_NAME}.zip" > "${BOARD_NAME}.zip.sha256"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
popd
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
"${sdcard}/${BOARD_NAME}.zip",
|
||||
"${sdcard}/${BOARD_NAME}.zip.md5",
|
||||
"${sdcard}/${BOARD_NAME}.zip.sha256",
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
"${sdcard}/**",
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["${sdcard}/**"])
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
echo 'Cleaning Loopback Devices'
|
||||
script {
|
||||
if (isUnix()) {
|
||||
if ("${CLEANUP_LOOP_DEVICES}" == "true") {
|
||||
sh """
|
||||
echo "${PASSWORD}" | sudo -S pwd
|
||||
sudo losetup -d "${VIRTUALDISK}"
|
||||
"""
|
||||
}
|
||||
// Clear up workspace by changing ownership to the running user - for clear up purposes
|
||||
sh """#!/bin/bash
|
||||
echo "${PASSWORD}" | sudo -S echo
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
sudo chown -R "${USER}": "${WORKSPACE}"/
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
bat """
|
||||
echo "Cannot be built on windows at the moment"
|
||||
exit 1
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
174
cloning/cloning.groovy
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
PYTHONBRANCH = 'origin/3.6.3_windows'
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
PYTHONROOTDIR = 'python'
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR, PYTHONROOTDIR)
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage("Clean exports") {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
]
|
||||
def cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generate new job name prefix') {
|
||||
steps {
|
||||
script {
|
||||
def version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
versionprefix = version.getVersionPrefix("origin/${BRANCH_TO_BUILD}", true)
|
||||
echo "From revision: ${BRANCH_TO_BUILD} creating prefix: ${versionprefix}"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clone jobs') {
|
||||
steps {
|
||||
script {
|
||||
def templates = []
|
||||
def stringreplace = []
|
||||
def templatefolder = ''
|
||||
if (BRANCH_TO_COPY == "1.0.x") {
|
||||
templates = [ // AHB_KM_1024A jobs
|
||||
"AHB_KM_1024A_1.0.x_build",
|
||||
"AHB_KM_1024A_1.0.x_image_create",
|
||||
"AHB_KM_1024A_Init_1.0.x_image_create",
|
||||
"AHB_KM_1024A_1.0.x_release_notes",
|
||||
"AHB_KM_1024A_app_1.0.x_debpackage",
|
||||
"AHB_KM_1024A_app_1.0.x_publish_package",
|
||||
"AHB_KM_1024A_Boot_1.0.x_compile",
|
||||
"AHB_KM_1024A_Init_Boot_1.0.x_compile",
|
||||
"AHB_KM_1024A_control_1.0.x_debpackage",
|
||||
"AHB_KM_1024A_control_1.0.x_publish_package",
|
||||
"AHB_KM_1024A_ESW_1.0.x_compile",
|
||||
"AHB_KM_1024A_ESW_simulator_1.0.x_compile",
|
||||
"AHB_KM_1024A_ESW_Core_1.0.x_mark",
|
||||
"AHB_KM_1024A_kernel_1.0.x_compile",
|
||||
"AHB_KM_1024A_STM8_1.0.x_compile",
|
||||
"AHB_KM_1024A_1.0.x_doxygen_deploy",
|
||||
// AHB_KM_1024A test jobs
|
||||
"AHB_KM_1024A_1.0.x_run_tests"
|
||||
]
|
||||
stringreplace = [ "1.0.x" ]
|
||||
templatefolder = TEMPLATE_FOLDER_1_0_x.trim()
|
||||
}
|
||||
def destfoldername = templatefolder ? templatefolder.replaceAll(BRANCH_TO_COPY, versionprefix) : ''
|
||||
def destfolder
|
||||
if (destfoldername) {
|
||||
destfolder = hudson.model.Hudson.instance.getItemByFullName(destfoldername, com.cloudbees.hudson.plugins.folder.Folder)
|
||||
if (!destfolder) {
|
||||
echo "Creating destination folder: ${destfoldername}"
|
||||
destfolder = Jenkins.instance.createProject(com.cloudbees.hudson.plugins.folder.Folder, destfoldername)
|
||||
} else {
|
||||
echo "Destination folder already exists: ${destfoldername}"
|
||||
}
|
||||
}
|
||||
for (templatejobname in templates) {
|
||||
def templatefolderjobname = templatefolder ? templatefolder + '/' + templatejobname : templatejobname
|
||||
//def job = hudson.model.Hudson.instance.getItem(templatejobname)
|
||||
def job = hudson.model.Hudson.instance.getItemByFullName(templatefolderjobname)
|
||||
def newjobname = templatejobname.replaceAll(BRANCH_TO_COPY, versionprefix)
|
||||
echo "Creating new job name: ${newjobname} from: ${templatejobname}"
|
||||
|
||||
//def alreadyexistingjob = hudson.model.Hudson.instance.getItem(newjobname)
|
||||
def alreadyexistingjob = hudson.model.Hudson.instance.getItemByFullName(newjobname)
|
||||
if (!alreadyexistingjob) {
|
||||
def configXMLFile = job.getConfigFile()
|
||||
//def file = configXMLFile.getFile()
|
||||
|
||||
def configXMLString = configXMLFile.asString()
|
||||
echo "XML is: ${configXMLString}"
|
||||
|
||||
echo "Changing instances of: origin/${BRANCH_TO_COPY} with: origin/${BRANCH_TO_BUILD}"
|
||||
configXMLString = configXMLString.replaceAll("origin/${BRANCH_TO_COPY}", "origin/${BRANCH_TO_BUILD}")
|
||||
echo "Changing instances of: <defaultValue>${BRANCH_TO_COPY}</defaultValue> with: <defaultValue>${BRANCH_TO_BUILD}</defaultValue>"
|
||||
configXMLString = configXMLString.replaceAll("<defaultValue>${BRANCH_TO_COPY}</defaultValue>", "<defaultValue>${BRANCH_TO_BUILD}</defaultValue>")
|
||||
|
||||
for (replacement in stringreplace) {
|
||||
echo "Changing instances of: ${replacement} with: ${versionprefix}"
|
||||
configXMLString = configXMLString.replaceAll(replacement, versionprefix)
|
||||
}
|
||||
echo "XML is now: ${configXMLString}"
|
||||
def InputStream is = new ByteArrayInputStream(configXMLString.getBytes())
|
||||
|
||||
//def InputStream is = new FileInputStream(file)
|
||||
|
||||
echo "Creating new job ${newjobname}"
|
||||
def newjob
|
||||
if (destfolder) {
|
||||
newjob = destfolder.createProjectFromXML(newjobname, is)
|
||||
} else {
|
||||
newjob = Jenkins.instance.createProjectFromXML(newjobname, is)
|
||||
}
|
||||
newjob.save();
|
||||
echo "Created and saved new job ${newjob.getDisplayName()}"
|
||||
} else {
|
||||
echo "Job ${alreadyexistingjob.getDisplayName()} already exists"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts([])
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
97
compile/altera_soc_build_scripts/build_boot.sh
Executable file
|
|
@ -0,0 +1,97 @@
|
|||
#!/bin/bash -v
|
||||
set -x
|
||||
|
||||
PRODUCT_NAME=AHB-KM-1024A
|
||||
|
||||
echo SOURCE_PATH is ${SOURCE_PATH}
|
||||
|
||||
BSP_ROOT=${SOURCE_PATH}/saved_bsp
|
||||
echo BSP_ROOT is ${BSP_ROOT}
|
||||
BSP_DIR=${BSP_ROOT}/software/spl_bsp
|
||||
echo BSP_DIR is ${BSP_DIR}
|
||||
|
||||
ARTIFACT_HANDOFF_DIR=${LOGICDEST}/embedded_logic/hps_isw_handoff/${LOGIC_TOP_BLOCK_NAME}_hps_0
|
||||
|
||||
# Generate BSP from handoff held in source
|
||||
GEN_DIR=${SOURCE_PATH}/generated_bsp
|
||||
|
||||
rm -rf ${GEN_DIR}
|
||||
mkdir ${GEN_DIR}
|
||||
|
||||
BSP_SETTINGS_FILENAME=settings.bsp
|
||||
BSP_SETTINGS=${WORKSPACE}/${BSP_SETTINGS_FILENAME}
|
||||
bsp-create-settings --type spl --bsp-dir "${GEN_DIR}" --settings "${BSP_SETTINGS}" --preloader-settings-dir "${ARTIFACT_HANDOFF_DIR}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
bsp-query-settings --settings "${BSP_SETTINGS}" --get-all --show-names
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo BOARD_CONFIGURATION_CHOOSER is ${BOARD_CONFIGURATION_CHOOSER}
|
||||
|
||||
case "${BOARD_CONFIGURATION_CHOOSER}" in
|
||||
gis_ahbkm1024a)
|
||||
GIS_BOARD_DIR=${BSP_DIR}/uboot-socfpga/board/gis/ahbkm1024a
|
||||
;;
|
||||
|
||||
gis_ahbkm1024a_production_bootloader)
|
||||
GIS_BOARD_DIR=${BSP_DIR}/uboot-socfpga/board/gis/ahbkm1024a_production_bootloader
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unsupported board configuration: ${BOARD_CONFIGURATION_CHOOSER}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo GIS_BOARD_DIR is ${GIS_BOARD_DIR}
|
||||
echo PRELOADER_UPDATE_DIR is ${GIS_BOARD_DIR}
|
||||
echo PRELOADER_SETTINGS_DIR is ${ARTIFACT_HANDOFF_DIR}
|
||||
|
||||
cp -rv ${GEN_DIR}/generated/* ${GIS_BOARD_DIR}
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp -rv ${ARTIFACT_HANDOFF_DIR}/* ${GIS_BOARD_DIR}/sdram
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo Making Preloader and Bootloader at ${BSP_DIR}
|
||||
pushd "${BSP_DIR}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
which make
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
#make clean
|
||||
#if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
|
||||
# Preloader
|
||||
make SOCFPGA_BOARD_CONFIG=${BOARD_CONFIGURATION_CHOOSER}
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# U-Boot
|
||||
make uboot SOCFPGA_BOARD_CONFIG=${BOARD_CONFIGURATION_CHOOSER}
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
popd
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
OUTPUT_DIR=${WORKSPACE}/bin
|
||||
|
||||
PRELOADER_OUTPUT_DIR=${OUTPUT_DIR}/preloader
|
||||
rm -rf "${PRELOADER_OUTPUT_DIR}"
|
||||
mkdir -p "${PRELOADER_OUTPUT_DIR}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
BUILD_OUTPUT_ROOT=${BSP_DIR}
|
||||
|
||||
cp "${BUILD_OUTPUT_ROOT}/preloader-mkpimage.bin" "${PRELOADER_OUTPUT_DIR}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
UBOOT_OUTPUT_DIR=${OUTPUT_DIR}/uboot
|
||||
rm -rf "${UBOOT_OUTPUT_DIR}"
|
||||
mkdir -p "${UBOOT_OUTPUT_DIR}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
cp "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.img" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.srec" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.bin" "${BUILD_OUTPUT_ROOT}/uboot-socfpga/u-boot.map" "${UBOOT_OUTPUT_DIR}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
exit 0
|
||||
35
compile/altera_soc_build_scripts/build_device_tree_blob.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash -x
|
||||
#
|
||||
# Script to convert a sopcinfo file with board xml files into a device tree blob using sopc2dts command
|
||||
#
|
||||
|
||||
DTB_ROOT=${WORKSPACE}/device_tree
|
||||
|
||||
rm -rf "${DTB_ROOT}"
|
||||
mkdir "${DTB_ROOT}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
ELOGIC_DIR=${LOGICDEST}/embedded_logic
|
||||
BOARD_INFO_ROOT=${WORKSPACE}/gis_preloader_uboot/device_tree/${BOARD_CONFIGURATION_CHOOSER}
|
||||
|
||||
sopc2dts --input "${ELOGIC_DIR}/${LOGIC_SOPCINFO_NAME_PREFIX}.sopcinfo" --output "${DTB_ROOT}/top_system.dts" --type dts --board "${BOARD_INFO_ROOT}/soc_system_board_info.xml" --board "${BOARD_INFO_ROOT}/hps_common_board_info.xml" --bridge-removal all --clocks
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# We should use dtc to build the dtb file from the dts.
|
||||
# This is because dtc has the -@ option to keep symbols, which we need for device tree overlays
|
||||
# It is also stricter than sopc2dts, which will help us catch errors.
|
||||
|
||||
#sopc2dts --input "${ELOGIC_DIR}/${LOGIC_SOPCINFO_NAME_PREFIX}.sopcinfo" --output "${DTB_ROOT}/top_system.dtb" --type dtb --board "${BOARD_INFO_ROOT}/soc_system_board_info.xml" --board "${BOARD_INFO_ROOT}/hps_common_board_info.xml" --bridge-removal all --clocks
|
||||
|
||||
# Need to force output, as pll drivers are missing
|
||||
which dtc
|
||||
echo workspace is
|
||||
echo ${WORKSPACE}
|
||||
chmod 775 ${WORKSPACE}/dtc/dtc
|
||||
${WORKSPACE}/dtc/dtc -f -@ -I dts -O dtb -o "${DTB_ROOT}/top_system.dtb" "${DTB_ROOT}/top_system.dts"
|
||||
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
30
compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash -x
|
||||
#
|
||||
# Script to convert board-specific hierarchical device tree source into a device tree blob
|
||||
#
|
||||
|
||||
DTB_ROOT=${WORKSPACE}/device_tree
|
||||
|
||||
rm -rf "${DTB_ROOT}"
|
||||
mkdir "${DTB_ROOT}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
ALL_BOARD_ROOT=${WORKSPACE}/gis_preloader_uboot/device_tree
|
||||
BOARD_INFO_ROOT=${ALL_BOARD_ROOT}/${BOARD_CONFIGURATION_CHOOSER}
|
||||
BOARD_DTS=${BOARD_INFO_ROOT}/altsource/${BOARD_CONFIGURATION_CHOOSER}.dts
|
||||
BOARD_FLAT_DTS=${BOARD_INFO_ROOT}/altsource/${BOARD_CONFIGURATION_CHOOSER}.flat.dts
|
||||
SOCFPGA_DTS_DEFINITIONS_ROOT=${ALL_BOARD_ROOT}/socfpga
|
||||
|
||||
# First convert hierarchical device tree source into flat device tree source
|
||||
cpp -nostdinc -I "${SOCFPGA_DTS_DEFINITIONS_ROOT}" -I "${SOCFPGA_DTS_DEFINITIONS_ROOT}/include" -undef -x assembler-with-cpp "${BOARD_DTS}" > "${BOARD_FLAT_DTS}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Convert flat device tree file into dtc-processed device tree source
|
||||
dtc -I dts -O dts -o "${DTB_ROOT}/top_system.dts" "${BOARD_FLAT_DTS}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Convert flat device tree file into device tree blob
|
||||
dtc -I dts -O dtb -o "${DTB_ROOT}/top_system.dtb" "${BOARD_FLAT_DTS}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
exit 0
|
||||
17
compile/altera_soc_build_scripts/build_uboot_images.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash -x
|
||||
#
|
||||
# Script to convert a text file into a u-boot script
|
||||
#
|
||||
# Note that the text input file should be saved with Linux line endings to avoid lots of warnings at boot time
|
||||
#
|
||||
|
||||
UBOOT_IMAGE_ROOT=${WORKSPACE}/uboot_images
|
||||
|
||||
rm -rf "${UBOOT_IMAGE_ROOT}"
|
||||
mkdir "${UBOOT_IMAGE_ROOT}"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
mkimage -A arm -O linux -T script -C none -n "GIS u-boot script" -d "${WORKSPACE}/gis_preloader_uboot/uboot_script/${BOARD_CONFIGURATION_CHOOSER}/gis-u-boot.txt" "${UBOOT_IMAGE_ROOT}/top_system.scr"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
exit 0
|
||||
325
compile/compile.groovy
Normal file
|
|
@ -0,0 +1,325 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(
|
||||
this,
|
||||
PRODUCT_NAME,
|
||||
SUBCOMPONENT_NAME,
|
||||
RELEASE_REPO,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
|
||||
XMLCOREUTILSURL = 'git@hydra:tools/xml-coreutils.git'
|
||||
XMLCOREUTILSREVISION = "origin/master"
|
||||
XMLCOREUTILSDIR = "${WORKSPACE}/xmlcoreutils"
|
||||
configurationhelper.gitCheckoutAndRegister(
|
||||
meta,
|
||||
'xmlcoreutils',
|
||||
XMLCOREUTILSURL,
|
||||
XMLCOREUTILSREVISION,
|
||||
XMLCOREUTILSDIR
|
||||
)
|
||||
env.PATH = "${XMLCOREUTILSDIR}/ver/src" + ":" + env.PATH
|
||||
|
||||
ALTERASOCEDSURL = 'git@hydra:tools/altera_soc_eds.git'
|
||||
if (isUnix()) {
|
||||
ALTERASOCEDSBRANCH = "origin/17.1.0.240-linux"
|
||||
}
|
||||
else {
|
||||
ALTERASOCEDSBRANCH = "origin/17.1.0.240-windows"
|
||||
}
|
||||
ALTERASOCEDSDIR = "${WORKSPACE}/altera_soc_eds"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'altera_soc_eds', ALTERASOCEDSURL, ALTERASOCEDSBRANCH, ALTERASOCEDSDIR)
|
||||
env.ALTERA_SOC_EDS = ALTERASOCEDSDIR
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = "origin/3.6.3_linux"
|
||||
}
|
||||
else {
|
||||
PYTHONBRANCH = "origin/3.6.3_windows"
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
if (isUnix()) {
|
||||
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
|
||||
}
|
||||
else {
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
|
||||
ARMGCCURL = 'git@hydra:tools/arm-gcc.git'
|
||||
ARMGCCREVISION = ARM_GCC_REVISION.trim()
|
||||
ARMGCCDIR = "${WORKSPACE}/arm-gcc"
|
||||
ARMGCCNAME = ARM_GCC_NAME.trim()
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'arm-gcc', ARMGCCURL, ARMGCCREVISION, ARMGCCDIR)
|
||||
if (isUnix()) {
|
||||
env.TOOLCHAIN_FOLDER = "${ARMGCCDIR}/x86_64_arm-linux-gnueabihf/ver/bin"
|
||||
env.ARMGCCSTDLIB_FOLDER = "${ARMGCCDIR}/x86_64_arm-linux-gnueabihf/ver/arm-linux-gnueabihf/libc/lib"
|
||||
}
|
||||
else {
|
||||
env.TOOLCHAIN_FOLDER = "${ARMGCCDIR}/i686-mingw32_arm-linux-gnueabihf/ver/bin"
|
||||
env.ARMGCCSTDLIB_FOLDER = "${ARMGCCDIR}/i686-mingw32_arm-linux-gnueabihf/ver/arm-linux-gnueabihf/libc/lib"
|
||||
}
|
||||
env.ARM_GCC = ARMGCCDIR
|
||||
|
||||
CMAKEURL = 'git@hydra:tools/cmake.git'
|
||||
CMAKEREVISION = "origin/3.19.3"
|
||||
CMAKEDIR = "${WORKSPACE}/cmake"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'cmake', CMAKEURL, CMAKEREVISION, CMAKEDIR)
|
||||
if (isUnix()) {
|
||||
env.PATH = "${CMAKEDIR}/Linux-x86_64/ver/bin" + ":" + env.PATH
|
||||
} else {
|
||||
env.PATH = "${CMAKEDIR}/win64-x64/ver/bin" + ";" + env.PATH
|
||||
}
|
||||
|
||||
CDSURL = 'git@hydra:core-presto/core-developer-scripts.git'
|
||||
CDSREVISION = "origin/master"
|
||||
CDSDIR = "${WORKSPACE}/cds"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'core-developer-scripts', CDSURL, CDSREVISION, CDSDIR)
|
||||
env.CDS = CDSDIR
|
||||
|
||||
DOXYGENEXE = 'doxygen'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
ESWDIR = 'esw'
|
||||
SOURCEURL = "git@hydra:ahb-km-1024a-source/ahb-km-1024a-embedded-software-subtree.git"
|
||||
SOURCEREVISION = SOURCE_REVISION.trim()
|
||||
SOURCENAME = 'ahb-km-1024a'
|
||||
hs = "${ESWDIR}/${SOURCENAME}"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, SOURCENAME, SOURCEURL, SOURCEREVISION, hs, '', 0, false)
|
||||
env.SOURCE_PATH = hs
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
env.LOGICDEST = "${WORKSPACE}/logic"
|
||||
DOXYGENOUT_FOLDER_NAME = 'doxygen_out'
|
||||
env.DOXYGENOUT = "${WORKSPACE}/${DOXYGENOUT_FOLDER_NAME}"
|
||||
env.EXPORT = "${WORKSPACE}/export"
|
||||
cleanfolders = [
|
||||
EXPORT,
|
||||
LOGICDEST,
|
||||
STATICANALYSIS,
|
||||
DOXYGENOUT
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout core source') {
|
||||
steps {
|
||||
script {
|
||||
CORESOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git"
|
||||
CORESOURCEREVISION = CORE_SOURCE_REVISION.trim()
|
||||
CORESOURCENAME = 'core'
|
||||
cs = "${ESWDIR}/${CORESOURCENAME}"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, CORESOURCENAME, CORESOURCEURL, CORESOURCEREVISION, cs, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying logic artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def logicoptions = importer.getNewImportOptions()
|
||||
logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION)
|
||||
importer.artifactimport(meta, logicoptions, LOGICDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checking for logic handover change') {
|
||||
steps {
|
||||
script {
|
||||
def jsondifferenceshelper = load("${autobuilder.commonscripts()}/differences/json.groovy")
|
||||
|
||||
// Fails build if there is a difference
|
||||
IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/combined_auto.json"
|
||||
CURRENT_JSON="${hs}/HAL_Generator/combined_auto.json"
|
||||
jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON)
|
||||
|
||||
IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/ahb_fpga.json"
|
||||
CURRENT_JSON="${hs}/HAL_Generator/ahb_fpga.json"
|
||||
jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON)
|
||||
|
||||
IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/hmb_fpga.json"
|
||||
CURRENT_JSON="${hs}/HAL_Generator/hmb_fpga.json"
|
||||
jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON)
|
||||
|
||||
IMPORTED_HPS0="${LOGICDEST}/embedded_logic/hps_0.h"
|
||||
CURRENT_HPS0="${hs}/src/model/logic_adapters/hps_0.h"
|
||||
def filedifferenceshelper = load("${autobuilder.commonscripts()}/differences/file.groovy")
|
||||
filedifferenceshelper.comparefiles(IMPORTED_HPS0, CURRENT_HPS0)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Version stamp files') {
|
||||
steps {
|
||||
script {
|
||||
convertdetails = [
|
||||
// File to convert Pattern to replace New string
|
||||
[ "${cs}/presto_hal/src/prestohal/Common/Generic4Version.cpp", "0,30000,0,0", meta.buildstampinfo.buildstampcommasep() ],
|
||||
[ "${cs}/presto/src_embedded/HMB/src/presto/RestApi/productinfo/ProductInfoJView.cpp", "0.30000.0.0", meta.buildstampinfo.buildstamp ],
|
||||
]
|
||||
versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy")
|
||||
versionnumbering.stamp(convertdetails)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
dir(SOURCE_PATH) {
|
||||
toBuild = []
|
||||
def toBuildUntrimmed = BUILD_VARIANTS.split(',')
|
||||
toBuildUntrimmed.each {
|
||||
toBuild.add(it.trim())
|
||||
}
|
||||
env.TARGET_HOST_IP = 'localhost'
|
||||
env.GDB_PORT = '12345'
|
||||
for (variant in toBuild) {
|
||||
sh """#!/bin/bash
|
||||
cmake -v -S . -Bbuild/${variant} -DCMAKE_TOOLCHAIN_FILE="${CDS}/cmake/arm_cross_compiler.cmake" -DCMAKE_BUILD_TYPE=${variant} --build .
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
cmake --build build/${variant} --parallel \$(nproc) -v --target KM1024a
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
cmake --install build/${variant} --prefix "${EXPORT}/${variant}" --component APPLICATION_AUTOBUILD
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
recordIssues(
|
||||
enabledForFailure: true,
|
||||
tools: [
|
||||
gcc(reportEncoding: 'UTF-8')
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Produce doxygen output') {
|
||||
when {
|
||||
expression {
|
||||
PRODUCE_DOXYGEN_OUTPUT == 'true'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
DOXYGENCONFIG = "${WORKSPACE}/autobuild/compile/${DOXYGEN_CONFIG_FILENAME.trim()}"
|
||||
dir(DOXYGENOUT) {
|
||||
}
|
||||
echo "Running doxygen in folder: ${ESWDIR} using executable: ${DOXYGENEXE} and config: ${DOXYGENCONFIG} Expecting output at: ${DOXYGENOUT}"
|
||||
dir(ESWDIR) {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
"${DOXYGENEXE}" "${DOXYGENCONFIG}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
} else {
|
||||
error "Windows not supported for building at the moment"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Create compressed export (preserving links)') {
|
||||
steps {
|
||||
script {
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash
|
||||
rm export.tgz
|
||||
tar zcvf export.tgz export
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
} else {
|
||||
error "Windows not supported for building at the moment"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
'export/**',
|
||||
'export.tgz',
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
if (PRODUCE_DOXYGEN_OUTPUT == 'true') {
|
||||
publishable.add("${DOXYGENOUT_FOLDER_NAME}/**")
|
||||
}
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifacts = ['export/**','export.tgz']
|
||||
if (PRODUCE_DOXYGEN_OUTPUT == 'true') {
|
||||
artifacts.add("${DOXYGENOUT_FOLDER_NAME}/**")
|
||||
}
|
||||
def artifactlist = meta.generateartifacts(artifacts)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
223
compile/compile_boot.groovy
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
|
||||
ALTERASOCEDSURL = 'git@hydra:tools/altera_soc_eds.git'
|
||||
ALTERASOCEDSDIR = "${WORKSPACE}/altera_soc_eds"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'altera_soc_eds', ALTERASOCEDSURL, ALTERA_SOC_EDS_REVISION, ALTERASOCEDSDIR)
|
||||
env.ALTERA_SOC_EDS = ALTERASOCEDSDIR
|
||||
|
||||
DTCURL = 'git@hydra:tools/dtc.git'
|
||||
DTCREVISION = "origin/1.4.5"
|
||||
DTCDIR = "${WORKSPACE}/dtc"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'dtc', DTCURL, DTCREVISION, DTCDIR)
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = "origin/3.6.3_linux"
|
||||
}
|
||||
else {
|
||||
PYTHONBRANCH = "origin/3.6.3_windows"
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
if (isUnix()) {
|
||||
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
|
||||
}
|
||||
else {
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEURL = 'git@hydra:gis-embedded-linux/gis_preloader_uboot.git'
|
||||
SOURCEREVISION = "${SOURCE_REVISION}".trim()
|
||||
SOURCEDIR = "${WORKSPACE}/gis_preloader_uboot"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'gis_preloader_uboot', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
env.SOURCE_PATH = SOURCEDIR
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
env.LOGICDEST = "${WORKSPACE}/logic"
|
||||
cleanfolders = [
|
||||
"${WORKSPACE}/bin",
|
||||
LOGICDEST,
|
||||
"${WORKSPACE}/version",
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying logic artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def logicoptions = importer.getNewImportOptions()
|
||||
logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION)
|
||||
importer.artifactimport(meta, logicoptions, LOGICDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Version stamp files') {
|
||||
steps {
|
||||
script {
|
||||
convertdetails = [
|
||||
// File to convert Pattern to replace New string
|
||||
]
|
||||
versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy")
|
||||
versionnumbering.stamp(convertdetails)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build preloader and u-boot') {
|
||||
steps {
|
||||
script {
|
||||
env.COMPILE_SCRIPTS = "${autobuilder.getautobuildpath()}/compile"
|
||||
echo "Compile scripts at ${COMPILE_SCRIPTS}"
|
||||
if (isUnix()) {
|
||||
sh '''
|
||||
"${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_boot.sh"
|
||||
'''
|
||||
}
|
||||
else {
|
||||
bat '''
|
||||
"%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_boot.sh"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
recordIssues(
|
||||
enabledForFailure: true,
|
||||
tools: [
|
||||
gcc(reportEncoding: 'UTF-8'),
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build u-boot script') {
|
||||
steps {
|
||||
script {
|
||||
echo "Compile scripts at ${COMPILE_SCRIPTS}"
|
||||
if (isUnix()) {
|
||||
sh '''
|
||||
"${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_uboot_images.sh"
|
||||
'''
|
||||
}
|
||||
else {
|
||||
bat '''
|
||||
"%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_uboot_images.sh"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build device tree blob') {
|
||||
steps {
|
||||
script {
|
||||
echo "Compile scripts at ${COMPILE_SCRIPTS}"
|
||||
if ("${BUILD_DEVICE_TREE_FROM_SOPCINFO}" == "true") {
|
||||
if (isUnix()) {
|
||||
sh '''
|
||||
"${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob.sh"
|
||||
'''
|
||||
}
|
||||
else {
|
||||
bat '''
|
||||
"%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob.sh"
|
||||
'''
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isUnix()) {
|
||||
sh '''
|
||||
"${ALTERA_SOC_EDS}/ver/embedded/embedded_command_shell.sh" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob_from_source.sh"
|
||||
'''
|
||||
}
|
||||
else {
|
||||
bat '''
|
||||
"%ALTERA_SOC_EDS%/ver/embedded/embedded_command_shell.bat" "${COMPILE_SCRIPTS}/altera_soc_build_scripts/build_device_tree_blob_from_source.sh"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
'bin/**',
|
||||
'uboot_script/**',
|
||||
'device_tree/**',
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["bin/**","uboot_images/**","device_tree/**"])
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
173
compile/compile_kernel.groovy
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = "origin/3.6.3_linux"
|
||||
}
|
||||
else {
|
||||
PYTHONBRANCH = "origin/3.6.3_windows"
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
if (isUnix()) {
|
||||
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
|
||||
}
|
||||
else {
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
|
||||
ARMGCCURL = 'git@hydra:tools/arm-gcc.git'
|
||||
ARMGCCREVISION = "${ARM_GCC_REVISION}"
|
||||
ARMGCCDIR = "${WORKSPACE}/arm-gcc"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'arm-gcc', ARMGCCURL, ARMGCCREVISION, ARMGCCDIR)
|
||||
if (isUnix()) {
|
||||
env.TOOLCHAIN_FOLDER = "${WORKSPACE}/arm-gcc/x86_64_arm-linux-gnueabihf/ver/bin"
|
||||
}
|
||||
else {
|
||||
env.TOOLCHAIN_FOLDER = "${WORKSPACE}/arm-gcc/i686-mingw32_arm-linux-gnueabihf/ver/bin"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEURL = SOURCE_URL.trim()
|
||||
SOURCEREVISION = SOURCE_REVISION.trim()
|
||||
SOURCEDIR = "${WORKSPACE}/kernel"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'kernel', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
env.SOURCE_PATH = SOURCEDIR
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
"${WORKSPACE}/bin",
|
||||
"${WORKSPACE}/version",
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
// Setting environment
|
||||
env.CROSS_COMPILE = "${TOOLCHAIN_FOLDER}/arm-linux-gnueabihf-"
|
||||
env.ARCH = 'arm'
|
||||
if (isUnix()) {
|
||||
sh """#!/bin/bash -v
|
||||
CORES=\$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
# Build the kernel using the socfpga default config (that comes with the kernel)
|
||||
pushd "${SOURCE_PATH}"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
echo Building kernel in folder: `pwd`
|
||||
|
||||
make socfpga_defconfig
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
make -j\${CORES} zImage
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# Create an artifacts directory and copy the kernel to it
|
||||
mkdir "${WORKSPACE}/bin"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
cp "${SOURCE_PATH}/arch/arm/boot/zImage" "${WORKSPACE}/bin/zImage"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
cp "${SOURCE_PATH}/.config" "${WORKSPACE}/bin/config"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
|
||||
popd
|
||||
|
||||
"""
|
||||
}
|
||||
else {
|
||||
error "Windows not currently supported"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
recordIssues(
|
||||
enabledForFailure: true,
|
||||
tools: [
|
||||
gcc(reportEncoding: 'UTF-8'),
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
'bin/**',
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["bin/**"])
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
267
compile/compile_simulator.groovy
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(
|
||||
this,
|
||||
PRODUCT_NAME,
|
||||
SUBCOMPONENT_NAME,
|
||||
RELEASE_REPO,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
importer = load("${autobuilder.commonscripts()}/import/importer.groovy")
|
||||
|
||||
XMLCOREUTILSURL = 'git@hydra:tools/xml-coreutils.git'
|
||||
XMLCOREUTILSREVISION = "origin/master"
|
||||
XMLCOREUTILSDIR = "${WORKSPACE}/xmlcoreutils"
|
||||
configurationhelper.gitCheckoutAndRegister(
|
||||
meta,
|
||||
'xmlcoreutils',
|
||||
XMLCOREUTILSURL,
|
||||
XMLCOREUTILSREVISION,
|
||||
XMLCOREUTILSDIR
|
||||
)
|
||||
env.PATH = "${XMLCOREUTILSDIR}/ver/src" + ":" + env.PATH
|
||||
|
||||
ALTERASOCEDSURL = 'git@hydra:tools/altera_soc_eds.git'
|
||||
if (isUnix()) {
|
||||
ALTERASOCEDSBRANCH = "origin/17.1.0.240-linux"
|
||||
}
|
||||
else {
|
||||
ALTERASOCEDSBRANCH = "origin/17.1.0.240-windows"
|
||||
}
|
||||
ALTERASOCEDSDIR = "${WORKSPACE}/altera_soc_eds"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'altera_soc_eds', ALTERASOCEDSURL, ALTERASOCEDSBRANCH, ALTERASOCEDSDIR)
|
||||
env.ALTERA_SOC_EDS = ALTERASOCEDSDIR
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = "origin/3.6.3_linux"
|
||||
}
|
||||
else {
|
||||
PYTHONBRANCH = "origin/3.6.3_windows"
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
if (isUnix()) {
|
||||
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
|
||||
}
|
||||
else {
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
|
||||
CYGWIN64URL = 'git@hydra:gis/cygwin64.git'
|
||||
CYGWIN64REVISION = "origin/master"
|
||||
CYGWIN64DIR = "${WORKSPACE}/cygwin64"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'cygwin64', CYGWIN64URL, CYGWIN64REVISION, CYGWIN64DIR)
|
||||
|
||||
CMAKEURL = 'git@hydra:tools/cmake.git'
|
||||
CMAKEREVISION = "origin/3.19.3"
|
||||
CMAKEDIR = "${WORKSPACE}/cmake"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'cmake', CMAKEURL, CMAKEREVISION, CMAKEDIR)
|
||||
if (isUnix()) {
|
||||
env.PATH = "${CMAKEDIR}/Linux-x86_64/ver/bin" + ":" + env.PATH
|
||||
} else {
|
||||
env.PATH = "${CMAKEDIR}/win64-x64/ver/bin" + ";" + env.PATH
|
||||
}
|
||||
|
||||
CDSURL = 'git@hydra:core-presto/core-developer-scripts.git'
|
||||
CDSREVISION = "origin/master"
|
||||
CDSDIR = "${WORKSPACE}/cds"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'core-developer-scripts', CDSURL, CDSREVISION, CDSDIR)
|
||||
env.CDS = CDSDIR
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
ESWDIR = 'esw'
|
||||
SOURCEURL = "git@hydra:ahb-km-1024a-source/ahb-km-1024a-embedded-software-subtree.git"
|
||||
SOURCEREVISION = SOURCE_REVISION.trim()
|
||||
SOURCENAME = 'ahb-km-1024a'
|
||||
hs = "${ESWDIR}/${SOURCENAME}"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, SOURCENAME, SOURCEURL, SOURCEREVISION, hs, '', 0, false)
|
||||
env.SOURCE_PATH = hs
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
STATICANALYSIS = 'staticanalysis'
|
||||
env.LOGICDEST = "${WORKSPACE}/logic"
|
||||
DOXYGENOUT_FOLDER_NAME = 'doxygen_out'
|
||||
env.DOXYGENOUT = "${WORKSPACE}/${DOXYGENOUT_FOLDER_NAME}"
|
||||
env.EXPORT = "${WORKSPACE}/export"
|
||||
cleanfolders = [
|
||||
EXPORT,
|
||||
LOGICDEST,
|
||||
STATICANALYSIS,
|
||||
DOXYGENOUT
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout core source') {
|
||||
steps {
|
||||
script {
|
||||
CORESOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git"
|
||||
CORESOURCEREVISION = CORE_SOURCE_REVISION.trim()
|
||||
CORESOURCENAME = 'core'
|
||||
cs = "${ESWDIR}/${CORESOURCENAME}"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, CORESOURCENAME, CORESOURCEURL, CORESOURCEREVISION, cs, '', 0, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Copying logic artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def logicoptions = importer.getNewImportOptions()
|
||||
logicoptions.source(LOGIC_ARTIFACT_LOCATION, LOGIC_ARTIFACT_PROJECT, LOGIC_ARTIFACT_BUILD_SELECTOR, LOGIC_ARTIFACT_RELEASE_REPO, LOGIC_ARTIFACT_RELEASE_REVISION)
|
||||
importer.artifactimport(meta, logicoptions, LOGICDEST)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checking for logic handover change') {
|
||||
steps {
|
||||
script {
|
||||
def jsondifferenceshelper = load("${autobuilder.commonscripts()}/differences/json.groovy")
|
||||
|
||||
// Fails build if there is a difference
|
||||
IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/combined_auto.json"
|
||||
CURRENT_JSON="${hs}/HAL_Generator/combined_auto.json"
|
||||
jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON)
|
||||
|
||||
IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/ahb_fpga.json"
|
||||
CURRENT_JSON="${hs}/HAL_Generator/ahb_fpga.json"
|
||||
jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON)
|
||||
|
||||
IMPORTED_JSON="${LOGICDEST}/embedded_logic/handover/hmb_fpga.json"
|
||||
CURRENT_JSON="${hs}/HAL_Generator/hmb_fpga.json"
|
||||
jsondifferenceshelper.comparefiles(IMPORTED_JSON, CURRENT_JSON)
|
||||
|
||||
IMPORTED_HPS0="${LOGICDEST}/embedded_logic/hps_0.h"
|
||||
CURRENT_HPS0="${hs}/src/model/logic_adapters/hps_0.h"
|
||||
def filedifferenceshelper = load("${autobuilder.commonscripts()}/differences/file.groovy")
|
||||
filedifferenceshelper.comparefiles(IMPORTED_HPS0, CURRENT_HPS0)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Version stamp files') {
|
||||
steps {
|
||||
script {
|
||||
convertdetails = [
|
||||
// File to convert Pattern to replace New string
|
||||
[ "${cs}/presto_hal/src/prestohal/Common/Generic4Version.cpp", "0,30000,0,0", meta.buildstampinfo.buildstampcommasep() ],
|
||||
[ "${cs}/presto/src_embedded/HMB/src/presto/RestApi/productinfo/ProductInfoJView.cpp", "0.30000.0.0", meta.buildstampinfo.buildstamp ],
|
||||
]
|
||||
versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy")
|
||||
versionnumbering.stamp(convertdetails)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
dir(SOURCE_PATH) {
|
||||
toBuild = []
|
||||
def toBuildUntrimmed = BUILD_VARIANTS.split(',')
|
||||
toBuildUntrimmed.each {
|
||||
toBuild.add(it.trim())
|
||||
}
|
||||
env.TARGET_HOST_IP = 'localhost'
|
||||
env.GDB_PORT = '12345'
|
||||
for (variant in toBuild) {
|
||||
powershell """
|
||||
& cmake -v -S . -B "build/${variant}" -G "Visual Studio 16 2019" -A Win32 -D_WIN32_WINNT_WIN10=0x0A00 -DCMAKE_BUILD_TYPE=${variant}
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
|
||||
& cmake --build "build/${variant}" --config "${variant}" --parallel \$env:NUMBER_OF_PROCESSORS -v --target ALL_BUILD
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
|
||||
& cmake --install "build/${variant}" --config "${variant}" --prefix "${EXPORT}/${variant}" --component SIMULATION_AUTOBUILD
|
||||
if (\$lastexitcode -ge 1) { exit 1 }
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
recordIssues(
|
||||
enabledForFailure: true,
|
||||
tools: [
|
||||
msBuild(reportEncoding: 'UTF-8')
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
'export/**'
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifacts = ['export/**']
|
||||
def artifactlist = meta.generateartifacts(artifacts)
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
155
compile/compile_stm8.groovy
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
script {
|
||||
meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout dependencies') {
|
||||
steps {
|
||||
script {
|
||||
configurationhelper = autobuilder.configurationhelper()
|
||||
|
||||
PYTHONURL = 'git@hydra:tools/python.git'
|
||||
if (isUnix()) {
|
||||
PYTHONBRANCH = "origin/3.6.3_linux"
|
||||
}
|
||||
else {
|
||||
PYTHONBRANCH = "origin/3.6.3_windows"
|
||||
}
|
||||
PYTHONDIR = "${WORKSPACE}/python"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'python', PYTHONURL, PYTHONBRANCH, PYTHONDIR)
|
||||
if (isUnix()) {
|
||||
env.PYTHON = "${PYTHONDIR}/usr/local/bin/python3"
|
||||
}
|
||||
else {
|
||||
env.PYTHON = "${PYTHONDIR}/ver/python.exe"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checkout source') {
|
||||
steps {
|
||||
script {
|
||||
SOURCEURL = 'git@hydra:gis/stm8-embedded.git'
|
||||
SOURCEREVISION = "${SOURCE_REVISION}".trim()
|
||||
SOURCEDIR = "${WORKSPACE}/esw"
|
||||
configurationhelper.gitCheckoutAndRegister(meta, 'esw', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false)
|
||||
env.SOURCE_PATH = SOURCEDIR
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Clean exports') {
|
||||
steps {
|
||||
script {
|
||||
cleanfolders = [
|
||||
"${WORKSPACE}/bin",
|
||||
"${WORKSPACE}/version",
|
||||
]
|
||||
cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy")
|
||||
cleaner.clean(cleanfolders)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Generating version info') {
|
||||
steps {
|
||||
script {
|
||||
version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy")
|
||||
version.generate(meta, SOURCE_REVISION, SOURCE_PATH)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Version stamp files') {
|
||||
steps {
|
||||
script {
|
||||
convertdetails = [
|
||||
// File to convert Pattern to replace New string
|
||||
]
|
||||
versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy")
|
||||
versionnumbering.stamp(convertdetails)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
// Copying files for now
|
||||
if (isUnix()) {
|
||||
sh """
|
||||
mkdir -p "${WORKSPACE}/bin"
|
||||
cp "${WORKSPACE}/esw/stm_projects/Project/som_adc_monitor/STVD/Cosmic/Release/hostA_adc_monitor.stm8bin" "${WORKSPACE}/bin"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
cp "${WORKSPACE}/esw/stm_projects/Project/som_adc_monitor/STVD/Cosmic/Release/hostB_adc_monitor.stm8bin" "${WORKSPACE}/bin"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
cp "${WORKSPACE}/esw/stm_projects/Project/som_adc_monitor/STVD/Cosmic/Release/som_adc_monitor.stm8bin" "${WORKSPACE}/bin"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
cp "${WORKSPACE}/esw/stm_projects/Project/cleanworm/Release/cleanworm.stm8bin" "${WORKSPACE}/bin"
|
||||
if [ \$? -ne 0 ]; then exit 1; fi
|
||||
"""
|
||||
}
|
||||
else {
|
||||
error "Windows not currently supported"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Static analysis') {
|
||||
steps {
|
||||
script {
|
||||
recordIssues(
|
||||
enabledForFailure: true,
|
||||
tools: [
|
||||
gcc(reportEncoding: 'UTF-8'),
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Checksum artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def checksummable = [
|
||||
'bin/**',
|
||||
]
|
||||
checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy")
|
||||
checksumutils.generatelist(meta, checksummable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Classifying publishable artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def publishable = [
|
||||
]
|
||||
publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy")
|
||||
publishutils.generatelist(meta, publishable)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Archiving artifacts') {
|
||||
steps {
|
||||
script {
|
||||
def artifactlist = meta.generateartifacts(["bin/**"])
|
||||
archiveArtifacts "${artifactlist}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
echo 'Post-build'
|
||||
}
|
||||
failure {
|
||||
echo 'Failed build'
|
||||
}
|
||||
unstable {
|
||||
echo 'Unstable build'
|
||||
}
|
||||
success {
|
||||
echo 'Succeeded build'
|
||||
}
|
||||
}
|
||||
}
|
||||
383
compile/doxygenconfig
Normal file
|
|
@ -0,0 +1,383 @@
|
|||
# Doxyfile 1.8.19
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "My Project"
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY =
|
||||
CREATE_SUBDIRS = NO
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
OUTPUT_TEXT_DIRECTION = None
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
JAVADOC_BANNER = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
OPTIMIZE_OUTPUT_SLICE = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
TOC_INCLUDE_HEADINGS = 5
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
NUM_PROC_THREADS = 1
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_PRIV_VIRTUAL = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT =
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.idl \
|
||||
*.ddl \
|
||||
*.odl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.cs \
|
||||
*.d \
|
||||
*.php \
|
||||
*.php4 \
|
||||
*.php5 \
|
||||
*.phtml \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.markdown \
|
||||
*.md \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.doc \
|
||||
*.txt \
|
||||
*.py \
|
||||
*.pyw \
|
||||
*.f90 \
|
||||
*.f95 \
|
||||
*.f03 \
|
||||
*.f08 \
|
||||
*.f18 \
|
||||
*.f \
|
||||
*.for \
|
||||
*.vhd \
|
||||
*.vhdl \
|
||||
*.ucf \
|
||||
*.qsf \
|
||||
*.ice
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
GENERATE_QHP = NO
|
||||
QCH_FILE =
|
||||
QHP_NAMESPACE = org.doxygen.Project
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
HTML_FORMULA_FORMAT = png
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
FORMULA_MACROFILE =
|
||||
USE_MATHJAX = NO
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = YES
|
||||
SERVER_BASED_SEARCH = NO
|
||||
EXTERNAL_SEARCH = NO
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHDATA_FILE = searchdata.xml
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME =
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
LATEX_MAKEINDEX_CMD = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
LATEX_FOOTER =
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
LATEX_EXTRA_FILES =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_SOURCE_CODE = NO
|
||||
LATEX_BIB_STYLE = plain
|
||||
LATEX_TIMESTAMP = NO
|
||||
LATEX_EMOJI_DIRECTORY =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
RTF_SOURCE_CODE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_SUBDIR =
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_PROGRAMLISTING = YES
|
||||
XML_NS_MEMB_FILE_SCOPE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the DOCBOOK output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_DOCBOOK = NO
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
DOCBOOK_PROGRAMLISTING = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
DIA_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = NO
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_CFG_FILE =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
114
compile/esw_doxygen.conf
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = GIS-EmbeddedSoftware
|
||||
INPUT = .
|
||||
OUTPUT_DIRECTORY = $(DOXYGENOUT)
|
||||
INCLUDE_PATH = .
|
||||
EXCLUDE = ./core/presto/gis_rest_tools_subtree ./html
|
||||
STRIP_FROM_PATH = .
|
||||
TAGFILES = esw.tag
|
||||
WARNINGS = YES
|
||||
SEARCHENGINE = YES
|
||||
RECURSIVE = YES
|
||||
ALPHABETICAL_INDEX = YES
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = YES
|
||||
EXTRACT_ALL = YES
|
||||
EXTENSION_MAPPING = h=C++
|
||||
EXTRACT_STATIC = YES
|
||||
TEMPLATE_RELATIONS = YES
|
||||
SEARCH_INCLUDES = YES
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST = YES
|
||||
GENERATE_TREEVIEW = YES
|
||||
DISABLE_INDEX = NO
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 2
|
||||
SUBGROUPING = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
UML_LIMIT_NUM_FIELDS = 50
|
||||
LOOKUP_CACHE_SIZE = 1
|
||||
NUM_PROC_THREADS = 4
|
||||
CLASS_DIAGRAMS = YES
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.cs \
|
||||
*.C \
|
||||
*.CC \
|
||||
*.C++ \
|
||||
*.H \
|
||||
*.HH \
|
||||
*.H++ \
|
||||
*.CS
|
||||
|
||||
|
||||
## HTML
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_COLORSTYLE_HUE = 189
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 69
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
HTML_DYNAMIC_SECTIONS = YES
|
||||
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
|
||||
## DOT
|
||||
HAVE_DOT = NO
|
||||
# DOT_IMAGE_FORMAT = png
|
||||
# DOT_PATH =
|
||||
# DOT_GRAPH_MAX_NODES = 100
|
||||
# MAX_DOT_GRAPH_DEPTH = 0
|
||||
# DOT_TRANSPARENT = YES
|
||||
# DOT_NUM_THREADS = 4
|
||||
|
||||
|
||||
## GRAPHs
|
||||
UML_LOOK = YES
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = YES
|
||||
CALLER_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
|
||||
|
||||
## // LATEX & PDF generation
|
||||
## IF (GENERATE LATEX == FALSE)
|
||||
GENERATE_LATEX = NO
|
||||
## ELSE
|
||||
## GENERATE_LATEX = YES
|
||||
## LATEX_OUTPUT = latex
|
||||
## USE_PDFLATEX = YES
|
||||
## PDF_HYPERLINKS = YES
|
||||
## LATEX_CMD_NAME = lualatex
|
||||
## LATEX_BATCHMODE = YES
|
||||
|
||||
|
||||
# GENERATE_TAGFILE = esw_doxygen.tag
|
||||
|
||||
STRIP_CODE_COMMENTS = NO
|
||||
LOOKUP_CACHE_SIZE = 1
|
||||
BIN
compile/html/bc_s.png
Normal file
|
After Width: | Height: | Size: 663 B |
BIN
compile/html/bdwn.png
Normal file
|
After Width: | Height: | Size: 143 B |
BIN
compile/html/closed.png
Normal file
|
After Width: | Height: | Size: 133 B |
BIN
compile/html/doc.png
Normal file
|
After Width: | Height: | Size: 798 B |
1730
compile/html/doxygen.css
Normal file
26
compile/html/doxygen.svg
Normal file
|
After Width: | Height: | Size: 15 KiB |
121
compile/html/dynsections.js
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
function toggleVisibility(linkObj)
|
||||
{
|
||||
var base = $(linkObj).attr('id');
|
||||
var summary = $('#'+base+'-summary');
|
||||
var content = $('#'+base+'-content');
|
||||
var trigger = $('#'+base+'-trigger');
|
||||
var src=$(trigger).attr('src');
|
||||
if (content.is(':visible')===true) {
|
||||
content.hide();
|
||||
summary.show();
|
||||
$(linkObj).addClass('closed').removeClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
content.show();
|
||||
summary.hide();
|
||||
$(linkObj).removeClass('closed').addClass('opened');
|
||||
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updateStripes()
|
||||
{
|
||||
$('table.directory tr').
|
||||
removeClass('even').filter(':visible:even').addClass('even');
|
||||
}
|
||||
|
||||
function toggleLevel(level)
|
||||
{
|
||||
$('table.directory tr').each(function() {
|
||||
var l = this.id.split('_').length-1;
|
||||
var i = $('#img'+this.id.substring(3));
|
||||
var a = $('#arr'+this.id.substring(3));
|
||||
if (l<level+1) {
|
||||
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
|
||||
a.html('▼');
|
||||
$(this).show();
|
||||
} else if (l==level+1) {
|
||||
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
|
||||
a.html('►');
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
}
|
||||
});
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
function toggleFolder(id)
|
||||
{
|
||||
// the clicked row
|
||||
var currentRow = $('#row_'+id);
|
||||
|
||||
// all rows after the clicked row
|
||||
var rows = currentRow.nextAll("tr");
|
||||
|
||||
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
|
||||
|
||||
// only match elements AFTER this one (can't hide elements before)
|
||||
var childRows = rows.filter(function() { return this.id.match(re); });
|
||||
|
||||
// first row is visible we are HIDING
|
||||
if (childRows.filter(':first').is(':visible')===true) {
|
||||
// replace down arrow by right arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
currentRowSpans.filter(".arrow").html('►');
|
||||
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
|
||||
} else { // we are SHOWING
|
||||
// replace right arrow by down arrow for current row
|
||||
var currentRowSpans = currentRow.find("span");
|
||||
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
|
||||
currentRowSpans.filter(".arrow").html('▼');
|
||||
// replace down arrows by right arrows for child rows
|
||||
var childRowsSpans = childRows.find("span");
|
||||
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
|
||||
childRowsSpans.filter(".arrow").html('►');
|
||||
childRows.show(); //show all children
|
||||
}
|
||||
updateStripes();
|
||||
}
|
||||
|
||||
|
||||
function toggleInherit(id)
|
||||
{
|
||||
var rows = $('tr.inherit.'+id);
|
||||
var img = $('tr.inherit_header.'+id+' img');
|
||||
var src = $(img).attr('src');
|
||||
if (rows.filter(':first').is(':visible')===true) {
|
||||
rows.css('display','none');
|
||||
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
|
||||
} else {
|
||||
rows.css('display','table-row'); // using show() causes jump in firefox
|
||||
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
|
||||
}
|
||||
}
|
||||
/* @license-end */
|
||||
BIN
compile/html/folderclosed.png
Normal file
|
After Width: | Height: | Size: 636 B |
BIN
compile/html/folderopen.png
Normal file
|
After Width: | Height: | Size: 651 B |
97
compile/html/index.html
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||
<meta name="generator" content="Doxygen 1.8.19"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>GIS_embedded_SW: Main Page</title>
|
||||
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="dynsections.js"></script>
|
||||
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="resize.js"></script>
|
||||
<script type="text/javascript" src="navtreedata.js"></script>
|
||||
<script type="text/javascript" src="navtree.js"></script>
|
||||
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="search/search.js"></script>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
<div id="titlearea">
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<div id="projectname">GIS_embedded_SW
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.8.19 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
||||
/* @license-end */
|
||||
</script>
|
||||
<script type="text/javascript" src="menudata.js"></script>
|
||||
<script type="text/javascript" src="menu.js"></script>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(function() {
|
||||
initMenu('',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */</script>
|
||||
<div id="main-nav"></div>
|
||||
</div><!-- top -->
|
||||
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
||||
<div id="nav-tree">
|
||||
<div id="nav-tree-contents">
|
||||
<div id="nav-sync" class="sync"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="splitbar" style="-moz-user-select:none;"
|
||||
class="ui-resizable-handle">
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
||||
$(document).ready(function(){initNavTree('index.html',''); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
<!-- window showing the filter options -->
|
||||
<div id="MSearchSelectWindow"
|
||||
onmouseover="return searchBox.OnSearchSelectShow()"
|
||||
onmouseout="return searchBox.OnSearchSelectHide()"
|
||||
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
||||
</div>
|
||||
|
||||
<!-- iframe showing the search results (closed by default) -->
|
||||
<div id="MSearchResultsWindow">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="headertitle">
|
||||
<div class="title">GIS_embedded_SW Documentation</div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
</div><!-- contents -->
|
||||
</div><!-- doc-content -->
|
||||
<!-- start footer part -->
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="footer">Generated by <a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.19 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
35
compile/html/jquery.js
vendored
Normal file
51
compile/html/menu.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
|
||||
function makeTree(data,relPath) {
|
||||
var result='';
|
||||
if ('children' in data) {
|
||||
result+='<ul>';
|
||||
for (var i in data.children) {
|
||||
result+='<li><a href="'+relPath+data.children[i].url+'">'+
|
||||
data.children[i].text+'</a>'+
|
||||
makeTree(data.children[i],relPath)+'</li>';
|
||||
}
|
||||
result+='</ul>';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
$('#main-nav').append(makeTree(menudata,relPath));
|
||||
$('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
|
||||
if (searchEnabled) {
|
||||
if (serverSide) {
|
||||
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><div class="left"><form id="FSearchBox" action="'+relPath+searchPage+'" method="get"><img id="MSearchSelect" src="'+relPath+'search/mag.svg" alt=""/><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div><div class="right"></div></div></li>');
|
||||
} else {
|
||||
$('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.svg" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.svg" alt=""/></a></span></div></li>');
|
||||
}
|
||||
}
|
||||
$('#main-menu').smartmenus();
|
||||
}
|
||||
/* @license-end */
|
||||
26
compile/html/menudata.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
var menudata={children:[
|
||||
{text:"Main Page",url:"index.html"}]}
|
||||
BIN
compile/html/nav_f.png
Normal file
|
After Width: | Height: | Size: 170 B |
BIN
compile/html/nav_g.png
Normal file
|
After Width: | Height: | Size: 95 B |
BIN
compile/html/nav_h.png
Normal file
|
After Width: | Height: | Size: 99 B |
146
compile/html/navtree.css
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#nav-tree .children_ul {
|
||||
margin:0;
|
||||
padding:4px;
|
||||
}
|
||||
|
||||
#nav-tree ul {
|
||||
list-style:none outside none;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree li {
|
||||
white-space:nowrap;
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree .plus {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
#nav-tree .selected {
|
||||
background-image: url('tab_a.png');
|
||||
background-repeat:repeat-x;
|
||||
color: #fff;
|
||||
text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
|
||||
}
|
||||
|
||||
#nav-tree img {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
border:0px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#nav-tree a {
|
||||
text-decoration:none;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
outline:none;
|
||||
}
|
||||
|
||||
#nav-tree .label {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
font: 12px 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
|
||||
}
|
||||
|
||||
#nav-tree .label a {
|
||||
padding:2px;
|
||||
}
|
||||
|
||||
#nav-tree .selected a {
|
||||
text-decoration:none;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
#nav-tree .children_ul {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree .item {
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
#nav-tree {
|
||||
padding: 0px 0px;
|
||||
background-color: #FAFAFF;
|
||||
font-size:14px;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
#doc-content {
|
||||
overflow:auto;
|
||||
display:block;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
-webkit-overflow-scrolling : touch; /* iOS 5+ */
|
||||
}
|
||||
|
||||
#side-nav {
|
||||
padding:0 6px 0 0;
|
||||
margin: 0px;
|
||||
display:block;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.ui-resizable .ui-resizable-handle {
|
||||
display:block;
|
||||
}
|
||||
|
||||
.ui-resizable-e {
|
||||
background-image:url("splitbar.png");
|
||||
background-size:100%;
|
||||
background-repeat:repeat-y;
|
||||
background-attachment: scroll;
|
||||
cursor:ew-resize;
|
||||
height:100%;
|
||||
right:0;
|
||||
top:0;
|
||||
width:6px;
|
||||
}
|
||||
|
||||
.ui-resizable-handle {
|
||||
display:none;
|
||||
font-size:0.1px;
|
||||
position:absolute;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
#nav-tree-contents {
|
||||
margin: 6px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#nav-tree {
|
||||
background-image:url('nav_h.png');
|
||||
background-repeat:repeat-x;
|
||||
background-color: #F3FCF3;
|
||||
-webkit-overflow-scrolling : touch; /* iOS 5+ */
|
||||
}
|
||||
|
||||
#nav-sync {
|
||||
position:absolute;
|
||||
top:5px;
|
||||
right:24px;
|
||||
z-index:0;
|
||||
}
|
||||
|
||||
#nav-sync img {
|
||||
opacity:0.3;
|
||||
}
|
||||
|
||||
#nav-sync img:hover {
|
||||
opacity:0.9;
|
||||
}
|
||||
|
||||
@media print
|
||||
{
|
||||
#nav-tree { display: none; }
|
||||
div.ui-resizable-handle { display: none; position: relative; }
|
||||
}
|
||||
|
||||
546
compile/html/navtree.js
Normal file
|
|
@ -0,0 +1,546 @@
|
|||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
var navTreeSubIndices = new Array();
|
||||
var arrowDown = '▼';
|
||||
var arrowRight = '►';
|
||||
|
||||
function getData(varName)
|
||||
{
|
||||
var i = varName.lastIndexOf('/');
|
||||
var n = i>=0 ? varName.substring(i+1) : varName;
|
||||
return eval(n.replace(/\-/g,'_'));
|
||||
}
|
||||
|
||||
function stripPath(uri)
|
||||
{
|
||||
return uri.substring(uri.lastIndexOf('/')+1);
|
||||
}
|
||||
|
||||
function stripPath2(uri)
|
||||
{
|
||||
var i = uri.lastIndexOf('/');
|
||||
var s = uri.substring(i+1);
|
||||
var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
|
||||
return m ? uri.substring(i-6) : s;
|
||||
}
|
||||
|
||||
function hashValue()
|
||||
{
|
||||
return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,'');
|
||||
}
|
||||
|
||||
function hashUrl()
|
||||
{
|
||||
return '#'+hashValue();
|
||||
}
|
||||
|
||||
function pathName()
|
||||
{
|
||||
return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, '');
|
||||
}
|
||||
|
||||
function localStorageSupported()
|
||||
{
|
||||
try {
|
||||
return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
|
||||
}
|
||||
catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function storeLink(link)
|
||||
{
|
||||
if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
|
||||
window.localStorage.setItem('navpath',link);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteLink()
|
||||
{
|
||||
if (localStorageSupported()) {
|
||||
window.localStorage.setItem('navpath','');
|
||||
}
|
||||
}
|
||||
|
||||
function cachedLink()
|
||||
{
|
||||
if (localStorageSupported()) {
|
||||
return window.localStorage.getItem('navpath');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function getScript(scriptName,func,show)
|
||||
{
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
var script = document.createElement('script');
|
||||
script.id = scriptName;
|
||||
script.type = 'text/javascript';
|
||||
script.onload = func;
|
||||
script.src = scriptName+'.js';
|
||||
head.appendChild(script);
|
||||
}
|
||||
|
||||
function createIndent(o,domNode,node,level)
|
||||
{
|
||||
var level=-1;
|
||||
var n = node;
|
||||
while (n.parentNode) { level++; n=n.parentNode; }
|
||||
if (node.childrenData) {
|
||||
var imgNode = document.createElement("span");
|
||||
imgNode.className = 'arrow';
|
||||
imgNode.style.paddingLeft=(16*level).toString()+'px';
|
||||
imgNode.innerHTML=arrowRight;
|
||||
node.plus_img = imgNode;
|
||||
node.expandToggle = document.createElement("a");
|
||||
node.expandToggle.href = "javascript:void(0)";
|
||||
node.expandToggle.onclick = function() {
|
||||
if (node.expanded) {
|
||||
$(node.getChildrenUL()).slideUp("fast");
|
||||
node.plus_img.innerHTML=arrowRight;
|
||||
node.expanded = false;
|
||||
} else {
|
||||
expandNode(o, node, false, false);
|
||||
}
|
||||
}
|
||||
node.expandToggle.appendChild(imgNode);
|
||||
domNode.appendChild(node.expandToggle);
|
||||
} else {
|
||||
var span = document.createElement("span");
|
||||
span.className = 'arrow';
|
||||
span.style.width = 16*(level+1)+'px';
|
||||
span.innerHTML = ' ';
|
||||
domNode.appendChild(span);
|
||||
}
|
||||
}
|
||||
|
||||
var animationInProgress = false;
|
||||
|
||||
function gotoAnchor(anchor,aname,updateLocation)
|
||||
{
|
||||
var pos, docContent = $('#doc-content');
|
||||
var ancParent = $(anchor.parent());
|
||||
if (ancParent.hasClass('memItemLeft') ||
|
||||
ancParent.hasClass('memtitle') ||
|
||||
ancParent.hasClass('fieldname') ||
|
||||
ancParent.hasClass('fieldtype') ||
|
||||
ancParent.is(':header'))
|
||||
{
|
||||
pos = ancParent.position().top;
|
||||
} else if (anchor.position()) {
|
||||
pos = anchor.position().top;
|
||||
}
|
||||
if (pos) {
|
||||
var dist = Math.abs(Math.min(
|
||||
pos-docContent.offset().top,
|
||||
docContent[0].scrollHeight-
|
||||
docContent.height()-docContent.scrollTop()));
|
||||
animationInProgress=true;
|
||||
docContent.animate({
|
||||
scrollTop: pos + docContent.scrollTop() - docContent.offset().top
|
||||
},Math.max(50,Math.min(500,dist)),function(){
|
||||
if (updateLocation) window.location.href=aname;
|
||||
animationInProgress=false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function newNode(o, po, text, link, childrenData, lastNode)
|
||||
{
|
||||
var node = new Object();
|
||||
node.children = Array();
|
||||
node.childrenData = childrenData;
|
||||
node.depth = po.depth + 1;
|
||||
node.relpath = po.relpath;
|
||||
node.isLast = lastNode;
|
||||
|
||||
node.li = document.createElement("li");
|
||||
po.getChildrenUL().appendChild(node.li);
|
||||
node.parentNode = po;
|
||||
|
||||
node.itemDiv = document.createElement("div");
|
||||
node.itemDiv.className = "item";
|
||||
|
||||
node.labelSpan = document.createElement("span");
|
||||
node.labelSpan.className = "label";
|
||||
|
||||
createIndent(o,node.itemDiv,node,0);
|
||||
node.itemDiv.appendChild(node.labelSpan);
|
||||
node.li.appendChild(node.itemDiv);
|
||||
|
||||
var a = document.createElement("a");
|
||||
node.labelSpan.appendChild(a);
|
||||
node.label = document.createTextNode(text);
|
||||
node.expanded = false;
|
||||
a.appendChild(node.label);
|
||||
if (link) {
|
||||
var url;
|
||||
if (link.substring(0,1)=='^') {
|
||||
url = link.substring(1);
|
||||
link = url;
|
||||
} else {
|
||||
url = node.relpath+link;
|
||||
}
|
||||
a.className = stripPath(link.replace('#',':'));
|
||||
if (link.indexOf('#')!=-1) {
|
||||
var aname = '#'+link.split('#')[1];
|
||||
var srcPage = stripPath(pathName());
|
||||
var targetPage = stripPath(link.split('#')[0]);
|
||||
a.href = srcPage!=targetPage ? url : "javascript:void(0)";
|
||||
a.onclick = function(){
|
||||
storeLink(link);
|
||||
if (!$(a).parent().parent().hasClass('selected'))
|
||||
{
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
$(a).parent().parent().addClass('selected');
|
||||
$(a).parent().parent().attr('id','selected');
|
||||
}
|
||||
var anchor = $(aname);
|
||||
gotoAnchor(anchor,aname,true);
|
||||
};
|
||||
} else {
|
||||
a.href = url;
|
||||
a.onclick = function() { storeLink(link); }
|
||||
}
|
||||
} else {
|
||||
if (childrenData != null)
|
||||
{
|
||||
a.className = "nolink";
|
||||
a.href = "javascript:void(0)";
|
||||
a.onclick = node.expandToggle.onclick;
|
||||
}
|
||||
}
|
||||
|
||||
node.childrenUL = null;
|
||||
node.getChildrenUL = function() {
|
||||
if (!node.childrenUL) {
|
||||
node.childrenUL = document.createElement("ul");
|
||||
node.childrenUL.className = "children_ul";
|
||||
node.childrenUL.style.display = "none";
|
||||
node.li.appendChild(node.childrenUL);
|
||||
}
|
||||
return node.childrenUL;
|
||||
};
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function showRoot()
|
||||
{
|
||||
var headerHeight = $("#top").height();
|
||||
var footerHeight = $("#nav-path").height();
|
||||
var windowHeight = $(window).height() - headerHeight - footerHeight;
|
||||
(function (){ // retry until we can scroll to the selected item
|
||||
try {
|
||||
var navtree=$('#nav-tree');
|
||||
navtree.scrollTo('#selected',100,{offset:-windowHeight/2});
|
||||
} catch (err) {
|
||||
setTimeout(arguments.callee, 0);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
function expandNode(o, node, imm, showRoot)
|
||||
{
|
||||
if (node.childrenData && !node.expanded) {
|
||||
if (typeof(node.childrenData)==='string') {
|
||||
var varName = node.childrenData;
|
||||
getScript(node.relpath+varName,function(){
|
||||
node.childrenData = getData(varName);
|
||||
expandNode(o, node, imm, showRoot);
|
||||
}, showRoot);
|
||||
} else {
|
||||
if (!node.childrenVisited) {
|
||||
getNode(o, node);
|
||||
}
|
||||
$(node.getChildrenUL()).slideDown("fast");
|
||||
node.plus_img.innerHTML = arrowDown;
|
||||
node.expanded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function glowEffect(n,duration)
|
||||
{
|
||||
n.addClass('glow').delay(duration).queue(function(next){
|
||||
$(this).removeClass('glow');next();
|
||||
});
|
||||
}
|
||||
|
||||
function highlightAnchor()
|
||||
{
|
||||
var aname = hashUrl();
|
||||
var anchor = $(aname);
|
||||
if (anchor.parent().attr('class')=='memItemLeft'){
|
||||
var rows = $('.memberdecls tr[class$="'+hashValue()+'"]');
|
||||
glowEffect(rows.children(),300); // member without details
|
||||
} else if (anchor.parent().attr('class')=='fieldname'){
|
||||
glowEffect(anchor.parent().parent(),1000); // enum value
|
||||
} else if (anchor.parent().attr('class')=='fieldtype'){
|
||||
glowEffect(anchor.parent().parent(),1000); // struct field
|
||||
} else if (anchor.parent().is(":header")) {
|
||||
glowEffect(anchor.parent(),1000); // section header
|
||||
} else {
|
||||
glowEffect(anchor.next(),1000); // normal member
|
||||
}
|
||||
}
|
||||
|
||||
function selectAndHighlight(hash,n)
|
||||
{
|
||||
var a;
|
||||
if (hash) {
|
||||
var link=stripPath(pathName())+':'+hash.substring(1);
|
||||
a=$('.item a[class$="'+link+'"]');
|
||||
}
|
||||
if (a && a.length) {
|
||||
a.parent().parent().addClass('selected');
|
||||
a.parent().parent().attr('id','selected');
|
||||
highlightAnchor();
|
||||
} else if (n) {
|
||||
$(n.itemDiv).addClass('selected');
|
||||
$(n.itemDiv).attr('id','selected');
|
||||
}
|
||||
if ($('#nav-tree-contents .item:first').hasClass('selected')) {
|
||||
$('#nav-sync').css('top','30px');
|
||||
} else {
|
||||
$('#nav-sync').css('top','5px');
|
||||
}
|
||||
showRoot();
|
||||
}
|
||||
|
||||
function showNode(o, node, index, hash)
|
||||
{
|
||||
if (node && node.childrenData) {
|
||||
if (typeof(node.childrenData)==='string') {
|
||||
var varName = node.childrenData;
|
||||
getScript(node.relpath+varName,function(){
|
||||
node.childrenData = getData(varName);
|
||||
showNode(o,node,index,hash);
|
||||
},true);
|
||||
} else {
|
||||
if (!node.childrenVisited) {
|
||||
getNode(o, node);
|
||||
}
|
||||
$(node.getChildrenUL()).css({'display':'block'});
|
||||
node.plus_img.innerHTML = arrowDown;
|
||||
node.expanded = true;
|
||||
var n = node.children[o.breadcrumbs[index]];
|
||||
if (index+1<o.breadcrumbs.length) {
|
||||
showNode(o,n,index+1,hash);
|
||||
} else {
|
||||
if (typeof(n.childrenData)==='string') {
|
||||
var varName = n.childrenData;
|
||||
getScript(n.relpath+varName,function(){
|
||||
n.childrenData = getData(varName);
|
||||
node.expanded=false;
|
||||
showNode(o,node,index,hash); // retry with child node expanded
|
||||
},true);
|
||||
} else {
|
||||
var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
|
||||
if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
|
||||
expandNode(o, n, true, true);
|
||||
}
|
||||
selectAndHighlight(hash,n);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectAndHighlight(hash);
|
||||
}
|
||||
}
|
||||
|
||||
function removeToInsertLater(element) {
|
||||
var parentNode = element.parentNode;
|
||||
var nextSibling = element.nextSibling;
|
||||
parentNode.removeChild(element);
|
||||
return function() {
|
||||
if (nextSibling) {
|
||||
parentNode.insertBefore(element, nextSibling);
|
||||
} else {
|
||||
parentNode.appendChild(element);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getNode(o, po)
|
||||
{
|
||||
var insertFunction = removeToInsertLater(po.li);
|
||||
po.childrenVisited = true;
|
||||
var l = po.childrenData.length-1;
|
||||
for (var i in po.childrenData) {
|
||||
var nodeData = po.childrenData[i];
|
||||
po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
|
||||
i==l);
|
||||
}
|
||||
insertFunction();
|
||||
}
|
||||
|
||||
function gotoNode(o,subIndex,root,hash,relpath)
|
||||
{
|
||||
var nti = navTreeSubIndices[subIndex][root+hash];
|
||||
o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
|
||||
if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
|
||||
navTo(o,NAVTREE[0][1],"",relpath);
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
}
|
||||
if (o.breadcrumbs) {
|
||||
o.breadcrumbs.unshift(0); // add 0 for root node
|
||||
showNode(o, o.node, 0, hash);
|
||||
}
|
||||
}
|
||||
|
||||
function navTo(o,root,hash,relpath)
|
||||
{
|
||||
var link = cachedLink();
|
||||
if (link) {
|
||||
var parts = link.split('#');
|
||||
root = parts[0];
|
||||
if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,'');
|
||||
else hash='';
|
||||
}
|
||||
if (hash.match(/^#l\d+$/)) {
|
||||
var anchor=$('a[name='+hash.substring(1)+']');
|
||||
glowEffect(anchor.parent(),1000); // line number
|
||||
hash=''; // strip line number anchors
|
||||
}
|
||||
var url=root+hash;
|
||||
var i=-1;
|
||||
while (NAVTREEINDEX[i+1]<=url) i++;
|
||||
if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
|
||||
if (navTreeSubIndices[i]) {
|
||||
gotoNode(o,i,root,hash,relpath)
|
||||
} else {
|
||||
getScript(relpath+'navtreeindex'+i,function(){
|
||||
navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
|
||||
if (navTreeSubIndices[i]) {
|
||||
gotoNode(o,i,root,hash,relpath);
|
||||
}
|
||||
},true);
|
||||
}
|
||||
}
|
||||
|
||||
function showSyncOff(n,relpath)
|
||||
{
|
||||
n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
|
||||
}
|
||||
|
||||
function showSyncOn(n,relpath)
|
||||
{
|
||||
n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
|
||||
}
|
||||
|
||||
function toggleSyncButton(relpath)
|
||||
{
|
||||
var navSync = $('#nav-sync');
|
||||
if (navSync.hasClass('sync')) {
|
||||
navSync.removeClass('sync');
|
||||
showSyncOff(navSync,relpath);
|
||||
storeLink(stripPath2(pathName())+hashUrl());
|
||||
} else {
|
||||
navSync.addClass('sync');
|
||||
showSyncOn(navSync,relpath);
|
||||
deleteLink();
|
||||
}
|
||||
}
|
||||
|
||||
var loadTriggered = false;
|
||||
var readyTriggered = false;
|
||||
var loadObject,loadToRoot,loadUrl,loadRelPath;
|
||||
|
||||
$(window).on('load',function(){
|
||||
if (readyTriggered) { // ready first
|
||||
navTo(loadObject,loadToRoot,loadUrl,loadRelPath);
|
||||
showRoot();
|
||||
}
|
||||
loadTriggered=true;
|
||||
});
|
||||
|
||||
function initNavTree(toroot,relpath)
|
||||
{
|
||||
var o = new Object();
|
||||
o.toroot = toroot;
|
||||
o.node = new Object();
|
||||
o.node.li = document.getElementById("nav-tree-contents");
|
||||
o.node.childrenData = NAVTREE;
|
||||
o.node.children = new Array();
|
||||
o.node.childrenUL = document.createElement("ul");
|
||||
o.node.getChildrenUL = function() { return o.node.childrenUL; };
|
||||
o.node.li.appendChild(o.node.childrenUL);
|
||||
o.node.depth = 0;
|
||||
o.node.relpath = relpath;
|
||||
o.node.expanded = false;
|
||||
o.node.isLast = true;
|
||||
o.node.plus_img = document.createElement("span");
|
||||
o.node.plus_img.className = 'arrow';
|
||||
o.node.plus_img.innerHTML = arrowRight;
|
||||
|
||||
if (localStorageSupported()) {
|
||||
var navSync = $('#nav-sync');
|
||||
if (cachedLink()) {
|
||||
showSyncOff(navSync,relpath);
|
||||
navSync.removeClass('sync');
|
||||
} else {
|
||||
showSyncOn(navSync,relpath);
|
||||
}
|
||||
navSync.click(function(){ toggleSyncButton(relpath); });
|
||||
}
|
||||
|
||||
if (loadTriggered) { // load before ready
|
||||
navTo(o,toroot,hashUrl(),relpath);
|
||||
showRoot();
|
||||
} else { // ready before load
|
||||
loadObject = o;
|
||||
loadToRoot = toroot;
|
||||
loadUrl = hashUrl();
|
||||
loadRelPath = relpath;
|
||||
readyTriggered=true;
|
||||
}
|
||||
|
||||
$(window).bind('hashchange', function(){
|
||||
if (window.location.hash && window.location.hash.length>1){
|
||||
var a;
|
||||
if ($(location).attr('hash')){
|
||||
var clslink=stripPath(pathName())+':'+hashValue();
|
||||
a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]');
|
||||
}
|
||||
if (a==null || !$(a).parent().parent().hasClass('selected')){
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
}
|
||||
var link=stripPath2(pathName());
|
||||
navTo(o,link,hashUrl(),relpath);
|
||||
} else if (!animationInProgress) {
|
||||
$('#doc-content').scrollTop(0);
|
||||
$('.item').removeClass('selected');
|
||||
$('.item').removeAttr('id');
|
||||
navTo(o,toroot,hashUrl(),relpath);
|
||||
}
|
||||
})
|
||||
}
|
||||
/* @license-end */
|
||||
36
compile/html/navtreedata.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
var NAVTREE =
|
||||
[
|
||||
[ "GIS_embedded_SW", "index.html", ]
|
||||
];
|
||||
|
||||
var NAVTREEINDEX =
|
||||
[
|
||||
"index.html"
|
||||
];
|
||||
|
||||
var SYNCONMSG = 'click to disable panel synchronisation';
|
||||
var SYNCOFFMSG = 'click to enable panel synchronisation';
|
||||
5
compile/html/navtreeindex0.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var NAVTREEINDEX0 =
|
||||
{
|
||||
"index.html":[],
|
||||
"pages.html":[]
|
||||
};
|
||||
BIN
compile/html/open.png
Normal file
|
After Width: | Height: | Size: 117 B |
140
compile/html/resize.js
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
function initResizable()
|
||||
{
|
||||
var cookie_namespace = 'doxygen';
|
||||
var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight;
|
||||
|
||||
function readCookie(cookie)
|
||||
{
|
||||
var myCookie = cookie_namespace+"_"+cookie+"=";
|
||||
if (document.cookie) {
|
||||
var index = document.cookie.indexOf(myCookie);
|
||||
if (index != -1) {
|
||||
var valStart = index + myCookie.length;
|
||||
var valEnd = document.cookie.indexOf(";", valStart);
|
||||
if (valEnd == -1) {
|
||||
valEnd = document.cookie.length;
|
||||
}
|
||||
var val = document.cookie.substring(valStart, valEnd);
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function writeCookie(cookie, val, expiration)
|
||||
{
|
||||
if (val==undefined) return;
|
||||
if (expiration == null) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
|
||||
expiration = date.toGMTString();
|
||||
}
|
||||
document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
|
||||
}
|
||||
|
||||
function resizeWidth()
|
||||
{
|
||||
var windowWidth = $(window).width() + "px";
|
||||
var sidenavWidth = $(sidenav).outerWidth();
|
||||
content.css({marginLeft:parseInt(sidenavWidth)+"px"});
|
||||
writeCookie('width',sidenavWidth-barWidth, null);
|
||||
}
|
||||
|
||||
function restoreWidth(navWidth)
|
||||
{
|
||||
var windowWidth = $(window).width() + "px";
|
||||
content.css({marginLeft:parseInt(navWidth)+barWidth+"px"});
|
||||
sidenav.css({width:navWidth + "px"});
|
||||
}
|
||||
|
||||
function resizeHeight()
|
||||
{
|
||||
var headerHeight = header.outerHeight();
|
||||
var footerHeight = footer.outerHeight();
|
||||
var windowHeight = $(window).height() - headerHeight - footerHeight;
|
||||
content.css({height:windowHeight + "px"});
|
||||
navtree.css({height:windowHeight + "px"});
|
||||
sidenav.css({height:windowHeight + "px"});
|
||||
var width=$(window).width();
|
||||
if (width!=collapsedWidth) {
|
||||
if (width<desktop_vp && collapsedWidth>=desktop_vp) {
|
||||
if (!collapsed) {
|
||||
collapseExpand();
|
||||
}
|
||||
} else if (width>desktop_vp && collapsedWidth<desktop_vp) {
|
||||
if (collapsed) {
|
||||
collapseExpand();
|
||||
}
|
||||
}
|
||||
collapsedWidth=width;
|
||||
}
|
||||
if (location.hash.slice(1)) {
|
||||
(document.getElementById(location.hash.slice(1))||document.body).scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
function collapseExpand()
|
||||
{
|
||||
if (sidenav.width()>0) {
|
||||
restoreWidth(0);
|
||||
collapsed=true;
|
||||
}
|
||||
else {
|
||||
var width = readCookie('width');
|
||||
if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); }
|
||||
collapsed=false;
|
||||
}
|
||||
}
|
||||
|
||||
header = $("#top");
|
||||
sidenav = $("#side-nav");
|
||||
content = $("#doc-content");
|
||||
navtree = $("#nav-tree");
|
||||
footer = $("#nav-path");
|
||||
$(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
|
||||
$(sidenav).resizable({ minWidth: 0 });
|
||||
$(window).resize(function() { resizeHeight(); });
|
||||
var device = navigator.userAgent.toLowerCase();
|
||||
var touch_device = device.match(/(iphone|ipod|ipad|android)/);
|
||||
if (touch_device) { /* wider split bar for touch only devices */
|
||||
$(sidenav).css({ paddingRight:'20px' });
|
||||
$('.ui-resizable-e').css({ width:'20px' });
|
||||
$('#nav-sync').css({ right:'34px' });
|
||||
barWidth=20;
|
||||
}
|
||||
var width = readCookie('width');
|
||||
if (width) { restoreWidth(width); } else { resizeWidth(); }
|
||||
resizeHeight();
|
||||
var url = location.href;
|
||||
var i=url.indexOf("#");
|
||||
if (i>=0) window.location.hash=url.substr(i);
|
||||
var _preventDefault = function(evt) { evt.preventDefault(); };
|
||||
$("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
|
||||
$(".ui-resizable-handle").dblclick(collapseExpand);
|
||||
$(window).on('load',resizeHeight);
|
||||
}
|
||||
/* @license-end */
|
||||
31
compile/html/search/close.svg
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 11"
|
||||
height="11"
|
||||
width="11"
|
||||
id="svg2"
|
||||
version="1.1">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs6" />
|
||||
<path
|
||||
id="path12"
|
||||
d="M 5.5 0.5 A 5 5 0 0 0 0.5 5.5 A 5 5 0 0 0 5.5 10.5 A 5 5 0 0 0 10.5 5.5 A 5 5 0 0 0 5.5 0.5 z M 3.5820312 3 A 0.58291923 0.58291923 0 0 1 4 3.1757812 L 5.5 4.6757812 L 7 3.1757812 A 0.58291923 0.58291923 0 0 1 7.4003906 3 A 0.58291923 0.58291923 0 0 1 7.8242188 4 L 6.3242188 5.5 L 7.8242188 7 A 0.58291923 0.58291923 0 1 1 7 7.8242188 L 5.5 6.3242188 L 4 7.8242188 A 0.58291923 0.58291923 0 1 1 3.1757812 7 L 4.6757812 5.5 L 3.1757812 4 A 0.58291923 0.58291923 0 0 1 3.5820312 3 z "
|
||||
style="stroke-width:1.09870648;fill:#bababa;fill-opacity:1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
74
compile/html/search/mag_sel.svg
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="20"
|
||||
height="19"
|
||||
viewBox="0 0 20 19"
|
||||
sodipodi:docname="mag_sel.svg"
|
||||
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs6" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="2096"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:zoom="32"
|
||||
inkscape:cx="5.9792688"
|
||||
inkscape:cy="1.1436277"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" />
|
||||
<circle
|
||||
style="fill:#000000;fill-opacity:0;stroke:#656565;stroke-width:1.4;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
id="path4611"
|
||||
cx="5.5"
|
||||
cy="8.5"
|
||||
r="3.5" />
|
||||
<path
|
||||
style="fill:#656565;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 11,7 13.5,10 16,7 Z"
|
||||
id="path4609"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
<path
|
||||
style="fill:none;stroke:#656565;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 8.1085854,11.109059 2.7823556,2.782356"
|
||||
id="path4630"
|
||||
inkscape:connector-curvature="0" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
12
compile/html/search/nomatches.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html><head><title></title>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="search.css"/>
|
||||
<script type="text/javascript" src="search.js"></script>
|
||||
</head>
|
||||
<body class="SRPage">
|
||||
<div id="SRIndex">
|
||||
<div class="SRStatus" id="NoMatches">No Matches</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
255
compile/html/search/search.css
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
/*---------------- Search Box */
|
||||
|
||||
#MSearchBox {
|
||||
white-space : nowrap;
|
||||
background: white;
|
||||
border-radius: 0.65em;
|
||||
box-shadow: inset 0.5px 0.5px 3px 0px #555;
|
||||
z-index: 102;
|
||||
}
|
||||
|
||||
#MSearchBox .left {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 1.4em;
|
||||
}
|
||||
|
||||
#MSearchSelect {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 1.4em;
|
||||
padding: 0 0 0 0.3em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#MSearchField {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 7.5em;
|
||||
height: 1.1em;
|
||||
margin: 0 0.15em;
|
||||
padding: 0;
|
||||
line-height: 1em;
|
||||
border:none;
|
||||
color: #909090;
|
||||
outline: none;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
-webkit-border-radius: 0px;
|
||||
border-radius: 0px;
|
||||
background: none;
|
||||
}
|
||||
|
||||
|
||||
#MSearchBox .right {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
}
|
||||
|
||||
#MSearchClose {
|
||||
display: none;
|
||||
font-size: inherit;
|
||||
background : none;
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
outline: none;
|
||||
|
||||
}
|
||||
|
||||
#MSearchCloseImg {
|
||||
height: 1.4em;
|
||||
padding: 0.3em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.MSearchBoxActive #MSearchField {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#main-menu > li:last-child {
|
||||
/* This <li> object is the parent of the search bar */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 36px;
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
/*---------------- Search filter selection */
|
||||
|
||||
#MSearchSelectWindow {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0; top: 0;
|
||||
border: 1px solid #31CB31;
|
||||
background-color: #F3FCF3;
|
||||
z-index: 10001;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
-webkit-border-bottom-left-radius: 4px;
|
||||
-webkit-border-bottom-right-radius: 4px;
|
||||
-webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.SelectItem {
|
||||
font: 8pt Arial, Verdana, sans-serif;
|
||||
padding-left: 2px;
|
||||
padding-right: 12px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
span.SelectionMark {
|
||||
margin-right: 4px;
|
||||
font-family: monospace;
|
||||
outline-style: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.SelectItem {
|
||||
display: block;
|
||||
outline-style: none;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
padding-left: 6px;
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
||||
a.SelectItem:focus,
|
||||
a.SelectItem:active {
|
||||
color: #000000;
|
||||
outline-style: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.SelectItem:hover {
|
||||
color: #FFFFFF;
|
||||
background-color: #114811;
|
||||
outline-style: none;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*---------------- Search results window */
|
||||
|
||||
iframe#MSearchResults {
|
||||
width: 60ex;
|
||||
height: 15em;
|
||||
}
|
||||
|
||||
#MSearchResultsWindow {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0; top: 0;
|
||||
border: 1px solid #000;
|
||||
background-color: #DBF6DB;
|
||||
z-index:10000;
|
||||
}
|
||||
|
||||
/* ----------------------------------- */
|
||||
|
||||
|
||||
#SRIndex {
|
||||
clear:both;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.SREntry {
|
||||
font-size: 10pt;
|
||||
padding-left: 1ex;
|
||||
}
|
||||
|
||||
.SRPage .SREntry {
|
||||
font-size: 8pt;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
body.SRPage {
|
||||
margin: 5px 2px;
|
||||
}
|
||||
|
||||
.SRChildren {
|
||||
padding-left: 3ex; padding-bottom: .5em
|
||||
}
|
||||
|
||||
.SRPage .SRChildren {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.SRSymbol {
|
||||
font-weight: bold;
|
||||
color: #145314;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a.SRScope {
|
||||
display: block;
|
||||
color: #145314;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a.SRSymbol:focus, a.SRSymbol:active,
|
||||
a.SRScope:focus, a.SRScope:active {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
span.SRScope {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.SRPage .SRStatus {
|
||||
padding: 2px 5px;
|
||||
font-size: 8pt;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.SRResult {
|
||||
display: none;
|
||||
}
|
||||
|
||||
DIV.searchresults {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/*---------------- External search page results */
|
||||
|
||||
.searchresult {
|
||||
background-color: #E0F7E0;
|
||||
}
|
||||
|
||||
.pages b {
|
||||
color: white;
|
||||
padding: 5px 5px 3px 5px;
|
||||
background-image: url("../tab_a.png");
|
||||
background-repeat: repeat-x;
|
||||
text-shadow: 0 1px 1px #000000;
|
||||
}
|
||||
|
||||
.pages {
|
||||
line-height: 17px;
|
||||
margin-left: 4px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.hl {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#searchresults {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.searchpages {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
814
compile/html/search/search.js
Normal file
|
|
@ -0,0 +1,814 @@
|
|||
/*
|
||||
@licstart The following is the entire license notice for the JavaScript code in this file.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@licend The above is the entire license notice for the JavaScript code in this file
|
||||
*/
|
||||
function convertToId(search)
|
||||
{
|
||||
var result = '';
|
||||
for (i=0;i<search.length;i++)
|
||||
{
|
||||
var c = search.charAt(i);
|
||||
var cn = c.charCodeAt(0);
|
||||
if (c.match(/[a-z0-9\u0080-\uFFFF]/))
|
||||
{
|
||||
result+=c;
|
||||
}
|
||||
else if (cn<16)
|
||||
{
|
||||
result+="_0"+cn.toString(16);
|
||||
}
|
||||
else
|
||||
{
|
||||
result+="_"+cn.toString(16);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function getXPos(item)
|
||||
{
|
||||
var x = 0;
|
||||
if (item.offsetWidth)
|
||||
{
|
||||
while (item && item!=document.body)
|
||||
{
|
||||
x += item.offsetLeft;
|
||||
item = item.offsetParent;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
function getYPos(item)
|
||||
{
|
||||
var y = 0;
|
||||
if (item.offsetWidth)
|
||||
{
|
||||
while (item && item!=document.body)
|
||||
{
|
||||
y += item.offsetTop;
|
||||
item = item.offsetParent;
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
/* A class handling everything associated with the search panel.
|
||||
|
||||
Parameters:
|
||||
name - The name of the global variable that will be
|
||||
storing this instance. Is needed to be able to set timeouts.
|
||||
resultPath - path to use for external files
|
||||
*/
|
||||
function SearchBox(name, resultsPath, inFrame, label)
|
||||
{
|
||||
if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); }
|
||||
|
||||
// ---------- Instance variables
|
||||
this.name = name;
|
||||
this.resultsPath = resultsPath;
|
||||
this.keyTimeout = 0;
|
||||
this.keyTimeoutLength = 500;
|
||||
this.closeSelectionTimeout = 300;
|
||||
this.lastSearchValue = "";
|
||||
this.lastResultsPage = "";
|
||||
this.hideTimeout = 0;
|
||||
this.searchIndex = 0;
|
||||
this.searchActive = false;
|
||||
this.insideFrame = inFrame;
|
||||
this.searchLabel = label;
|
||||
|
||||
// ----------- DOM Elements
|
||||
|
||||
this.DOMSearchField = function()
|
||||
{ return document.getElementById("MSearchField"); }
|
||||
|
||||
this.DOMSearchSelect = function()
|
||||
{ return document.getElementById("MSearchSelect"); }
|
||||
|
||||
this.DOMSearchSelectWindow = function()
|
||||
{ return document.getElementById("MSearchSelectWindow"); }
|
||||
|
||||
this.DOMPopupSearchResults = function()
|
||||
{ return document.getElementById("MSearchResults"); }
|
||||
|
||||
this.DOMPopupSearchResultsWindow = function()
|
||||
{ return document.getElementById("MSearchResultsWindow"); }
|
||||
|
||||
this.DOMSearchClose = function()
|
||||
{ return document.getElementById("MSearchClose"); }
|
||||
|
||||
this.DOMSearchBox = function()
|
||||
{ return document.getElementById("MSearchBox"); }
|
||||
|
||||
// ------------ Event Handlers
|
||||
|
||||
// Called when focus is added or removed from the search field.
|
||||
this.OnSearchFieldFocus = function(isActive)
|
||||
{
|
||||
this.Activate(isActive);
|
||||
}
|
||||
|
||||
this.OnSearchSelectShow = function()
|
||||
{
|
||||
var searchSelectWindow = this.DOMSearchSelectWindow();
|
||||
var searchField = this.DOMSearchSelect();
|
||||
|
||||
if (this.insideFrame)
|
||||
{
|
||||
var left = getXPos(searchField);
|
||||
var top = getYPos(searchField);
|
||||
left += searchField.offsetWidth + 6;
|
||||
top += searchField.offsetHeight;
|
||||
|
||||
// show search selection popup
|
||||
searchSelectWindow.style.display='block';
|
||||
left -= searchSelectWindow.offsetWidth;
|
||||
searchSelectWindow.style.left = left + 'px';
|
||||
searchSelectWindow.style.top = top + 'px';
|
||||
}
|
||||
else
|
||||
{
|
||||
var left = getXPos(searchField);
|
||||
var top = getYPos(searchField);
|
||||
top += searchField.offsetHeight;
|
||||
|
||||
// show search selection popup
|
||||
searchSelectWindow.style.display='block';
|
||||
searchSelectWindow.style.left = left + 'px';
|
||||
searchSelectWindow.style.top = top + 'px';
|
||||
}
|
||||
|
||||
// stop selection hide timer
|
||||
if (this.hideTimeout)
|
||||
{
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.hideTimeout=0;
|
||||
}
|
||||
return false; // to avoid "image drag" default event
|
||||
}
|
||||
|
||||
this.OnSearchSelectHide = function()
|
||||
{
|
||||
this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
|
||||
this.closeSelectionTimeout);
|
||||
}
|
||||
|
||||
// Called when the content of the search field is changed.
|
||||
this.OnSearchFieldChange = function(evt)
|
||||
{
|
||||
if (this.keyTimeout) // kill running timer
|
||||
{
|
||||
clearTimeout(this.keyTimeout);
|
||||
this.keyTimeout = 0;
|
||||
}
|
||||
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==40 || e.keyCode==13)
|
||||
{
|
||||
if (e.shiftKey==1)
|
||||
{
|
||||
this.OnSearchSelectShow();
|
||||
var win=this.DOMSearchSelectWindow();
|
||||
for (i=0;i<win.childNodes.length;i++)
|
||||
{
|
||||
var child = win.childNodes[i]; // get span within a
|
||||
if (child.className=='SelectItem')
|
||||
{
|
||||
child.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.frames.MSearchResults.postMessage("take_focus", "*");
|
||||
}
|
||||
}
|
||||
else if (e.keyCode==27) // Escape out of the search field
|
||||
{
|
||||
this.DOMSearchField().blur();
|
||||
this.DOMPopupSearchResultsWindow().style.display = 'none';
|
||||
this.DOMSearchClose().style.display = 'none';
|
||||
this.lastSearchValue = '';
|
||||
this.Activate(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// strip whitespaces
|
||||
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
|
||||
|
||||
if (searchValue != this.lastSearchValue) // search value has changed
|
||||
{
|
||||
if (searchValue != "") // non-empty search
|
||||
{
|
||||
// set timer for search update
|
||||
this.keyTimeout = setTimeout(this.name + '.Search()',
|
||||
this.keyTimeoutLength);
|
||||
}
|
||||
else // empty search field
|
||||
{
|
||||
this.DOMPopupSearchResultsWindow().style.display = 'none';
|
||||
this.DOMSearchClose().style.display = 'none';
|
||||
this.lastSearchValue = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.SelectItemCount = function(id)
|
||||
{
|
||||
var count=0;
|
||||
var win=this.DOMSearchSelectWindow();
|
||||
for (i=0;i<win.childNodes.length;i++)
|
||||
{
|
||||
var child = win.childNodes[i]; // get span within a
|
||||
if (child.className=='SelectItem')
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
this.SelectItemSet = function(id)
|
||||
{
|
||||
var i,j=0;
|
||||
var win=this.DOMSearchSelectWindow();
|
||||
for (i=0;i<win.childNodes.length;i++)
|
||||
{
|
||||
var child = win.childNodes[i]; // get span within a
|
||||
if (child.className=='SelectItem')
|
||||
{
|
||||
var node = child.firstChild;
|
||||
if (j==id)
|
||||
{
|
||||
node.innerHTML='•';
|
||||
}
|
||||
else
|
||||
{
|
||||
node.innerHTML=' ';
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when an search filter selection is made.
|
||||
// set item with index id as the active item
|
||||
this.OnSelectItem = function(id)
|
||||
{
|
||||
this.searchIndex = id;
|
||||
this.SelectItemSet(id);
|
||||
var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
|
||||
if (searchValue!="" && this.searchActive) // something was found -> do a search
|
||||
{
|
||||
this.Search();
|
||||
}
|
||||
}
|
||||
|
||||
this.OnSearchSelectKey = function(evt)
|
||||
{
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
|
||||
{
|
||||
this.searchIndex++;
|
||||
this.OnSelectItem(this.searchIndex);
|
||||
}
|
||||
else if (e.keyCode==38 && this.searchIndex>0) // Up
|
||||
{
|
||||
this.searchIndex--;
|
||||
this.OnSelectItem(this.searchIndex);
|
||||
}
|
||||
else if (e.keyCode==13 || e.keyCode==27)
|
||||
{
|
||||
this.OnSelectItem(this.searchIndex);
|
||||
this.CloseSelectionWindow();
|
||||
this.DOMSearchField().focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// --------- Actions
|
||||
|
||||
// Closes the results window.
|
||||
this.CloseResultsWindow = function()
|
||||
{
|
||||
this.DOMPopupSearchResultsWindow().style.display = 'none';
|
||||
this.DOMSearchClose().style.display = 'none';
|
||||
this.Activate(false);
|
||||
}
|
||||
|
||||
this.CloseSelectionWindow = function()
|
||||
{
|
||||
this.DOMSearchSelectWindow().style.display = 'none';
|
||||
}
|
||||
|
||||
// Performs a search.
|
||||
this.Search = function()
|
||||
{
|
||||
this.keyTimeout = 0;
|
||||
|
||||
// strip leading whitespace
|
||||
var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
|
||||
|
||||
var code = searchValue.toLowerCase().charCodeAt(0);
|
||||
var idxChar = searchValue.substr(0, 1).toLowerCase();
|
||||
if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair
|
||||
{
|
||||
idxChar = searchValue.substr(0, 2);
|
||||
}
|
||||
|
||||
var resultsPage;
|
||||
var resultsPageWithSearch;
|
||||
var hasResultsPage;
|
||||
|
||||
var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar);
|
||||
if (idx!=-1)
|
||||
{
|
||||
var hexCode=idx.toString(16);
|
||||
resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';
|
||||
resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
|
||||
hasResultsPage = true;
|
||||
}
|
||||
else // nothing available for this search term
|
||||
{
|
||||
resultsPage = this.resultsPath + '/nomatches.html';
|
||||
resultsPageWithSearch = resultsPage;
|
||||
hasResultsPage = false;
|
||||
}
|
||||
|
||||
window.frames.MSearchResults.location = resultsPageWithSearch;
|
||||
var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
|
||||
|
||||
if (domPopupSearchResultsWindow.style.display!='block')
|
||||
{
|
||||
var domSearchBox = this.DOMSearchBox();
|
||||
this.DOMSearchClose().style.display = 'inline-block';
|
||||
if (this.insideFrame)
|
||||
{
|
||||
var domPopupSearchResults = this.DOMPopupSearchResults();
|
||||
domPopupSearchResultsWindow.style.position = 'relative';
|
||||
domPopupSearchResultsWindow.style.display = 'block';
|
||||
var width = document.body.clientWidth - 8; // the -8 is for IE :-(
|
||||
domPopupSearchResultsWindow.style.width = width + 'px';
|
||||
domPopupSearchResults.style.width = width + 'px';
|
||||
}
|
||||
else
|
||||
{
|
||||
var domPopupSearchResults = this.DOMPopupSearchResults();
|
||||
var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
|
||||
var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;
|
||||
domPopupSearchResultsWindow.style.display = 'block';
|
||||
left -= domPopupSearchResults.offsetWidth;
|
||||
domPopupSearchResultsWindow.style.top = top + 'px';
|
||||
domPopupSearchResultsWindow.style.left = left + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
this.lastSearchValue = searchValue;
|
||||
this.lastResultsPage = resultsPage;
|
||||
}
|
||||
|
||||
// -------- Activation Functions
|
||||
|
||||
// Activates or deactivates the search panel, resetting things to
|
||||
// their default values if necessary.
|
||||
this.Activate = function(isActive)
|
||||
{
|
||||
if (isActive || // open it
|
||||
this.DOMPopupSearchResultsWindow().style.display == 'block'
|
||||
)
|
||||
{
|
||||
this.DOMSearchBox().className = 'MSearchBoxActive';
|
||||
|
||||
var searchField = this.DOMSearchField();
|
||||
|
||||
if (searchField.value == this.searchLabel) // clear "Search" term upon entry
|
||||
{
|
||||
searchField.value = '';
|
||||
this.searchActive = true;
|
||||
}
|
||||
}
|
||||
else if (!isActive) // directly remove the panel
|
||||
{
|
||||
this.DOMSearchBox().className = 'MSearchBoxInactive';
|
||||
this.DOMSearchField().value = this.searchLabel;
|
||||
this.searchActive = false;
|
||||
this.lastSearchValue = ''
|
||||
this.lastResultsPage = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// The class that handles everything on the search results page.
|
||||
function SearchResults(name)
|
||||
{
|
||||
// The number of matches from the last run of <Search()>.
|
||||
this.lastMatchCount = 0;
|
||||
this.lastKey = 0;
|
||||
this.repeatOn = false;
|
||||
|
||||
// Toggles the visibility of the passed element ID.
|
||||
this.FindChildElement = function(id)
|
||||
{
|
||||
var parentElement = document.getElementById(id);
|
||||
var element = parentElement.firstChild;
|
||||
|
||||
while (element && element!=parentElement)
|
||||
{
|
||||
if (element.nodeName == 'DIV' && element.className == 'SRChildren')
|
||||
{
|
||||
return element;
|
||||
}
|
||||
|
||||
if (element.nodeName == 'DIV' && element.hasChildNodes())
|
||||
{
|
||||
element = element.firstChild;
|
||||
}
|
||||
else if (element.nextSibling)
|
||||
{
|
||||
element = element.nextSibling;
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
element = element.parentNode;
|
||||
}
|
||||
while (element && element!=parentElement && !element.nextSibling);
|
||||
|
||||
if (element && element!=parentElement)
|
||||
{
|
||||
element = element.nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.Toggle = function(id)
|
||||
{
|
||||
var element = this.FindChildElement(id);
|
||||
if (element)
|
||||
{
|
||||
if (element.style.display == 'block')
|
||||
{
|
||||
element.style.display = 'none';
|
||||
}
|
||||
else
|
||||
{
|
||||
element.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Searches for the passed string. If there is no parameter,
|
||||
// it takes it from the URL query.
|
||||
//
|
||||
// Always returns true, since other documents may try to call it
|
||||
// and that may or may not be possible.
|
||||
this.Search = function(search)
|
||||
{
|
||||
if (!search) // get search word from URL
|
||||
{
|
||||
search = window.location.search;
|
||||
search = search.substring(1); // Remove the leading '?'
|
||||
search = unescape(search);
|
||||
}
|
||||
|
||||
search = search.replace(/^ +/, ""); // strip leading spaces
|
||||
search = search.replace(/ +$/, ""); // strip trailing spaces
|
||||
search = search.toLowerCase();
|
||||
search = convertToId(search);
|
||||
|
||||
var resultRows = document.getElementsByTagName("div");
|
||||
var matches = 0;
|
||||
|
||||
var i = 0;
|
||||
while (i < resultRows.length)
|
||||
{
|
||||
var row = resultRows.item(i);
|
||||
if (row.className == "SRResult")
|
||||
{
|
||||
var rowMatchName = row.id.toLowerCase();
|
||||
rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
|
||||
|
||||
if (search.length<=rowMatchName.length &&
|
||||
rowMatchName.substr(0, search.length)==search)
|
||||
{
|
||||
row.style.display = 'block';
|
||||
matches++;
|
||||
}
|
||||
else
|
||||
{
|
||||
row.style.display = 'none';
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
document.getElementById("Searching").style.display='none';
|
||||
if (matches == 0) // no results
|
||||
{
|
||||
document.getElementById("NoMatches").style.display='block';
|
||||
}
|
||||
else // at least one result
|
||||
{
|
||||
document.getElementById("NoMatches").style.display='none';
|
||||
}
|
||||
this.lastMatchCount = matches;
|
||||
return true;
|
||||
}
|
||||
|
||||
// return the first item with index index or higher that is visible
|
||||
this.NavNext = function(index)
|
||||
{
|
||||
var focusItem;
|
||||
while (1)
|
||||
{
|
||||
var focusName = 'Item'+index;
|
||||
focusItem = document.getElementById(focusName);
|
||||
if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (!focusItem) // last element
|
||||
{
|
||||
break;
|
||||
}
|
||||
focusItem=null;
|
||||
index++;
|
||||
}
|
||||
return focusItem;
|
||||
}
|
||||
|
||||
this.NavPrev = function(index)
|
||||
{
|
||||
var focusItem;
|
||||
while (1)
|
||||
{
|
||||
var focusName = 'Item'+index;
|
||||
focusItem = document.getElementById(focusName);
|
||||
if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (!focusItem) // last element
|
||||
{
|
||||
break;
|
||||
}
|
||||
focusItem=null;
|
||||
index--;
|
||||
}
|
||||
return focusItem;
|
||||
}
|
||||
|
||||
this.ProcessKeys = function(e)
|
||||
{
|
||||
if (e.type == "keydown")
|
||||
{
|
||||
this.repeatOn = false;
|
||||
this.lastKey = e.keyCode;
|
||||
}
|
||||
else if (e.type == "keypress")
|
||||
{
|
||||
if (!this.repeatOn)
|
||||
{
|
||||
if (this.lastKey) this.repeatOn = true;
|
||||
return false; // ignore first keypress after keydown
|
||||
}
|
||||
}
|
||||
else if (e.type == "keyup")
|
||||
{
|
||||
this.lastKey = 0;
|
||||
this.repeatOn = false;
|
||||
}
|
||||
return this.lastKey!=0;
|
||||
}
|
||||
|
||||
this.Nav = function(evt,itemIndex)
|
||||
{
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==13) return true;
|
||||
if (!this.ProcessKeys(e)) return false;
|
||||
|
||||
if (this.lastKey==38) // Up
|
||||
{
|
||||
var newIndex = itemIndex-1;
|
||||
var focusItem = this.NavPrev(newIndex);
|
||||
if (focusItem)
|
||||
{
|
||||
var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
|
||||
if (child && child.style.display == 'block') // children visible
|
||||
{
|
||||
var n=0;
|
||||
var tmpElem;
|
||||
while (1) // search for last child
|
||||
{
|
||||
tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
|
||||
if (tmpElem)
|
||||
{
|
||||
focusItem = tmpElem;
|
||||
}
|
||||
else // found it!
|
||||
{
|
||||
break;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (focusItem)
|
||||
{
|
||||
focusItem.focus();
|
||||
}
|
||||
else // return focus to search field
|
||||
{
|
||||
parent.document.getElementById("MSearchField").focus();
|
||||
}
|
||||
}
|
||||
else if (this.lastKey==40) // Down
|
||||
{
|
||||
var newIndex = itemIndex+1;
|
||||
var focusItem;
|
||||
var item = document.getElementById('Item'+itemIndex);
|
||||
var elem = this.FindChildElement(item.parentNode.parentNode.id);
|
||||
if (elem && elem.style.display == 'block') // children visible
|
||||
{
|
||||
focusItem = document.getElementById('Item'+itemIndex+'_c0');
|
||||
}
|
||||
if (!focusItem) focusItem = this.NavNext(newIndex);
|
||||
if (focusItem) focusItem.focus();
|
||||
}
|
||||
else if (this.lastKey==39) // Right
|
||||
{
|
||||
var item = document.getElementById('Item'+itemIndex);
|
||||
var elem = this.FindChildElement(item.parentNode.parentNode.id);
|
||||
if (elem) elem.style.display = 'block';
|
||||
}
|
||||
else if (this.lastKey==37) // Left
|
||||
{
|
||||
var item = document.getElementById('Item'+itemIndex);
|
||||
var elem = this.FindChildElement(item.parentNode.parentNode.id);
|
||||
if (elem) elem.style.display = 'none';
|
||||
}
|
||||
else if (this.lastKey==27) // Escape
|
||||
{
|
||||
parent.searchBox.CloseResultsWindow();
|
||||
parent.document.getElementById("MSearchField").focus();
|
||||
}
|
||||
else if (this.lastKey==13) // Enter
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.NavChild = function(evt,itemIndex,childIndex)
|
||||
{
|
||||
var e = (evt) ? evt : window.event; // for IE
|
||||
if (e.keyCode==13) return true;
|
||||
if (!this.ProcessKeys(e)) return false;
|
||||
|
||||
if (this.lastKey==38) // Up
|
||||
{
|
||||
if (childIndex>0)
|
||||
{
|
||||
var newIndex = childIndex-1;
|
||||
document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
|
||||
}
|
||||
else // already at first child, jump to parent
|
||||
{
|
||||
document.getElementById('Item'+itemIndex).focus();
|
||||
}
|
||||
}
|
||||
else if (this.lastKey==40) // Down
|
||||
{
|
||||
var newIndex = childIndex+1;
|
||||
var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
|
||||
if (!elem) // last child, jump to parent next parent
|
||||
{
|
||||
elem = this.NavNext(itemIndex+1);
|
||||
}
|
||||
if (elem)
|
||||
{
|
||||
elem.focus();
|
||||
}
|
||||
}
|
||||
else if (this.lastKey==27) // Escape
|
||||
{
|
||||
parent.searchBox.CloseResultsWindow();
|
||||
parent.document.getElementById("MSearchField").focus();
|
||||
}
|
||||
else if (this.lastKey==13) // Enter
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function setKeyActions(elem,action)
|
||||
{
|
||||
elem.setAttribute('onkeydown',action);
|
||||
elem.setAttribute('onkeypress',action);
|
||||
elem.setAttribute('onkeyup',action);
|
||||
}
|
||||
|
||||
function setClassAttr(elem,attr)
|
||||
{
|
||||
elem.setAttribute('class',attr);
|
||||
elem.setAttribute('className',attr);
|
||||
}
|
||||
|
||||
function createResults()
|
||||
{
|
||||
var results = document.getElementById("SRResults");
|
||||
for (var e=0; e<searchData.length; e++)
|
||||
{
|
||||
var id = searchData[e][0];
|
||||
var srResult = document.createElement('div');
|
||||
srResult.setAttribute('id','SR_'+id);
|
||||
setClassAttr(srResult,'SRResult');
|
||||
var srEntry = document.createElement('div');
|
||||
setClassAttr(srEntry,'SREntry');
|
||||
var srLink = document.createElement('a');
|
||||
srLink.setAttribute('id','Item'+e);
|
||||
setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');
|
||||
setClassAttr(srLink,'SRSymbol');
|
||||
srLink.innerHTML = searchData[e][1][0];
|
||||
srEntry.appendChild(srLink);
|
||||
if (searchData[e][1].length==2) // single result
|
||||
{
|
||||
srLink.setAttribute('href',searchData[e][1][1][0]);
|
||||
if (searchData[e][1][1][1])
|
||||
{
|
||||
srLink.setAttribute('target','_parent');
|
||||
}
|
||||
var srScope = document.createElement('span');
|
||||
setClassAttr(srScope,'SRScope');
|
||||
srScope.innerHTML = searchData[e][1][1][2];
|
||||
srEntry.appendChild(srScope);
|
||||
}
|
||||
else // multiple results
|
||||
{
|
||||
srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")');
|
||||
var srChildren = document.createElement('div');
|
||||
setClassAttr(srChildren,'SRChildren');
|
||||
for (var c=0; c<searchData[e][1].length-1; c++)
|
||||
{
|
||||
var srChild = document.createElement('a');
|
||||
srChild.setAttribute('id','Item'+e+'_c'+c);
|
||||
setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');
|
||||
setClassAttr(srChild,'SRScope');
|
||||
srChild.setAttribute('href',searchData[e][1][c+1][0]);
|
||||
if (searchData[e][1][c+1][1])
|
||||
{
|
||||
srChild.setAttribute('target','_parent');
|
||||
}
|
||||
srChild.innerHTML = searchData[e][1][c+1][2];
|
||||
srChildren.appendChild(srChild);
|
||||
}
|
||||
srEntry.appendChild(srChildren);
|
||||
}
|
||||
srResult.appendChild(srEntry);
|
||||
results.appendChild(srResult);
|
||||
}
|
||||
}
|
||||
|
||||
function init_search()
|
||||
{
|
||||
var results = document.getElementById("MSearchSelectWindow");
|
||||
for (var key in indexSectionLabels)
|
||||
{
|
||||
var link = document.createElement('a');
|
||||
link.setAttribute('class','SelectItem');
|
||||
link.setAttribute('onclick','searchBox.OnSelectItem('+key+')');
|
||||
link.href='javascript:void(0)';
|
||||
link.innerHTML='<span class="SelectionMark"> </span>'+indexSectionLabels[key];
|
||||
results.appendChild(link);
|
||||
}
|
||||
searchBox.OnSelectItem(0);
|
||||
}
|
||||
/* @license-end */
|
||||
BIN
compile/html/search/search_l.png
Normal file
|
After Width: | Height: | Size: 567 B |