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

Last change on this file since 32045 was 31950, checked in by floscher, 9 years ago

[mapillary] Simplify installation instructions, especially setting up git-svn

File size: 5.0 KB
Line 
1If you don't want to tinker with the code, just [install JOSM](https://josm.openstreetmap.de/) and open the Settings dialog in JOSM, choose the Plugin tab, check "Mapillary" and you are ready to go.
2
3But if you want to explore the sourcecode and maybe even improve it, first of all a :thumbsup: for you, and here are the instructions on getting the source code and building it on your machine:
4
5## Setting up your local git-repo
6
7```shell
8git clone git@github.com:floscher/josm-mapillary-plugin.git
9cd josm-mapillary-plugin
10```
11
12## Building the plugin with Gradle
13
14This project uses the so-called Gradle wrapper. That means you have to install nothing on your machine in order
15to build the project. The wrapper consists of the two scripts `gradlew` (for UNIX-based systems like Mac and Linux)
16and `gradlew.bat` (for systems running Windows). The following examples shows the commands for Linux/Mac users,
17Windows users can simply replace `./gradlew` with `./gradlew.bat`.
18
19For just building the jar-file for the plugin, run
20```shell
21./gradlew jar
22```
23
24If you also want to run the unit tests, create a FindBugs report and a code coverage report, then the following command is for you:
25```shell
26./gradlew build
27```
28(look for the results in the directory `build/reports`)
29
30And finally, you can execute the following to build the plugin from source, and run the latest JOSM with the Mapillary plugin already loaded.
31This works regardless if you have JOSM installed, or which version of it. Any already present JOSM-installation stays untouched by the following command.
32```shell
33./gradlew runJosm
34```
35
36For info about other available tasks you can run
37```shell
38./gradlew tasks
39```
40
41---
42
43If you don't have push-access to the SVN-server, you should now be ready to go.
44
45The following paragraphs only deal with transferring commits grom the GitHub-repository to the SVN-server and the other way around.
46
47---
48
49## Connecting the git-repo to the SVN-server (optional)
50
51This step is normally only relevant, if you either have push-access to the SVN-server and want to push your commits from the git-repo to the SVN-repo. Otherwise just skip it.
52
53First, you need to have [`git-svn`](https://git-scm.com/docs/git-svn) installed. E.g. on Ubuntu, just run `sudo apt install git-svn`. On Windows you probably already installed it together with `git`.
54
55Then run the following commands:
56```shell
57git svn init --prefix=svn/ http://svn.openstreetmap.org/applications/editors/josm/plugins/mapillary #You have to use http://, _not_ https://
58git config --local svn.authorsfile authors.txt
59mkdir .git/refs/remotes/svn
60git rev-parse master > .git/refs/remotes/svn/git-svn # creates a file containing the SHA1 of master-branch
61git svn fetch
62git reset --hard svn/git-svn
63```
64
65## Making changes to the repo and committing back to SVN (if you have git-svn set up as described above)
66
67The following steps are for those with commit-privileges for the SVN repository containing the plugins for JOSM.
68All others can simply file pull requests against the master-branch on github.
69
70We recommend, that you start your development at the head of the master-branch in a separate branch (in this example
71it's called _‹foo›_, you can name it what you like, but best call it after the feature you are working on):
72```shell
73git checkout origin/master
74git branch ‹foo›
75```
76
77---
78
79Then commit your changes to this branch _‹foo›_ until you feel it's time for committing them back to SVN:
80```shell
81git commit
82```
83
84---
85
86If you want to commit all of the commits that you made on the _‹foo›_-branch back to SVN, then you can skip this step.
87
88Otherwise execute the following line to preserve the other commits:
89```shell
90git branch tmp
91```
92This creates a new branch called _tmp_ which saves those commits for later, which are not rebased.
93
94---
95
96Then fetch the current state of the SVN-repository to avoid merge conflicts:
97```shell
98git svn fetch
99```
100
101---
102
103Now you should rebase onto the current state of the SVN-repository:
104```shell
105git rebase --interactive svn/git-svn
106```
107A text editor should open with all commits on the _‹foo›_-branch that are currently not in SVN. Delete all lines except
108the ones containing those commits you want to commit to SVN.
109
110Watch the command line. If it says, that merge conflicts have occured you'll first have to resolve these conflicts.
111For example with the following command:
112```shell
113git mergetool --tool=‹name_of_your_mergetool›
114```
115Possible mergetools include emerge, gvimdiff, kdiff3, meld, vimdiff and tortoisemerge.
116
117After merging you'll have to tell git that it should complete the rebasing:
118```shell
119git rebase --continue
120```
121
122If it still says that there are merge conflicts, go back to the `git mergetool`-command and repeat the steps from there on.
123
124---
125
126You have reached the final step, the following command will now interact with the SVN-server to commit your changes
127to the SVN-repository:
128```shell
129git svn dcommit --interactive --username=‹your_svn_username›
130```
131This command will ask for your password and shows you the commit message of every git-commit before it
132applies it to the SVN-repo.
Note: See TracBrowser for help on using the repository browser.