About Monkey 2 › Forums › Monkey 2 Development › Update/Rebuild time
This topic contains 3 replies, has 2 voices, and was last updated by
degac 2 years ago.
-
AuthorPosts
-
March 24, 2017 at 8:00 am #7598
Hi
I’m toying with MX2 and sometimes I made some changes to modules to see the effects
Of course I need to compile the changes, BUT it takes very very long time!
There’s some options to accelerate things?
No matter if I use Update Modules or Rebuild Modules (while BlitzMax can/should compile – if wanted – just the pieces changed).sitting down waiting
March 24, 2017 at 10:21 am #7599If I make a change to a module then I just compile that module from the command line eg:
Monkey1mx2cc_windows makemods mojoMarch 24, 2017 at 5:16 pm #7602Many thanks!
(so obviuous now! :P)March 25, 2017 at 8:43 am #7610Ok, as I’m a very lazy person I created this (not full working at the moment) to find what modules should be rebuild because a change in the source code (of a file in them) has happened.
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120''edit:''as exercise I'm trying to write a little thing with this goal: check what module needs to be recompiled.'The logic of the program should be:'1 * every module as a folder called MODULE_NAME.buildvXXXXX, where MODULE_NAME is the name of the folder TOO.'2 * scan every single module in the 'modules' folder and register the FileTime of the 'buildv/windows_release' folder (see #1)'3 * scan every single other file with .monkey2 extension in that folder: if just one has a more recent timestamps, that module is marked as 'to_be_compiled''4 * at the end, launch the mx2cc_XXX commands to compile what needed.'Namespace myapp#Import "<std>"Using std..Global map_module:=New StringMap<Module>Class ModuleField name:StringField path:StringField timestamp:ULongField rebuild:intField list_source:StringList 'just for debugFunction Store:Module(_path:String,_file:String)Local m:=New Module'find the timestamp of' path+module/build xxx /windows_debug/module.am.name=_file.Slice(0,_file.Find(".")).ToUpper()Local t1:=GetFileTime(_path+"/"+_file+"/windows_debug/"+m.name+".a")Local t2:=GetFileTime(_path+"/"+_file+"/windows_release/"+m.name+".a")m.timestamp=Max(t1,t2)'consider the youngerm.path=_path+"/"+_filem.list_source=New StringList 'not really needed... just for debugmap_module.Set(m.name,m)' Print "Module '"+m.name+"' "+m.timestampReturn mEnd functionEnd ClassFunction Main()'scan Modules folder to check the latest 'change'Local path:="E:\monkey2-develop\modules" 'here my MX2 folderReScan(path)'get the modulesPrint "Check source in modules scanned..."For Local k:=Eachin map_module.KeysLocal v:=map_module.Get(k)If vSourceScan(path+"/"+v.name,v)End ifnext'these are the modules that *should* be recompiledFor Local k:=Eachin map_module.Keyslocal v:=map_module.Get(k)If vIf v.rebuild<>0 Print v.name+" "+v.rebuildEnd ifNextendFunction SourceScan:Int(path:String,v:Module)'check if exist any file younger than the module build'it should be possible to add a filter to eliminate files and folder not to be scannedLocal dirs:=LoadDir(path)Local codeext:=New String[]("monkey2","c","cpp","h")For Local f:=Eachin dirsFor Local exx:=Eachin codeextIf ExtractExt(f)="."+exx'monkey2"' Print "--- ["+f+"]"If GetFileTime(path+"/"+f)>v.timestampv.list_source.AddLast(f)v.rebuild=TruePrint "File <"+path+"> <"+f+">"End IfEnd IfnextIf GetFileType(path+"/"+f)=FileType.Directory SourceScan(path+"/"+f,v)NextReturn 1End FunctionFunction ReScan:Int(path:String)Local getfolder:=StripDir(path)getfolder=StripDir(path)'get the FOLDER NAMEpath=path.Replace("/","\")Local mname:=GetFolderName(path)+".buildv"Local dirs:=LoadDir(path)For Local f:=Eachin dirsIf f.Contains(mname)Print "MODULE BUILD FOLDER <"+f+">"Module.Store(path,f)f=""End ifIf GetFileType(path+"/"+f)=FileType.DirectoryReScan(path+"/"+f)End ifnextReturn 1End FunctionSURELY not the best thing written in MX2, but it could be the starting point to integrate this in Ted2/Ted2Go (a specific menu to build MODULES CHANGED
ps: I checked only the folder ‘windows_debug’ and ‘windows_release’ as I’m working on Win.edit: support for other source file (monkey2, c, cpp, h)
-
AuthorPosts
You must be logged in to reply to this topic.