Can we use Oomph to share and enforce company code format? [message #1749188] |
Fri, 02 December 2016 20:13 |
Mike Muske Messages: 2 Registered: December 2016 |
Junior Member |
|
|
Hi all,
I am attempting to setup code formatting preferences for my company that are identical across all of our projects. Initially I looked at Workspace Mechanic and the Common Preferences plugin, but these seem to have died off after Oomph was introduced - presumably because Oomph does the same things better and offers additional capabilities?
Basically what we are trying to achieve is to define a global code format profile, and use a tool (like Oomph) to keep all of the developers' environments up to date with the central definition. This way a team lead can modify the central code format profile and the change will be pushed to every dev's eclipse the next time it starts up (or better yet at some polling interval).
Is this possible?
I tried to achieve this by creating my own product.setup file with all the plugins/repos we use. I was then trying to populate it with User Preferences by first recording preference changes into my workspace.setup file, and then copying those into the product.setup file. The problem I ran into with the formatter is that the only preference the Oomph recorder saved was the profile name that is selected. Is there a way to include the profile in the setup file as well?
I've seen comments on the forum and in blog articles about using project settings for formatter preferences, but we don't want to do that. We don't work on code external to our company, we always use the same formatter. We don't want to maintain multiple project.setup files every time a format setting changes.
My hope is that after defining a product.setup file with formatter and other preferences, I can host it at an HTTP url, and our developers can point the Eclipse installer at it to install the company flavor of Eclipse. If the installer is pointed at a URL for the product.setup file, does that mean that Eclipse will check this remote product.setup file each time it starts to see if it has changed and then update Eclipse accordingly?
I'm afraid I may be fundamentally misunderstanding Oomph's capabilities. Most of the blogs/docs are more interested in explaining how to roll up all your plugins in a distro, which is neat, but not our main requirement. I'm really hoping Oomph is able to facilitate team code formatting standards because it looks like a lot of thought and effort has gone into this tool, and it seems to be the future of Eclipse preference management.
|
|
|
Re: Can we use Oomph to share and enforce company code format? [message #1749215 is a reply to message #1749188] |
Sat, 03 December 2016 11:50 |
Ed Merks Messages: 33258 Registered: July 2009 |
Senior Member |
|
|
Mike Muske wrote on Fri, 02 December 2016 15:13Hi all,
I am attempting to setup code formatting preferences for my company that are identical across all of our projects. Initially I looked at Workspace Mechanic and the Common Preferences plugin, but these seem to have died off after Oomph was introduced - presumably because Oomph does the same things better and offers additional capabilities?
I'd like to think that Oomph does this very well.
Quote:
Basically what we are trying to achieve is to define a global code format profile, and use a tool (like Oomph) to keep all of the developers' environments up to date with the central definition. This way a team lead can modify the central code format profile and the change will be pushed to every dev's eclipse the next time it starts up (or better yet at some polling interval).
Is this possible?
Yes.
Quote:
I tried to achieve this by creating my own product.setup file with all the plugins/repos we use. I was then trying to populate it with User Preferences by first recording preference changes into my workspace.setup file, and then copying those into the product.setup file. The problem I ran into with the formatter is that the only preference the Oomph recorder saved was the profile name that is selected. Is there a way to include the profile in the setup file as well?
Yes. The recorder only detects things you change so if you didn't change the profile itself during the process, but only changes to active profile that was chosen, then only the latter is recorded.
Quote:
I've seen comments on the forum and in blog articles about using project settings for formatter preferences, but we don't want to do that. We don't work on code external to our company, we always use the same formatter. We don't want to maintain multiple project.setup files every time a format setting changes.
Maintaining it in your own Product definition is definitely a way to achieve your goal.
Quote:
My hope is that after defining a product.setup file with formatter and other preferences, I can host it at an HTTP url, and our developers can point the Eclipse installer at it to install the company flavor of Eclipse. If the installer is pointed at a URL for the product.setup file, does that mean that Eclipse will check this remote product.setup file each time it starts to see if it has changed and then update Eclipse accordingly?
Yes, exactly.
Quote:
I'm afraid I may be fundamentally misunderstanding Oomph's capabilities. Most of the blogs/docs are more interested in explaining how to roll up all your plugins in a distro, which is neat, but not our main requirement. I'm really hoping Oomph is able to facilitate team code formatting standards because it looks like a lot of thought and effort has gone into this tool, and it seems to be the future of Eclipse preference management.
So it sounds like the only thing you've missed the recording of the profile itself. If I open a Setup Editor, and use the "Record Preferences" button, and go to the JDT formatter preferences to create a new profile and activate it, I get these recorded tasks:
<?xml version="1.0" encoding="UTF-8"?>
<setup:CompoundTask
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
name="org.eclipse.jdt.ui">
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.ui/formatter_profile"
value="_MyFormatter"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.ui/formatter_settings_version"
value="12"/>
<setupTask
xsi:type="setup:PreferenceTask"
key="/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.formatterprofiles"
value="*** removed because it's very big ***"/>
</setup:CompoundTask>
Note that the setup editor also has a "Capture Preferences" toolbar button that lets you record the current state of any preference as a preference task, so you could find your org.eclipse.jdt.ui/org.eclipse.jdt.ui.formatterprofiles preference and capture it in your Product setup.
I've used this support in customer projects so this definitely all works. In this case I was captured in a Project setup, but the tasks are the same. Note that for this customer I also defined the profiles for source cleanup and editor save actions. The latter are cool because the files will be formatted when you save them, so they're always in the perfect state.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03986 seconds