| | 109 | def prop(key) { |
| | 110 | return System.getProperty(key) == null ? null : "--${key}=${System.getProperty(key)}" |
| | 111 | } |
| | 112 | |
| | 113 | task run(dependesOn: compileJava) << { |
| | 114 | String warning = """[WARNING] config parameter is required. |
| | 115 | |
| | 116 | Usage: |
| | 117 | gradle run -Dconfig={value} [-Dspec={value}] [-Dverbose={value}] [-Doutput={value}] [-DclientConfig] [-Dreferer={value}] [-Dlog4jConfig={value}] |
| | 118 | Params: |
| | 119 | -Dconfig={String}: Filename for the configuration (templates&CO) |
| | 120 | -Dspec={String}: The location of the description of what has to be printed. By default, STDIN (defaults to [null]) |
| | 121 | -Dverbose={int}: Used only if log4jConfig is not specified. 3 if you want everything, 2 if you want the debug information (stacktraces are shown), 1 for infos and 0 for only warnings and errors (defaults to [1]) |
| | 122 | -Doutput={String}: The destination file. By default, STDOUT (defaults to [null]) |
| | 123 | -DclientConfig={on|off}: Get the config for the client form. Doesn't generate a PDF (defaults to [off]) |
| | 124 | -Dreferer={String}: Referer address to use when doing queries (defaults to [null]) |
| | 125 | -Dlog4jConfig={String}: Property file for the log4j configuration (defaults to [null]) |
| | 126 | |
| | 127 | Example: |
| | 128 | gradle run -Dconfig=samples/config.yaml -Dspec=samples/spec.json -Doutput=/tmp/print-out.pdf |
| | 129 | |
| | 130 | |
| | 131 | """ |
| | 132 | |
| | 133 | args = [prop("config"),prop("spec"),prop("output"),prop("verbose"),prop("clientConfig"),prop("referer"),prop("log4jConfig")] |
| | 134 | if(prop("config") == null) { |
| | 135 | println(warning) |
| | 136 | } else { |
| | 137 | ant.java(classname: 'org.mapfish.print.ShellMapPrinter', fork: false, logError: false, |
| | 138 | classpath: "${sourceSets.main.runtimeClasspath.asPath}") { |
| | 139 | for(a in args.findAll {it!=null}){ |
| | 140 | arg(value: a) |
| | 141 | } |
| | 142 | } |
| | 143 | } |
| | 144 | } |
| | 167 | |
| | 168 | /* |
| | 169 | task install(overwrite: true) << { |
| | 170 | env = System.getenv() |
| | 171 | sep = File.separator |
| | 172 | localRepo = env['MAVEN_REPO'] ?: env['HOME']+"${sep}.m2${sep}repository" |
| | 173 | repository(url: "file://"+localRepo) |
| | 174 | snapshotRepository(url: "file://"+localRepo) |
| | 175 | |
| | 176 | addFilter('lib') { artifact, file -> |
| | 177 | artifact.name.contains 'print-lib' |
| | 178 | } |
| | 179 | |
| | 180 | addFilter('standalone') { artifact, file -> |
| | 181 | artifact.name.contains 'print-standalone' |
| | 182 | } |
| | 183 | |
| | 184 | addFilter('war') { artifact, file -> |
| | 185 | artifact.name.contains 'print-servlet' |
| | 186 | } |
| | 187 | } |
| | 188 | */ |