1f95a3fa9f98628afe461d60b6a51a1fca39f034
[Mograsim.git] / docs / building_mograsim.md
1 # Building Mograsim
2
3 These is a very basic instruction set for building Mograsim from source. 
4
5 It assumes you know nothing about Eclipse Plug-In development, Maven, or Git.
6
7 ## Prerequisites
8
9 - [Java JDK](http://jdk.java.net/) 11 or later (or [Oracle Implementation](https://www.oracle.com/technetwork/java/javase/downloads/index.html))
10 - [Eclipse](https://www.eclipse.org/downloads/) 2019-03 or later (TODO: do earlier versions work?)
11 - _(optional)_ [Git](https://git-scm.com/downloads)
12
13 ## Install PDE (Plugin Development Environment)
14
15 1. In Eclipse, click on "Help" -> "Install New Software...".
16 2. Next to "Work With:", select "The Eclipse Project Updates".
17 3. Tick "Eclipse PDE Plug-in Developer Resources" (expand "Eclipse Plugin Development 
18    Tools" or type "PDE" in the search bar to see it).
19 4. Click on "Next >" two times, read and accept the license, and click on "Finish".
20 5. Wait for the installation to complete (may take a while). When prompted, restart 
21    Eclipse.
22
23 ## Clone the Git repository and import the projects
24
25 Can be done via Git or via EGit (Eclipse Git).
26
27 ### a) via EGit
28
29 1. In Eclipse, click on "Window" -> "Show View" -> "Other...".
30 2. Select "Git Repositories" (expand "Git" to see it); click on "Open".
31 3. In the "Git Repositories" view, click on "Clone a Git repository".
32 4. Enter the repository URL ("Host", "Repository path", and "Protocol" should fill 
33    automatically); click on "Next >".
34 5. Select only "master"; click on "Next >".
35 6. Enter the directory you want the Mograsim projects to be saved in.
36 7. Tick "Clone submodules" and "Import all existing Eclipse projects after clone 
37    finishes"; click on "Finish".
38
39 ### b) via Git (requires Git to be installed)
40
41 1. In a command prompt (Terminal on Linux; git-bash on Windows), execute `git clone 
42    --recurse-submodules --single-branch -b master <repository URL> <target directory>`.
43 2. _(optional)_ Import the repository in Eclipse:
44     1. In Eclipse, open the "Git Repositories" view as described in the first two 
45        steps in **a)**.
46     2. In the "Git Repositories" view, click on "Add an existing local Git repository".
47     3. Enter the directory of the repository and tick the repository you see in the 
48        list below; click on "Add". (If there is another repository ending with "SWTHelper", 
49        ignore it).
50 3. Import the projects into the workspace:
51     1. Click on "File" -> "Import...".
52     2. Select "Existing Projects into Workspace" (expand "General" to see it); click 
53        on "Next >".
54     3. Tick "Select root directory:" and "Search for nested projects".
55     4. Next to "Select root directory:", enter the directory of the repository; click 
56        on "Finish".
57
58 Note: After importing the projects, probably an automatic workspace build will start. 
59 Wait for it to finish before continuing.
60
61 ## Do the Maven Tycho workaround:
62
63 In the project explorer or package explorer, right-click on "net.mograsim.tycho-download", 
64 click on "Run As" -> "Maven clean" and wait for it to finish.
65
66 ## Build the Update Site
67
68 1. In the project explorer or package explorer, right-click on "net.mograsim", click 
69    on "Run As" -> "Maven build...".
70 2. Next to "Goals", enter "clean verify"; click on "Run" and wait for it to finish 
71    (this will take a while).
72 3. Select all projects, right-click, and click on "Refresh".
73
74 The update site now should be built and is located in net.mograsim.plugin.updatesite/target/repository. 
75 In there you should see, among other files, a folder named "features", a folder named 
76 "plugins" containing some jar files, and two jar files called "artifacts.jar" and 
77 "content.jar".
78
79 To install Mograsim from this site, follow the [Getting Started](getting_started.md) guide,
80 but in the dialog for adding a software site, instead of using the online update site address,
81 click on "Local..." and select `<repository directory>/releng/net.mograsim.plugin.updatesite/target/repository/`.
82
83 More information about the build, structure and environment can be found in the [development environment description](development_environment.md).