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
9c7b1f85
Commit
9c7b1f85
authored
Feb 27, 2013
by
Jurrien Stutterheim
Browse files
Improved help message; add type signatures; commented unused code
parent
3bac5bd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
BatchBuild/BatchBuild.icl
View file @
9c7b1f85
...
...
@@ -20,6 +20,7 @@ from UtilIO import GetFullApplicationPath,GetLongPathName
::
MaybeError
a
b
=
Error
a
|
Ok
b
::
MaybeErrorString
a
:==
MaybeError
String
a
// END TODO
::
BBArgs
=
{
force_rebuild
::
Bool
...
...
@@ -38,7 +39,7 @@ Start world
(
EnvironmentVariable
ch
)
->
ch
cl
=
intersperse
" "
(
tl
[
arg
\\
arg
<-:
commandline
])
argsrec
=
startPBB
(
concat
[
fromString
c
\\
c
<-
cl
])
|
isNothing
argsrec
.
filename
=
wAbort
(
"BatchBuild
\n
Use as: 'BatchBuild [--force] filename [--action=ARG] [--envsdir=ARG]'
\n
"
)
world
|
isNothing
argsrec
.
filename
=
showUsage
world
#
world
=
case
getStringArg
"action"
of
"create"
->
createProject
world
argsrec
.
filename
cleanhome
"show"
->
showProject
world
argsrec
.
filename
cleanhome
...
...
@@ -46,6 +47,17 @@ Start world
"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')"
]
world
buildProject
::
*
World
BBArgs
->
*
World
buildProject
world
{
force_rebuild
=
force_rebuild
,
filename
=
filename
,
args
=
args
}
#
(
startup
,
world
)
=
accFiles
GetFullApplicationPath
world
...
...
@@ -90,13 +102,13 @@ showProject world (Just filename) cleanhome
//Open the projectfile
#
(
mbProj
,
world
)
=
openProject
cleanhome
projectfile
world
=
case
mbProj
of
Error
e
->
error
e
world
Ok
project
->
show
[
"Content of "
+++
projectfile
,
"Target: "
+++
PR_GetTarget
project
,
"Executable: "
+++
PR_GetExecPath
project
,
"Paths:"
:
[
toString
p
\\
p
<-
StrictListToList
(
PR_GetPaths
project
)]
]
world
Error
e
->
error
e
world
Ok
project
->
show
[
"Content of "
+++
projectfile
,
"Target: "
+++
PR_GetTarget
project
,
"Executable: "
+++
PR_GetExecPath
project
,
"Paths:"
:
[
toString
p
\\
p
<-
StrictListToList
(
PR_GetPaths
project
)]
]
world
openProject
::
!
FilePath
!
FilePath
!*
World
->
(!
MaybeErrorString
Project
,!*
World
)
openProject
cleanhome
projectfile
world
...
...
@@ -114,20 +126,20 @@ show lines world
error
::
!
String
!*
World
->
*
World
error
msg
world
=
show
[
"Error: "
+++
msg
]
world
addPath
::
*
World
(
Maybe
String
)
String
->
*
World
addPath
world
Nothing
_
=
wAbort
"No filename"
world
addPath
world
(
Just
filename
)
cleanhome
#
projectfile
=
addExtension
(
dropExtension
filename
)
"prj"
//Open the projectfile
#
(
mbProj
,
world
)
=
openProject
cleanhome
projectfile
world
=
case
mbProj
of
Error
e
=
error
e
world
Ok
project
#
paths
=
StrictListToList
(
PR_GetPaths
project
)
=
show
[
"Paths"
+++
toString
(
length
paths
)]
world
removePath
::
*
World
BBArgs
String
->
*
World
removePath
world
{
filename
=
filename
,
args
=
args
}
cleanhome
=
error
"Not implemented"
world
//
addPath :: *World (Maybe String) String -> *World
//
addPath world Nothing _ = wAbort "No filename" world
//
addPath world (Just filename) cleanhome
//
# projectfile = addExtension (dropExtension filename) "prj"
//
//Open the projectfile
//
# (mbProj,world) = openProject cleanhome projectfile world
//
= case mbProj of
//
Error e = error e world
//
Ok project
//
# paths = StrictListToList (PR_GetPaths project)
//
= show ["Paths" +++ toString (length paths)] world
//
removePath :: *World BBArgs String -> *World
//
removePath world {filename=filename, args=args} cleanhome = error "Not implemented" world
concat
::
[[.
a
]]
->
[.
a
]
concat
xss
=
foldr
(++)
[]
xss
...
...
@@ -172,18 +184,22 @@ getIntArg arg [(BBInt x v):xs]
pNotSpace
::
CParser
Char
[
Char
]
a
pNotSpace
=
sp
(<+>
(
satisfy
(
not
o
isWhite
)))
pBoolLongOpt
::
String
->
CParser
Char
BBArg
a
pBoolLongOpt
long
=
pLongOpt
long
<@
const
(
BBBool
long
)
//pBoolShortOpt short = pShortOpt short <@ const (BBBool short)
pIntLongOpt
::
String
->
CParser
Char
BBArg
a
pIntLongOpt
long
=
pLongOpt
long
&>
sp
int
<@
BBInt
long
//pIntShortOpt short = pShortOpt short &> sp int <@ BBInt short
pStringLongOpt
::
String
->
CParser
Char
BBArg
a
pStringLongOpt
long
=
pLongOpt
long
&>
sp
pNotSpace
<@
\
s
->
BBString
long
(
toString
s
)
//pStringShortOpt short = pShortOpt short &> sp pNotSpace <@ BBString short o toString
pLongOpt
::
String
->
CParser
Char
[
Char
]
a
pLongOpt
long
=
sptoken
(
fromString
"--"
)
&>
token
(
fromString
long
)
<&
(<?>
(
spsymbol
'='
))
//pShortOpt short = spsymbol '-' &> token (fromString short) <& (<?> (spsymbol '='))
...
...
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