Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clean-ide
Commits
0af08346
Commit
0af08346
authored
Feb 27, 2013
by
Jurrien Stutterheim
Browse files
Fix Start function
parent
9c7b1f85
Changes
1
Hide whitespace changes
Inline
Side-by-side
BatchBuild/BatchBuild.icl
View file @
0af08346
...
...
@@ -35,35 +35,35 @@ Start :: *World -> *World
Start
world
#
commandline
=
getCommandLine
#
cleanhome
=
case
getEnvironmentVariable
"CLEAN_HOME"
of
EnvironmentVariable
Undefined
->
"."
(
EnvironmentVariable
ch
)
->
ch
(
EnvironmentVariable
ch
)
->
ch
_
->
"."
cl
=
intersperse
" "
(
tl
[
arg
\\
arg
<-:
commandline
])
argsrec
=
startPBB
(
concat
[
fromString
c
\\
c
<-
cl
])
|
isNothing
argsrec
.
filename
=
showUsage
world
#
world
=
case
getStringArg
"action"
of
"create"
->
createProject
world
argsrec
.
filename
cleanhome
"show"
->
showProject
world
argsrec
.
filename
cleanhome
"addpath"
->
addPath
world
argsrec
.
filename
cleanhome
"removepath"
->
removePath
world
argsrec
cleanhome
_
->
buildProject
world
argsrec
=
case
getStringArg
"action"
argsrec
.
args
of
(
Just
"create"
)
->
createProject
world
argsrec
.
filename
cleanhome
(
Just
"show"
)
->
showProject
world
argsrec
.
filename
cleanhome
//(Just
"addpath"
)
-> addPath world argsrec.filename cleanhome
//(Just
"removepath"
)
-> removePath world argsrec cleanhome
_
->
buildProject
world
argsrec
showUsage
::
!*
World
->
*
World
showUsage
world
=
show
[
"BatchBuild"
,
"Usage: BatchBuild [--force] filename [--action=ARG] [--envsdir=ARG]"
,
"--action : Execute a specific action. Possible actions:"
,
" build : Build a project (default)."
,
" create : Create a basic project file for a module."
,
" show : Summarize the contents of a project file."
,
"--envsdir : Specify a directory where environment files can be found (defaults to 'IDEEnvs')"
,
"
--action : Execute a specific action. Possible actions:"
,
"
build : Build a project (default)."
,
"
create : Create a basic project file for a module."
,
"
show : Summarize the contents of a project file."
,
"
--envsdir : Specify a directory where environment files can be found (defaults to 'IDEEnvs')"
]
world
buildProject
::
*
World
BBArgs
->
*
World
buildProject
world
{
force_rebuild
=
force_rebuild
,
filename
=
filename
,
args
=
args
}
#
(
startup
,
world
)
=
accFiles
GetFullApplicationPath
world
#
envsdir
=
case
getStringArg
"envsdir"
args
of
Nothing
->
application_path
EnvsFileName
(
Just
p
)
->
application_path
p
_
->
application_path
EnvsFileName
#
(
envs
,
world
)
=
openEnvironments
startup
envsdir
world
#
((
proj
,
ok
,
err
),
world
)
=
accFiles
(
ReadProjectFile
(
fromJust
filename
)
startup
)
world
|
not
ok
||
err
<>
""
=
wAbort
(
"BatchBuild failed while opening project: "
+++.
err
+++.
"
\n
"
)
world
...
...
@@ -146,8 +146,8 @@ concat xss = foldr (++) [] xss
startPBB
::
[.
Char
]
->
BBArgs
startPBB
args
=
case
filter
(\(
xs
,
_)
->
xs
==
[])
(
begin
pBB
args
)
of
[]
->
{
force_rebuild
=
False
,
filename
=
Nothing
,
args
=
[]
}
[(_,
as
):_]
->
as
_
->
{
force_rebuild
=
False
,
filename
=
Nothing
,
args
=
[]
}
pBB
::
CParser
Char
BBArgs
BBArgs
pBB
=
pForce
<&>
\
f
->
pFilename
<&>
\
p
->
<*>
(
sp
pArgs
)
<@
\
fs
->
{
force_rebuild
=
f
,
filename
=
p
,
args
=
fs
}
...
...
@@ -167,18 +167,19 @@ pArgs = pStringLongOpt "envsdir" <|> pBoolLongOpt "force" <|> pStringLongOpt "ac
hasFlag
::
String
[
BBArg
]
->
Bool
hasFlag
_
[]
=
False
hasFlag
flag
[(
BBBool
x
):
xs
]
=
flag
===
x
||
hasFlag
flag
xs
hasFlag
flag
[_:
xs
]
=
hasFlag
flag
xs
getStringArg
::
String
[
BBArg
]
->
Maybe
String
getStringArg
_
[]
=
Nothing
getStringArg
arg
[
(
BBString
x
v
)
:
xs
]
|
arg
===
x
=
Just
v
|
otherwise
=
getStringArg
arg
xs
getStringArg
_
[]
=
Nothing
getStringArg
arg
[
BBString
x
v
:
xs
]
|
arg
===
x
=
Just
v
getStringArg
arg
[_:
xs
]
=
getStringArg
arg
xs
getIntArg
::
String
[
BBArg
]
->
Maybe
Int
getIntArg
_
[]
=
Nothing
getIntArg
arg
[
(
BBInt
x
v
)
:
xs
]
|
arg
===
x
=
Just
v
|
otherwise
=
getIntArg
arg
xs
getIntArg
_
[]
=
Nothing
getIntArg
arg
[
BBInt
x
v
:
xs
]
|
arg
===
x
=
Just
v
getIntArg
arg
[_:
xs
]
=
getIntArg
arg
xs
pNotSpace
::
CParser
Char
[
Char
]
a
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment