source: osm/applications/editors/josm/plugins/mapillary/INSTALL.md@ 31802

Last change on this file since 31802 was 31394, checked in by floscher, 9 years ago

[mapillary] Add documentation on the contribution workflow and on how to build the plugin

File size: 4.2 KB
Line 
1## Setting up your local git-repo
2
3```shell
4git clone https://github.com/floscher/josm-mapillary-plugin
5cd josm-mapillary-plugin
6git svn init --prefix=svn/ http://svn.openstreetmap.org/applications/editors/josm/plugins/mapillary #You have to use http://, _not_ https://
7git config --local svn.authorsfile authors.txt
8git svn fetch #this might take a while
9```
10
11## Fetching from the SVN-repo into your local git-repo
12
13```shell
14git svn fetch
15```
16
17## Building the plugin with Gradle
18
19This project uses the so-called Gradle wrapper. That means you have to install nothing on your machine in order
20to build the project. The wrapper consists of the two scripts `gradlew` (for UNIX-based systems like Mac and Linux)
21and `gradlew.bat` (for systems running Windows). The following examples shows the commands for Linux/Mac users,
22Windows users can simply replace `./gradlew` with `./gradlew.bat`.
23
24For just building the jar-file for the plugin, run
25```shell
26./gradlew jar
27```
28
29If you also want to run the unit tests, create a FindBugs report and a code coverage report, then the following command is for you:
30```shell
31./gradlew build
32```
33(look for the results in the directory `build/reports`)
34
35And finally if you have JOSM installed on your machine, you can execute the following to build the plugin from source,
36installs it for you in JOSM and then even starts JOSM with the plugin loaded:
37```shell
38./gradlew runJosm
39```
40
41For info about other available tasks you can run
42```shell
43./gradlew tasks
44```
45
46## Making changes to the repo and committing them back to SVN
47The following steps are for those with commit-privileges for the SVN repository containing the plugins for JOSM.
48All others can simply file pull requests against the master-branch on github.
49
50We recommend, that you start your development at the head of the master-branch in a separate branch (in this example
51it's called _‹foo›_, you can name it what you like, but best call it after the feature you are working on):
52```shell
53git checkout origin/master
54git branch ‹foo›
55```
56
57---
58
59Then commit your changes to this branch _‹foo›_ until you feel it's time for committing them back to SVN:
60```shell
61git commit
62```
63
64---
65
66If you want to commit all of the commits that you made on the _‹foo›_-branch back to SVN, then you can skip this step.
67
68Otherwise execute the following line to preserve the other commits:
69```shell
70git branch tmp
71```
72This creates a new branch called _tmp_ which saves those commits for later, which are not rebased.
73
74---
75
76Then fetch the current state of the SVN-repository to avoid merge conflicts:
77```shell
78git svn fetch
79```
80
81---
82
83Now you should rebase onto the current state of the SVN-repository:
84```shell
85git rebase --interactive svn/git-svn
86```
87A text editor should open with all commits on the _‹foo›_-branch that are currently not in SVN. Delete all lines except
88the ones containing those commits you want to commit to SVN.
89
90Watch the command line. If it says, that merge conflicts have occured you'll first have to resolve these conflicts.
91For example with the following command:
92```shell
93git mergetool --tool=‹name_of_your_mergetool›
94```
95Possible mergetools include emerge, gvimdiff, kdiff3, meld, vimdiff and tortoisemerge.
96
97After merging you'll have to tell git that it should complete the rebasing:
98```shell
99git rebase --continue
100```
101
102If it still says that there are merge conflicts, go back to the `git mergetool`-command and repeat the steps from there on.
103
104---
105
106You have reached the final step, the following command will now interact with the SVN-server to commit your changes
107to the SVN-repository:
108```shell
109git svn dcommit --interactive --username=‹your_svn_username›
110```
111This command will ask for your password and shows you the commit message of every git-commit before it
112applies it to the SVN-repo.
113
114---
115
116__Pro-tip:__
117
118If you want to use a different text-editor than git currently uses, execute the following command:
119`git config --global core.editor ‹insert_your_favourite_text_editor›` and git will in the future always fire the new
120editor up instead.
121
122The same applies for the merge-tool: After executing `git config --global merge.tool ‹insert_your_favourite_merge_tool›`
123you can omit the --tool option when executing `git mergetool` in the future.
Note: See TracBrowser for help on using the repository browser.