From f0ef516b8e5383d047524bff65c0e6c6067eaeda Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:12:50 +0100 Subject: [PATCH 01/18] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 27 +++++++++------------ 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 302b4f8..e93ed4b 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -54,7 +54,7 @@ def doCheck(checkpathlist, build_variant = "") { return result } -def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { +def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { def result = 0 def destFolder = "" def srcFile = "" @@ -71,9 +71,12 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } else { echo "No build variant" - destFolder = "${exportfolder}/${project}" + destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + if (partdest) { + destFolder += "/" + partdest + } } dir (destFolder) { echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" @@ -146,7 +149,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } // Build and export files -def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/bin") { +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] if (variantstobuild) { toBuildUntrimmed = variantstobuild.split(',') @@ -162,32 +165,26 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps ) { - (build, cleanbuild, project, variants, exportpathlist) = appInfo + (build, project, variants, exportpathlist, destpart) = appInfo if (build) { - if (cleanbuild) { - buildtype = "-cleanBuild" - } - else { - buildtype = "-build" - } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\'" + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" timeout(time: 10, unit: 'MINUTES') { if (isUnix()) { sh """ echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" """ } } @@ -195,7 +192,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, "", build_variant) + result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." } @@ -214,7 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou else { // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { - result = doExport(exportfolder, exportpathlist, project) + result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } From 17ddcb8404e77127c2dae4cb22e327ecf622b955 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:38:21 +0100 Subject: [PATCH 02/18] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e93ed4b..bb79b36 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -79,10 +79,11 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } } dir (destFolder) { - echo "Copy \"${srcFileExpanded}\" to \"${destFolder}\"" + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ - cp -r -v "${srcFileExpanded}" "${destFolder}" + cp -r -v "${srcFileExpanded}" "${destFolderExpanded}" if [ \$? -ne 0 ]; then exit 1; fi """, returnStatus: true @@ -93,7 +94,7 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { } else { result = bat( script: """ - copy "${srcFileExpanded}" "${destFolder}" + copy "${srcFileExpanded}" "${destFolderExpanded}" if errorlevel 1 EXIT /b 1 """, returnStatus: true @@ -209,12 +210,20 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - // Only export if the project has no variants - signifying that there are files to export which have been prebuilt if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { error "Failed to copy...." } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } } } } From d123e7f152509ce599b8b353b9a431186ffd7d51 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 15:49:24 +0100 Subject: [PATCH 03/18] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index bb79b36..9ebe541 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -78,8 +78,8 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { destFolder += "/" + partdest } } - dir (destFolder) { - def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + def destFolderExpanded = destFolder.replace("-BUILDVARIANT-", "${build_variant}") + dir (destFolderExpanded) { echo "Copy \"${srcFileExpanded}\" to \"${destFolderExpanded}\"" if (isUnix()) { result = sh( script: """ From 36c28665e08be410e640d07bbce2d3ddb1ea7839 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:05:02 +0100 Subject: [PATCH 04/18] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 9ebe541..b3e25bd 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -62,18 +62,16 @@ def doExport(exportfolder, exportpathlist, partdest = "", build_variant = "") { for (exportpath in exportpathlist) { echo "Export path at: ${exportpath}" script { - echo "Build variant is ${build_variant}" if (build_variant) { echo "Build variant is ${build_variant}" - destFolder = "${exportfolder}/${build_variant}" srcFile = "${WORKSPACE}/${exportpath}" srcFileExpanded = srcFile.replace("-BUILDVARIANT-", "${build_variant}") } else { echo "No build variant" - destFolder = "${exportfolder}" srcFileExpanded = "${WORKSPACE}/${exportpath}" } + destFolder = "${exportfolder}" if (partdest) { destFolder += "/" + partdest } @@ -165,7 +163,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } - for (appInfo in apps ) { + for (appInfo in apps) { (build, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { From 3c7deff68c6fe5bd2adb87cfdab8d4c6a924985b Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:20:48 +0100 Subject: [PATCH 05/18] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 34 ++++++++++++--------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b3e25bd..721a024 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, project, variants, exportpathlist, destpart) = appInfo + (build, export, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,9 +191,11 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } else { @@ -208,17 +210,19 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." + if (export) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } } } } From 0ae452e1ba613b9ee09aff2d88653902ad701b52 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:43:26 +0100 Subject: [PATCH 06/18] HMBXR5601-827 - Update compile output suitable for packaging --- compile/eclipsebuild/eclipseds5build.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 721a024..77124d7 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -164,7 +164,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { - (build, export, project, variants, exportpathlist, destpart) = appInfo + (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -191,7 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } - if (export) { + if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { error "Failed to copy...." @@ -210,7 +210,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { - if (export) { + if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) if (result != 0) { From 54e5d7ff081b06795b2578ffb2a678aae63529c5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 16:52:24 +0100 Subject: [PATCH 07/18] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 77124d7..e3d2ffb 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -191,6 +191,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou if (result != 0) { error "Failed to check files...." } + echo "Doing export: ${doexport}" if (doexport) { result = doExport(exportfolder, exportpathlist, destpart, build_variant) if (result != 0) { @@ -202,7 +203,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou echo "Not building ${build_variant} variant of project: ${project}" } } catch (Exception e) { - echo "Build failed - Waiting for a while" + echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" sleep(time: 4, unit: 'SECONDS') error "Build failed..." } @@ -210,6 +211,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } else { + echo "Doing export: ${doexport}" if (doexport) { if (!variants) { result = doExport(exportfolder, exportpathlist, destpart) @@ -231,7 +233,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } } catch (Exception e) { // doKillLeftovers() - error "Build failed - Killing leftovers" + error "Exception: ${e.message()}\nBuild failed - Killing leftovers" } } } From fbd1b756987f7533d70714c9174ea0aa1aad6da8 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:32:08 +0100 Subject: [PATCH 08/18] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 133 +++++++++++--------- 1 file changed, 71 insertions(+), 62 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index e3d2ffb..b5b5401 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,6 +147,74 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } +def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing build and export project: ${project} : ${doexport}" + for (build_variant in variants) { + retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) + try { + if (toBuild.contains(build_variant)) { + doDisplayLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder) + echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" + timeout(time: 10, unit: 'MINUTES') { + if (isUnix()) { + sh """ + echo Start time: `date` + ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' + echo End time: `date` + """ + } + else { + bat """ + "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" + """ + } + } + result = doCheck(exportpathlist, build_variant) + if (result != 0) { + error "Failed to check files...." + } + echo "Doing export: ${doexport}" + if (doexport) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + else { + echo "Not building ${build_variant} variant of project: ${project}" + } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } + } + } +} + +def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { + echo "Doing export only project: ${project} : ${doexport}" + if (doexport) { + if (!variants) { + result = doExport(exportfolder, exportpathlist, destpart) + if (result != 0) { + error "Failed to copy...." + } + } else { + for (build_variant in variants) { + if (toBuild.contains(build_variant)) { + result = doExport(exportfolder, exportpathlist, destpart, build_variant) + if (result != 0) { + error "Failed to copy...." + } + } + } + } + } +} + // Build and export files def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder, variantstobuild, exportfolder = "${WORKSPACE}/export") { toBuild = [] @@ -166,74 +234,15 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - for (build_variant in variants) { - retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { - if (toBuild.contains(build_variant)) { - doDisplayLeftovers() - doRegisterToolchain(ds5folder, toolchainfolder) - echo "Build command: ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\'" - timeout(time: 10, unit: 'MINUTES') { - if (isUnix()) { - sh """ - echo Start time: `date` - ${ds5shellcommand} \'${buildcommand} -no-indexer -build \"${project}/${build_variant}\"\' - echo End time: `date` - """ - } - else { - bat """ - "%ds5shellcommand%" "%buildcommand%" -no-indexer -build "${project}\\${build_variant}" - """ - } - } - result = doCheck(exportpathlist, build_variant) - if (result != 0) { - error "Failed to check files...." - } - echo "Doing export: ${doexport}" - if (doexport) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - else { - echo "Not building ${build_variant} variant of project: ${project}" - } - } catch (Exception e) { - echo "Exception: ${e.message()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } - } - } + doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } else { - echo "Doing export: ${doexport}" - if (doexport) { - if (!variants) { - result = doExport(exportfolder, exportpathlist, destpart) - if (result != 0) { - error "Failed to copy...." - } - } else { - for (build_variant in variants) { - if (toBuild.contains(build_variant)) { - result = doExport(exportfolder, exportpathlist, destpart, build_variant) - if (result != 0) { - error "Failed to copy...." - } - } - } - } - } + doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } } catch (Exception e) { // doKillLeftovers() - error "Exception: ${e.message()}\nBuild failed - Killing leftovers" + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" } } } From 5d081f74cfbe86f38c6e401723201c76277e9bcf Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:39:32 +0100 Subject: [PATCH 09/18] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index b5b5401..0de368c 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -234,7 +234,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou for (appInfo in apps) { (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { - doBuildAndExportProject(project, doexport, variants, exportfolder, exportpathlist, destpart) + doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) } else { doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) From 382a48c08abea0c5d108aebbfbbf335478071130 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:46:24 +0100 Subject: [PATCH 10/18] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 0de368c..3070e4e 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - try { +// try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } - } catch (Exception e) { - echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" - sleep(time: 4, unit: 'SECONDS') - error "Build failed..." - } +// } catch (Exception e) { +// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" +// sleep(time: 4, unit: 'SECONDS') +// error "Build failed..." +// } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { - try { +// try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -240,10 +240,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } - } catch (Exception e) { - // doKillLeftovers() - error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" - } +// } catch (Exception e) { +// // doKillLeftovers() +// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" +// } } } From 709ab6b27699593dc8507e3bbca6fc17fb27d849 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 17:59:14 +0100 Subject: [PATCH 11/18] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 3070e4e..779c235 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -147,7 +147,7 @@ def doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, } } -def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5shellcommand, String buildcommand, String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) @@ -194,7 +194,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 } } -def doExportOnlyProject(String project, boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { +def doExportOnlyProject(String project, Boolean doexport, variants, String exportfolder, exportpathlist, String destpart) { echo "Doing export only project: ${project} : ${doexport}" if (doexport) { if (!variants) { @@ -232,6 +232,8 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) } for (appInfo in apps) { + def Boolean build + def Boolean doexport (build, doexport, project, variants, exportpathlist, destpart) = appInfo if (build) { doBuildAndExportProject(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, project, doexport, variants, exportfolder, exportpathlist, destpart) From 5d2d494d20952d487b5795e848812ba9912a8da5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Mon, 19 Aug 2019 18:37:16 +0100 Subject: [PATCH 12/18] HMBXR5601-827 - Update compile output suitable for packaging - adding debug --- compile/eclipsebuild/eclipseds5build.groovy | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.groovy b/compile/eclipsebuild/eclipseds5build.groovy index 779c235..9ab8df3 100644 --- a/compile/eclipsebuild/eclipseds5build.groovy +++ b/compile/eclipsebuild/eclipseds5build.groovy @@ -151,7 +151,7 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 echo "Doing build and export project: ${project} : ${doexport}" for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) -// try { + try { if (toBuild.contains(build_variant)) { doDisplayLeftovers() doRegisterToolchain(ds5folder, toolchainfolder) @@ -185,11 +185,11 @@ def doBuildAndExportProject(String ds5folder, String toolchainfolder, String ds5 else { echo "Not building ${build_variant} variant of project: ${project}" } -// } catch (Exception e) { -// echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" -// sleep(time: 4, unit: 'SECONDS') -// error "Build failed..." -// } + } catch (Exception e) { + echo "Exception: ${e.getMessage()}\nBuild failed - Waiting for a while" + sleep(time: 4, unit: 'SECONDS') + error "Build failed..." + } } } } @@ -226,7 +226,7 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou } // The lock is being used because it was being found that the doKillLeftovers was affecting other builds lock(resource: "eclipsebuild_${env.NODE_NAME}") { -// try { + try { timeout(time: 2, unit: 'MINUTES') { addToolchainPath(toolchainfolder) doImportProjects(ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sourcefolder) @@ -242,10 +242,10 @@ def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, sou doExportOnlyProject(project, doexport, variants, exportfolder, exportpathlist, destpart) } } -// } catch (Exception e) { -// // doKillLeftovers() -// error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" -// } + } catch (Exception e) { + // doKillLeftovers() + error "Exception: ${e.getMessage()}\nBuild failed - Killing leftovers" + } } } From 9a7e394fa2517653ff1f7b4431c55d6e49634465 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:24:14 +0100 Subject: [PATCH 13/18] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 packaging/debian.groovy diff --git a/packaging/debian.groovy b/packaging/debian.groovy new file mode 100644 index 0000000..d55b6a9 --- /dev/null +++ b/packaging/debian.groovy @@ -0,0 +1,49 @@ +class DebRootDefinitions { + String PACKAGE_PREFIX + String PACKAGE_FOLDER_NAME + String PACKAGE_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_WWW + String GIS_OPT_OTHER + 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 + + DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + PACKAGE_PREFIX = packageprefix + PACKAGE_FOLDER_NAME = packageprefix + buildstamp + PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + + DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + + ETC = "${DEBPATH}/etc" + GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" + GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" + GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" + GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" + GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" + GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic" + GIS_OPT_PRINTHEAD = "${DEBPATH}/opt/gis/printhead" + + USR_BIN = "${DEBPATH}/usr/bin" + USR_LIB_ARCH = "${DEBPATH}/usr/lib/arm-linux-gnueabihf" + LIB_FIRMWARE = "${DEBPATH}/lib/firmware" + HTTP_DEV_DIV = "${DEBPATH}/var/www/gis_dev" + LIB_SYSTEMD = "${DEBPATH}/lib/systemd" + } +} + +return this; \ No newline at end of file From 703c4930db6588ccca56d94bb8f5b74efe7e86e6 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:39:05 +0100 Subject: [PATCH 14/18] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index d55b6a9..127173e 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,4 @@ -class DebRootDefinitions { +class DebRootDefinition { String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -21,7 +21,7 @@ class DebRootDefinitions { String HTTP_DEV_DIV String LIB_SYSTEMD - DebRootDefinitions(String rootpath, String packageprefix, String buildstamp) { + DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" @@ -46,4 +46,8 @@ class DebRootDefinitions { } } +def DebRootDefinition debDefinition(String rootpath, String packageprefix, String buildstamp) { + return new DebRootDefinition(rootpath, packageprefix, buildstamp) +} + return this; \ No newline at end of file From 5891f4ec02f54ab96bd42e809982cda6562a5290 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:47:37 +0100 Subject: [PATCH 15/18] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 127173e..84ba090 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -3,6 +3,7 @@ class DebRootDefinition { String PACKAGE_FOLDER_NAME String PACKAGE_NAME + String PACKAGE_SOURCE_FOLDER_NAME String DEBPATH String ETC @@ -26,6 +27,7 @@ class DebRootDefinition { PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" + PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" From 93430a782e82af1e64ffd0bafc067cf4f0850efe Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 13:59:08 +0100 Subject: [PATCH 16/18] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 84ba090..9340180 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -1,4 +1,5 @@ class DebRootDefinition { + String ROOTPATH String PACKAGE_PREFIX String PACKAGE_FOLDER_NAME String PACKAGE_NAME @@ -23,12 +24,13 @@ class DebRootDefinition { String LIB_SYSTEMD DebRootDefinition(String rootpath, String packageprefix, String buildstamp) { + ROOTPATH = rootpath PACKAGE_PREFIX = packageprefix PACKAGE_FOLDER_NAME = packageprefix + buildstamp PACKAGE_NAME = packageprefix + buildstamp + "_armhf.deb" - PACKAGE_SOURCE_FOLDER_NAME = "${rootpath}/${PACKAGE_PREFIX}" - DEBPATH = "${rootpath}/${PACKAGE_FOLDER_NAME}" + PACKAGE_SOURCE_FOLDER_NAME = "${ROOTPATH}/${PACKAGE_PREFIX}" + DEBPATH = "${ROOTPATH}/${PACKAGE_FOLDER_NAME}" ETC = "${DEBPATH}/etc" GIS_OPT_BIN = "${DEBPATH}/opt/gis/bin" From 6df15e3bf2f60d7daf349426c423574c13dfff7f Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 14:42:12 +0100 Subject: [PATCH 17/18] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index 9340180..a7de1f0 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -54,4 +54,30 @@ def DebRootDefinition debDefinition(String rootpath, String packageprefix, Strin return new DebRootDefinition(rootpath, packageprefix, buildstamp) } +def buildPackage(String packageout, DebRootDefinition packagedefs) { + sh """#!/bin/bash + # Exit if any command fails + set -e + + mkdir -v -p "${packagedefs.USR_BIN}" + mkdir -v -p "${packagedefs.USR_LIB_ARCH}" + mkdir -v -p "${packagedefs.LIB_FIRMWARE}" + + mkdir -v -p "${packagedefs.HTTP_DEV_DIV}" + mkdir -v -p "${packagedefs.LIB_SYSTEMD}/system" + + cp -v -r "${SOURCE_PATH}/hmb-xr-5601-source/presto_xr/${packagedefs.PACKAGE_SOURCE_FOLDER_NAME}"/* "${packagedefs.DEBPATH}" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/preinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postinst" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/prerm" + chmod -v 775 "${packagedefs.DEBPATH}/DEBIAN/postrm" + + mkdir -v -p "${packageout}" + dpkg-deb -v --build "${packagedefs.DEBPATH}" "${packageout}/${packagedefs.PACKAGE_NAME}" + + dpkg-deb --show "${packageout}/${packagedefs.PACKAGE_NAME}" + dpkg-deb --contents "${packageout}/${packagedefs.PACKAGE_NAME}" + """ +} + return this; \ No newline at end of file From 99efb640c1e6aea041684c53cff28b3dea1df4e5 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Thu, 22 Aug 2019 18:08:54 +0100 Subject: [PATCH 18/18] HMBXR5601-827 - Create debian package definition class --- packaging/debian.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/debian.groovy b/packaging/debian.groovy index a7de1f0..25d06a2 100644 --- a/packaging/debian.groovy +++ b/packaging/debian.groovy @@ -12,6 +12,7 @@ class DebRootDefinition { 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_LOGIC @@ -37,6 +38,7 @@ class DebRootDefinition { GIS_OPT_LIB = "${DEBPATH}/opt/gis/lib" GIS_OPT_SCRIPTS_APP = "${DEBPATH}/opt/gis/scripts/app" GIS_OPT_SCRIPTS_EL = "${DEBPATH}/opt/gis/scripts/el" + GIS_OPT_SCRIPTS_CONTROL = "${DEBPATH}/opt/gis/scripts/control" GIS_OPT_WWW = "${DEBPATH}/opt/gis/www" GIS_OPT_OTHER = "${DEBPATH}/opt/gis/other" GIS_OPT_LOGIC = "${DEBPATH}/opt/gis/logic"