Skip to content

Commit

Permalink
refactor const and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Aug 20, 2023
1 parent fde3d58 commit 02b9c03
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 12 deletions.
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ This file defines all your project information that is needed in order to run an
Example:
```json
{
// The title of your project
"name" : "OIS simulation",
// The state that will be activated when running the simulation
"initialState" : "Green",
"name" : "OIS simulation", // The title of your project
"initialState" : "Green", // The state that will be activated when running the simulation
// Map of all the implemented IState classes in your project and their keys.
"states" : {
"Blue" : "org.example.BlueState",
Expand All @@ -126,20 +124,25 @@ Example:
},
// The deployer configurations
"runner" : {
// OIS runner version
"version" : "1.0-SNAPSHOT",
// The platforms that the simulation will run on, must define at least one
// Options: 'Desktop'
"types" : [ "Desktop" ],
"assetsDirectories" : [ ]
"version" : "0.1", // OIS runner version
// The platforms that the simulation will run on, must define at least one
"types" : [ "Desktop" ]
}
}
```
Optionally - You can also control where to read the `simulation.ois` file by adding the plugin Extension to your `build.gradle`:
### Plugin Extension
To allow smooth development, you can optionally override some project `simulation.ois` or plugin configurations by specific the `oisDeployer` extension in your `build.gradle`:
```groovy
oisDeployer {
// Instead of resolving the runner base on its version in simulation.ois,
// Run the runner project from this directory.
runnerPath = 'path-to-dir-of-specific-runner'
// Instead of getting the project configurations from the `simulation.ois` file in the project root directory,
// Get project configurations from this file.
configPath = 'path-to-your-simulation-config-file'
// Instead of resolving the assets directory from your project resources, resolve from this path.
assetsPath = 'path-to-your-resources-dir'
}
```
Expand All @@ -151,7 +154,7 @@ All the task exposed by the plugin are grouped under the group `ois`.
### 🌱 Develop your project
Read the [user guide](https://github.com/attiasas/open-interactive-simulation-core/USER_GUIDE.md) in the core library.
Read the [user guide](https://github.com/attiasas/open-interactive-simulation-core/blob/master/USER_GUIDE.md) in the core library.
### 👀 Run your project
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.attias.open.interactive.simulation.deployer;

import org.attias.open.interactive.simulation.core.backend.engine.AppConfiguration;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Constant {
public static final String OIS = "ois";
public static final String GROUP_NAME = OIS;
public static final String FILE_SUFFIX = "." + OIS;
public static final String PROJECT_CONFIG_FILE_NAME = "simulation" + FILE_SUFFIX;

public static final Path HOME_PATH = Paths.get(System.getProperty("user.home"), FILE_SUFFIX);
public static final Path RUNNERS_PATH = HOME_PATH.resolve("runners");
public static final String DEFAULT_RUNNER_VERSION = "0.1";

public static final String DEFAULT_PROJECT_TITLE = "OIS Simulation";
public static final Set<AppConfiguration.AppType> APP_TYPES = new HashSet<>(List.of(AppConfiguration.AppType.Desktop));

public static final String OIS_RUNNER_GIT_REPO = "https://github.com/attiasas/open-interactive-simulation-runner.git";
public static final String EXTENSION_NAME = "oisDeployer";

public static final String INIT_TASK_NAME = "initializeDeployer";
public static final String INIT_TASK_DESCRIPTION = "Initialize the simulation deployer resources before running related tasks";

public static final String RUN_DESKTOP_TASK_NAME = "runDesktop";
public static final String RUN_DESKTOP_TASK_DESCRIPTION = "Runs the simulation using desktop";
}

0 comments on commit 02b9c03

Please sign in to comment.