Ignore:
Timestamp:
2015-12-01T23:08:33+01:00 (9 years ago)
Author:
floscher
Message:

[mapillary] Declutter build.gradle, no longer needs JOSM installed in order to try plugin

When running ./gradlew runJosm, the latest JOSM-version is downloaded and run with JOSM_HOME set inside the build-directory, so it doesn't interfere with some other JOSM-installation.

Location:
applications/editors/josm/plugins/mapillary
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/build.gradle

    r31783 r31784  
    77sourceCompatibility = '1.7'
    88
    9 configurations {
    10   packIntoJar
    11   compile.extendsFrom packIntoJar
    12 }
    139repositories {
    1410  // for JUnit
    1511  mavenCentral()
    16   // for commons-imaging
    17   maven {
    18     url "https://repository.apache.org/content/repositories/snapshots/"
    19   }
    2012  //for josm-(latest|tested).jar
    2113  ivy {
    22     url "https://josm.openstreetmap.de/download/"
     14    url 'https://josm.openstreetmap.de/download'
     15    layout 'pattern', {
     16      artifact "[artifact]-[revision].jar"
     17      artifact "[artifact]-snapshot-[revision].jar"
     18      artifact "Archiv/[artifact]-snapshot-[revision].jar"
     19    }
     20  }
     21  //for josm-plugins
     22  ivy {
     23    url "https://svn.openstreetmap.org/applications/editors/josm/dist/"
    2324    layout "pattern", {
    24       artifact "[artifact]-[revision].jar"
     25      artifact "[artifact].jar"
    2526    }
    2627  }
    2728}
    2829dependencies {
    29   // The JOSM-version can be specified as "latest", "tested" or "snapshot-1234" (replace 1234 by the desired version number).
    30   // For revisions older than the last ~60 versions, also append "Archiv" to the repository URL above
    31   compile 'org.openstreetmap.josm:josm:latest'
    32   compile 'org.apache.commons:commons-imaging:1.0-SNAPSHOT'
    33 
    34   packIntoJar 'com.amazonaws:aws-java-sdk-s3:1.10.37'
    35   packIntoJar 'org.apache.httpcomponents:httpmime:4.5.1'
     30  // The JOSM-version can be specified as "latest", "tested" or the numeric version number.
     31  compile ':josm:latest'
     32  // For plugins it's irrelevant, which version is specified, always the latest version is used.
     33  compile ':apache-commons:latest'
     34  compile ':apache-http:latest'
    3635
    3736  testCompile 'junit:junit:4.12'
     
    6362build.dependsOn jacocoTestReport
    6463build.dependsOn projectReport
    65 
    66 /** Eclipse configuration */
    67 eclipse {
    68    classpath {
    69     downloadSources=true
    70     downloadJavadoc=true
    71   }
    72 }
    7364
    7465/** FindBugs configuration */
     
    10596
    10697jar {
    107   from configurations.packIntoJar.collect { it.isDirectory() ? it : zipTree(it) }
    10898  manifest {
    10999    attributes("Plugin-Mainversion": project.property('plugin.main.version'),
    110                "Plugin-Version": "31395",
     100               "Plugin-Version": "31784",
    111101               "Plugin-Class": project.property('plugin.class'),
    112102               "Plugin-Description": project.property('plugin.description'),
     
    120110}
    121111
     112task activatePlugin(type: Copy) {
     113  from "gradle/josm-preferences.xml"
     114  into "$buildDir/.josm"
     115  rename 'josm-preferences.xml', 'preferences.xml'
     116}
     117
     118task installPlugin(type: Copy) {
     119 from "$buildDir/libs/${project.name}.jar"
     120 from configurations.runtime
     121 into "$buildDir/.josm/plugins"
     122 include 'apache*.jar'
     123 include "${project.name}.jar"
     124 rename "${project.name}.jar", 'Mapillary.jar'
     125 rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
     126}
     127installPlugin.dependsOn jar
     128installPlugin.dependsOn activatePlugin
     129
    122130/**
    123  * The following are tasks to directly run JOSM with the freshly-built
    124  * Mapillary-plugin already installed.
    125  * Only prerequisite is to have JOSM (or JOSM-latest) installed on your machine.
    126  * Previously installed versions of the plugin are overridden by executions of these tasks.
    127  **/
    128 
    129 task installPluginToJosm(type: Copy) {
    130  from "$buildDir/libs/josm-mapillary-plugin.jar"
    131  into "$System.env.HOME/.josm/plugins"
    132  rename '.*', 'Mapillary.jar'
     131 * This runs the JOSM-version specified in the dependency configuration above.
     132 * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
     133 */
     134task runJosm(type: JavaExec) {
     135  classpath = sourceSets.main.runtimeClasspath
     136  main = 'JOSM'
     137  args '--offline=josm_website'
     138  jvmArgs "-Djosm.home=$buildDir/.josm"
    133139}
    134 installPluginToJosm.dependsOn jar
    135 
    136 task runJosm(type: Exec) {
    137  commandLine 'josm'
    138 }
    139 runJosm.dependsOn installPluginToJosm
    140 
    141 task installPluginToJosmLatest(type: Copy) {
    142   from "$buildDir/libs/josm-mapillary-plugin.jar"
    143   into "$System.env.HOME/.josm-latest/plugins"
    144   rename '.*', 'Mapillary.jar'
    145 }
    146 installPluginToJosmLatest.dependsOn jar
    147 
    148 task runJosmLatest(type: Exec) {
    149   commandLine 'josm-latest'
    150 }
    151 runJosmLatest.dependsOn installPluginToJosmLatest
     140runJosm.dependsOn installPlugin
Note: See TracChangeset for help on using the changeset viewer.