1 | If 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 |
|
---|
3 | But 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
|
---|
8 | git clone git@github.com:floscher/josm-mapillary-plugin.git
|
---|
9 | cd josm-mapillary-plugin
|
---|
10 | ```
|
---|
11 |
|
---|
12 | ## Building the plugin with Gradle
|
---|
13 |
|
---|
14 | This project uses the so-called Gradle wrapper. That means you have to install nothing on your machine in order
|
---|
15 | to build the project. The wrapper consists of the two scripts `gradlew` (for UNIX-based systems like Mac and Linux)
|
---|
16 | and `gradlew.bat` (for systems running Windows). The following examples shows the commands for Linux/Mac users,
|
---|
17 | Windows users can simply replace `./gradlew` with `./gradlew.bat`.
|
---|
18 |
|
---|
19 | For just building the jar-file for the plugin, run
|
---|
20 | ```shell
|
---|
21 | ./gradlew jar
|
---|
22 | ```
|
---|
23 |
|
---|
24 | If 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 |
|
---|
30 | And finally, you can execute the following to build the plugin from source, and run the latest JOSM with the Mapillary plugin already loaded.
|
---|
31 | This 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 |
|
---|
36 | For info about other available tasks you can run
|
---|
37 | ```shell
|
---|
38 | ./gradlew tasks
|
---|
39 | ```
|
---|
40 |
|
---|
41 | ---
|
---|
42 |
|
---|
43 | If you don't have push-access to the SVN-server, you should now be ready to go.
|
---|
44 |
|
---|
45 | The 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 |
|
---|
51 | This 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 |
|
---|
53 | First, 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 |
|
---|
55 | Then run the following commands:
|
---|
56 | ```shell
|
---|
57 | git svn init --prefix=svn/ http://svn.openstreetmap.org/applications/editors/josm/plugins/mapillary #You have to use http://, _not_ https://
|
---|
58 | git config --local svn.authorsfile authors.txt
|
---|
59 | mkdir .git/refs/remotes/svn
|
---|
60 | git rev-parse master > .git/refs/remotes/svn/git-svn # creates a file containing the SHA1 of master-branch
|
---|
61 | git svn fetch
|
---|
62 | git 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 |
|
---|
67 | The following steps are for those with commit-privileges for the SVN repository containing the plugins for JOSM.
|
---|
68 | All others can simply file pull requests against the master-branch on github.
|
---|
69 |
|
---|
70 | We recommend, that you start your development at the head of the master-branch in a separate branch (in this example
|
---|
71 | it's called _‹foo›_, you can name it what you like, but best call it after the feature you are working on):
|
---|
72 | ```shell
|
---|
73 | git checkout origin/master
|
---|
74 | git branch ‹foo›
|
---|
75 | ```
|
---|
76 |
|
---|
77 | ---
|
---|
78 |
|
---|
79 | Then commit your changes to this branch _‹foo›_ until you feel it's time for committing them back to SVN:
|
---|
80 | ```shell
|
---|
81 | git commit
|
---|
82 | ```
|
---|
83 |
|
---|
84 | ---
|
---|
85 |
|
---|
86 | If 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 |
|
---|
88 | Otherwise execute the following line to preserve the other commits:
|
---|
89 | ```shell
|
---|
90 | git branch tmp
|
---|
91 | ```
|
---|
92 | This creates a new branch called _tmp_ which saves those commits for later, which are not rebased.
|
---|
93 |
|
---|
94 | ---
|
---|
95 |
|
---|
96 | Then fetch the current state of the SVN-repository to avoid merge conflicts:
|
---|
97 | ```shell
|
---|
98 | git svn fetch
|
---|
99 | ```
|
---|
100 |
|
---|
101 | ---
|
---|
102 |
|
---|
103 | Now you should rebase onto the current state of the SVN-repository:
|
---|
104 | ```shell
|
---|
105 | git rebase --interactive svn/git-svn
|
---|
106 | ```
|
---|
107 | A text editor should open with all commits on the _‹foo›_-branch that are currently not in SVN. Delete all lines except
|
---|
108 | the ones containing those commits you want to commit to SVN.
|
---|
109 |
|
---|
110 | Watch the command line. If it says, that merge conflicts have occured you'll first have to resolve these conflicts.
|
---|
111 | For example with the following command:
|
---|
112 | ```shell
|
---|
113 | git mergetool --tool=‹name_of_your_mergetool›
|
---|
114 | ```
|
---|
115 | Possible mergetools include emerge, gvimdiff, kdiff3, meld, vimdiff and tortoisemerge.
|
---|
116 |
|
---|
117 | After merging you'll have to tell git that it should complete the rebasing:
|
---|
118 | ```shell
|
---|
119 | git rebase --continue
|
---|
120 | ```
|
---|
121 |
|
---|
122 | If 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 |
|
---|
126 | You have reached the final step, the following command will now interact with the SVN-server to commit your changes
|
---|
127 | to the SVN-repository:
|
---|
128 | ```shell
|
---|
129 | git svn dcommit --interactive --username=‹your_svn_username›
|
---|
130 | ```
|
---|
131 | This command will ask for your password and shows you the commit message of every git-commit before it
|
---|
132 | applies it to the SVN-repo.
|
---|