Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command "resetmods" to clean precompilates #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 44 additions & 17 deletions bmk.bmx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Case "makebootstrap"
Case "compile"
SetConfigMung
MakeApplication args,False,True
Case "resetmods"
ResetModules(args)
Case "cleanmods"
CleanModules args
Case "zapmod"
Expand Down Expand Up @@ -206,28 +208,53 @@ Function CleanModules( args$[] )
Local path$=ModulePath(name)

CleanBmxDirs(path)
Rem
If Not opt_kill Continue
Next

End Function

Function ResetModules( args$[], removeBuildResults:Int = False )
If args.length > 1 Then CmdError("Expecting only 1 argument for ResetModules")
If args.length > 0
SetModfilter(args[0])
Else
opt_modfilter = ""
EndIf

Local mods:TList = EnumModules()

For Local name:String = EachIn mods
If (name + ".").Find(opt_modfilter) <> 0 Then Continue

If opt_verbose Then
Print " Resetting " + name
EndIf

Local path:String = ModulePath(name)
'if there is no "." in the string, this returns "-1 + 1" so will
'copy the whole name-string
Local localName:String = name[name.FindLast(".") + 1 ..]

For Local f$=EachIn LoadDir( path )

Local p$=path+"/"+f
Select FileType(p)
Case FILETYPE_DIR
If f<>"doc"
DeleteDir p,True
EndIf
Case FILETYPE_FILE
Select ExtractExt(f).tolower()
Case "i","a","txt","htm","html"
'nop
Default
'Remove .bmx directory
CleanBmxDirs(path)

For Local f:String = EachIn LoadDir( path )
Local p:String = path + "/" + f

'only interested in files, skip directories
If FileType(p) <> FILETYPE_FILE Then Continue

'remove prebuilt module builds
Select ExtractExt(f).tolower()
Case "i","a","i2"
'search for "modulename.release.*" and "modulename.debug.*"
If Not ( (f + ".").Find(localName + ".release.") = 0 Or (f + ".").Find(localName + ".debug.") = 0) Then Continue
If opt_verbose Then
Print " Deleting " + p
EndIf
DeleteFile p
End Select
End Select

Next
End Rem
Next

End Function
Expand Down