/* * Copyright 2000-2018 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Script to fetch dependencies // Just run 'gradle -b update-libs.gradle update' ext.versions = [ 'jersey' : '1.19', 'jackson': '2.6.6', //swagger requires at least 2.4.0 'swagger': '1.5.4', ] apply plugin: 'java' repositories { mavenLocal() mavenCentral() } configurations { jersey jackson swagger } def dep(String coordinates, javadoc = false, sources = true) { def result = [dependencies.create(coordinates)] if (javadoc) result << dependencies.create("$coordinates:javadoc") if (sources) result << dependencies.create("$coordinates:sources") result } def dep(Map coordinates, javadoc = false, sources = true) { def result = [dependencies.create(coordinates)] if (javadoc) { def c = new HashMap(coordinates) c['classifier'] = 'javadoc' result << dependencies.create(c) } if (sources) { def c = new HashMap(coordinates) c['classifier'] = 'sources' result << dependencies.create(c) } result } dependencies { jersey dep("javax.ws.rs:jsr311-api:1.1.1") jersey dep("com.sun.jersey:jersey-core:${versions.jersey}") jersey dep("com.sun.jersey:jersey-json:${versions.jersey}") jersey dep("com.sun.jersey:jersey-server:${versions.jersey}") jersey dep("com.sun.jersey:jersey-servlet:${versions.jersey}") jersey dep("com.sun.jersey.contribs:jersey-spring:${versions.jersey}") jersey dep("com.sun.jersey.contribs:jersey-multipart:${versions.jersey}") jackson dep("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}") jackson dep("com.fasterxml.jackson.core:jackson-core:${versions.jackson}") jackson dep("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}") jackson dep("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${versions.jackson}") jackson dep("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}") jackson dep("com.fasterxml.jackson.datatype:jackson-datatype-joda:${versions.jackson}") jackson dep("com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:${versions.jackson}") jackson dep("com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:${versions.jackson}") jackson dep("com.fasterxml.jackson.module:jackson-module-jaxb-annotations:${versions.jackson}") swagger( dep(group: 'io.swagger', name: 'swagger-core', version: versions.swagger), dep(group: 'io.swagger', name: 'swagger-jersey-jaxrs', version: versions.swagger), ) } configurations.jersey.dependencies.forEach { configurations.jackson.exclude(group: it.group, module: it.name) } configurations.jersey.dependencies.forEach { configurations.swagger.exclude(group: it.group, module: it.name) } configurations.jackson.dependencies.forEach { configurations.swagger.exclude(group: it.group, module: it.name) } // Exclude libraries that already present in TC core or JRE configurations.swagger.exclude group: 'com.google.guava' // TC core configurations.swagger.exclude module: 'slf4j-api' // TC core configurations.jackson.exclude group: 'joda-time' // TC core configurations.jackson.exclude module: 'stax-api' // JRE configurations.jersey.exclude module: 'jaxb-api' // JRE configurations.jersey.exclude module: 'jaxb-impl' // JRE configurations.jersey.exclude group: 'org.codehaus.jackson' // added later from jackson configuration configurations.jersey.exclude group: 'org.springframework' // TC core configurations.jersey.exclude module: 'aopalliance' // TC core configurations.jersey.exclude module: 'commons-logging' // TC core // Until https://github.com/swagger-api/swagger-core/pull/1814/ is released: configurations.swagger.exclude group: 'com.sun.jersey', module: 'jersey-servlet' configurations.swagger.exclude group: 'com.sun.jersey', module: 'jersey-server' configurations.swagger.exclude group: 'com.sun.jersey', module: 'jersey-client' task fetchJersey(type: Copy) { from configurations.jersey.grep { !it.name.contains("sources") } into 'lib' } task fetchJerseySrc(type: Copy) { from configurations.jersey.grep { it.name.contains("sources") } into 'lib/src' } task fetchJackson(type: Copy) { from configurations.jackson.grep { !it.name.contains("sources") } into 'lib' } task fetchJacksonSrc(type: Copy) { from configurations.jackson.grep { it.name.contains("sources") } into 'lib/src' } task fetchSwagger(type: Copy) { from configurations.swagger.grep { !it.name.contains("sources") } into 'lib' } task fetchSwaggerSrc(type: Copy) { from configurations.swagger.grep { it.name.contains("sources") } into 'lib/src' } task sources(dependsOn: [fetchJerseySrc, fetchJacksonSrc, fetchSwaggerSrc]) task fetchLibs(dependsOn: [fetchJersey, fetchJackson, fetchSwagger]) task update(dependsOn: fetchLibs) task cleanup(type: Delete) { delete '.gradle', project.buildDir } cleanup.shouldRunAfter update