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 "Xtext/Contributor Guide"

m
(29 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Xtext}} {{:DocumentationGuidelines/DraftHeader}}  
+
{{Xtext}}
== Prerequisites ==
+
== User Account ==
=== User Account ===
+
 
We use [https://git.eclipse.org/r/ eclipse gerrit review server]. To use the review server a few steps are required:
+
We use eclipse [https://git.eclipse.org/r/ eclipse gerrit review server] to review and manage new contributions. You need to perform the following few steps to be able to use the Gerrit server:  
 +
 
 
* Register an Eclipse.org account at [https://dev.eclipse.org/site_login/createaccount.php dev.eclipse.org]. The same account is used for [https://bugs.eclipse.org/bugs Bugzilla] and [https://git.eclipse.org/r Gerrit]. If you are an Eclipse committer you already have one.  
 
* Register an Eclipse.org account at [https://dev.eclipse.org/site_login/createaccount.php dev.eclipse.org]. The same account is used for [https://bugs.eclipse.org/bugs Bugzilla] and [https://git.eclipse.org/r Gerrit]. If you are an Eclipse committer you already have one.  
* [https://git.eclipse.org/r/#settings,http-password Define a username]
+
* [https://git.eclipse.org/r/#settings,http-password Define a username]  
* [https://git.eclipse.org/r/#settings,ssh-keys Upload your public ssh-key] for authentication
+
* [https://git.eclipse.org/r/#settings,ssh-keys Upload your public SSH key] for authentication. For more information about ssh authentication and how to generate an SSH key, refer to [https://help.github.com/articles/generating-ssh-keys this site]. Make sure that you use the same email address for your SSH key as you did for your eclipse account to avoid authentification issues.
=== Eclipse Distribution ===
+
* You need to sign Eclipse's new [http://wiki.eclipse.org/CLA CLA] to be able to push on Gerrit. You can do that after you log in at the [https://projects.eclipse.org/user/login/sso Eclipse projects forge] site, using your eclipse account.
Download Full eclipse from [http://www.eclipse.org/Xtext/download.html Xtext website] or use the [http://www.eclipse.org/downloads/ eclipse DSL Package]  
+
<br><br>
+
  
== Let Buckminster setup your Xcontributor environment ==
+
== Setup Development Environment ==
  
We provide an ant script which installs and runs [[Buckminster]]. Buckminster will do the most off necessary steps to crete a contributor workspace for you.  
+
The Xtext team uses [[Eclipse_Oomph_Installer|Oomph]] to setup the developer environment.
 +
Download The Oomph installer and start it.
  
What does this script do in detail:  
+
* On the initial page, click on the ''Switch to advanced mode'' button in the top right.
 +
* On the '''Product''' page, select "Eclipse IDE for Eclipse Committers (Mars)" or newer.
 +
* On the '''Projects''' page, double-click ''Xtext -> Core'' and select the ''master'' stream.
 +
* On the '''Variables''' page, select ''Luna'' as "Target Platform". It is recommended to use the ''SSH (read-write, gerrit)'' setting as "Xtext Git or Gerrit Repository". You may choose yourself which settings to enter for the other options on this wizard page. They are well documented in the Oomph installer (click the question mark in the bottom left). Here is an example how it could finally look like:
  
*create an eclipse workspace
+
[[File:variables-wiz-page.png]]
*clone the Xtext git repository
+
*populate workspace with necessary projects
+
*create and set api baseline
+
*create and set a target platform
+
*set some important workspace settings
+
*perform gerrit setup
+
  
=== Run the script  ===
+
Now you can complete the installation wizard with the ''Finish'' button.
  
Run the ant script located [http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/plain/devtools/org.eclipse.xtext.contributor/workspace.ant here]. In unix you can use following commands:
+
First Oomph will create a new eclipse installation for you. Downloading required files may take a while.
<source lang="bash">
+
You can close the Oomph installer after your fresh eclipse installation starts.
wget -N http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/plain/devtools/org.eclipse.xtext.contributor/workspace.ant
+
In the started eclipse, you will see a startup tasks execution running. Initially it may take a while because it clones the Xtext git repository. In order to see the setup progress details, click the icon left to "Executing startup tasks" in the status bar. Wait for the setup to complete and restart Eclipse when prompted.
ant -f workspace.ant
+
</source>
+
If it's the first time you are cloning Xtext repository, the script will ask you to input your bugzilla/gerrit id in order to create the necessary entries in the git configuration file, so you can push to gerrit review server. You can also skip this step by leaving your input empty and manually set up your local git repository. [[Gerrit|Here]] you can find a good description.
+
  
=== Start eclipse ===
+
After initial setup is done, you should check which version of JDK is used for the JavaSE-1.6 execution environment. Go to ''Eclipse preferences -> Java -> Installed JREs -> Execution Environments''. Select JavaSE-1.6 and set a compatible JRE to Java less than 1.8.
Start your eclipse and choose ${user.home}/workspaces/xtext-sources as eclipse workspace
+
Clean build the workspace after changing this setting.
=== Setup working sets ===
+
* In "Package Explorer" - view, select "Top level elements -> Working sets"
+
* Select File -> Import -> Team -> Team Project Set.
+
* Point to the following URL http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/plain/devtools/org.eclipse.xtext.contributor/projectSet.psf
+
* Perform import
+
<br> <br>
+
== Using git  ==
+
  
As git client you may use whatever you want, the important thing is after setup your config looks like this:  
+
[[File:setup-jre-page.png]]
  
<br>
+
 
 +
== Contributing Changes ==
 +
 
 +
If you have followed the recommendations in the section above, the Oomph installer has already configured your local repository to push changes to the Xtext Gerrit repository. To contribute your changes, commit them using ''Team -> Commit'' and finally, if you feel ready to push, push them to the remote Gerrit server using ''Team -> Remote -> Push to Gerrit''.
 +
 
 +
=== Contribution Monitoring ===
 +
After you have pushed your first commit to Gerrit, it will be reviewed on the [https://hudson.eclipse.org/sandbox/job/xtext.gerrit/ hudson review server].
 +
If all tests pass, a manual review will be done by one of the Xtext committers. If everything looks good, your contribution will be pushed to the master repository and you can install it from the regular [https://hudson.eclipse.org/hudson/job/Xtext-nightly-HEAD/ eclipse hudson server].
 +
 
 +
=== Browse Sources Online ===
 +
Xtext and Xtend are hosted in git. You can browse the repository in cgit here [http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/ Xtext/Xtend repository].
 +
 
 +
=== Helpful Sites  ===
 +
 
 +
* [[Gerrit|Using Gerrit hosted at eclipse]]
 +
 
 +
----
 +
 
 +
=== Using a Git Console Application (optional) ===
 +
 
 +
You may use whatever git client you like. The important thing is that finally your local git configuration should look similar to this:
  
 
<code>
 
<code>
Line 62: Line 69:
 
</code>
 
</code>
  
 +
You can find the configuration file (called "config") in the root of your local repository, in the hidden folder ".git".
  
=== Pulling changes from server ===
+
==== Pulling Changes from the Server ====
 +
To fetch the last changes run:
  
 
<code>git pull origin master</code>  
 
<code>git pull origin master</code>  
  
=== Pushing to review server ===
+
==== Committing Your Changes ====
  
<code>git push origin master</code>
+
After you made your changes to the source code, you have to commit them locally:
  
=== Helpful sites  ===
+
<code>git commit -a -s -m "Bug 390852: my first contribution"</code>
  
[[Gerrit]]
+
-a performs 'add' and 'remove' operations to modified and removed files (new files git does not know about won't be affected)<br>
 +
-s is necessary to 'sign-off' your commit; refer to section [http://wiki.eclipse.org/Xtext/Contributor_Guide#User_Account User Account] to make sure you signed the CLA!<br>
 +
-m stands for message. It's common to refer to an existing bug report, in this example [https://bugs.eclipse.org/bugs/show_bug.cgi?id=390852 390852], in your commit message<br>
 +
Now if you call <code>git status</code>, you will see one outgoing change:
  
== Contribution monitoring ==
+
<source lang="bash">MacHuebner:org.eclipse.xtext-test dhuebner$ git status
After you pushed your first commit to gerrit, it will be reviewed on the [https://hudson.eclipse.org/sandbox/job/xtext.gerrit/ hudson review server].
+
# Auf Zweig master
If all tests pass a manuel review will be done by one of the Xtext committers. If all looks good, your contribution will be pushed to the master repository and you can install it from the regular [https://hudson.eclipse.org/hudson/job/Xtext-nightly-HEAD/ eclipse hudson server].
+
# Ihr Zweig ist vor 'origin/master' um 1 Version.
 +
#  (benutzen Sie "git push" um lokalen Versionen herauszubringen)
 +
#
 +
nichts einzutragen, Arbeitsverzeichnis sauber
 +
</source>
 +
 
 +
==== Pushing to Review Server  ====
 +
After you committed the changes to the local git repository, you can push them to Gerrit by running
 +
 
 +
<code>git push origin master</code>
  
== Browse Sources Online  ==
+
==== Updating changes with new patches ====
Xtext and Xtend are hosted in Git. You can browse the repository in cgit here [http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/ Xtext/Xtend repository].
+
In case a patch has problems and you want to provide an updated patch, you need
<br>
+
to
 +
# Go to the Gerrit website with your change and copy the Change-Id into your clipboard
 +
# Update the commit and paste the Change-Id from your clipboard into the commit message
 +
# Push again and the amended commit will be added as an update to the Gerrit change

Revision as of 09:15, 26 February 2015

User Account

We use eclipse eclipse gerrit review server to review and manage new contributions. You need to perform the following few steps to be able to use the Gerrit server:

  • Register an Eclipse.org account at dev.eclipse.org. The same account is used for Bugzilla and Gerrit. If you are an Eclipse committer you already have one.
  • Define a username
  • Upload your public SSH key for authentication. For more information about ssh authentication and how to generate an SSH key, refer to this site. Make sure that you use the same email address for your SSH key as you did for your eclipse account to avoid authentification issues.
  • You need to sign Eclipse's new CLA to be able to push on Gerrit. You can do that after you log in at the Eclipse projects forge site, using your eclipse account.

Setup Development Environment

The Xtext team uses Oomph to setup the developer environment. Download The Oomph installer and start it.

  • On the initial page, click on the Switch to advanced mode button in the top right.
  • On the Product page, select "Eclipse IDE for Eclipse Committers (Mars)" or newer.
  • On the Projects page, double-click Xtext -> Core and select the master stream.
  • On the Variables page, select Luna as "Target Platform". It is recommended to use the SSH (read-write, gerrit) setting as "Xtext Git or Gerrit Repository". You may choose yourself which settings to enter for the other options on this wizard page. They are well documented in the Oomph installer (click the question mark in the bottom left). Here is an example how it could finally look like:

Variables-wiz-page.png

Now you can complete the installation wizard with the Finish button.

First Oomph will create a new eclipse installation for you. Downloading required files may take a while. You can close the Oomph installer after your fresh eclipse installation starts. In the started eclipse, you will see a startup tasks execution running. Initially it may take a while because it clones the Xtext git repository. In order to see the setup progress details, click the icon left to "Executing startup tasks" in the status bar. Wait for the setup to complete and restart Eclipse when prompted.

After initial setup is done, you should check which version of JDK is used for the JavaSE-1.6 execution environment. Go to Eclipse preferences -> Java -> Installed JREs -> Execution Environments. Select JavaSE-1.6 and set a compatible JRE to Java less than 1.8. Clean build the workspace after changing this setting.

Setup-jre-page.png


Contributing Changes

If you have followed the recommendations in the section above, the Oomph installer has already configured your local repository to push changes to the Xtext Gerrit repository. To contribute your changes, commit them using Team -> Commit and finally, if you feel ready to push, push them to the remote Gerrit server using Team -> Remote -> Push to Gerrit.

Contribution Monitoring

After you have pushed your first commit to Gerrit, it will be reviewed on the hudson review server. If all tests pass, a manual review will be done by one of the Xtext committers. If everything looks good, your contribution will be pushed to the master repository and you can install it from the regular eclipse hudson server.

Browse Sources Online

Xtext and Xtend are hosted in git. You can browse the repository in cgit here Xtext/Xtend repository.

Helpful Sites


Using a Git Console Application (optional)

You may use whatever git client you like. The important thing is that finally your local git configuration should look similar to this:

[core]
      repositoryformatversion = 0
      filemode = true
      logallrefupdates = true
[remote "origin"]
        url = git://git.eclipse.org/gitroot/tmf/org.eclipse.xtext.git
        pushurl = ssh://<your account id>@git.eclipse.org:29418/tmf/org.eclipse.xtext.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        push = HEAD:refs/for/master
[branch "master"]
        remote = origin
        merge = refs/heads/master

You can find the configuration file (called "config") in the root of your local repository, in the hidden folder ".git".

Pulling Changes from the Server

To fetch the last changes run:

git pull origin master

Committing Your Changes

After you made your changes to the source code, you have to commit them locally:

git commit -a -s -m "Bug 390852: my first contribution"

-a performs 'add' and 'remove' operations to modified and removed files (new files git does not know about won't be affected)
-s is necessary to 'sign-off' your commit; refer to section User Account to make sure you signed the CLA!
-m stands for message. It's common to refer to an existing bug report, in this example 390852, in your commit message
Now if you call git status, you will see one outgoing change:

MacHuebner:org.eclipse.xtext-test dhuebner$ git status
# Auf Zweig master
# Ihr Zweig ist vor 'origin/master' um 1 Version.
#   (benutzen Sie "git push" um lokalen Versionen herauszubringen)
#
nichts einzutragen, Arbeitsverzeichnis sauber

Pushing to Review Server

After you committed the changes to the local git repository, you can push them to Gerrit by running

git push origin master

Updating changes with new patches

In case a patch has problems and you want to provide an updated patch, you need to

  1. Go to the Gerrit website with your change and copy the Change-Id into your clipboard
  2. Update the commit and paste the Change-Id from your clipboard into the commit message
  3. Push again and the amended commit will be added as an update to the Gerrit change

Back to the top