From e5aa2bc6407133590cc4ee57e254b943288a2452 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Sat, 15 Sep 2018 12:52:17 +0100 Subject: [PATCH] Now that the build has become reliable - remove some debug; Refactor clean up and build set up --- compile/eclipsebuild/eclipseds5build.gsh | 33 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/compile/eclipsebuild/eclipseds5build.gsh b/compile/eclipsebuild/eclipseds5build.gsh index c0e28c0..1095d32 100644 --- a/compile/eclipsebuild/eclipseds5build.gsh +++ b/compile/eclipsebuild/eclipseds5build.gsh @@ -61,7 +61,27 @@ def doExport(exportfolder, exportpathlist, project = "", build_variant = "") { } // Build and export files -def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { +def doRegisterToolchain(ds5folder, toolchainfolder) { + # Register toolchain (if it is not already) + if (isUnix()) { + sh """ + "${ds5folder}/bin/add_toolchain" --non-interactive "${toolchainfolder}" + """ + env.PATH = env.TOOLCHAIN_FOLDER + ":" + env.PATH + } + else { + bat """ + "%ds5folder%\\bin\\add_toolchain" --non-interactive "%toolchainfolder%" + """ + env.PATH = env.TOOLCHAIN_FOLDER + ";" + env.PATH + } + echo "Path is: ${PATH}" +} + +// Build and export files +def doBuild(apps, ds5folder, toolchainfolder, ds5shellcommand, buildcommand, exportfolder = "${WORKSPACE}/bin") { + doKillLeftovers() + doRegisterToolchain(ds5folder, toolchainfolder for (appInfo in apps ) { (build, cleanbuild, project, variants, exportpathlist) = appInfo if (build) { @@ -73,20 +93,17 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } for (build_variant in variants) { retry(maxprojectbuildretries) { // Eclipse occasionally raises exceptions (rather than the builds failing) - echo "Build command: ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\'" - doKillLeftovers() + echo "Build command: ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\'" if (isUnix()) { sh """ - # Register toolchain (if it is not already) - "${DS5_FOLDER}/bin/add_toolchain" --non-interactive "${TOOLCHAIN_FOLDER}" echo Start time: `date` - ${DS5SHELL} \'${BUILD_COMMAND} ${buildtype} \"${project}/${build_variant}\"\' + ${ds5shellcommand} \'${buildcommand} ${buildtype} \"${project}/${build_variant}\"\' echo End time: `date` """ } else { bat """ - "%DS5SHELL%" "%BUILD_COMMAND%" ${buildtype} "${project}\\${build_variant}" + "%ds5shellcommand%" "%buildcommand%" ${buildtype} "${project}\\${build_variant}" """ } doExport(exportfolder, exportpathlist, "", build_variant) @@ -102,4 +119,4 @@ def doBuild(apps, exportfolder = "${WORKSPACE}/bin") { } } -return this; \ No newline at end of file +return this;