Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eclipse-Installer (Oomph) Setup for JGraphT-Developers #942

Open
HannesWell opened this issue Jun 7, 2020 · 7 comments
Open

Eclipse-Installer (Oomph) Setup for JGraphT-Developers #942

HannesWell opened this issue Jun 7, 2020 · 7 comments

Comments

@HannesWell
Copy link

HannesWell commented Jun 7, 2020

 * JGraphT version: development
 * Java version (java-version)/platform: all

Issue

The Eclipse Installer (Project Oomph) provides means to automate the installation of an Eclipse instance and the setup of an Eclipse-workspace.
The workspace setup can include things like setting preferences (such as formatter and Save-actions), cloning a Git-repository, importing projects and installing plug-ins (just to name the probably most relevant tasks for JGraphT), all automated.

Furthermore the setup of projects hosted on GitHub (and Eclipse projects) can be registered in Eclipse's public global index, so one can setup a workspace to work on JGraphT directly from within the Eclipse-Installer or the Eclipse Importer.
This can make it very easy first time contributors to start their development for JGraphT.

Are you interested in having such a setup for JGraphT-development?

@d-michail
Copy link
Member

Can't speak for the others, but it sounds like a good idea. We also have a maven archetype, which can generate a skeleton maven project. See wiki. It is a little bit behind in versioning, 1.2 if I recall correctly.

@jkinable
Copy link
Collaborator

jkinable commented Jun 7, 2020 via email

@HannesWell
Copy link
Author

I work a lot with Eclipse and write a lot of code based on Eclipse, so I know the pain it can cause. Nevertheless I find this a quite handy tool, that actually worked very well in the cases I used it so far.

But one thing I have to state (I obviously wasn't clear about that):
The setup is not intended to setup a workspace to work with the JGraphT-library, it is to setup a workspace to develop for JGraphT.
So it is more a simplification of the Eclipse section of Dev guide: How to setup your development environment for JGraphT.

Of course such a setup isn't necessary, everybody that contributes for JGraphT is with no doubt capable to follow that guide. But it would make the setup of the dev-environment even easier.
Also it would ensure for Eclipse-Users that for example the Save-Actions are turned on, so the formatter is applied all the time.

@HannesWell HannesWell changed the title Eclipse-Installer (Oomph) Setup for JGraphT Eclipse-Installer (Oomph) Setup for JGraphT-Developers Jun 7, 2020
@HannesWell
Copy link
Author

Do you have any further opinions on this?
If you conclude that a Eclipse-Oomph developer setup is not suitable for JGraphT, I think this issue can be closed.

@jsichi
Copy link
Member

jsichi commented Jun 27, 2020

@HannesWell is it possible for you to publish this in your own repository first, and then we can take a look at it?

@HannesWell
Copy link
Author

Sure. I'll create and publish a setup in my repository and post the link here.

@HannesWell
Copy link
Author

First of all, sorry for the delay. I created a first suggestion for a JGraphT setup in my fork-repo, so you can evaluate if a Eclipse-Oomph-setup is suitable for JGraphT development:
https://github.com/HannesWell/jgrapht/blob/dev/EclipseOomphSetup/etc/org.jgrapht.setup

How to use it?

  1. Get an Eclipse installation that has Eclipse-Oomph installed.

    • Either by installing Oomph via Help->"Install New Software..."
    • or by Installing Eclipse with the Eclipse-Oomph Installer (for example "Eclipse IDE for Java Developers" is suitable).
  2. In a a new Workspace open the "Import projects..." dialogue and select "Oomph" -> "Projects from Catalog".
    -> Click Next

  3. At the "Eclipse Importer" page add "org.jgrapht.setup" as user project.

  4. At the "Variables" page specify the location of the git-repo clone, your JRE-11 location and your Github Author name and e-mail:

    • The "Git clone location rule" specifies how the location of the git-repo clone is composed. Personally I prefer the rule "Located in a folder named within the root Git-container folder" ${git.container.root/}${@id.locationQualifier|trim}${@id.remoteURI|gitRepository}) to locate all my repositories in the same directory. But you can also locate your clone inside your workspace or your installation directory or at an arbitrary other location.
    • With that rule selected "Root Git-container folder" specifies that container directory.
    • "JGraphT Github repository" specifies how your JGraphT-fork is accessed. Via the "git" or the "https" protocol. For the first one Eclipse needs to now your SSH-keys.
    • In JRE 11 Location your can choose your preferred JRE. The one at JAVA_HOME should be selected by default
    • "Github author name" and "Github author email" specify the name and email address contained in your commits.
    • Last the "Github user ID" specifies your personal part in the URL to your fork: https://github.com//jgrapht/
      -> Click Next
  5. At the Confirmation page, start the setup by clicking Finish.
    The JGraphT project is now set up. You can watch the detailed progress by clicking the two rotating arrows in the lower right toolbar.

It is also possible to perform the project setup already during installation of the Eclipse-Product by the Eclipse-Oomph Installer.
For this open the installer, switch to the advanced mode (click on the menu in the upper right corner and click "ADVANCED MODE...").
First select a Eclipse-product, then continue on the "projects"-page like in step 3 and onwards.
Then at the Variables page additionally the rules for the location of the Eclipse installation and the workspace have to be specified.

During its execution the org.jgrapht.setup does the following:

  • Clone the git-repo and setup its .git/config
  • Import the maven projects of jgrapht
  • Assigns the imported projects a working-set named "jgrapht"
  • Setup Eclipse-preferences:
    • Apply the formatter
    • Set "Number of (static) imports needed for .*" to 0
    • Set the Import order
    • The following "Save actions" are turned on by default:
      • Format source code, all lines
      • Set Import order in Java -> Code Style -> Organize imports
      • Additional actions (takes the default of Eclipse)

The presented setup is a first suggestion, many more aspects can be configured, for example:

  • Add some more plug-ins? Like Sonar-Lint, Checkstyle or similar?
  • Specify more save Actions to improve Code-Style?
    E.g. Remove trailing white-space, use blocks in if/while/for/do, convert for loops to enhanced, use modifier final where possible, convert functional interface instances, remove unnecessary code (a lot of stuff can be done).
  • Add launch configs for maven build?

Remarks:

  1. The formatter specification in the setup file must be synchronized manually with the eclipse-formatter-settings.xml.
    -> If the eclipse-formatter-settings.xml changes, its content must be pasted as value of the variable /instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.formatterprofiles in the setup-editor.
    If you want to go on with this Oomph-setup I can try to find a solution to reference the xml-file.

  2. Remote "origin" and "upstream" are currently set up according to https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#keep-your-fork-synced
    The fork is cloned and the original repo is configured as upstream. This has the down side that by default EGit fetches from the fork-repo. But there are usually no new commits to include. Therefore for the daily work it could be handier to clone the original repo and set the fork as second remote and/or as pushurl target?

Questions:

  1. Set both "Number of imports needed for ." and "Number of static imports needed for ." to zero?
  2. Is the specified import order correct? I just noticed that imports were changed with activated Save-Actions and default import order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants