Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Orion/Getting the source"

(Accessing the code)
(Self-hosting)
 
(64 intermediate revisions by 18 users not shown)
Line 1: Line 1:
This page covers how to take a look at the source, as well as how to set up for self-hosting (changing Orion code from Orion).
+
This page covers how to get the Orion source code, as well as how to get started editing the source.
See the [[Orion/Releng_Builds|Releng Builds]] page for details on how to contribute changes to the build.
+
  
== Accessing the code ==
+
== What you need ==
Source for Orion can be forked from our [[Git]] repositories:
+
* Basic knowledge of the Git version control system. (New to Git? [http://githowto.com/ Here's an introduction]).
 +
* (Optional) An [http://download.eclipse.org Eclipse IDE]. "Eclipse IDE for Eclipse Committers" is recommended.
 +
* (Optional) An [http://download.eclipse.org/orion/ Orion build].
  
* {{Git|orion|org.eclipse.orion.client.git}}
+
If you're interested in contributing changes to Orion, you must do a few additional things:
* {{Git|orion|org.eclipse.orion.server.git}}
+
* [https://dev.eclipse.org/site_login/ Create an Eclipse developer account].
 
+
* Sign the [https://projects.eclipse.org/user/sign/CLA Contributor License Agreement] (CLA).
You can also view/fork our mirrors on GitHub:
+
  
 +
== Orion repositories ==
 +
The Orion source code lives in four [https://github.com GitHub] repositories:
 
* https://github.com/eclipse/orion.client
 
* https://github.com/eclipse/orion.client
 
* https://github.com/eclipse/orion.server
 
* https://github.com/eclipse/orion.server
 +
* https://github.com/eclipse/orion.server.node
 +
* https://github.com/eclipse/orion.electron
  
== Self hosting using orion.eclipse.org ==
+
== Cloning the repositories ==
Eclipse committers can self host with our demo server located at [http://orion.eclipse.org orion.eclipse.org]. See [[Orion/Selfhosting | Selfhosting]] for instructions.
+
==== HTTPS ====
 +
To checkout our repositories, you'll generally perform the following commands in your command shell:
 +
git clone https://github.com/eclipse/orion.client.git
 +
git clone https://github.com/eclipse/orion.server.git
 +
git clone https://github.com/eclipse/orion.server.node.git
 +
git clone https://github.com/eclipse/orion.electron.git
  
== Self hosting using local server ==
+
==== GIT ====
We assume you are familiar with git. If not, review the [[Git | Eclipsepedia Git Page]]. You can use [http://www.eclipse.org/egit/ EGit] (the Eclipse Git client) or the command-line Git client. If you are on Windows, use msysgit if you prefer the command line git client.
+
The '''git''' protocol can be used instead of https:
 +
  git clone git@github.com:eclipse/orion.client.git
 +
git clone git@github.com:eclipse/orion.server.git
 +
git clone git@github.com:eclipse/orion.server.node.git
 +
git clone git@github.com:eclipse/orion.electron.git
  
Self-hosting locally involves running an Orion server on localhost, pointing your Orion editor at your local git repo directories, and working within Orion to make changes. Changes are committed using the command-line tools (or EGit), as a separate phase from the Orion workflow. Orion M6 will support an integrated Git workflow; see [[Orion/How Tos/Working with git | Working with git]].
+
== Self-hosting ==
 +
To edit Orion's own source code using Orion, there's a few different ways we can do it. Here are our options:
 +
; [[Orion/Selfhosting|Pure cloud]]
 +
: Using a cloud deployment of Orion (like [http://orionhub.org/ OrionHub], a public Orion server that anyone can use), you checkout the Orion source code using Orion's built-in Git features, then edit and test it. There's no software install; all you need is a web browser. Since you don't control the server, this method only allows you to hack on the Orion client code. See [[Orion/Selfhosting|Selfhosting]] for instructions.
 +
; [[#Self-hosting on your local computer using Eclipse IDE|Self-hosting on your local computer using Eclipse IDE]]
 +
: This method requires the Eclipse IDE. On your local computer, you checkout the Orion source code from a Git repository, and launch the Orion server from your Eclipse IDE. You can develop both client-side and server-side code using this method.
 +
; [[#Self-hosting on your local computer using Node.js|Self-hosting on your local computer using Node.js]]
 +
: This method uses [http://nodejs.org Node.js] to run a local Orion server, with Orion development tools running in the browser.
  
 +
== Self-hosting on your local computer using Eclipse IDE ==
 +
Self-hosting locally involves running an Orion server on your local workstation, pointing your Orion editor at your local Git repository, and working within Orion to make changes. Changes are committed using any Git client; for instructions on Orion's Git features, see [[Orion/How Tos/Working with git | Working with git]].
 
Here are the steps needed to get up and running.
 
Here are the steps needed to get up and running.
 +
=== Install the Eclipse SDK ===
 +
* When working with the latest Orion code from master you will need a recent stable build of the Eclipse SDK to run the server. You can download an Eclipse SDK from [http://download.eclipse.org/eclipse/downloads/ eclipse.org].
 +
* If you use an older version of Eclipse, such as a Eclipse 4.2.2 or earlier, you may get a warning indicating that you are attempting to launch an application that is using a newer version of Eclipse.  There are no known issues launching the server from Eclipse 4.2 Juno or 4.3 Kepler, but it is recommended you use a more recent release. See [https://bugs.eclipse.org/bugs/show_bug.cgi?id=409440 Bug 409440] for more information.
 +
* You should also install the [http://www.eclipse.org/egit/ Eclipse Git Team Provider] package via Help > Install New Software. Select the '''Luna''' repository and search for 'Eclipse Git Team Provider' to find the package.
 +
* At the same time, install the [http://www.eclipse.org/webtools/ Eclipse Web Developer Tools] package to view and edit the HTML, CSS and JavaScript source within Eclipse.
  
=== Getting the Source onto your computer ===
+
=== Clone the client and server Git repositories into Eclipse ===
* '''For committers:''' Ensure that your user name and email are set up properly so that your email matches the foundation's email address on record. Otherwise you can't push changes.  See [[Git#Committers_new_to_Git]]
+
* Start Eclipse and create a new workspace.
* Clone the Orion client and server repositories using the URLs below. Choose a target directory that works for you. You'll be importing this code later into Eclipse in order to run your changes on the local server.
+
* Clone the Orion client repository:
<br>For committers:<br>
+
** Open the Git Repository Exploring perspective.
    git clone ssh://myCommitterId@git.eclipse.org/gitroot/orion/org.eclipse.orion.client.git
+
** Select Clone a Git Repository.
    git clone ssh://myCommitterId@git.eclipse.org/gitroot/orion/org.eclipse.orion.server.git
+
** Specify a Location URI '''https://github.com/eclipse/orion.client.git''' and click Next on the Source Git Repository page.
<br>For everybody else:<br>
+
** Click Next on the Branch Selection page to accept the defaults.
    git clone http://git.eclipse.org/gitroot/orion/org.eclipse.orion.client.git
+
** At the Local Destination page, the directory can be placed in a new git folder under your workspace folder so all your files are within the workspace tree (the default is under your user home folder).
    git clone http://git.eclipse.org/gitroot/orion/org.eclipse.orion.server.git
+
** Also select '''Import all existing projects after clone finishes''' so all the projects are loaded into your workspace.
 +
** You may also wish to assign a working set such as '''orion.client''' to group the client projects via the Working Sets section of the page.
 +
** Click Finish on the Local Destination page to clone the repository.
 +
* Repeat the steps above to clone the Orion server repository.
 +
** Specify the Location URI '''https://github.com/eclipse/orion.server.git'''.
  
 +
=== Specify a target to build your Orion server ===
 +
* After loading in the client and server projects, a number of the server projects will have compile errors due to missing dependencies. We need to add the required content to the target platform. The source code includes a target definition for your self-hosting workspace.
 +
* Check that you have the '''org.eclipse.orion.target''' project in your workspace
 +
* Open Window > Preferences > Plug-in Development > Target Platform
 +
* Check the '''org.eclipse.orion''' target definition and press OK.
 +
* The requisite plug-ins will be downloaded from the repositories. This step will take some time. The progress view will have a job called '''Resolving Target Definition'''.
 +
* When complete, your projects will build and the compiler errors will be resolved.
  
Make sure that you have Git 1.7 or higher when using Git with http protocol.
+
Alternatively, you can open the '''org.eclipse.orion.target.target''' file in the Eclipse Target Definition editor. Upon opening, the target content will be downloaded.  When complete, you can press the '''Set as Target Platform''' link in the top right corner to update the target platform.
  
If Git clone fails you can also try the git protocol
+
=== Set up the server configuration file ===
    git clone git://git.eclipse.org/gitroot/orion/org.eclipse.orion.client.git
+
* The launch configuration we will use is associated with a [[Orion/Server_admin_guide|Orion server configuration file]] called '''web-ide.conf'''. This file controls which directories the Orion server can access on your machine, among other things.
    git clone git://git.eclipse.org/gitroot/orion/org.eclipse.orion.server.git
+
*Since we want to use Orion to edit its own source code, we have to ensure the Orion server can access the files in your local git repo.
 +
** Add a line like this to web-ide.conf: <br><pre>orion.file.allowedPaths=C:\\Users\\orionfan\\workspace\\git</pre>The path points to under the git folder where you checked out the Orion source code. (Windows paths must be separated with '''double backslashes'''!)
 +
=== Run the Orion server ===
 +
* Open the '''Run->Run Configurations''' dialog, expand '''OSGi Framework''', and select the OSGi Framework launch called '''web-ide'''.
 +
* Run the launch configuration (click the '''Run''' button from the launch configuration dialog, or use the '''Run''' command on the Eclipse toolbar.)
 +
* Point your browser at [http://localhost:8080 http://localhost:8080].
 +
* You'll be prompted to login (create an account).
 +
* Once logged in, you'll see an empty Navigator view. Click the '''New''' button and choose '''Link to Server'''.
 +
* Type a name (for example, "Orion Client") and in the '''Server Path''' field, enter the path to the Orion code on your local machine.
 +
** The path must be of one of the <code>orion.file.allowedPaths</code> entries we created in the previous section (or a subfolder thereof).
 +
** For example, if you wanted to make changes to the client, you might link to the following file path:<br><pre>C:\Users\orionfan\workspace\git\org.eclipse.orion.client</pre>
 +
<!--* Repeat the previous step to add links for each git repository that you care about.-->
 +
* You should see the folders show up in your Orion explorer:<br>[[Image:orion-navexample30M2.jpg]]
 +
* From here, you can start editing files. As you make changes to the client code, you can simply reload the corresponding page in your browser to see the changes. We recommend you keep a browser tab open with a stable editor and stable navigator, and open a new tab for reloading and trying changes.  In this way, you'll always have a couple of safe browser tabs to use to revert changes if you break something!
  
=== Install the Eclipse SDK ===
+
== Self-hosting on your local computer using Node.js ==
* You can use any recent stable build of the Eclipse SDK to run the server, such as [http://download.eclipse.org/eclipse/downloads/drops/R-3.7.1-201109091335/index.php Eclipse 3.7.1].
+
  
=== Load the source into Eclipse ===
+
=== Installing from source ===
* [http://download.eclipse.org/orion/ Download] a stable orion build (latest integration build is the current recommendation) and unpack it somewhere on your hard disk. This download will be used as a so-called "target platform" when you run the server from Eclipse.
+
#Make sure you have Node.js and npm installed. See [http://nodejs.org/download/ nodejs.org] for details.
** Occasionally, new dependencies are introduced in the server and you will need to take a nightly build to keep up-to-date. Check the [https://dev.eclipse.org/mailman/listinfo/orion-dev orion-dev mailing list] if you aren't sure which build to take.
+
#[[Orion/Getting_the_source#Getting_the_source_onto_your_computer|Get the Orion source]]. You only need to get the [http://git.eclipse.org/c/orion/org.eclipse.orion.client.git client source].
* Create a new workspace using your Eclipse SDK.
+
#Open a command shell and change directory to '''org.eclipse.orion.client/modules/orionode'''.
* Use the '''File->Import->General->Existing Projects into Workspace''' wizard.  In the wizard, set the root directory for the import to whatever directory you used when you cloned the Git repositories.  You'll know you have the right path when you see a bunch of org.eclipse.orion.* projects in the project list. 
+
#Run the <code>npm install</code> command to automatically download Orionode's dependencies.
* Ensure that '''Copy projects into workspace''' is ''not'' checked. Feel free to import just a subset of the projects (for example, just client plugins) - the remaining ones will come from the 'target platform'.
+
#*If you're not interested in developing the server, you can instead run <code>npm install --production</code>, which omits the dev-time dependencies for a smaller download.
* The projects should appear in your workspace.  Don't worry about compile errors just yet until after you've set up the target platform.
+
#Edit the '''modules/orionode/orion.conf''' file, adding the ''workspace'' entry: <pre>workspace=/home/orionfan/workspace/org.eclipse.orion.client</pre>
* Now you need to set up a target that points to the Orion build you downloaded.  ('''Window->Preferences->Plug-in Development->Target Platform'''). 
+
#* For more information on working with the node.js server, refer to the Orion-node.js README: '''modules/orionode/README.md'''
** Add a target
+
** Initialize the target definition with "Nothing", Next...
+
** In the '''Locations''' tab, click '''Add...''' , Select '''Installation''', click "Next", click "Browse...", and point to the eclipse directory of your stable Orion build
+
** Once you finish the wizard, you'll have a new target definition available in the list of targets.
+
** Make this the active target definition for your self-hosting workspace.<br>[[Image:orion-targetdefinition.png]]
+
* Your workspace will be rebuilt and compile errors should disappear. There might be a few errors related to unsatisfied dependencies from test plugins, but you can ignore them for now.
+
  
=== Set up the launch to run from source ===
+
=== Concatenation and Minification ===
The plugin source you've loaded into Eclipse can now overwrite the plugins in the working stable build.
+
By default the pages served up by Orionode are not concatenated or minified, so they will load rather slowly. You can mitigate this by running the client-side build. To do this, just run <code>build.js</code>, found in the <code>org.eclipse.orion.client/modules/orionode/build</code> directory:
 +
  node ./build/build.js
 +
{{warning| Running the script will overwrite files in your working directory! Make sure anything important is committed to a branch first.}}
  
* Open the '''Run->Run Configurations''' dialog, expand OSGi Framework, and select the OSGi Framework launch called "web-ide"
+
Clear your browser cache. The next time you load Orionode, it should be much faster.
* The Orion server configuration file associated with this launch configuration is called web-ide.conf. This file controls which directories the Orion server can access on your machine (among other things). You want to ensure the Orion server can update the files in your local git repo.  Use whatever path format makes sense on your platform.  Whatever format you use must match exactly what you type later into the "Link folder" dialog in Orion.  (So if you use drive letters and back slashes on windows, you'll need to use the same format in the web client.)<br><pre>orion.file.allowedPaths=C:\\workspaces\\orion</pre>
+
* If you only want to work on the client (not the server), you can now close the server projects (5 client projects should remain).
+
* On "Bundles" pick "Launch with features selected below". Ensure there are five Orion features selected (see image below)
+
[[Image:Orion-launch-config.png]]
+
  
=== Running the server ===
+
=== Running tests ===
* Run the launch and point your browser at [http://localhost:8080 http://localhost:8080]
+
 
* You'll be prompted to login (create an account).
+
The Orion node server has its own test suite. See [[Orion/Running_the_tests#Node.js_Server_Tests]] for more details.
* Once logged in, you'll see a landing page with descriptions of some basic tasks you can perform. You can ignore this, and click "Navigator" in the menu at the top right.
+
 
* Click the Link Folder button on the toolbar and add a folder that links to your local git repos.  For example, if you wanted to make changes to the client, you could link a folder named "Orion Client" to the following file path:<br><pre>c:\myLocalGitRepos\org.eclipse.orion.client</pre>
+
== Related links ==
* Repeat the previous step to add links for each git repository that you care about.
+
 
* You should see the folders show up in your Orion explorer:<br>[[Image:orion-navexampleM6.png]]
+
See the [[Orion/Releng_Builds|Releng Builds]] page for details on how to contribute changes to the Orion build.
* From here, you can start editing files. As you make changes to the client code, you can simply reload the corresponding page in your browser to see the changes. We recommend you keep a browser tab open with a stable editor and stable navigator, and open a new tab for reloading and trying changes.  In this way, you'll always have a couple of safe browser tabs to use to revert changes if you break something!
+
  
 +
See the cloud [[Orion/Selfhosting|Selfhosting]] page for details on self-hosting purely from the browser
  
 
[[Category:Orion|Getting the source]]
 
[[Category:Orion|Getting the source]]

Latest revision as of 18:04, 11 April 2017

This page covers how to get the Orion source code, as well as how to get started editing the source.

What you need

If you're interested in contributing changes to Orion, you must do a few additional things:

Orion repositories

The Orion source code lives in four GitHub repositories:

Cloning the repositories

HTTPS

To checkout our repositories, you'll generally perform the following commands in your command shell:

git clone https://github.com/eclipse/orion.client.git
git clone https://github.com/eclipse/orion.server.git
git clone https://github.com/eclipse/orion.server.node.git
git clone https://github.com/eclipse/orion.electron.git

GIT

The git protocol can be used instead of https:

git clone git@github.com:eclipse/orion.client.git
git clone git@github.com:eclipse/orion.server.git
git clone git@github.com:eclipse/orion.server.node.git
git clone git@github.com:eclipse/orion.electron.git

Self-hosting

To edit Orion's own source code using Orion, there's a few different ways we can do it. Here are our options:

Pure cloud
Using a cloud deployment of Orion (like OrionHub, a public Orion server that anyone can use), you checkout the Orion source code using Orion's built-in Git features, then edit and test it. There's no software install; all you need is a web browser. Since you don't control the server, this method only allows you to hack on the Orion client code. See Selfhosting for instructions.
Self-hosting on your local computer using Eclipse IDE
This method requires the Eclipse IDE. On your local computer, you checkout the Orion source code from a Git repository, and launch the Orion server from your Eclipse IDE. You can develop both client-side and server-side code using this method.
Self-hosting on your local computer using Node.js
This method uses Node.js to run a local Orion server, with Orion development tools running in the browser.

Self-hosting on your local computer using Eclipse IDE

Self-hosting locally involves running an Orion server on your local workstation, pointing your Orion editor at your local Git repository, and working within Orion to make changes. Changes are committed using any Git client; for instructions on Orion's Git features, see Working with git. Here are the steps needed to get up and running.

Install the Eclipse SDK

  • When working with the latest Orion code from master you will need a recent stable build of the Eclipse SDK to run the server. You can download an Eclipse SDK from eclipse.org.
  • If you use an older version of Eclipse, such as a Eclipse 4.2.2 or earlier, you may get a warning indicating that you are attempting to launch an application that is using a newer version of Eclipse. There are no known issues launching the server from Eclipse 4.2 Juno or 4.3 Kepler, but it is recommended you use a more recent release. See Bug 409440 for more information.
  • You should also install the Eclipse Git Team Provider package via Help > Install New Software. Select the Luna repository and search for 'Eclipse Git Team Provider' to find the package.
  • At the same time, install the Eclipse Web Developer Tools package to view and edit the HTML, CSS and JavaScript source within Eclipse.

Clone the client and server Git repositories into Eclipse

  • Start Eclipse and create a new workspace.
  • Clone the Orion client repository:
    • Open the Git Repository Exploring perspective.
    • Select Clone a Git Repository.
    • Specify a Location URI https://github.com/eclipse/orion.client.git and click Next on the Source Git Repository page.
    • Click Next on the Branch Selection page to accept the defaults.
    • At the Local Destination page, the directory can be placed in a new git folder under your workspace folder so all your files are within the workspace tree (the default is under your user home folder).
    • Also select Import all existing projects after clone finishes so all the projects are loaded into your workspace.
    • You may also wish to assign a working set such as orion.client to group the client projects via the Working Sets section of the page.
    • Click Finish on the Local Destination page to clone the repository.
  • Repeat the steps above to clone the Orion server repository.

Specify a target to build your Orion server

  • After loading in the client and server projects, a number of the server projects will have compile errors due to missing dependencies. We need to add the required content to the target platform. The source code includes a target definition for your self-hosting workspace.
  • Check that you have the org.eclipse.orion.target project in your workspace
  • Open Window > Preferences > Plug-in Development > Target Platform
  • Check the org.eclipse.orion target definition and press OK.
  • The requisite plug-ins will be downloaded from the repositories. This step will take some time. The progress view will have a job called Resolving Target Definition.
  • When complete, your projects will build and the compiler errors will be resolved.

Alternatively, you can open the org.eclipse.orion.target.target file in the Eclipse Target Definition editor. Upon opening, the target content will be downloaded. When complete, you can press the Set as Target Platform link in the top right corner to update the target platform.

Set up the server configuration file

  • The launch configuration we will use is associated with a Orion server configuration file called web-ide.conf. This file controls which directories the Orion server can access on your machine, among other things.
  • Since we want to use Orion to edit its own source code, we have to ensure the Orion server can access the files in your local git repo.
    • Add a line like this to web-ide.conf:
      orion.file.allowedPaths=C:\\Users\\orionfan\\workspace\\git
      The path points to under the git folder where you checked out the Orion source code. (Windows paths must be separated with double backslashes!)

Run the Orion server

  • Open the Run->Run Configurations dialog, expand OSGi Framework, and select the OSGi Framework launch called web-ide.
  • Run the launch configuration (click the Run button from the launch configuration dialog, or use the Run command on the Eclipse toolbar.)
  • Point your browser at http://localhost:8080.
  • You'll be prompted to login (create an account).
  • Once logged in, you'll see an empty Navigator view. Click the New button and choose Link to Server.
  • Type a name (for example, "Orion Client") and in the Server Path field, enter the path to the Orion code on your local machine.
    • The path must be of one of the orion.file.allowedPaths entries we created in the previous section (or a subfolder thereof).
    • For example, if you wanted to make changes to the client, you might link to the following file path:
      C:\Users\orionfan\workspace\git\org.eclipse.orion.client
  • You should see the folders show up in your Orion explorer:
    Orion-navexample30M2.jpg
  • From here, you can start editing files. As you make changes to the client code, you can simply reload the corresponding page in your browser to see the changes. We recommend you keep a browser tab open with a stable editor and stable navigator, and open a new tab for reloading and trying changes. In this way, you'll always have a couple of safe browser tabs to use to revert changes if you break something!

Self-hosting on your local computer using Node.js

Installing from source

  1. Make sure you have Node.js and npm installed. See nodejs.org for details.
  2. Get the Orion source. You only need to get the client source.
  3. Open a command shell and change directory to org.eclipse.orion.client/modules/orionode.
  4. Run the npm install command to automatically download Orionode's dependencies.
    • If you're not interested in developing the server, you can instead run npm install --production, which omits the dev-time dependencies for a smaller download.
  5. Edit the modules/orionode/orion.conf file, adding the workspace entry:
    workspace=/home/orionfan/workspace/org.eclipse.orion.client
    • For more information on working with the node.js server, refer to the Orion-node.js README: modules/orionode/README.md

Concatenation and Minification

By default the pages served up by Orionode are not concatenated or minified, so they will load rather slowly. You can mitigate this by running the client-side build. To do this, just run build.js, found in the org.eclipse.orion.client/modules/orionode/build directory:

 node ./build/build.js
Warning2.png
Running the script will overwrite files in your working directory! Make sure anything important is committed to a branch first.


Clear your browser cache. The next time you load Orionode, it should be much faster.

Running tests

The Orion node server has its own test suite. See Orion/Running_the_tests#Node.js_Server_Tests for more details.

Related links

See the Releng Builds page for details on how to contribute changes to the Orion build.

See the cloud Selfhosting page for details on self-hosting purely from the browser

Back to the top