Skip to content

Commit

Permalink
Do not protect callers dynacfg* from modification by sanityCheck* etc…
Browse files Browse the repository at this point in the history
…. methods

checking if success actually relied on the changes, something broke
since August
  • Loading branch information
jimklimov committed Oct 8, 2023
1 parent 55173cf commit 496500d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 23 deletions.
9 changes: 6 additions & 3 deletions src/org/nut/dynamatrix/Dynamatrix.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1080,11 +1080,14 @@ def parallelStages = prepareDynamatrix(
boolean debugMilestones = this.shouldDebugMilestones()
boolean debugMilestonesDetails = this.shouldDebugMilestonesDetails()

// Avoid NPEs and changing the original Map's entries unexpectedly:
// Avoid NPEs (TBD: and changing the original Map's entries unexpectedly
// commented away currently - this may misbehave vs. generateBuild() =>
// use of script delegate => caller's original dynacfgPipeline when
// resolving stage closures):
if (dynacfgOrig == null) {
dynacfgOrig = [:]
} else {
dynacfgOrig = (Map)(dynacfgOrig.clone())
// } else {
// dynacfgOrig = (Map)(dynacfgOrig.clone())
}

//if (debugErrors) this.script.println "[WARNING] NOT FULLY IMPLEMENTED: Dynamatrix.prepareDynamatrix()"
Expand Down
22 changes: 14 additions & 8 deletions vars/dynamatrixPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,14 @@ def stageNameFunc_ShellcheckCustom(DynamatrixSingleBuildConfig dsbc) {

/** Revise base defaults not too specific for any particular toolchain we would use */
Map sanityCheckDynacfgPipeline(Map dynacfgPipeline = [:]) {
// Avoid NPEs and changing the original Map's entries unexpectedly:
// Avoid NPEs (TBD: and changing the original Map's entries unexpectedly
// commented away currently - this may misbehave vs. generateBuild() =>
// use of script delegate => caller's original dynacfgPipeline when
// resolving stage closures):
if (dynacfgPipeline == null) {
dynacfgPipeline = [:]
} else {
dynacfgPipeline = (Map)(dynacfgPipeline.clone())
// } else {
// dynacfgPipeline = (Map)(dynacfgPipeline.clone())
}

if (!dynacfgPipeline.containsKey('buildSystem')) {
Expand Down Expand Up @@ -204,17 +207,20 @@ def call(Map dynacfgBase = [:], Map dynacfgPipeline = [:]) {
// dynacfgBase = Base configuration for Dynamatrix for this pipeline
// dynacfgPipeline = Step-dependent setup in sub-maps

// Avoid NPEs and changing the original Map's entries unexpectedly:
// Avoid NPEs (TBD: and changing the original Map's entries unexpectedly
// commented away currently - this may misbehave vs. generateBuild() =>
// use of script delegate => caller's original dynacfgPipeline when
// resolving stage closures):
if (dynacfgPipeline == null) {
dynacfgPipeline = [:]
} else {
dynacfgPipeline = (Map)(dynacfgPipeline.clone())
// } else {
// dynacfgPipeline = (Map)(dynacfgPipeline.clone())
}

if (dynacfgBase == null) {
dynacfgBase = [:]
} else {
dynacfgBase = (Map)(dynacfgBase.clone())
// } else {
// dynacfgBase = (Map)(dynacfgBase.clone())
}

// Hacky big switch for a max debug option
Expand Down
18 changes: 12 additions & 6 deletions vars/shellcheck.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ def stageNameFunc_Shellcheck(DynamatrixSingleBuildConfig dsbc) {
* and pipeline serialization).
*/
Set<List> call(Map dynacfgPipeline = [:], Boolean returnSet = true) {
// Avoid NPEs and changing the original Map's entries unexpectedly:
// Avoid NPEs (TBD: and changing the original Map's entries unexpectedly
// commented away currently - this may misbehave vs. generateBuild() =>
// use of script delegate => caller's original dynacfgPipeline when
// resolving stage closures):
if (dynacfgPipeline == null) {
dynacfgPipeline = [:]
} else {
dynacfgPipeline = (Map)(dynacfgPipeline.clone())
// } else {
// dynacfgPipeline = (Map)(dynacfgPipeline.clone())
}

// Set of Map'able tuples of <String, Closure>
Expand Down Expand Up @@ -273,11 +276,14 @@ Map makeMap(Set<List> stagesShellcheck_arr = []) {
}

Map sanityCheckDynacfgPipeline(Map dynacfgPipeline = [:]) {
// Avoid NPEs and changing the original Map's entries unexpectedly:
// Avoid NPEs (TBD: and changing the original Map's entries unexpectedly
// commented away currently - this may misbehave vs. generateBuild() =>
// use of script delegate => caller's original dynacfgPipeline when
// resolving stage closures):
if (dynacfgPipeline == null) {
dynacfgPipeline = [:]
} else {
dynacfgPipeline = (Map)(dynacfgPipeline.clone())
// } else {
// dynacfgPipeline = (Map)(dynacfgPipeline.clone())
}

if (dynacfgPipeline.containsKey('shellcheck')) {
Expand Down
9 changes: 6 additions & 3 deletions vars/spellcheck.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ Map makeMap(Map dynacfgPipeline = [:]) {
}

Map sanityCheckDynacfgPipeline(Map dynacfgPipeline = [:]) {
// Avoid NPEs and changing the original Map's entries unexpectedly:
// Avoid NPEs (TBD: and changing the original Map's entries unexpectedly
// commented away currently - this may misbehave vs. generateBuild() =>
// use of script delegate => caller's original dynacfgPipeline when
// resolving stage closures):
if (dynacfgPipeline == null) {
dynacfgPipeline = [:]
} else {
dynacfgPipeline = (Map)(dynacfgPipeline.clone())
// } else {
// dynacfgPipeline = (Map)(dynacfgPipeline.clone())
}

if (dynacfgPipeline.containsKey('spellcheck')) {
Expand Down
9 changes: 6 additions & 3 deletions vars/stylecheck.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ Map makeMap(Map dynacfgPipeline = [:]) {
}

Map sanityCheckDynacfgPipeline(Map dynacfgPipeline = [:]) {
// Avoid NPEs and changing the original Map's entries unexpectedly:
// Avoid NPEs (TBD: and changing the original Map's entries unexpectedly
// commented away currently - this may misbehave vs. generateBuild() =>
// use of script delegate => caller's original dynacfgPipeline when
// resolving stage closures):
if (dynacfgPipeline == null) {
dynacfgPipeline = [:]
} else {
dynacfgPipeline = (Map)(dynacfgPipeline.clone())
// } else {
// dynacfgPipeline = (Map)(dynacfgPipeline.clone())
}

if (dynacfgPipeline.containsKey('stylecheck')) {
Expand Down

0 comments on commit 496500d

Please sign in to comment.