-
Notifications
You must be signed in to change notification settings - Fork 38
Hacking AutoRefactor
Fabrice TIERCELIN edited this page Nov 12, 2019
·
13 revisions
Before starting hacking on AutoRefactor, you must setup your environment and download the source code. To submit pull requests, you must have a github account, so start by creating one.
- Download and install JDK 8 (not higher)
- Download Eclipse and install it
- Install the Plugin Development Environment (PDE) and the resources for Java Development Tools (JDT) development into your Eclipse installation:
-
Helpmenu >Install New Software... - In the opening window:
Work with:select:The Eclipse Project Updates - http://download.eclipse.org/eclipse/updates/4.5(4.5 for Mars, 4.6 for Neon, etc.)- Unfold
Eclipse Plugin Development Tools, and selectEclipse PDE Plug-in Developer ResourcesandEclipse Plug-in Development Environment - Unfold
Eclipse Java Development Tools, and selectEclipse JDT Plug-in Developer Resources - Unfold
Eclipse Platform SDK, and selectEclipse Platform SDK
- Unfold
- Then click the
Next >,Next >buttons and thenFinish - Then restart Eclipse once asked to
-
- Install the Tycho Configurator Plugin into your Eclipse installation:
-
Windowsmenu >Preferences - In the opening window: unfold
Maven>Discovery, then click theOpen Catalogbutton- In the opening window: type "tycho" in the
Findfield - Select "Tycho Configurator", and click the
Finishbutton
- In the opening window: type "tycho" in the
-
- Fork the project on github
-
Windowmenu >Perspective>Open Perspective>Other...- Select
Gitin the dialog and clickOKbutton - Then select
Clone a git repository - In the opening dialog window;
- Enter the location URI (Copy it from your fork on Github)
- Then in
Authenticationenter theUserandPasswordand clickStore in Secure Store - Then click
Next >button, andNext >button again - Make a note of the
DestinationDirectory, and click theFinishbutton
- Select
- In the
Package Explorerview, right-click, then selectImport...- Then in the opening dialog, select
Maven>Existing Maven Projects - Then click
Next >button - Then click
Browsebutton and select the directory where you cloned the git repository - Then click
Finish
- Then in the opening dialog, select
- Adapt the files to your Eclipse
- In /AutoRefactor/pom.xml, using Eclipse Oxygen for example, change this :
- <id>Indigo</id> - <layout>p2</layout> - <url>http://download.eclipse.org/eclipse/updates/3.7</url> + <id>Oxygen</id> + <url>http://download.eclipse.org/eclipse/releases/oxygen</url>- In MANIFEST.MF, using Eclipse Oxygen for example, change this :
- org.eclipse.jdt.core;bundle-version="3.7.1", + org.eclipse.jdt.core;bundle-version="3.12.3",
To save time and not being disturbed by the CheckStyle rules, you should configure some save actions:
- Window -> Preferences -> Java -> Editor -> Save actions -> Perform the selected actions on save -> Additional actions -> Remove trailing white space on all lines
- Window -> Preferences -> Java -> Code style -> Formatter -> Edit -> Indentation -> Tab policy -> Spaces only
You should prefer coding unit tests because:
- it is by far the fastest code/compile/run/debug cycle
- it provides good code coverage, thus reducing possibilities of regressions
You can run tests by:
- Running
mvn clean install - Or running JUnit tests directly from Eclipse:
-
RefactoringRulesTesttests each refactoring rule in isolation- Put the class of the refactoring rule you are working with in the
WHITELISTfield
- Put the class of the refactoring rule you are working with in the
-
AllRefactoringRulesTesttests all refactoring rules together- Put the name of the refactoring rule test you are working with in the
WHITELISTfield
- Put the name of the refactoring rule test you are working with in the
- Open either file, then right-click >
Run As>Run Configurations...- In the opening dialog, right-click
JUnit Plug-in Test>New - then select the
Maintab, then inProgram to Run, selectRun an application, and in the drop-down, select[No Application] - Headless Mode - then click the
Applybutton, and click theRunbutton - The JUnit view should appear, and the test run should be green
- In the opening dialog, right-click
-
-
Runmenu >Debug Configurations... - then right-click on
Eclipse Application, thenNew - type "AutoRefactor" in the
Namefield, clickApplybutton, then clickDebugbutton