Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
c8c3ced6
Commit
c8c3ced6
authored
4 years ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[server] kernel project
parent
67033aa7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/server/Makefile.in
+1
-1
1 addition, 1 deletion
src/plugins/server/Makefile.in
src/plugins/server/kernel_project.ml
+45
-35
45 additions, 35 deletions
src/plugins/server/kernel_project.ml
with
46 additions
and
36 deletions
src/plugins/server/Makefile.in
+
1
−
1
View file @
c8c3ced6
...
...
@@ -45,7 +45,7 @@ PLUGIN_CMO:= \
main request states
\
server_batch
\
kernel_main
\
#
kernel_project
\
kernel_project
\
# kernel_ast
\
# kernel_properties
...
...
This diff is collapsed.
Click to expand it.
src/plugins/server/kernel_project.ml
+
45
−
35
View file @
c8c3ced6
...
...
@@ -21,36 +21,40 @@
(**************************************************************************)
open
Data
module
Sy
=
Syntax
module
Md
=
Markdown
module
Js
=
Yojson
.
Basic
.
Util
module
Pkg
=
Package
let
page
=
Server_doc
.
page
`Kernel
~
title
:
"Project Management"
~
file
name
:
"project
.md
"
()
let
pa
cka
ge
=
Pkg
.
package
~
name
:
"project"
()
(* -------------------------------------------------------------------------- *)
(* --- Project Info --- *)
(* -------------------------------------------------------------------------- *)
module
ProjectId
=
(
val
jkey
~
kind
:
"project"
)
module
ProjectInfo
=
Collection
(
struct
type
t
=
Project
.
t
let
syntax
=
Sy
.
publish
~
page
~
name
:
"project-info"
~
descr
:
(
Md
.
plain
"Project informations"
)
~
synopsis
:
Sy
.(
record
[
"id"
,
ident
;
"name"
,
string
;
"current"
,
boolean
])
()
let
of_json
js
=
Js
.
member
"id"
js
|>
Js
.
to_string
|>
Project
.
from_unique_name
let
to_json
p
=
`Assoc
[
"id"
,
`String
(
Project
.
get_unique_name
p
)
;
"name"
,
`String
(
Project
.
get_name
p
)
;
"current"
,
`Bool
(
Project
.
is_current
p
)
;
]
end
)
struct
type
t
=
Project
.
t
let
jtype
=
Pkg
.
datatype
~
package
~
name
:
"projectInfo"
~
descr
:
(
Md
.
plain
"Project informations"
)
Pkg
.(
Jrecord
[
"id"
,
ProjectId
.
jtype
;
"name"
,
Jstring
;
"current"
,
Jboolean
;
])
let
of_json
js
=
Js
.
member
"id"
js
|>
Js
.
to_string
|>
Project
.
from_unique_name
let
to_json
p
=
`Assoc
[
"id"
,
`String
(
Project
.
get_unique_name
p
)
;
"name"
,
`String
(
Project
.
get_name
p
)
;
"current"
,
`Bool
(
Project
.
is_current
p
)
;
]
end
(* -------------------------------------------------------------------------- *)
(* --- Project Requests --- *)
...
...
@@ -59,11 +63,17 @@ module ProjectInfo =
module
ProjectRequest
=
struct
(* forward request on a given project *)
type
t
=
Project
.
t
*
string
*
json
let
syntax
=
Sy
.
publish
~
page
~
name
:
"project-request"
~
synopsis
:
(
Sy
.(
record
[
"project"
,
ident
;
"request"
,
string
;
"data"
,
any
;
]))
~
descr
:
(
Md
.
plain
"Request to be executed on the specified project."
)
()
let
jtype
=
Pkg
.
datatype
~
package
~
name
:
"projectRequest"
~
descr
:
(
Md
.
plain
"Request to be executed on the specified project."
)
(
Jrecord
[
"project"
,
ProjectId
.
jtype
;
"request"
,
Jstring
;
"data"
,
Jany
;
])
let
of_json
js
=
begin
...
...
@@ -84,37 +94,37 @@ end
(* --- Project Requests --- *)
(* -------------------------------------------------------------------------- *)
let
()
=
Request
.
register
~
page
~
kind
:
`GET
~
name
:
"
kernel.project.
getCurrent"
let
()
=
Request
.
register
~
pa
cka
ge
~
kind
:
`GET
~
name
:
"getCurrent"
~
descr
:
(
Md
.
plain
"Returns the current project"
)
~
input
:
(
module
Junit
)
~
output
:
(
module
ProjectInfo
)
Project
.
current
let
()
=
Request
.
register
~
page
~
kind
:
`SET
~
name
:
"
kernel.project.
setCurrent"
let
()
=
Request
.
register
~
pa
cka
ge
~
kind
:
`SET
~
name
:
"setCurrent"
~
descr
:
(
Md
.
plain
"Switches the current project"
)
~
input
:
(
module
Jident
)
~
output
:
(
module
Junit
)
~
input
:
(
module
ProjectId
)
~
output
:
(
module
Junit
)
(
fun
pid
->
Project
.(
set_current
(
from_unique_name
pid
)))
let
()
=
Request
.
register
~
page
let
()
=
Request
.
register
~
pa
cka
ge
~
kind
:
`GET
~
name
:
"kernel.project.getList"
~
descr
:
(
Md
.
plain
"Returns the list of all projects"
)
~
input
:
(
module
Junit
)
~
output
:
(
module
ProjectInfo
.
Jlist
)
~
input
:
(
module
Junit
)
~
output
:
(
module
Jlist
(
ProjectInfo
)
)
(
fun
()
->
Project
.
fold_on_projects
(
fun
ids
p
->
p
::
ids
)
[]
)
let
()
=
Request
.
register
~
page
let
()
=
Request
.
register
~
pa
cka
ge
~
kind
:
`GET
~
name
:
"kernel.project.getOn"
~
descr
:
(
Md
.
plain
"Execute a GET request within the given project"
)
~
input
:
(
module
ProjectRequest
)
~
output
:
(
module
Jany
)
(
ProjectRequest
.
process
`GET
)
let
()
=
Request
.
register
~
page
let
()
=
Request
.
register
~
pa
cka
ge
~
kind
:
`SET
~
name
:
"kernel.project.setOn"
~
descr
:
(
Md
.
plain
"Execute a SET request within the given project"
)
~
input
:
(
module
ProjectRequest
)
~
output
:
(
module
Jany
)
(
ProjectRequest
.
process
`SET
)
let
()
=
Request
.
register
~
page
let
()
=
Request
.
register
~
pa
cka
ge
~
kind
:
`EXEC
~
name
:
"kernel.project.execOn"
~
descr
:
(
Md
.
plain
"Execute an EXEC request within the given project"
)
~
input
:
(
module
ProjectRequest
)
~
output
:
(
module
Jany
)
...
...
@@ -126,7 +136,7 @@ let () = Request.register ~page
let
()
=
Request
.
register
~
page
~
pa
cka
ge
~
descr
:
(
Md
.
plain
"Create a new project"
)
~
kind
:
`SET
~
name
:
"kernel.project.setCreate"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment