Commit efa240b9 authored by Juste Raimbault's avatar Juste Raimbault
Browse files

Merge branch 'dev' of github.com:openmole/openmole into dev

parents 262e4870 d74b4b8f
Pipeline #1192 canceled with stages
......@@ -10,15 +10,13 @@
The default way to run the OpenMOLE application is with a graphical user interface (GUI).
To do so, just execute the @code{openmole} file in the folder you @aa("downloaded", href := download.file), it will bring up the application in your web browser.
OpenMOLE supports Chrome and Firefox, so if you are using another default web browser please copy paste the OpenMOLE url @b{http://localhost:[port]} in one of these browsers.
OpenMOLE supports Chrome and Firefox, so if you are using another default web browser please copy-paste the OpenMOLE url @b{http://localhost:[port]} in one of these browsers.
@br
You should see something like below.
The documentation concerning the GUI is provided within the GUI, some basic information can also be found @aa("here", href := gui.file).
@br@br
@img(src := Resource.img.mole.uiScreenshot.file, width := "100%")
......@@ -26,7 +24,7 @@ The documentation concerning the GUI is provided within the GUI, some basic info
@h3{GUI on a remote machine}
To run OpenMOLE on a remote machine you should execute the following command @code{openmole --remote --port portnumber}.
The first time you launch it, you will be prompted for choosing a password.
The first time you launch it, you will be prompted to choose a password.
Then you can remotely connect to OpenMOLE using the url @b{https://remotemachine:portnumber} (note that the "https://" part is important).
When you connect to OpenMOLE through your remote, you will be asked for the password you chose previously.
......@@ -53,8 +51,6 @@ The only differences between the scripts in the console mode and the ones from t
A console workflow is launched like this:
@br@br
@hl.code("""
val exploration =
DirectSampling(
......@@ -65,8 +61,6 @@ A console workflow is launched like this:
val ex = exploration start
""")
@br
Using the @code{ex} and the @code{env} variables created above, you can follow the progress of the execution by using the commands @code{print(ex)} and @code{print(env)}.
To cancel the execution you should use @code{ex.cancel}.
......@@ -75,5 +69,4 @@ To cancel the execution you should use @code{ex.cancel}.
@h2{Launching options}
OpenMOLE comes with several launching options.
Execute @code{openmole -h} in a terminal to list them all.
Execute @code{openmole -h} in a terminal to list them all.
\ No newline at end of file
......@@ -11,16 +11,13 @@ It allows editing, managing and running them.
The way to write these experiments is fully explained in the @aa("main documentation of OpenMOLE", href := DocumentationPages.plug.file).
We focus here on the way to manage them in the application.
@br@br
@br
In the OpenMOLE GUI, you can upload and edit files, run and monitor experiments, and store authentication credentials for distributed computation.
The application runs in a browser (Firefox or Chrome).
The First time you run it, you are asked for a password to encrypt your settings (server port, authentication credentials, etc).
The first time you run it, you are asked for a password to encrypt your settings (server port, authentication credentials, etc).
Your settings data (so not your projects, which are never wiped out) are preserved so long as your password do not change.
For now, the OpenMOLE GUI looks like a web application but still runs as a heavy client one.
This should change in version 8 or 9.
@br@br
@img(src := Resource.img.guiGuide.overview.file, width := "100%")
......@@ -29,38 +26,39 @@ This should change in version 8 or 9.
@h2{Starting a project}
Clicking on the main red button @i{New project} in the menu bar offers 3 choices:
@h3{Empty project}
Selecting this option creates a new script file called @i{newProject.oms} in the current folder and open the (empty) file for edition.
@h3{From market place}
Selecting this option pops up a dialog containing all the running projects contained in our Market Place.
The Market Place is a collection of projects built by users and offer different aspects of experiments that can be run on the OpenMOLE platform with a large variety of programming codes, exploration methods.
@h3{From Market Place}
Selecting this option pops up a dialog box containing all the running projects contained in our Market Place.
The Market Place is a collection of projects built by users which offers different aspects of experiments that can be run on the OpenMOLE platform with a large variety of programming codes, exploration methods.
The sources can be found @aa("here", href := shared.link.repo.market).
Just select one of the market entries and click on the @i{Dowload} button to import it in the current folder.
Just select one of the Market entries and click on the @i{Download} button to import it in the current folder.
@h3{From existing model sources}
The model wizard is a tool designed to quickly import your Model.
The model wizard is a tool designed to quickly import your model.
It both uploads your model archive and prepares the OpenMOLE script for you.
The wizard automatically distinguishes your model's programming language among JVM, Netlogo or native codes.
Then it detects the potential inputs and outputs. For each input/output, the wizard generates a variable with a relevant name if possible.
At the end of the import process, the should run your script without you having to do anything!
The wizard automatically distinguishes your model's programming language among JVM, NetLogo or native codes.
Then it detects the potential inputs and outputs.
For each input/output, the wizard generates a variable with a relevant name if possible.
At the end of the import process, you should be able to run your script without having to do anything else!
@br@br
@br
To import your model, click on the @i{Your Model}.
A dialog box pops up. Set your model path in it.
The system should now display the programming language, a list of detected inputs / outputs and the command to launch your code.
To import your model, click on the @i{Your Model} button.
A dialog box pops up where you can set your model path.
The system should now display the programming language, a list of detected inputs/outputs and the command to launch your code.
In most cases, you are almost done.
Just press the @i{Build} button at the bottom: the wizard dialog disappears and the OpenMOLE script is generated in the wordDirectory with your uploaded code!
However, you may sometimes want to make some modifications if you observe the system did not correctly detect your code, its inputs/outputs or its launching command.
@br@br
Just press the @i{Build} button at the bottom: the wizard dialog box disappears and the OpenMOLE script is generated in your workDirectory with your uploaded code!
However, you can also make some modifications to input/output names, or launching commands before building the script.
@img(src := Resource.img.guiGuide.modelImport.file, width := "100%")
@br@br
For each input / output, three actions can be triggered using the icons located on the same line:
For each input/output, three actions can be triggered using the icons located on the same line:
@ul
@li
removes the current input/output
......@@ -69,15 +67,15 @@ For each input / output, three actions can be triggered using the icons located
@li
or switches an input to output and vice-versa.
The launching command uses the names of the previously defined input / output variables.
The launching command uses the names of the previously defined input/output variables.
It is reactive: if the name of the input/output changes, the launching command is updated with the corresponding name.
For the native codes (C, C++, Python, R, ...), the following syntax is required (automatically used): i{${}}.
For the native codes (C, C++, Python, R, ...), the following syntax is required (automatically used): code{${}}.
@br@br
@br
The Netlogo applications working with the .nls extension should be previously archived. The system will extract the archives
and deal with the extensions as resources of the task (displayed in the resources tab)
A seed variable (for the Netlogo random genarator) is automatically generated and passed to the Netlogo Generator through the Netlogo Task.
The NetLogo applications working with the @i{.nls} extension should be put in an archive beforehand.
The system will extract the archive and deal with the extensions as resources of the task (displayed in the resources tab).
A seed variable (for the NetLogo random generator) is automatically generated and passed to the NetLogo generator through the NetLogo Task.
......@@ -86,34 +84,31 @@ A seed variable (for the Netlogo random genarator) is automatically generated an
The OpenMOLE application essentially handles files: your model files, your model inputs our outputs, and the OpenMOLE scripts,
where you describe your experiment.
@br@br
@br
We distinguish multiple kinds of resources:
@ul
@li
oms (for Open Mole Script) is a file describing an OpenMOLE experiment according to the OpenMOLE language
@li
external code used in OpenMOLE scripts. Codes written in some specific programming languages (Java, Scala, Netlogo, R, Python, ...) can be edited in the application.
external code used in OpenMOLE scripts. Codes written in some specific programming languages (Java, Scala, NetLogo, R, Python, ...) can be edited in the application.
However, they will not be compiled.
@li
other external resources used as input for a model are editable in the application (CSV files, text files, ...), while binary files like images cannot be modified.
@br
These files are managed in a file system located in the left sidebar. This side bar offers basic tools for managing files
@br@br
These files are managed in a file system located in the left sidebar.
This side bar offers basic tools for managing files.
@img(src := Resource.img.guiGuide.files.file, width := "90%")
@br@br
The current directory is shown at the top in the folder navigation area. When the folder hierarchy is too deep to fit in the bar, it will be replaced by "...".
Clicking on one folder of the stack sets it as the current folder. In the image above, the current directory is for example @i{Pi Computation}.
The current directory is shown at the top in the folder navigation area.
When the folder hierarchy is too deep to fit in the bar, it will be replaced by "...".
Clicking on one folder of the stack sets it as the current folder.
In the image above, the current directory is for example @i{Pi Computation}.
@br@br
@br
The tool area at the top concerns the current folder and provides with
The tool area at the top concerns the current folder and provides:
@ul
@li
@b{filtering} this folder by number of entries or by names. It is especially recommended for folders containing a large number of files.
......@@ -123,8 +118,8 @@ The tool area at the top concerns the current folder and provides with
@b{copying files}. Clicking this icon make entering in a blue multi-selection mode. Each file selected turns to green.
The copy button on top permits to copy all of them. Then a @b{paste} button appears and just waits for being pressed from any other folder you go to.
@li
@b{deleting files}. Clicking this icon make entering in a blue multi-selection mode. Each file selected turns to green.
The red @b{Delete} button on top permits to wipe them out.
@b{deleting files}. Clicking this icon make entering in a blue multi-selection mode. Each selected file turns to green.
The red @b{Delete} button on top allows to wipe them out.
@li
checking for @aa("plugins", href := DocumentationPages.pluginDevelopment.file) in the current folder.
@li
......@@ -132,9 +127,7 @@ The tool area at the top concerns the current folder and provides with
@li
@b{refreshing} the content of the current folder
@br
Then, each file on each line has a settings button permitting for @b{cloning} the current file, @b{downloading} it, @b{editing} its name or @b{removing} it.
Then, each file on each line has a settings button allowing to @b{clone} the current file, @b{download} it, @b{edit} its name or @b{remove} it.
Other actions are available depending on the context (ie the file extension):
@ul
@li
......@@ -146,19 +139,14 @@ Other actions are available depending on the context (ie the file extension):
@h2{Play and monitor executions}
@h2{Run and monitor executions}
When a .oms file is edited, a @i{Play button} appears in the top right corner to start the execution of the workflow.
When a @i{.oms} file is edited, a @b{Run} button appears in the top right corner to start the execution of the workflow.
Once the workflow has been started, the execution panel appears, listing information for each execution on a separate row.
At any time this execution panel can be closed (without aborting the current runnings) and re-opened by clicking on the
@a("running icon", href := "#Overview")
@br@br
At any time, this execution panel can be closed (without aborting the current runs), and re-opened by clicking on the @a("running icon", href := "#Overview")
@img(src := Resource.img.guiGuide.running.file, width := "100%")
@br@br
The different statuses of the executions are:
@ul
@li
......@@ -166,7 +154,7 @@ The different statuses of the executions are:
@li
@b{success}: the execution has successfully finished
@li
@b{failed}: the execution has failed: click on this state to see the errors
@b{failed}: the execution has failed, click on this state to see the errors
@li
@b{canceled}: the execution has been canceled (by means of the button)
......@@ -175,8 +163,11 @@ The different statuses of the executions are:
@h2{Authentications}
In OpenMOLE, the computation load can be delegated to remote @aa("environments", href := DocumentationPages.scale.file).
When clicking on the @a("authentication icon", href := "#Overview"), panel appears with the list (initially empty) of all the defined authentications.
To add one authentication, click on @i{New} button.
When clicking on the @a("authentication", href := "#Overview") icon, a panel appears with the list (initially empty) of all the defined authentications.
@br
To add one authentication, click on the @b{New} button.
The currently supported authentications are:
@ul
@li
......@@ -191,34 +182,31 @@ The currently supported authentications are:
@b{Grid certificate} (.p12) for @aa("Grid Computing", href := shared.link.egi)@br
It only requires your EGI certificate file and the associated password. Click on No certificate to select your certificate file. It will be renamed to egi.p12. Note that only one EGI certificate is required (you will not need any other one!)
@br
@img(src := Resource.img.guiGuide.authentication.file, width := "100%")
@br@br
An authentication can be removed by clicking on the @i{trash bin icon}.
An authentication can be removed by clicking on the @b{trash bin} icon.
An existing authentication can also be edited by clicking on the name of an authentication in the list.
@br@br
@br
Each time an authentication is added, a check is made on the mentioned environment (for the EGI ones, a list of VOs to be checked can be set in the EGI authentication settings).
If it fails, a red label appears. When clicking on it, the error stack appears.
If it fails, a red label appears.
When clicking on it, the error stack appears.
@h2{Plugins}
New features can be dynamically inserted in the OpenMOLE platform through plugins.
Advanced users build their own plugins to express concepts that might not be present (yet) in OpenMOLE. In OpenMOLE, plugins take the form of jar files.
It can also be a JVM based model provided as a plugin. The way to build plugins in OpenMOLE is full described @aa("here", href := DocumentationPages.pluginDevelopment.file)
Advanced users build their own plugins to express concepts that might not be present (yet) in OpenMOLE.
In OpenMOLE, plugins take the form of jar files.
JVM based models can also be provided as plugins.
The way to build plugins in OpenMOLE is fully described @aa("here", href := DocumentationPages.pluginDevelopment.file)
@br@br
@br
To add a plugin, open the @a("plugin management panel", href := "#Overview").
You can upload a new plugin by clicking on the blue top right-hand corner and selecting the corresponding jar file.
Once uploaded, the plugin appears in the list.
@br@br
@img(src := Resource.img.guiGuide.plugin.file, width := "100%")
\ No newline at end of file
......@@ -50,6 +50,7 @@ Not all examples are listed here, for a full list look at the GitHub @aa("reposi
@img(src := Resource.img.guiGuide.market.file, width := "95%")
@h2{Contribute your example/tutorial!}
You can contribute to the market place either by making a pull request on the @aa("central OpenMOLE market place", href := shared.link.repo.market), or by pushing your example workflow on your own git repository and post it to the @aa("user mailing list", href:=shared.link.forum).
......
......@@ -9,7 +9,9 @@
OpenMOLE is a model exploration tool.
It offers several methods to perform experiments on a model, in order to better understand its behavior and capabilities.
@br
The composition of a full exploration experiment is achieved by writing a script in the @a("OpenMOLE language", href := language.file), which is an extension of the Scala language.
Such a script is called a @i{workflow} and should contain:
@ul
......@@ -119,12 +121,11 @@ Once the model execution is over, and since we asked in the workflow to @code{di
@h2{To go further}
In the @a("next tutorial", href := exploreTuto.file), you will learn how to prepare and run a more complex experiment, in order to explore your model with OpenMOLE.
@h2{Get help}
@h3{Get help}
To get help you are more than welcomed to contact the OpenMOLE community on our @aa("forum", href := shared.link.forum) and post your questions.
You can also reach us via our @aa("RocketChat", href := shared.link.chat).
@h3{Next tutorial}
In the @a("next tutorial", href := exploreTuto.file), you will learn how to prepare and run a more complex experiment, in order to explore your model with OpenMOLE.
\ No newline at end of file
......@@ -58,8 +58,6 @@ A visual representation of this model looks like:
@img(src := Resource.img.example.ants.file)
@br
In this tutorial we use a headless version (@aa("see NetLogo task documentation", href := DocumentationPages.netLogo.file)) of the model.
This modified version is available @aa("here", href := Resource.script.antsNLogo.file).
......@@ -80,8 +78,6 @@ Each source is positioned at different distances from the Ant colony.
@img(src := Resource.img.example.antNumbers.file)
@br
It can be interesting to search for the @b{best combination of the two parameters} @code{evaporation-rate} and @code{diffusion-rate} which minimises the eating time of each food source.
To build our fitness function, we modify the NetLogo Ants source code to store, for each food source, the first ticks indicating that this food source is empty.
......@@ -119,7 +115,7 @@ $model
// Define the hooks to collect the results
val displayHook = DisplayHook(food1, food2, food3)
//Definie the environment
//Define the environment
val env = LocalEnvironment(5)
// Start a workflow with 1 task
......@@ -150,7 +146,7 @@ Notice how the @code{evaluation} parameter of the @code{SteadyStateEvolution} me
// Define the fitness evaluation
// Define the parallelism level
// Terminate after 10000 evaluations
// Define a hook to save the Pareto frontier
// Define a hook to save the Pareto front
NSGA2Evolution(
// Define the inputs and their respective variation bounds.
// Define the objectives to minimize.
......@@ -167,7 +163,7 @@ NSGA2Evolution(
@h2{Scale up}
If you use distributed computing, it might be a good idea to opt for an Island model.
If you use distributed computing, it might be a good idea to opt for an island model (see @aa("this page", href := island.file)) for more details on the island distribution scheme.
Islands are better suited to exploit distributed computing resources than classical generational genetic algorithms.
See how the end of the script changes to implement islands in the workflow.
Here we compute 2,000 islands in parallel, each running during 10 minutes on the European grid:
......
......@@ -16,8 +16,6 @@ val burned = Val[Double]
Typical sensitivity analysis (in a simulation experiment context) is the study of how the variations of an input affects the output(s) of a model.
@br
@img(src := Resource.img.method.sensitivityAnim.file, width := "80%")
@basicButton("Run", classIs(btn, btn_danger))(id := shared.sensitivity.button, stylesheet.svgRunButton(10))
......@@ -52,9 +50,7 @@ We will perform sensitivity analysis to make this change of regime appear.
@br
The Fire model integration has been covered in the @aa("NetLogo page of the Model section", href:= DocumentationPages.netLogo.file), so we take it from here.
The former script was already performing a sensitivity analysis, by varying @code{density} from 20 to 80 by step of 10, with 10 replications for each (@code{mySeed} has 10 different values for each value of @code{density}).
@br
In our case, the quantum of 10 percent is quite coarsed, so we make it 1 percent:
@hl.openmole("""
......
......@@ -330,7 +330,7 @@ def corePlugins =
allDomain ++
allTools
def allTools = Seq(netLogoAPI, netLogo5API, netLogo6API, pattern, json)
def allTools = Seq(netLogoAPI, netLogo5API, netLogo6API, pattern, json, methodData)
lazy val defaultActivator = OsgiKeys.bundleActivator := Some(name.value + ".Activator")
......@@ -377,6 +377,11 @@ lazy val json = OsgiProject(pluginDir, "org.openmole.plugin.tool.json", imports
libraryDependencies += Libraries.shapeless)
lazy val methodData = OsgiProject(pluginDir, "org.openmole.plugin.tool.methoddata", imports = Seq("*")) settings (toolsSettings: _*) settings (
OsgiKeys.bundleActivator := None,
libraryDependencies += Libraries.circe
) enablePlugins(ScalaJSPlugin) dependsOn(openmoleDSL)
/* Domain */
def allDomain = Seq(collectionDomain, distributionDomain, fileDomain, modifierDomain, rangeDomain, boundsDomain)
......@@ -477,13 +482,13 @@ lazy val evolution = OsgiProject(pluginDir, "org.openmole.plugin.method.evolutio
lazy val evolutionData = OsgiProject(pluginDir, "org.openmole.plugin.method.evolution.data", imports = Seq("*")) settings (pluginSettings: _*) settings (
OsgiKeys.bundleActivator := None,
libraryDependencies += Libraries.circe
) enablePlugins(ScalaJSPlugin) dependsOn(omrHook)
) enablePlugins(ScalaJSPlugin) dependsOn(omrHook, methodData)
lazy val abc = OsgiProject(pluginDir, "org.openmole.plugin.method.abc", imports = Seq("*")) dependsOn(openmoleDSL, toolsTask, pattern, boundsDomain % "test") settings(
libraryDependencies += Libraries.mgo, libraryDependencies += Libraries.shapeless) settings (pluginSettings: _*)
lazy val directSampling = OsgiProject(pluginDir, "org.openmole.plugin.method.directsampling", imports = Seq("*")) dependsOn(openmoleDSL, distributionDomain, pattern, modifierDomain, fileHook, combineSampling, omrHook) settings (pluginSettings: _*)
lazy val directSampling = OsgiProject(pluginDir, "org.openmole.plugin.method.directsampling", imports = Seq("*")) dependsOn(openmoleDSL, distributionDomain, pattern, modifierDomain, fileHook, combineSampling, omrHook, methodData) settings (pluginSettings: _*)
lazy val sensitivity = OsgiProject(pluginDir, "org.openmole.plugin.method.sensitivity", imports = Seq("*")) dependsOn(exception, workflow, workspace, openmoleDSL, lhsSampling, quasirandomSampling, directSampling, collectionDomain % "test", boundsDomain % "test") settings (pluginSettings: _*)
......
......@@ -11,7 +11,7 @@ import ScriptContext.{ ENGINE_SCOPE, GLOBAL_SCOPE }
import java.io.{ Closeable, Reader }
import org.openmole.core.compiler.ScalaREPL.OMIMain
import org.openmole.tool.types.ClassUtils
import org.openmole.tool.types.TypeTool
import scala.tools.nsc.Settings
......@@ -168,7 +168,7 @@ class OMScripted(val factory: ScriptEngineFactory, val omIMain: IMain)
val newline = (defines map (s s"val ${s.name} = $$INSTANCE${req.accessPath}.${s.name}")).mkString(instance, ";", ";")
//val newreq = intp.requestFromLine(newline).right.get
val newreq = ClassUtils.callByName[IMain, Either[Result, intp.Request]](intp, "requestFromLine", Vector(newline)).right.get
val newreq = TypeTool.callByName[IMain, Either[Result, intp.Request]](intp, "requestFromLine", Vector(newline)).right.get
val ok = newreq.compile
......
......@@ -18,8 +18,8 @@
package org.openmole.core.context
import org.openmole.core.exception.UserBadDataError
import org.openmole.tool.types.ClassUtils._
import org.openmole.tool.types.{ ClassUtils, Id }
import org.openmole.tool.types.TypeTool._
import org.openmole.tool.types.{ TypeTool, Id }
import shapeless.{ TypeCase, Typeable }
import scala.annotation.tailrec
......@@ -110,6 +110,19 @@ object ValType {
*/
def unsecure(c: Manifest[_]): ValType[Any] = apply(c.asInstanceOf[Manifest[Any]])
def toNativeType(t: ValType[_]): ValType[_] = {
def native = {
val (contentType, level) = ValType.unArrayify(t)
for {
m classEquivalence(contentType.runtimeClass).map(_.manifest)
} yield (0 until level).foldLeft(ValType.unsecure(m)) {
(c, _) c.toArray.asInstanceOf[ValType[Any]]
}
}
native getOrElse t
}
def toTypeString(t: ValType[_]): String = TypeTool.toString(toNativeType(t).manifest)
}
/**
......@@ -261,11 +274,11 @@ class Val[T](val simpleName: String, val `type`: ValType[T], val namespace: Name
* @param p the prototype to test
* @return true if the prototype is assignable from the given prototype
*/
def isAssignableFrom(p: Val[_]): Boolean = ClassUtils.assignable(p.`type`.manifest, `type`.manifest)
def isAssignableFrom(p: Val[_]): Boolean = TypeTool.assignable(p.`type`.manifest, `type`.manifest)
/**
* Test if a given object can be accepted by the prototype
* (compares runtime classes using [[ClassUtils.classAssignable]])
* (compares runtime classes using [[TypeTool.classAssignable]])
*
* @param obj
* @return
......
......@@ -24,7 +24,7 @@ import org.openmole.core.context._
import org.openmole.core.exception._
import org.openmole.core.fileservice.FileService
import org.openmole.core.pluginmanager._
import org.openmole.tool.types.ClassUtils._
import org.openmole.tool.types.TypeTool._
import org.openmole.core.workspace.TmpDirectory
import org.openmole.tool.cache._
import org.openmole.tool.random._
......@@ -112,24 +112,6 @@ object ScalaCompilation {
}
}
def toScalaNativeType(t: ValType[_]): ValType[_] = {
def native = {
val (contentType, level) = ValType.unArrayify(t)
for {
m classEquivalence(contentType.runtimeClass).map(_.manifest)
} yield (0 until level).foldLeft(ValType.unsecure(m)) {
(c, _) c.toArray.asInstanceOf[ValType[Any]]
}
}
native getOrElse t
}
def toTypeString(t: ValType[_]): String = {
toScalaNativeType(t).manifest.toString.
replace(".package$", ".").
replace("$", ".")
}
def function[RETURN](inputs: Seq[Val[_]], source: String, plugins: Seq[File], libraries: Seq[File], wrapping: OutputWrapping[RETURN], returnType: ValType[_ <: RETURN])(implicit newFile: TmpDirectory, fileService: FileService) = {
val s = script(inputs, source, wrapping, returnType)
compile[CompilationClosure[RETURN]](s, plugins, libraries)
......@@ -162,10 +144,10 @@ object ScalaCompilation {
*/
def script[RETURN](inputs: Seq[Val[_]], source: String, wrapping: OutputWrapping[RETURN], returnType: ValType[_ <: RETURN]) = {
val header =
s"""new ${classOf[CompilationClosure[_]].getName}[${toTypeString(returnType)}] {
s"""new ${classOf[CompilationClosure[_]].getName}[${ValType.toTypeString(returnType)}] {
| def apply(${prefix}context: ${manifest[Context].toString}, ${prefix}RNG: ${manifest[RandomProvider].toString}, ${prefix}NewFile: ${manifest[TmpDirectory].toString}) = {
| object $inputObject {
| ${inputs.toSeq.map(i ⇒ s"""var ${i.name} = ${prefix}context("${i.name}").asInstanceOf[${toTypeString(i.`type`)}]""").mkString("; ")}
| ${inputs.toSeq.map(i ⇒ s"""var ${i.name} = ${prefix}context("${i.name}").asInstanceOf[${ValType.toTypeString(i.`type`)}]""").mkString("; ")}
| }
| import ${inputObject}._
| implicit def ${Val.name(Variable.openMOLENameSpace, "RNGProvider")} = ${prefix}RNG
......@@ -176,7 +158,7 @@ object ScalaCompilation {
s"""$header
| $source
| ${wrapping.wrapOutput}
| }: ${toTypeString(returnType)}
| }: ${ValType.toTypeString(returnType)}
|}""".stripMargin
Script(code, source, header.split("\n").size + 1)
......@@ -258,7 +240,7 @@ object ScalaCompilation {
def wrapOutput =
s"""
|scala.jdk.CollectionConverters.MapHasAsJava(Map[String, Any]( ${outputs.toSeq.map(p ⇒ s""" "${p.name}" -> (${p.name}: ${toTypeString(p.`type`)})""").mkString(",")} )).asJava
|scala.jdk.CollectionConverters.MapHasAsJava(Map[String, Any]( ${outputs.toSeq.map(p ⇒ s""" "${p.name}" -> (${p.name}: ${ValType.toTypeString(p.`type`)})""").mkString(",")} )).asJava
|""".stripMargin
}
......
......@@ -18,7 +18,7 @@ package org.openmole.core.outputmanager
import java.io.{ OutputStream, PrintStream }
import org.openmole.tool.types.ClassUtils
import org.openmole.tool.types.TypeTool
import scala.collection.mutable
import org.openmole.tool.stream._
......@@ -82,12 +82,12 @@ object OutputManager {
def redirectSystemOutput(ps: PrintStream) = {
System.setOut(ps)