delete old
This commit is contained in:
parent
347a0758e0
commit
e0d569cadc
@ -1,14 +1,13 @@
|
||||
import { cloneDeep } from "lodash"
|
||||
import NmakeGlobal from "../interface/NmakeGlobal"
|
||||
import printDebug from "../Tools/DebugPrint"
|
||||
import { popGlobalStack, pushGlobalStack } from "../Tools/GlobalStack"
|
||||
|
||||
const project = (name:string,callback:Function) =>{
|
||||
const oldGlobal = (global as any).nmake as unknown as NmakeGlobal
|
||||
const nGlobal = cloneDeep(((global as any).nmake as unknown as NmakeGlobal));
|
||||
(global as any).nmake = nGlobal
|
||||
pushGlobalStack()
|
||||
printDebug("adding project :"+name)
|
||||
callback()
|
||||
(global as any).nmake = oldGlobal
|
||||
popGlobalStack()
|
||||
}
|
||||
|
||||
export default project
|
@ -6,17 +6,19 @@ export const Global = global as any
|
||||
let globalNmakeStacks = Global.globalStacks as NmakeGlobal[]
|
||||
|
||||
export const pushGlobalStack = () =>{
|
||||
if(!Global.globalStacks){Global.globalStacks = [];globalNmakeStacks = Global.globalStacks as NmakeGlobal[]}
|
||||
printDebug("pushing global stack")
|
||||
if(!Global.globalStacks){Global.globalStacks = [];globalNmakeStacks = Global.globalStacks as NmakeGlobal[]}
|
||||
globalNmakeStacks.push(Global.nmake)
|
||||
Global.nmake = cloneDeep(Global.nmake)
|
||||
}
|
||||
|
||||
export const popGlobalStack = ()=>{
|
||||
printDebug("popping global stack")
|
||||
Global.nmake = globalNmakeStacks[globalNmakeStacks.length-1]
|
||||
globalNmakeStacks.pop()
|
||||
}
|
||||
|
||||
export const getGlobalNmake=():NmakeGlobal=>{
|
||||
printDebug("getting global nmake")
|
||||
return Global.nmake
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
import {project} from "../../src/CliFunc/tools";
|
||||
import CppProject from "../../src/Project/CppProject";
|
||||
|
||||
project("hello",()=>{
|
||||
|
||||
})
|
||||
new CppProject("hello");
|
||||
|
Loading…
Reference in New Issue
Block a user