Created
August 23, 2015 03:06
-
-
Save yebblies/43555390d29624232ada to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.algorithm; | |
import std.file; | |
import std.range; | |
import std.stdio; | |
import std.string; | |
import std.process; | |
string deleteSources = | |
` | |
access.c | |
aliasthis.c | |
apply.c | |
argtypes.c | |
arrayop.c | |
attrib.c | |
builtin.c | |
canthrow.c | |
cast.c | |
class.c | |
clone.c | |
cond.c | |
constfold.c | |
cppmangle.c | |
ctfeexpr.c | |
declaration.c | |
delegatize.c | |
doc.c | |
dsymbol.c | |
entity.c | |
enum.c | |
errors.c | |
escape.c | |
expression.c | |
func.c | |
globals.c | |
hdrgen.c | |
identifier.c | |
imphint.c | |
import.c | |
inifile.c | |
init.c | |
inline.c | |
interpret.c | |
intrange.c | |
json.c | |
lexer.c | |
link.c | |
macro.c | |
mangle.c | |
mars.c | |
module.c | |
mtype.c | |
nogc.c | |
nspace.c | |
objc.c | |
objc_stubs.c | |
opover.c | |
optimize.c | |
parse.c | |
root/aav.c | |
root/async.c | |
root/checkedint.c | |
root/file.c | |
root/filename.c | |
root/longdouble.c | |
root/man.c | |
root/object.c | |
root/outbuffer.c | |
root/port.c | |
root/response.c | |
root/rmem.c | |
root/speller.c | |
root/stringtable.c | |
sapply.c | |
scope.c | |
sideeffect.c | |
statement.c | |
staticassert.c | |
struct.c | |
target.c | |
template.c | |
tokens.c | |
traits.c | |
unittests.c | |
utf.c | |
version.c | |
`; | |
string addSources = | |
` | |
access.d | |
aggregate.d | |
aliasthis.d | |
apply.d | |
argtypes.d | |
arrayop.d | |
arraytypes.d | |
attrib.d | |
builtin.d | |
canthrow.d | |
clone.d | |
cond.d | |
constfold.d | |
cppmangle.d | |
ctfeexpr.d | |
dcast.d | |
dclass.d | |
declaration.d | |
delegatize.d | |
denum.d | |
dimport.d | |
dinifile.d | |
dinterpret.d | |
dmacro.d | |
dmangle.d | |
dmodule.d | |
doc.d | |
dscope.d | |
dstruct.d | |
dsymbol.d | |
dtemplate.d | |
dunittest.d | |
dversion.d | |
errors.d | |
escape.d | |
expression.d | |
func.d | |
globals.d | |
hdrgen.d | |
identifier.d | |
imphint.d | |
init.d | |
inline.d | |
json.d | |
lexer.d | |
lib.d | |
link.d | |
mars.d | |
mtype.d | |
nogc.d | |
nspace.d | |
objc.d | |
opover.d | |
optimize.d | |
parse.d | |
root/aav.d | |
root/file.d | |
root/filename.d | |
root/man.d | |
root/outbuffer.d | |
root/response.d | |
root/speller.d | |
root/stringtable.d | |
sapply.d | |
sideeffect.d | |
statement.d | |
staticassert.d | |
target.d | |
tokens.d | |
traits.d | |
utf.d | |
visitor.d | |
`; | |
void main() | |
{ | |
version(Windows) | |
assert(executeShell("make -fwin32.mak clean mars.d").status == 0); | |
else | |
assert(executeShell("make -fposix.mak clean mars.d").status == 0); | |
foreach(fn; addSources.strip.splitLines.map!strip) | |
{ | |
assert(executeShell("git add -f %s".format(fn)).status == 0); | |
} | |
foreach(fn; deleteSources.strip.splitLines.map!strip) | |
{ | |
assert(executeShell("git rm -f %s".format(fn)).status == 0); | |
} | |
auto changes = | |
[ | |
"posix.mak": | |
[ | |
["auto-tester-build: dmd checkwhitespace ddmd", "auto-tester-build: dmd checkwhitespace"], | |
[" $(GENSRC) $(MAGICPORT)", " $(MAGICPORT)"], | |
["ddmd: mars.d $(MANUALSRC) newdelete.o glue.a backend.a $(HOST_DC) verstr.h", "dmd: mars.d $(MANUALSRC) newdelete.o glue.a backend.a $(HOST_DC) verstr.h"], | |
[" CC=$(HOST_CC) $(HOST_DC_RUN) $(MODEL_FLAG) $(DSRC) -ofddmd newdelete.o glue.a backend.a -vtls -J. -d $(DFLAGS)", " CC=$(HOST_CC) $(HOST_DC_RUN) $(MODEL_FLAG) $(DSRC) -ofdmd newdelete.o glue.a backend.a -vtls -J. -d $(DFLAGS)"], | |
["dmd: $(DMD_OBJS) $(ROOT_OBJS) $(GLUE_OBJS) $(BACK_OBJS)", "#dmd: $(DMD_OBJS) $(ROOT_OBJS) $(GLUE_OBJS) $(BACK_OBJS)"], | |
[" $(HOST_CC) -o dmd $(MODEL_FLAG) $^ $(LDFLAGS)", "# $(HOST_CC) -o dmd $(MODEL_FLAG) $^ $(LDFLAGS)"], | |
["dmd: frontend.a root.a glue.a backend.a", "#dmd: frontend.a root.a glue.a backend.a"], | |
[" $(HOST_CC) -o dmd $(MODEL_FLAG) frontend.a root.a glue.a backend.a $(LDFLAGS)", "# $(HOST_CC) -o dmd $(MODEL_FLAG) frontend.a root.a glue.a backend.a $(LDFLAGS)"], | |
["mars.d : $(SRC) $(ROOT_SRC) magicport.json $(MAGICPORT)", "#mars.d : $(SRC) $(ROOT_SRC) magicport.json $(MAGICPORT)"], | |
[" $(MAGICPORT) . .", "# $(MAGICPORT) . ."], | |
], | |
"win32.mak": | |
[ | |
["auto-tester-build: dmd checkwhitespace ddmd", "auto-tester-build: dmd checkwhitespace"], | |
["ddmd.exe: $(DSRC) newdelete.obj glue.lib backend.lib verstr.h", "dmd.exe: $(DSRC) newdelete.obj glue.lib backend.lib verstr.h"], | |
[" $(HOST_DC) $(DSRC) -ofddmd.exe newdelete.obj glue.lib backend.lib -vtls -J. -d -L/STACK:8388608 $(DFLAGS)", " $(HOST_DC) $(DSRC) -ofdmd.exe newdelete.obj glue.lib backend.lib -vtls -J. -d -L/STACK:8388608 $(DFLAGS)"], | |
[" $(HOST_DC) $(DSRC) -ofddmd.exe newdelete.obj glue.lib backend.lib -vtls -J. -d -L/STACK:8388608 $(DFLAGS)", " $(HOST_DC) $(DSRC) -ofdmd.exe newdelete.obj glue.lib backend.lib -vtls -J. -d -L/STACK:8388608 $(DFLAGS)"], | |
[" $(DEL) $(GENSRC)", null], | |
["$(TARGETEXE): mars.obj $(LIBS) win32.mak", "#$(TARGETEXE): mars.obj $(LIBS) win32.mak"], | |
[" $(CC) -o$(TARGETEXE) mars.obj $(LIBS) -cpp -mn -Ar -L/STACK:8388608 $(LFLAGS)", "# $(CC) -o$(TARGETEXE) mars.obj $(LIBS) -cpp -mn -Ar -L/STACK:8388608 $(LFLAGS)"], | |
["$(GENSRC) : $(SRCS) $(ROOTSRC) magicport.json $(MAGICPORT)", "#$(GENSRC) : $(SRCS) $(ROOTSRC) magicport.json $(MAGICPORT)"], | |
[" $(MAGICPORT) . .", "# $(MAGICPORT) . ."], | |
] | |
]; | |
foreach(fn, ch; changes) | |
{ | |
auto f = cast(string)read(fn); | |
foreach(v; ch) | |
{ | |
f = f.replace(v[0] ~ '\n', v[1] is null ? v[1] : (v[1] ~ '\n')); | |
} | |
std.file.write(fn, f); | |
assert(executeShell("git add -f %s".format(fn)).status == 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment