February 27, 2013 at 9:25 pm #336054
Hello SDC users.
We have been working on a “Git Projects Workspace Task” for SDC. This workspace task lets you define a set of Git repositories with the projects you want to automatically include on your Eclipse Package. When your team installs the configured eclipse package the Git Workspace Task will clone the specified repositories and will add the specified projects to your workspace.
We kicked off this project based on our own needs, our development environment is managed with SDC and Git and we needed an easy way to set up or Eclipse packages with our projects. Given the global appeal of Git, we also wanted to share this plugin with you since you may well have similar needs.
Before completely finalizing this Git task, we would like to solicit feedback and ideas from you in your own uses of Git.
Our current Git Task is very capable, but like all things, your ideas can make it even better. The main goal is to include this feature into SDC in future versions so it will be available for everyone, and as it is based on Google Workspace Mechanic, could potentially be leveraged in other ways down the road if there is sufficient interest.
The Git Task Model
Before diving into how to begin using this Git task, we’d like to introduce the model we are using for the Git projects. In essence, it covers the repositories, branches, and projects you want to cover. If the task detects existing repositories, it will automatically look for missing projects to be imported, and helps you manage the ongoing usage of your Git repositories, not just the initial configuration.
The following is an example .git task file that includes two different repositories.
<git> <repository name="main project" uri="ssh://myHost:7022/home/my/repository"> <!-- Credentials can be provided for defaults if appropriate --> <credentials mode="BOTH"/> <!-- All or some branches can be configured --> <remote-branches> <remote-branch remote="origin" reference="refs/heads/master" clone-submodules="true" /> </remote-branches> <local-branches> <local-branch name="master" based-on="refs/heads/master" active="true" /> </local-branches> <!-- You can either opt-in or opt-out of projects in a repository --> <import-all-projects> <exclude> <project name="first.project.to.exclude"/> <project name="second.project.to.exclude"/> </exclude> </import-all-projects> </repository> <repository name="org.eclipse.epp.mpc" uri="git://git.eclipse.org/gitroot/mpc/org.eclipse.epp.mpc"> <credentials mode="NONE" /> <remote-branches> <remote-branch remote="origin" reference="refs/heads/maintenance_1_1_x" clone-submodules="true" /> </remote-branches> <local-branches> <local-branch name="maintenance_1_1_x" based-on="refs/heads/maintenance_1_1_x" active="true" /> </local-branches> <import-projects> <project name="org.eclipse.epp.mpc.core"/> </import-projects> </repository> <git>
Begin Using the Git Task With SDC
- Import the attached archived update site into your admin console as a Third-Party Library.
- Add Git Workspace Task to the Eclipse package(s) you want to configure (see the Software Tab of the package and the Third-Party Library you imported).
- Create a task file with .git extension with your definition of Git repositories and projects you want automatically configured in your Eclipse package(s).
- Add the task file to your package(s) on the Workspace Configuration section of the Configuration tab.
- Commit and promote the package.
- Install the package.
- Configure repository locations and/or supply credentials when prompted.
The following screenshot gives an idea of how the repositories are currently configured when presented to the user. Credentials can be configured, and paths tailored. This allows the user to quickly setup the configuration for their system.
See attachment git import settings page.png
Creating Your Git Task File (.git)
You can use any text editor to create your Git task file. If your editor supports XML validation and content assist, you can configure it to use the attached XML Schema Definition (xsd) to help you author your task files. To leverage code assist, you can start with an XML file extension and just change the extention to .git when you are ready to use it on SDC. Alternatively, you can set up your editor to recognize .git files as XML.
If you take a look at the schema definition you will get an idea of what our model supports and the requirements of it, but we are more than happy to help you with specific questions about the configuration.
If you have any doubts, suggestions or questions please feel free to post it, we will be happy to hear from you and help you.
Héctor – SDC Developer
Attachments:You must be logged in to view attached files.January 29, 2015 at 10:48 am #353594
I just tried this out, and it works great!
Here are a couple of questions I have…
1) If we’ve already configured defaults through the workspace task, couldn’t we “silently” check out the git repos? In other words, unless there’s some sort of problem accessing the repos, can’t it just automatically check them out (assuming the repo is public)?
2) For our project, the desired base folder for git repos is actually the workspace (I think this is because some of our senior developers like to have multiple workspaces). Is this a setting that’s pulled from a git or Eclipse config file somewhere, or could we have an option in the XML to set the default base path to the workspace folder?
Also, sorry for the thread necrophilia, but I figured it would be better to give feedback where it was originally requested.