-
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:
-
Help
menu >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 Resources
andEclipse 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:
-
Windows
menu >Preferences
- In the opening window: unfold
Maven
>Discovery
, then click theOpen Catalog
button- In the opening window: type "tycho" in the
Find
field - Select "Tycho Configurator", and click the
Finish
button
- In the opening window: type "tycho" in the
-
- Fork the project on github
-
Window
menu >Perspective
>Open Perspective
>Other...
- Select
Git
in the dialog and clickOK
button - Then select
Clone a git repository
- In the opening dialog window;
- Enter the location URI (Copy it from your fork on Github)
- Then in
Authentication
enter theUser
andPassword
and clickStore in Secure Store
- Then click
Next >
button, andNext >
button again - Make a note of the
Destination
Directory
, and click theFinish
button
- Select
- In the
Package Explorer
view, right-click, then selectImport...
- Then in the opening dialog, select
Maven
>Existing Maven Projects
- Then click
Next >
button - Then click
Browse
button 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:
-
RefactoringRulesTest
tests each refactoring rule in isolation- Put the class of the refactoring rule you are working with in the
WHITELIST
field
- Put the class of the refactoring rule you are working with in the
-
AllRefactoringRulesTest
tests all refactoring rules together- Put the name of the refactoring rule test you are working with in the
WHITELIST
field
- 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
Main
tab, then inProgram to Run
, selectRun an application
, and in the drop-down, select[No Application] - Headless Mode
- then click the
Apply
button, and click theRun
button - The JUnit view should appear, and the test run should be green
- In the opening dialog, right-click
-
-
Run
menu >Debug Configurations...
- then right-click on
Eclipse Application
, thenNew
- type "AutoRefactor" in the
Name
field, clickApply
button, then clickDebug
button