diff --git a/.project b/.project new file mode 100644 index 0000000..e329c3f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Common Build Scripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..1ce5929 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 2.7 +python35 + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..1174a06 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//versionnumbering/versioninfo.py=utf-8 diff --git a/README.md b/README.md deleted file mode 100644 index aeac840..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# HMB_SE_D3000_autobuild_scripts - -hmb_se_d3000_autobuild_scripts repo \ No newline at end of file diff --git a/artifacts/metaexport.groovy b/artifacts/metaexport.groovy new file mode 100644 index 0000000..67d13c3 --- /dev/null +++ b/artifacts/metaexport.groovy @@ -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 artifactFolders = new ArrayList() + 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; diff --git a/autobuilder.groovy b/autobuilder.groovy new file mode 100644 index 0000000..a8d418d --- /dev/null +++ b/autobuilder.groovy @@ -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; diff --git a/build/build_all.groovy b/build/build_all.groovy deleted file mode 100644 index dadbf8d..0000000 --- a/build/build_all.groovy +++ /dev/null @@ -1,407 +0,0 @@ -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: " ${app_build_job.getNumber()}"), - string(name: 'KERNEL_ARTIFACT_JOB', value: kernel_build_job.getProjectName()), - string(name: 'KERNEL_ARTIFACT_JOB_NUMBER', value: " ${kernel_build_job.getNumber()}"), - 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: " ${boot_build_job.getNumber()}"), - string(name: 'STM8_BUILD_JOB', value: stm8_build_job.getProjectName()), - string(name: 'STM8_BUILD_SELECTOR', value: " ${stm8_build_job.getNumber()}"), - string(name: 'CONTROL_PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()), - string(name: 'CONTROL_PACKAGE_CREATE_JOB_SELECTOR', value: " ${control_package_create_job.getNumber()}"), - 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: " ${app_package_create_job.getNumber()}"), - 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: " ${control_package_create_job.getNumber()}"), - 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: " ${kernel_build_job.getNumber()}"), - string(name: 'SOURCE_REVISION', value: ROOTFS_REVISION), - string(name: 'BOOTLOADER_ARTIFACT_JOB', value: boot_build_job.getProjectName()), - string(name: 'BOOTLOADER_ARTIFACT_JOB_SELECTOR', value: " ${boot_build_job.getNumber()}"), - string(name: 'PACKAGE_CREATE_JOB', value: app_package_create_job.getProjectName()), - string(name: 'PACKAGE_CREATE_JOB_SELECTOR', value: " ${app_package_create_job.getNumber()}"), - string(name: 'CONTROL_PACKAGE_CREATE_JOB', value: control_package_create_job.getProjectName()), - string(name: 'CONTROL_PACKAGE_CREATE_JOB_SELECTOR', value: " ${control_package_create_job.getNumber()}"), - 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: " ${init_boot_build_job.getNumber()}"), - string(name: 'MAIN_IMAGE_JOB', value: image_create_job.getProjectName()), - string(name: 'MAIN_IMAGE_JOB_SELECTOR', value: " ${image_create_job.getNumber()}"), - 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' - } - } -} diff --git a/buildimage/init.groovy b/buildimage/init.groovy deleted file mode 100644 index 0276c1b..0000000 --- a/buildimage/init.groovy +++ /dev/null @@ -1,403 +0,0 @@ -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' - } - } -} diff --git a/buildimage/main.groovy b/buildimage/main.groovy deleted file mode 100644 index 231bb79..0000000 --- a/buildimage/main.groovy +++ /dev/null @@ -1,729 +0,0 @@ -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' - } - } -} diff --git a/check/build_meta.groovy b/check/build_meta.groovy new file mode 100644 index 0000000..34eed98 --- /dev/null +++ b/check/build_meta.groovy @@ -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' + } + } +} + diff --git a/check/do_meta.groovy b/check/do_meta.groovy new file mode 100644 index 0000000..7bfe2d1 --- /dev/null +++ b/check/do_meta.groovy @@ -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; diff --git a/checksum/utils.groovy b/checksum/utils.groovy new file mode 100644 index 0000000..be7569d --- /dev/null +++ b/checksum/utils.groovy @@ -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; \ No newline at end of file diff --git a/clean/clean.groovy b/clean/clean.groovy new file mode 100644 index 0000000..4707ba0 --- /dev/null +++ b/clean/clean.groovy @@ -0,0 +1,10 @@ + +def clean(folderlist) { + for (folder in folderlist) { + dir(folder) { + deleteDir() + } + } +} + +return this; \ No newline at end of file diff --git a/cloning/cloning.groovy b/cloning/cloning.groovy deleted file mode 100644 index 32cab7d..0000000 --- a/cloning/cloning.groovy +++ /dev/null @@ -1,174 +0,0 @@ -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: ${BRANCH_TO_COPY} with: ${BRANCH_TO_BUILD}" - configXMLString = configXMLString.replaceAll("${BRANCH_TO_COPY}", "${BRANCH_TO_BUILD}") - - 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' - } - } -} diff --git a/commandline/commandline.groovy b/commandline/commandline.groovy new file mode 100644 index 0000000..38f80fa --- /dev/null +++ b/commandline/commandline.groovy @@ -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 \ No newline at end of file diff --git a/compile/altera_soc_build_scripts/build_boot.sh b/compile/altera_soc_build_scripts/build_boot.sh deleted file mode 100755 index 8a59b80..0000000 --- a/compile/altera_soc_build_scripts/build_boot.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/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 diff --git a/compile/altera_soc_build_scripts/build_device_tree_blob.sh b/compile/altera_soc_build_scripts/build_device_tree_blob.sh deleted file mode 100755 index fade6a4..0000000 --- a/compile/altera_soc_build_scripts/build_device_tree_blob.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/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 - - diff --git a/compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh b/compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh deleted file mode 100755 index 16baab1..0000000 --- a/compile/altera_soc_build_scripts/build_device_tree_blob_from_source.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 diff --git a/compile/altera_soc_build_scripts/build_uboot_images.sh b/compile/altera_soc_build_scripts/build_uboot_images.sh deleted file mode 100755 index 737ef41..0000000 --- a/compile/altera_soc_build_scripts/build_uboot_images.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 diff --git a/compile/compile.groovy b/compile/compile.groovy deleted file mode 100644 index 7dfbbc8..0000000 --- a/compile/compile.groovy +++ /dev/null @@ -1,325 +0,0 @@ -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' - } - } -} diff --git a/compile/compile_boot.groovy b/compile/compile_boot.groovy deleted file mode 100644 index 9f214ce..0000000 --- a/compile/compile_boot.groovy +++ /dev/null @@ -1,223 +0,0 @@ -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' - } - } -} diff --git a/compile/compile_kernel.groovy b/compile/compile_kernel.groovy deleted file mode 100644 index 209ebf4..0000000 --- a/compile/compile_kernel.groovy +++ /dev/null @@ -1,173 +0,0 @@ -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' - } - } -} diff --git a/compile/compile_simulator.groovy b/compile/compile_simulator.groovy deleted file mode 100644 index 17e85b7..0000000 --- a/compile/compile_simulator.groovy +++ /dev/null @@ -1,267 +0,0 @@ -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' - } - } -} diff --git a/compile/compile_stm8.groovy b/compile/compile_stm8.groovy deleted file mode 100644 index 8a62239..0000000 --- a/compile/compile_stm8.groovy +++ /dev/null @@ -1,155 +0,0 @@ -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' - } - } -} diff --git a/compile/doxygenconfig b/compile/doxygenconfig deleted file mode 100644 index bff117c..0000000 --- a/compile/doxygenconfig +++ /dev/null @@ -1,383 +0,0 @@ -# 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 diff --git a/compile/eclipsebuild/disableparallelbuilds.groovy b/compile/eclipsebuild/disableparallelbuilds.groovy new file mode 100644 index 0000000..03e4c8f --- /dev/null +++ b/compile/eclipsebuild/disableparallelbuilds.groovy @@ -0,0 +1,12 @@ + +// Disable parallel make builds - which may be causing autobuild issues +def doDisableParallelMake(rootSearchFolder = "${WORKSPACE}") { + if (isUnix()) { + sh """ + # Looks for " - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compile/html/dynsections.js b/compile/html/dynsections.js deleted file mode 100644 index 3174bd7..0000000 --- a/compile/html/dynsections.js +++ /dev/null @@ -1,121 +0,0 @@ -/* - @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 - - - - - - -GIS_embedded_SW: Main Page - - - - - - - - - - - - - -
-
- - - - - - -
-
GIS_embedded_SW -
-
-
- - - - - - - -
-
- -
-
-
- -
- -
-
- - -
- -
- -
-
-
GIS_embedded_SW Documentation
-
-
-
-
- - - - diff --git a/compile/html/jquery.js b/compile/html/jquery.js deleted file mode 100644 index 103c32d..0000000 --- a/compile/html/jquery.js +++ /dev/null @@ -1,35 +0,0 @@ -/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element -},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),m&&(p-=l),g&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable});/** - * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler - * Licensed under MIT - * @author Ariel Flesler - * @version 2.1.2 - */ -;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1-1){targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if(session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)}closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if(session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE,function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList,finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight()));return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")}function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(),elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight,viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 - * http://www.smartmenus.org/ - * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)),mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy(this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?(this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for(var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if((!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&(this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]")||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"),a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i,downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2))&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0),canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})}return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1,bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); \ No newline at end of file diff --git a/compile/html/menu.js b/compile/html/menu.js deleted file mode 100644 index 2fe2214..0000000 --- a/compile/html/menu.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - @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+=''; - } - 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('
  • '); - } else { - $('#main-menu').append('
  • '); - } - } - $('#main-menu').smartmenus(); -} -/* @license-end */ diff --git a/compile/html/menudata.js b/compile/html/menudata.js deleted file mode 100644 index d1ece13..0000000 --- a/compile/html/menudata.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - @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"}]} diff --git a/compile/html/nav_f.png b/compile/html/nav_f.png deleted file mode 100644 index 8d6c747..0000000 Binary files a/compile/html/nav_f.png and /dev/null differ diff --git a/compile/html/nav_g.png b/compile/html/nav_g.png deleted file mode 100644 index 2093a23..0000000 Binary files a/compile/html/nav_g.png and /dev/null differ diff --git a/compile/html/nav_h.png b/compile/html/nav_h.png deleted file mode 100644 index c02f661..0000000 Binary files a/compile/html/nav_h.png and /dev/null differ diff --git a/compile/html/navtree.css b/compile/html/navtree.css deleted file mode 100644 index 7672de7..0000000 --- a/compile/html/navtree.css +++ /dev/null @@ -1,146 +0,0 @@ -#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; } -} - diff --git a/compile/html/navtree.js b/compile/html/navtree.js deleted file mode 100644 index 1e272d3..0000000 --- a/compile/html/navtree.js +++ /dev/null @@ -1,546 +0,0 @@ -/* - @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+11) 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(''); -} - -function showSyncOn(n,relpath) -{ - n.html(''); -} - -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(/=desktop_vp) { - if (!collapsed) { - collapseExpand(); - } - } else if (width>desktop_vp && collapsedWidth0) { - 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 */ diff --git a/compile/html/search/close.svg b/compile/html/search/close.svg deleted file mode 100644 index a933eea..0000000 --- a/compile/html/search/close.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - diff --git a/compile/html/search/mag_sel.svg b/compile/html/search/mag_sel.svg deleted file mode 100644 index 03626f6..0000000 --- a/compile/html/search/mag_sel.svg +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/compile/html/search/nomatches.html b/compile/html/search/nomatches.html deleted file mode 100644 index 4377320..0000000 --- a/compile/html/search/nomatches.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - -
    -
    No Matches
    -
    - - diff --git a/compile/html/search/search.css b/compile/html/search/search.css deleted file mode 100644 index e45fb90..0000000 --- a/compile/html/search/search.css +++ /dev/null @@ -1,255 +0,0 @@ -/*---------------- 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
  • 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; -} - diff --git a/compile/html/search/search.js b/compile/html/search/search.js deleted file mode 100644 index 92b6094..0000000 --- a/compile/html/search/search.js +++ /dev/null @@ -1,814 +0,0 @@ -/* - @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 do a search - { - this.Search(); - } - } - - this.OnSearchSelectKey = function(evt) - { - var e = (evt) ? evt : window.event; // for IE - if (e.keyCode==40 && this.searchIndex0) // 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 . - 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; eli>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace!important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0!important;-webkit-border-radius:0;border-radius:0!important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px!important;-webkit-border-radius:5px;border-radius:5px!important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0!important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px!important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} \ No newline at end of file diff --git a/configuration/configuration.groovy b/configuration/configuration.groovy new file mode 100644 index 0000000..2a7f1ab --- /dev/null +++ b/configuration/configuration.groovy @@ -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 sparseitemlist = gh.convertSparseItemsString(filter) + gh.gitCheckoutAlt(gitURL, revision, targetDir, repoRoot, cloneDepth, shallowClone) + + registerConfigurationInfo(meta, tool, gitURL, revision, gh.getGitInfo(targetDir)) +} + +return this diff --git a/copy/all.groovy b/copy/all.groovy new file mode 100644 index 0000000..b7c4607 --- /dev/null +++ b/copy/all.groovy @@ -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' + } + } +} \ No newline at end of file diff --git a/copy/esw.groovy b/copy/esw.groovy new file mode 100644 index 0000000..2a63171 --- /dev/null +++ b/copy/esw.groovy @@ -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' + } + } +} \ No newline at end of file diff --git a/copy/filtered.groovy b/copy/filtered.groovy new file mode 100644 index 0000000..feaa2ab --- /dev/null +++ b/copy/filtered.groovy @@ -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' + } + } +} diff --git a/copy/logic.groovy b/copy/logic.groovy new file mode 100644 index 0000000..43ebd9c --- /dev/null +++ b/copy/logic.groovy @@ -0,0 +1,65 @@ +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 { + sh('env') + 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' + } + } +} \ No newline at end of file diff --git a/differences/.project b/differences/.project new file mode 100644 index 0000000..75af0fc --- /dev/null +++ b/differences/.project @@ -0,0 +1,17 @@ + + + Release_difference + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/differences/.pydevproject b/differences/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/differences/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/differences/dometahierarchy.groovy b/differences/dometahierarchy.groovy new file mode 100644 index 0000000..6280960 --- /dev/null +++ b/differences/dometahierarchy.groovy @@ -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 + 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 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 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 commentscollection + + RevertsReportRecord() { + jiraticket = '' + ticketURI = '' + commentscollection = new LinkedHashMap() + } +} + +def revertsreport(String reportsubfolder, String title, LinkedHashMap 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 commentscollection + + TicketedReportRecord() { + jiraticket = '' + ticketURI = '' + commentscollection = new LinkedHashMap() + } +} + +def ticketedreport(String reportsubfolder, String title, LinkedHashMap 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 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; diff --git a/differences/file.groovy b/differences/file.groovy new file mode 100644 index 0000000..aa4814a --- /dev/null +++ b/differences/file.groovy @@ -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; diff --git a/differences/json.groovy b/differences/json.groovy new file mode 100644 index 0000000..0556188 --- /dev/null +++ b/differences/json.groovy @@ -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; diff --git a/differences/metahierarchy.groovy b/differences/metahierarchy.groovy new file mode 100644 index 0000000..4bcdcdc --- /dev/null +++ b/differences/metahierarchy.groovy @@ -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' + } + } +} + diff --git a/documentation/doxygen_deploy.groovy b/documentation/doxygen_deploy.groovy new file mode 100644 index 0000000..6642256 --- /dev/null +++ b/documentation/doxygen_deploy.groovy @@ -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' + } + } +} + diff --git a/import/importer.groovy b/import/importer.groovy new file mode 100644 index 0000000..8624421 --- /dev/null +++ b/import/importer.groovy @@ -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 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 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, " ${buildnumber}") + 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; diff --git a/install/installhelper.groovy b/install/installhelper.groovy new file mode 100644 index 0000000..96a8b2e --- /dev/null +++ b/install/installhelper.groovy @@ -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; diff --git a/mark/core.groovy b/mark/core.groovy deleted file mode 100644 index abd1ec0..0000000 --- a/mark/core.groovy +++ /dev/null @@ -1,94 +0,0 @@ -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('Checkout source') { - steps { - script { - ESWDIR = 'esw' - SOURCEURL = "git@hydra:core-presto/core-presto-embedded-software-subtree.git" - SOURCEREVISION = SOURCE_REVISION.trim() - SOURCENAME = 'core' - hs = "${ESWDIR}/${SOURCENAME}" - configurationhelper.gitCheckoutAndRegister(meta, SOURCENAME, SOURCEURL, SOURCEREVISION, hs, '', 0, false) - env.SOURCE_PATH = hs - } - } - } - stage('Clean exports') { - steps { - script { - cleanfolders = [ - ] - 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('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 artifacts = [] - def artifactlist = meta.generateartifacts(artifacts) - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} diff --git a/meta/folder.groovy b/meta/folder.groovy new file mode 100644 index 0000000..704bfc8 --- /dev/null +++ b/meta/folder.groovy @@ -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 releaseitems + boolean released + + ReleaseInfo(script, String releaserepoURL = "", boolean released = false) { + super(script) + this.releaserepoURL = releaserepoURL + this.releaseitems = new ArrayList() + 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() + 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 checksumpairs + + ChecksumSet(script, artifactpath = "") { + super(script) + this.artifactpath = artifactpath + checksumpairs = new ArrayList() + } + + 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() + 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 checksumsets + + ChecksumInfo(script) { + super(script) + checksumsets = new ArrayList() + } + + 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() + 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 + private ArrayList publishableinfo + private LinkedHashMap custominfo + private ArrayList 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() + publishableinfo = new ArrayList() + custominfo = new LinkedHashMap() + associatedmeta = new ArrayList() + } + + 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 releasedfromhere = new ArrayList(), // These items are recorded in meta as released from here + ArrayList releasedfromsubmeta = new ArrayList(), // 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 releasewalkerp(int maxdepth, ArrayList 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 releasewalker(int maxdepth, String startpath = "") { + ArrayList releasemetacollection = new ArrayList() + 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 putwithshortestoffsetpath(Map 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 releasewalkerunique(int maxdepth, String startpath = "") { + def ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) + + def Map releasemetauniquecollection = new LinkedHashMap() + for (relatedmetainfo in releasemetacollection) { + def String uniquestring = relatedmetainfo.meta.componentidentifier() + releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo) + } + + return releasemetauniquecollection + } + + Map releasewalkerversionunique(int maxdepth, String startpath = "") { + ArrayList releasemetacollection = new ArrayList() + releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath) + + def Map releasemetaversionuniquecollection = new LinkedHashMap() + 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; diff --git a/packaging/build.groovy b/packaging/build.groovy deleted file mode 100644 index 2743be0..0000000 --- a/packaging/build.groovy +++ /dev/null @@ -1,315 +0,0 @@ -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") - - 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 = SOURCE_REPO.trim() - SOURCEREVISION = SOURCE_REVISION.trim() - SOURCEDIR = "${WORKSPACE}/ahb-km-1024a-embedded-software" - configurationhelper.gitCheckoutAndRegister(meta, 'ahb-km-1024a-embedded-software', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) - SOURCE_PATH = SOURCEDIR - PROD_SPECIFIC_SOURCE = SOURCE_PATH - } - } - } - stage('Clean exports') { - steps { - script { - versioninfo = "${WORKSPACE}/versioninfo" - packaging = "packaging" - packageout = "package" - uniquepackageout = "uniquepackage" - BOOTLOADERDEST = "${WORKSPACE}/boot" - KERNELDEST = "${WORKSPACE}/kernel" - env.BA4_LOGICDEST = "${WORKSPACE}/ba4_logic" - env.BA6_LOGICDEST = "${WORKSPACE}/ba6_logic" - env.FC5_LOGICDEST = "${WORKSPACE}/fc5_logic" - env.STM8_ARTIFACTS_DIR = "${WORKSPACE}/stm8" - CONTROL_PACKAGE = "${WORKSPACE}/control_package" - cleanfolders = [ - "${WORKSPACE}/esw", - BA4_LOGICDEST, - BA6_LOGICDEST, - FC5_LOGICDEST, - STM8_ARTIFACTS_DIR, - BOOTLOADERDEST, - KERNELDEST, - CONTROL_PACKAGE, - versioninfo, - packaging, - packageout, - uniquepackageout, - ] - 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 logic artifacts') { - steps { - script { - def ba4logicoptions = importer.getNewImportOptions() - ba4logicoptions.source(BA4_LOGIC_ARTIFACT_LOCATION, BA4_LOGIC_ARTIFACT_PROJECT, BA4_LOGIC_ARTIFACT_BUILD_SELECTOR, BA4_LOGIC_ARTIFACT_RELEASE_REPO, BA4_LOGIC_ARTIFACT_RELEASE_REVISION) - ba4logicmeta = importer.artifactimport(meta, ba4logicoptions, BA4_LOGICDEST) - - def ba6logicoptions = importer.getNewImportOptions() - ba6logicoptions.source(BA6_LOGIC_ARTIFACT_LOCATION, BA6_LOGIC_ARTIFACT_PROJECT, BA6_LOGIC_ARTIFACT_BUILD_SELECTOR, BA6_LOGIC_ARTIFACT_RELEASE_REPO, BA6_LOGIC_ARTIFACT_RELEASE_REVISION) - ba6logicmeta = importer.artifactimport(meta, ba6logicoptions, BA6_LOGICDEST) - - def fc5logicoptions = importer.getNewImportOptions() - fc5logicoptions.source(FC5_LOGIC_ARTIFACT_LOCATION, FC5_LOGIC_ARTIFACT_PROJECT, FC5_LOGIC_ARTIFACT_BUILD_SELECTOR, FC5_LOGIC_ARTIFACT_RELEASE_REPO, FC5_LOGIC_ARTIFACT_RELEASE_REVISION) - fc5logicmeta = importer.artifactimport(meta, fc5logicoptions, FC5_LOGICDEST) - } - } - } - stage('Copying STM8 artifacts') { - steps { - script { - stm8meta = importer.artifactimport(meta, STM8_BUILD_JOB, STM8_BUILD_SELECTOR, STM8_ARTIFACTS_DIR) - } - } - } - stage('Copying embedded software artifacts') { - steps { - script { - ESW = "${WORKSPACE}/esw" - eswmeta = importer.artifactimport(meta, ESW_ARTIFACT_JOB, ESW_ARTIFACT_JOB_SELECTOR, ESW) - ESWEXPORT = "${ESW}/export" - ESWEXPORTTGZ = "${ESW}/export.tgz" - ESWEXPORTEXPANDED = "${ESW}/expanded" - dir(ESWEXPORTEXPANDED) { - if (isUnix()) { - sh """#!/bin/bash - # Exit if any command fails - set -e - - tar zxvf "${ESWEXPORTTGZ}" - """ - } else { - error "This job does not support Windows at the moment" - } - } - ESWEXPORTEXPANDED_FOLDER = "${ESWEXPORTEXPANDED}/export" - } - } - } - stage('Copying control package artifacts') { - steps { - script { - controlpackagemeta = importer.artifactimport(meta, CONTROL_PACKAGE_CREATE_JOB, CONTROL_PACKAGE_CREATE_JOB_SELECTOR, CONTROL_PACKAGE) - } - } - } - stage('Generate version info folder for image') { - steps { - script { - def metamap = [ - [ "${versioninfo}/ba4logic", ba4logicmeta ], - [ "${versioninfo}/ba6logic", ba6logicmeta ], - [ "${versioninfo}/fc5logic", fc5logicmeta ], - [ "${versioninfo}/stm8meta", stm8meta ], - [ "${versioninfo}/bootloader", bootloadermeta ], - [ "${versioninfo}/kernel", kernelmeta ], - [ "${versioninfo}/esw", eswmeta ], - [ "${versioninfo}/control_package", controlpackagemeta ], - [ "${versioninfo}/app_package", meta ], // Incomplete until this job ends - ] - for (metaitem in metamap) { - (destfolder, componentmeta) = metaitem - dir(destfolder) { - componentmeta.saveJsonSerialised("meta.json") - } - } - } - } - } - stage('Create common definitions') { - steps { - script { - PASSWORD = "ramshorn42" - - debianpackage = load("${autobuilder.commonscripts()}/packaging/debian.groovy") - } - } - } - stage('Create ESW and EL definitions') { - steps { - script { - def ESW_EL_PACKAGE_NAME = 'gis-ahb-km-1024a-esw-el' - esw_el_debroot = debianpackage.debDefinition(packaging, PROD_SPECIFIC_SOURCE, ESW_EL_PACKAGE_NAME, meta.releasetagfordebpackage()) - } - } - } - stage('Version stamp ESW and EL package file') { - steps { - script { - convertdetails = [ - // File to convert Pattern to replace New string - [ "${PROD_SPECIFIC_SOURCE}/${esw_el_debroot.PACKAGE_SOURCE_FOLDER_NAME}/DEBIAN/control", "0.30000.0.0", meta.releasetagfordebpackage() ], - [ "${PROD_SPECIFIC_SOURCE}/${esw_el_debroot.PACKAGE_SOURCE_FOLDER_NAME}/DEBIAN/control", "0.30001.0.0", controlpackagemeta.releasetagfordebpackage() ], - ] - versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") - versionnumbering.stamp(convertdetails) - } - } - } - stage('Create ESW and EL package') { - steps { - script { - gh = load("${autobuilder.commonscripts()}/versioncontrol/git.groovy") - - sh """#!/bin/bash - # Exit if any command fails - set -e - - echo "${PASSWORD}" | sudo -S echo - - mkdir -v -p "${esw_el_debroot.ETC}" - cp -v -r "${PROD_SPECIFIC_SOURCE}/boardetc/app"/* "${esw_el_debroot.ETC}" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_BIN}" - cp -v --no-dereference --preserve=links "${ESWEXPORTEXPANDED_FOLDER}/Release/bin"/* "${esw_el_debroot.GIS_OPT_BIN}" - chmod -v -R u+x "${esw_el_debroot.GIS_OPT_BIN}" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_LIB}" - cp -v -r --no-dereference --preserve=links "${ESWEXPORTEXPANDED_FOLDER}/Release/lib"/* "${esw_el_debroot.GIS_OPT_LIB}" - cp -v -r "${PROD_SPECIFIC_SOURCE}/boardlib/app"/* "${esw_el_debroot.GIS_OPT_LIB}" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_SCRIPTS_APP}" - cp -v -r "${PROD_SPECIFIC_SOURCE}/boardscripts/scripts/app"/* "${esw_el_debroot.GIS_OPT_SCRIPTS_APP}" - chmod -v -R u+x "${esw_el_debroot.GIS_OPT_SCRIPTS_APP}" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_WWW}" - cp -v -r "${PROD_SPECIFIC_SOURCE}/devjsclient" "${esw_el_debroot.GIS_OPT_WWW}" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_OTHER}" - cp -v -r "${versioninfo}" "${esw_el_debroot.GIS_OPT_OTHER}" - - mkdir -v -p "${esw_el_debroot.LIB_FIRMWARE}" - mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba4" - cp -v "${BA4_LOGICDEST}/embedded_logic/top_encrypted.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba4/logic.rbf" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba6" - cp -v "${BA6_LOGICDEST}/embedded_logic/top_encrypted.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/ba6/logic.rbf" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/fc5" - cp -v "${FC5_LOGICDEST}/embedded_logic/top_encrypted.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/som/fpga/fc5/logic.rbf" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/hmbdg/fpga/any" - cp -v "${BA4_LOGICDEST}/embedded_logic/hmb_fpga_top.rbf" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/hmbdg/fpga/any/logic.rbf" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/ahb/fpga/any" - cp -v "${BA4_LOGICDEST}/embedded_logic/ahb_fpga_top.jbc" "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/ahb/fpga/any/logic.jbc" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/any/stm8/any" - cp -v "${STM8_ARTIFACTS_DIR}/bin"/* "${esw_el_debroot.GIS_OPT_LOGIC}/ahbkm1024a/any/stm8/any" - - mkdir -v -p "${esw_el_debroot.GIS_OPT_KERNEL}" - cp -v "${KERNELDEST}/bin/zImage" "${esw_el_debroot.GIS_OPT_KERNEL}" - """ - debianpackage.buildPackage(packageout, uniquepackageout, esw_el_debroot, PASSWORD) - } - } - } - stage('Checksum artifacts') { - steps { - script { - def checksummable = [ - "${packageout}/**", - "${uniquepackageout}/**", - ] - checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") - checksumutils.generatelist(meta, checksummable) - } - } - } - stage('Classifying publishable artifacts') { - steps { - script { - def publishable = [ - "${packageout}/**", - "${uniquepackageout}/**", - ] - publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") - publishutils.generatelist(meta, publishable) - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(["${packageout}/**","${uniquepackageout}/**"]) - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} diff --git a/packaging/buildcontrol.groovy b/packaging/buildcontrol.groovy deleted file mode 100644 index c068ed2..0000000 --- a/packaging/buildcontrol.groovy +++ /dev/null @@ -1,169 +0,0 @@ -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 = SOURCE_REPO.trim() - SOURCEREVISION = SOURCE_REVISION.trim() - SOURCEDIR = "${WORKSPACE}/ahb-km-1024a-embedded-software" - configurationhelper.gitCheckoutAndRegister(meta, 'ahb-km-1024a-embedded-software', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) - SOURCE_PATH = SOURCEDIR - PROD_SPECIFIC_SOURCE = SOURCE_PATH - } - } - } - stage('Clean exports') { - steps { - script { - packaging = "packaging" - packageout = "package" - uniquepackageout = "uniquepackage" - cleanfolders = [ - packaging, - packageout, - uniquepackageout, - ] - 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('Create common definitions') { - steps { - script { - PASSWORD = "ramshorn42" - - debianpackage = load("${autobuilder.commonscripts()}/packaging/debian.groovy") - } - } - } - stage('Create control service definitions') { - steps { - script { - def CONTROL_SERVICE_PACKAGE_NAME = 'gis-ahb-km-1024a-control-service' - control_service_debroot = debianpackage.debDefinition(packaging, PROD_SPECIFIC_SOURCE, CONTROL_SERVICE_PACKAGE_NAME, meta.releasetagfordebpackage()) - } - } - } - stage('Version stamp control service files') { - steps { - script { - convertdetails = [ - // File to convert Pattern to replace New string - [ "${PROD_SPECIFIC_SOURCE}/${control_service_debroot.PACKAGE_SOURCE_FOLDER_NAME}/DEBIAN/control", "0.30000.0.0", meta.releasetagfordebpackage() ], - ] - versionnumbering = load("${autobuilder.commonscripts()}/versionnumbering/do.groovy") - versionnumbering.stamp(convertdetails) - } - } - } - stage('Create control service package') { - steps { - script { - sh """#!/bin/bash - # Exit if any command fails - set -e - - echo "${PASSWORD}" | sudo -S echo - - # mkdir -v -p "${control_service_debroot.ETC}" - # cp -v -r "${PROD_SPECIFIC_SOURCE}/boardetc/control"/* "${control_service_debroot.ETC}" - - mkdir -v -p "${control_service_debroot.GIS_OPT_LIB}" - cp -v -r "${PROD_SPECIFIC_SOURCE}/boardlib/control"/* "${control_service_debroot.GIS_OPT_LIB}" - - mkdir -v -p "${control_service_debroot.GIS_OPT_SCRIPTS_CONTROL}" - cp -v -r "${PROD_SPECIFIC_SOURCE}/boardscripts/scripts/control"/* "${control_service_debroot.GIS_OPT_SCRIPTS_CONTROL}" - chmod -v -R u+x "${control_service_debroot.GIS_OPT_SCRIPTS_CONTROL}" - """ - debianpackage.buildPackage(packageout, uniquepackageout, control_service_debroot, PASSWORD) - } - } - } - stage('Checksum artifacts') { - steps { - script { - def checksummable = [ - "${packageout}/**", - "${uniquepackageout}/**", - ] - checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") - checksumutils.generatelist(meta, checksummable) - } - } - } - stage('Classifying publishable artifacts') { - steps { - script { - def publishable = [ - "${packageout}/**", - "${uniquepackageout}/**", - ] - publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") - publishutils.generatelist(meta, publishable) - } - } - } - stage('Archiving artifacts') { - steps { - script { - def artifactlist = meta.generateartifacts(["${packageout}/**","${uniquepackageout}/**"]) - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} diff --git a/packaging/debian.groovy b/packaging/debian.groovy new file mode 100644 index 0000000..65d3731 --- /dev/null +++ b/packaging/debian.groovy @@ -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; \ No newline at end of file diff --git a/platform/lineendings.groovy b/platform/lineendings.groovy new file mode 100644 index 0000000..9657b0d --- /dev/null +++ b/platform/lineendings.groovy @@ -0,0 +1,5 @@ + +// Put ${nl} into strings when wanting a newline +nl = System.properties['line.separator'] + +return this; diff --git a/publish/.classpath b/publish/.classpath new file mode 100644 index 0000000..287c1ab --- /dev/null +++ b/publish/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/publish/.gitignore b/publish/.gitignore new file mode 100644 index 0000000..abed335 --- /dev/null +++ b/publish/.gitignore @@ -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 diff --git a/publish/.project b/publish/.project new file mode 100644 index 0000000..5c60328 --- /dev/null +++ b/publish/.project @@ -0,0 +1,18 @@ + + + publish_item_select + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.groovy.core.groovyNature + org.eclipse.jdt.core.javanature + + diff --git a/publish/.settings/org.eclipse.jdt.groovy.core.prefs b/publish/.settings/org.eclipse.jdt.groovy.core.prefs new file mode 100644 index 0000000..1e68ed6 --- /dev/null +++ b/publish/.settings/org.eclipse.jdt.groovy.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +groovy.compiler.level=25 +groovy.script.filters=**/*.dsld,y,**/*.gradle,n diff --git a/publish/do.groovy b/publish/do.groovy new file mode 100644 index 0000000..1b227f4 --- /dev/null +++ b/publish/do.groovy @@ -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 publishablepaths = new ArrayList() + 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 ## +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; diff --git a/publish/package.groovy b/publish/package.groovy new file mode 100644 index 0000000..3bd9565 --- /dev/null +++ b/publish/package.groovy @@ -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' + } + } +} + diff --git a/publish/promptingpublish.groovy b/publish/promptingpublish.groovy new file mode 100644 index 0000000..4af0d62 --- /dev/null +++ b/publish/promptingpublish.groovy @@ -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 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() + 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' + } + } +} + diff --git a/publish/publish.groovy b/publish/publish.groovy new file mode 100644 index 0000000..7beb134 --- /dev/null +++ b/publish/publish.groovy @@ -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' + } + } +} + diff --git a/publish/publishitems.groovy b/publish/publishitems.groovy new file mode 100644 index 0000000..677970e --- /dev/null +++ b/publish/publishitems.groovy @@ -0,0 +1,127 @@ +import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition + +class PublishableItemsSelection { + def script + def ArrayList preselectedmenuitems + def ArrayList menuitemdescriptions + def ArrayList menuitemsfull + def ExtendedChoiceParameterDefinition multiselect + + PublishableItemsSelection(script) { + this.script = script + preselectedmenuitems = new ArrayList() + menuitemdescriptions = new ArrayList() + menuitemsfull = new ArrayList() + } + + 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; diff --git a/publishing/utils.groovy b/publishing/utils.groovy new file mode 100644 index 0000000..2daf6f6 --- /dev/null +++ b/publishing/utils.groovy @@ -0,0 +1,27 @@ + + +// The filepath must end in "/**" or "/" - 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 /** or / (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; diff --git a/release/do.groovy b/release/do.groovy new file mode 100644 index 0000000..9148572 --- /dev/null +++ b/release/do.groovy @@ -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: "${toplevelbuildmeta.jenkinsbuildinfo.buildnumber}" + ], + 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 maketaglist(buildmeta, String buildstamp, String otherreleasetags) { + def ArrayList taglist = new ArrayList() + taglist.add(buildstamp) + + def ArrayList 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 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 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 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; diff --git a/release/registerrepo.groovy b/release/registerrepo.groovy new file mode 100644 index 0000000..f565706 --- /dev/null +++ b/release/registerrepo.groovy @@ -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; diff --git a/release/release.groovy b/release/release.groovy new file mode 100644 index 0000000..4220f3b --- /dev/null +++ b/release/release.groovy @@ -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' + } + } +} diff --git a/remoteaccess/ftp.groovy b/remoteaccess/ftp.groovy new file mode 100644 index 0000000..25b9143 --- /dev/null +++ b/remoteaccess/ftp.groovy @@ -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; diff --git a/remoteaccess/hostedftp.groovy b/remoteaccess/hostedftp.groovy new file mode 100644 index 0000000..cf62d32 --- /dev/null +++ b/remoteaccess/hostedftp.groovy @@ -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 customerfilenames = new ArrayList() + def List customers = new ArrayList() + + 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; \ No newline at end of file diff --git a/static_analysis/static_analysis.groovy b/static_analysis/static_analysis.groovy deleted file mode 100644 index bac8b00..0000000 --- a/static_analysis/static_analysis.groovy +++ /dev/null @@ -1,104 +0,0 @@ -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() - } - } - } - stage('Checkout source') { - steps { - script { - SOURCEREVISION = "${SOURCE_REVISION}" - SOURCEDIR = "${WORKSPACE}\\source" - configurationhelper.gitCheckoutAndRegister(meta, 'source', SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) - SOURCE_PATH = "${SOURCEDIR}" - } - } - } - stage('Generating version info') { - steps { - script { - version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCE_PATH) - } - } - } - stage('Print server static analysis') { - parallel { - stage('Measure Print Server code complexity') { - steps { - script { - build job: CCM_ANALYSIS_JOB, - parameters: [ - string(name: 'SOURCEURL', value: SOURCEURL), - string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'SOURCE_OFFSET_PATH', value: SOURCE_OFFSET_PATH), - booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), - ] - } - } - } - stage('Perform Print Server C++ static analysis') { - steps { - script { - build job: CPPCHECK_ANALYSIS_JOB, - parameters: [ - string(name: 'SOURCEURL', value: SOURCEURL), - string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'SOURCE_OFFSET_PATH', value: SOURCE_OFFSET_PATH), - booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), - ] - } - } - } - stage('Perform Print Server DRY static analysis') { - steps { - script { - build job: CPD_ANALYSIS_JOB, - parameters: [ - string(name: 'SOURCEURL', value: SOURCEURL), - string(name: 'SOURCE_REVISION', value: SOURCEREVISION), - string(name: 'SOURCE_OFFSET_PATH', value: SOURCE_OFFSET_PATH), - booleanParam(name: 'CLEAN_WORKSPACE', value: CLEAN_WORKSPACE), - ] - } - } - } - } - } - stage('Archiving artifacts') { - steps { - script { - ArrayList itemsForRelease = [] - def artifactlist = meta.generateartifacts(itemsForRelease) - archiveArtifacts "${artifactlist}" - } - } - } - } - post { - always { - echo 'Post-build' - } - failure { - echo 'Failed build' - } - unstable { - echo 'Unstable build' - } - success { - echo 'Succeeded build' - } - } -} - diff --git a/documentation/api.groovy b/staticanalysis/ccm.groovy similarity index 53% rename from documentation/api.groovy rename to staticanalysis/ccm.groovy index fafd4f2..f0e5b80 100644 --- a/documentation/api.groovy +++ b/staticanalysis/ccm.groovy @@ -4,7 +4,7 @@ pipeline { stage('Initial setup') { steps { script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) } } } @@ -14,42 +14,36 @@ pipeline { configurationhelper = autobuilder.configurationhelper() PYTHONURL = 'git@hydra:tools/python.git' - if (isUnix()) { - PYTHONBRANCH = "origin/3.6.3_linux" - } - else { - PYTHONBRANCH = "origin/3.6.3_windows" - } + 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" - } + 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 { - SOURCEURL = 'git@hydra:gis/inksystem.git' - SOURCEREVISION = "${SOURCE_REVISION}".trim() - SOURCEDIR = "${WORKSPACE}/inksystem" - SOURCEROOTDIR = 'inksystem' - configurationhelper.gitCheckoutAndRegister(meta, 'inksystem', SOURCEURL, SOURCEREVISION, SOURCEDIR, SOURCEROOTDIR, 0, false) - env.SOURCE_PATH = SOURCEDIR + 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') { + stage("Clean exports") { steps { script { - env.API_DOCS = "api_docs" + STATICANALYSIS = 'staticanalysis' cleanfolders = [ - API_DOCS, + STATICANALYSIS, ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -58,29 +52,33 @@ pipeline { } stage('Generating version info') { steps { - script { + script { version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") version.generate(meta, SOURCE_REVISION, SOURCE_PATH) } } } - stage('Copy api docs') { + stage('Static analysis') { steps { script { - dir("${SOURCEDIR}/documents/api/public") { - fileOperations([fileCopyOperation(targetLocation: "${WORKSPACE}/${API_DOCS}", includes: '*.docx,*.pptx')]) + 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 + """ + } } - } - } - } - stage('Checksum artifacts') { - steps { - script { - def checksummable = [ - "${API_DOCS}/**", - ] - checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") - checksumutils.generatelist(meta, checksummable) + recordIssues(tools: [ + ccm(pattern: "**/ccm.xml", reportEncoding: 'UTF-8'), + ]) } } } @@ -88,7 +86,6 @@ pipeline { steps { script { def publishable = [ - "${API_DOCS}/**", ] publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") publishutils.generatelist(meta, publishable) @@ -98,7 +95,8 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["${API_DOCS}/**"]) + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) archiveArtifacts "${artifactlist}" } } diff --git a/staticanalysis/cpd.groovy b/staticanalysis/cpd.groovy new file mode 100644 index 0000000..6f3a33f --- /dev/null +++ b/staticanalysis/cpd.groovy @@ -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 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' + } + } +} diff --git a/documentation/release_note.groovy b/staticanalysis/cppcheck.groovy similarity index 57% rename from documentation/release_note.groovy rename to staticanalysis/cppcheck.groovy index 4c0b6f2..bdc6a2a 100644 --- a/documentation/release_note.groovy +++ b/staticanalysis/cppcheck.groovy @@ -4,7 +4,7 @@ pipeline { stage('Initial setup') { steps { script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild(this, PRODUCT_NAME, SUBCOMPONENT_NAME, RELEASE_REPO) + meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startnonbuild(this) } } } @@ -14,41 +14,30 @@ pipeline { configurationhelper = autobuilder.configurationhelper() PYTHONURL = 'git@hydra:tools/python.git' - if (isUnix()) { - PYTHONBRANCH = "origin/3.6.3_linux" - } - else { - PYTHONBRANCH = "origin/3.6.3_windows" - } + 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" - } + env.PYTHON = "${PYTHONDIR}/ver/python.exe" } } } stage('Checkout source') { steps { script { - SOURCEURL = SOURCE_REPO.trim() - SOURCEREVISION = "${SOURCE_REVISION}".trim() - ESWDIR = 'esw' - SOURCEDIR = "${WORKSPACE}/${ESWDIR}" - configurationhelper.gitCheckoutAndRegister(meta, ESWDIR, SOURCEURL, SOURCEREVISION, SOURCEDIR, '', 0, false) - hs = SOURCEDIR + 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') { + stage("Clean exports") { steps { script { - env.RELEASE_NOTES = "release_notes" + STATICANALYSIS = 'staticanalysis' cleanfolders = [ - RELEASE_NOTES, + STATICANALYSIS, ] cleaner = load("${autobuilder.commonscripts()}/clean/clean.groovy") cleaner.clean(cleanfolders) @@ -59,27 +48,31 @@ pipeline { steps { script { version = load("${autobuilder.commonscripts()}/versionnumbering/generate.groovy") - version.generate(meta, SOURCE_REVISION, SOURCEDIR) + version.generate(meta, SOURCE_REVISION, SOURCE_PATH) } } } - stage('Copy release notes') { + stage('Static analysis') { steps { script { - dir("${hs}/releasenotes") { - fileOperations([fileCopyOperation(targetLocation: "${WORKSPACE}/${RELEASE_NOTES}", includes: '*.txt')]) + 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 + """ + } } - } - } - } - stage('Checksum artifacts') { - steps { - script { - def checksummable = [ - "${RELEASE_NOTES}/**", - ] - checksumutils = load("${autobuilder.commonscripts()}/checksum/utils.groovy") - checksumutils.generatelist(meta, checksummable) + recordIssues(tools: [ + cppCheck(pattern: "**/cppcheck.xml", reportEncoding: 'UTF-8'), + ]) } } } @@ -87,7 +80,6 @@ pipeline { steps { script { def publishable = [ - "${RELEASE_NOTES}/**", ] publishutils = load("${autobuilder.commonscripts()}/publishing/utils.groovy") publishutils.generatelist(meta, publishable) @@ -97,7 +89,8 @@ pipeline { stage('Archiving artifacts') { steps { script { - def artifactlist = meta.generateartifacts(["${RELEASE_NOTES}/**"]) + ArrayList itemsForRelease = ["${STATICANALYSIS}/**"] + def artifactlist = meta.generateartifacts(itemsForRelease) archiveArtifacts "${artifactlist}" } } diff --git a/subtrees.txt b/subtrees.txt deleted file mode 100644 index fbf1dfa..0000000 --- a/subtrees.txt +++ /dev/null @@ -1,2 +0,0 @@ -Local folder: Remote repo: Revision: -Common_scripts git@hydra:jenkinsautobuild/Common_scripts.git (push) master diff --git a/test/main.groovy b/test/main.groovy deleted file mode 100644 index c120e8f..0000000 --- a/test/main.groovy +++ /dev/null @@ -1,260 +0,0 @@ -pipeline { - agent { label "${AGENT_LABEL}"} - stages { - stage ("STAGE: Initial Setup") { - steps{ - script { - meta = load("${WORKSPACE}/autobuild/Common_scripts/autobuilder.groovy").startbuild( - this, - PRODUCT_NAME, - SUBCOMPONENT_NAME, - RELEASE_REPO - ) - } - } - } - stage ("STAGE: Checkout dependencies") { - steps { - script{ - echo "BUILDSTEP: Creating configuration helper" - configurationhelper = autobuilder.configurationhelper() - - echo "BUILDSTEP: Checking out test content repository" - TEST_SOURCE_URL = "git@hydra:hmb_regression/hmb_fd_hv_tests.git" - TEST_SOURCE_REVISION = "${TEST_SOURCE_REVISION}" - TEST_SOURCE_DIR = "${WORKSPACE}/TestSuite" - - echo "url: ${TEST_SOURCE_URL}/nrevision: ${TEST_SOURCE_REVISION}/ndirectory: ${TEST_SOURCE_DIR}" - configurationhelper.gitCheckoutAndRegister( - meta, - "run_test", - TEST_SOURCE_URL, - TEST_SOURCE_REVISION, - TEST_SOURCE_DIR - ) - echo "BUILDSTEP: Checking out test content repository" - RESULT_SOURCE_URL = "git@hydra:gistestresults/ahb_km_1024a_results.git" - RESULT_SOURCE_REVISION = "origin/master" - RESULT_SOURCE_DIR = "${WORKSPACE}/${HISTORY_FOLDER}" - echo "url: ${TEST_SOURCE_URL}/nrevision: ${RESULT_SOURCE_REVISION}/ndirectory: ${RESULT_SOURCE_DIR}" - configurationhelper.gitCheckoutAndRegister( - meta, - "TestResults", - RESULT_SOURCE_URL, - RESULT_SOURCE_REVISION, - RESULT_SOURCE_DIR, - "", - 0, - false - ) - - echo "BUILDSTEP: checking out core test repository" - CORE_SOURCE_URL = "git@hydra:gistest/giscorelite.git" - CORE_SOURCE_REVISION = "${CORE_SOURCE_REVISION}" - CORE_SOURCE_DIR = "${WORKSPACE}/GisCore" - - echo "url: ${CORE_SOURCE_URL}/nrevision: ${CORE_SOURCE_REVISION}/ndirectory: ${CORE_SOURCE_DIR}" - configurationhelper.gitCheckoutAndRegister( - meta, - "run_test", - CORE_SOURCE_URL, - CORE_SOURCE_REVISION, - CORE_SOURCE_DIR - ) - - echo "BUILDSTEP: Checking out FTDI Relay control tools." - FTDI_SOURCE_URL = "git@hydra:python_scripts/ftdi_relay.git" - FTDI_SOURCE_REVISION = "origin/Core-98" - FTDI_SOURCE_DIR = "${WORKSPACE}/PowerController" - configurationhelper.gitCheckoutAndRegister( - meta, - "run_test", - FTDI_SOURCE_URL, - FTDI_SOURCE_REVISION, - FTDI_SOURCE_DIR - ) - } - } - } - stage ("STAGE: Force clean artifacts"){ - steps { - script{ - bat """ - set TEST_SOURCE_DIR=%WORKSPACE%/TestSuite - set GIS_TEST_OUTPUT_LOGGING_ROOT=%WORKSPACE%/%LOG_FOLDER% - echo "Using Python script to make sure the import and logging folders are clean." - echo "Logging Folder = %GIS_TEST_OUTPUT_LOGGING_ROOT%" - %python3% "${TEST_SOURCE_DIR}/autobuild/cleanEnvironment.py" - """ - } - } - } - stage("Copy artifacts") { - steps { - script{ - POWER_CONTROL_HOME = "${WORKSPACE}/PowerController" - POWER_CONTROL_DEVICE = "${FTDI_RELAY_DEVICE_KM1024A}" - POWER_CYCLE_HARDWARE = "${POWER_CYCLE_HARDWARE}" - echo "DEBUG: POWER_CYCLE_HARDWARE is ${POWER_CYCLE_HARDWARE}" - if (POWER_CYCLE_HARDWARE == "true"){ - bat """ - pushd ${POWER_CONTROL_HOME} - - ${python3} ${POWER_CONTROL_HOME}/RegressionPower.py -d ${POWER_CONTROL_DEVICE} -o True - - popd - - if %errorlevel% neq 0 ( exit /b 1) - exit /b 0 - """ - } - else{ - echo "DEBUG: Skipping Power Cycle update" - } - } - } - } - stage("STAGE: Copy artifacts") { - - steps { - script { - UPDATE_HARDWARE = "${UPDATE_HARDWARE}" - if (UPDATE_HARDWARE == "true" ){ - echo "BUILDSTEP: Take the artifacts from the selected build job." - APPLICATION_ARTIFACT_PROJECT = "${APPLICATION_ARTIFACT_PROJECT}" - APPLICATION_ARTIFACT_FOLDER = "${WORKSPACE}/hmbbuild" - APPLICATION_ARTIFACT_SELECTOR = "${APPLICATION_ARTIFACT_SELECTOR}" - APPLICATION_ARTIFACT_FILTER = "app_package/**,control_package/**" - - importer = load("${autobuilder.commonscripts()}/import/importer.groovy") - APPLICATION = importer.artifactimport(meta, APPLICATION_ARTIFACT_PROJECT, APPLICATION_ARTIFACT_SELECTOR, APPLICATION_ARTIFACT_FOLDER, true, APPLICATION_ARTIFACT_FILTER) - echo "BUILDSTEP: Copied Control and App packages" - - } - else{ - echo "DEBUG: Skipping Copy Artifaces" - } - } - } - } - stage("STAGE: Update target hardware") { - steps { - script { - if (UPDATE_HARDWARE == "true" ){ - PACKAGE_FOLDER = "${WORKSPACE}/hmbbuild" - HMB_ADDRESS = "${HMB_KM_1024A_IP}" - GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore" - bat """ - echo "TODO: Determine the hardeware to target" - - echo "pushd ${GIS_TEST_SUITE_CORE}" - pushd "${GIS_TEST_SUITE_CORE}" - - echo "Updating ESW only" - ${python3} "${GIS_TEST_SUITE_CORE}/HMBCommon/hmbPackageDeployer.py" -p "${PACKAGE_FOLDER}" -t "${HMB_ADDRESS}" - echo "Exiting from ${GIS_TEST_SUITE_CORE}" - - popd - ) - if %errorlevel% neq 0 ( exit /b 1) - exit /b 0 - """ - } - else{ - echo "DEBUG: Skipping remote update" - } - } - } - } - stage ("Inspect hardware state") { - - steps{ - script{ - if (UPDATE_HARDWARE == "true" ){ - echo "Inspecting the state of the hardware" - rc =bat (script:""" - set GIS_TEST_SUITE_CORE="${WORKSPACE}/TestSuite/GisCore" - ${python3} "${WORKSPACE}/TestSuite/GisCore/HMBCommon/hmbinspectstate.py" - if %errorlevel% neq 0 ( - echo "ERROR: Unable to detect hardware" - exit /b 1 - ) - """, - returnStatus: true) - if (rc == 1){ - currentBuild.result = 'UNSTABLE' - } - } - else{ - echo "DEBUG: Skipping Inspect Hardware State" - } - } - } - } - stage("STAGE: Run tests"){ - steps{ - script{ - if (DO_TEST == "true" ){ - GIS_TEST_SUITE_CORE = "${WORKSPACE}/GisCore" - rc =bat (script:""" - set TestFail=0 - set GIS_TEST_SUITE_CORE="${WORKSPACE}/GisCore" - set GIS_TEST_SUITE_HOME="${WORKSPACE}/TestSuite" - set GIS_TEST_OUTPUT_LOGGING_ROOT="${WORKSPACE}/%LOG_FOLDER%" - ${python3} "${GIS_TEST_SUITE_CORE}/GISTestMaster.py" -w --hmbkm1024a INSTALLED -fl --include ${TEST_INCLUDE_FILTER} - if %errorlevel% neq 0 (set TestFail=1) - echo "TODO: Do some history or sorting stuff at this point" - if %TestFail% neq 0 ( - exit /b 1 - ) - """, - returnStatus: true - ) - if (rc == 1){ - currentBuild.result = 'UNSTABLE' - } - } - } - } - } - - stage("STAGE: Archive Test History"){ - steps{ - script{ - rc =bat (script:""" - set HistoryFail=0 - pushd %HISTORY_FOLDER% - %python3% GitCyclicPush.py - if %errorlevel% neq 0 (set HistoryFail=1) - popd - if %HistoryFail% neq 0 ( - exit /b 1 - ) - """, - returnStatus: true - ) - if (rc == 1){ - unstable('FAILED to process history') - } - } - } - } - stage("Archive test artifacts"){ - steps{ - script{ - if (UPDATE_HARDWARE == "true" ){ - def artifactlist = meta.generateartifacts(["TestSuite/**","${PACKAGE_FOLDER}/meta/**","${LOG_FOLDER}/**"]) - archiveArtifacts "${artifactlist}" - } - else{ - def artifactlist = meta.generateartifacts(["TestSuite/**","/meta/**","${LOG_FOLDER}/**"]) - archiveArtifacts "${artifactlist}" - } - } - } - } - } -} - - - diff --git a/textutils/subst.groovy b/textutils/subst.groovy new file mode 100644 index 0000000..c0207a3 --- /dev/null +++ b/textutils/subst.groovy @@ -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; \ No newline at end of file diff --git a/tool configurations/vs2017install/buildmachines.vsconfig b/tool configurations/vs2017install/buildmachines.vsconfig new file mode 100644 index 0000000..ea618a3 --- /dev/null +++ b/tool configurations/vs2017install/buildmachines.vsconfig @@ -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" + ] +} \ No newline at end of file diff --git a/versioncontrol/git.groovy b/versioncontrol/git.groovy new file mode 100644 index 0000000..5bcb0ba --- /dev/null +++ b/versioncontrol/git.groovy @@ -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 gettaglist(String workingSetRootPath) { + ArrayList taglist = new ArrayList() + dir(workingSetRootPath) { + def tagliststring = clh.getCommandOutput('git tag --sort=-version:refname') + taglist = tagliststring.split('\\n') + } + return taglist +} + +@NonCPS +def ArrayList sparsecheckoutconfig(ArrayList paths) { + ArrayList sparsecheckoutpaths = new ArrayList() + 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 sparseitemlist = new ArrayList()) { + 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 sparseitemlist = new ArrayList()) { + 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 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 sparseitemlist = new ArrayList()) { + 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 diff --git a/versionnumbering/do.groovy b/versionnumbering/do.groovy new file mode 100644 index 0000000..208a60f --- /dev/null +++ b/versionnumbering/do.groovy @@ -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; diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy new file mode 100644 index 0000000..405b7be --- /dev/null +++ b/versionnumbering/generate.groovy @@ -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; \ No newline at end of file diff --git a/versionstamping/.project b/versionstamping/.project new file mode 100644 index 0000000..74928d6 --- /dev/null +++ b/versionstamping/.project @@ -0,0 +1,17 @@ + + + versionstamping + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/versionstamping/.pydevproject b/versionstamping/.pydevproject new file mode 100644 index 0000000..746d0f0 --- /dev/null +++ b/versionstamping/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +python35 + diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py new file mode 100644 index 0000000..9243aa4 --- /dev/null +++ b/versionstamping/versionstamper.py @@ -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:]))