build: move back dependencies declaration from buildSrc to ./
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/0d573a40 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/0d573a40 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/0d573a40 Branch: refs/heads/develop Commit: 0d573a406e81f199aec9c897c4fd29484fc7ffe3 Parents: 3562f7f Author: Paul Merlin <[email protected]> Authored: Sat Nov 19 19:04:46 2016 +0100 Committer: Paul Merlin <[email protected]> Committed: Sat Nov 19 19:04:46 2016 +0100 ---------------------------------------------------------------------- build.gradle | 10 +- .../apache/zest/gradle/AllProjectsPlugin.groovy | 1 - .../DependenciesDeclarationExtension.groovy | 32 ++ .../DependenciesDeclarationPlugin.groovy | 30 ++ .../dependencies/DependenciesPlugin.groovy | 289 ++----------------- .../zest/gradle/dist/DistributionPlugin.groovy | 6 +- core/runtime/build.gradle | 1 - dependencies.gradle | 255 ++++++++++++++++ manual/build.gradle | 2 +- samples/sql-support/build.gradle | 2 +- tests/regression/build.gradle | 4 +- tools/shell/build.gradle | 1 - 12 files changed, 350 insertions(+), 283 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index df33a55..ebd7b5d 100644 --- a/build.gradle +++ b/build.gradle @@ -15,8 +15,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import org.apache.zest.gradle.AllProjectsPlugin +import org.apache.zest.gradle.RootProjectPlugin +import org.apache.zest.gradle.dependencies.DependenciesDeclarationPlugin + +apply plugin: DependenciesDeclarationPlugin +apply from: 'dependencies.gradle' allprojects { - apply plugin: org.apache.zest.gradle.AllProjectsPlugin + apply plugin: AllProjectsPlugin } -apply plugin: org.apache.zest.gradle.RootProjectPlugin +apply plugin: RootProjectPlugin http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy index 2563abe..82441f2 100644 --- a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy @@ -18,7 +18,6 @@ package org.apache.zest.gradle import groovy.transform.CompileStatic -import java.nio.file.Files import org.apache.zest.gradle.dependencies.DependenciesPlugin import org.apache.zest.gradle.publish.PublishingPlugin import org.gradle.api.JavaVersion http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy new file mode 100644 index 0000000..fbeb2f0 --- /dev/null +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package org.apache.zest.gradle.dependencies + +import groovy.transform.CompileStatic +import org.gradle.api.artifacts.DependencySubstitution +import org.gradle.api.artifacts.component.ModuleComponentSelector +import org.gradle.internal.BiAction + +@CompileStatic +class DependenciesDeclarationExtension +{ + final Map<String, String> repositoriesUrls = [ : ] + final Map<String, Object> libraries = [ : ] + final Map<String, List<Object>> defaultDependencies = [ : ] + BiAction<DependencySubstitution, ModuleComponentSelector> dependencySubstitutionSpec +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy new file mode 100644 index 0000000..c04ca55 --- /dev/null +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +package org.apache.zest.gradle.dependencies + +import org.gradle.api.Plugin +import org.gradle.api.Project + +class DependenciesDeclarationPlugin implements Plugin<Project> +{ + @Override + void apply( Project project ) + { + project.extensions.create( 'dependenciesDeclaration', DependenciesDeclarationExtension ) + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy index 3a7f31b..bd9efde 100644 --- a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy @@ -29,230 +29,19 @@ import org.gradle.api.artifacts.repositories.MavenArtifactRepository @CompileStatic class DependenciesPlugin implements Plugin<Project> { - static final Map<String, String> REPOSITORIES_URLS = [ - mavenCentral: "https://repo1.maven.org/maven2/", - ops4j : "http://repository.ops4j.org/maven2/", - restlet : 'https://maven.restlet.com/', - clojars : "https://clojars.org/repo/", - ] - - static final def asmVersion = '5.1' - static final def bonecpVersion = '0.8.0.RELEASE' - static final def bouncyVersion = '1.55' - static final def codahaleMetricsVersion = '3.1.2' - static final def commonsDbcpVersion = '2.1.1' - static final def commonsLangVersion = '3.5' - static final def derbyVersion = '10.13.1.1' - static final def dnsJavaVersion = '2.1.7' - static final def ehcacheVersion = '3.1.3' - static final def elasticsearchVersion = '5.0.0' - static final def freemarkerVersion = '2.3.25-incubating' - static final def geodeVersion = '1.0.0-incubating' - static final def groovyVersion = '2.4.7' - static final def h2Version = '1.4.193' - static final def hazelcastVersion = '3.7.2' - static final def hamcrestVersion = '1.3' - static final def httpClientVersion = '4.5.2' - static final def jacksonVersion = '2.8.4' - static final def javascriptVersion = '1.7.7.1' - static final def javasqlgeneratorVersion = '0.3.2' - static final def jcloudsVersion = '1.9.2' - static final def jdbmVersion = '2.4' - static final def jedisVersion = '2.9.0' - static final def jettyVersion = '9.2.17.v20160517' // 9.3.x Tests fail! - static final def jgoodiesLooksVersion = '2.7.0' - static final def jtaVersion = '1.1' - static final def leveldbVersion = '0.9' - static final def leveldbJniVersion = '1.8' - static final def liquibaseVersion = '3.5.3' - static final def logbackVersion = '1.1.7' - static final def mongodbVersion = '3.3.0' - static final def mysqlVersion = '6.0.4' - static final def orgJsonVersion = '20130213' - static final def osgiVersion = '4.2.0' // 4.3.0 Fails to compile! - 5.0.0 exists - static final def pdfboxVersion = '2.0.3' - static final def postgresqlVersion = '9.4.1211' - static final def prefuseVersion = '1.0.1' - static final def restletVersion = '2.3.7' - static final def rdfVersion = '2.7.16' // 2.8.x change query results!! 4.x exists - static final def riakVersion = '2.0.8' - static final def servletVersion = '3.1.0' - static final def shiroVersion = '1.3.2' - static final def skedVersion = '2.1' - static final def slf4jVersion = '1.7.21' - static final def solrVersion = "1.4.1" // 4.x Fails to compile! - static final def springVersion = '4.3.3.RELEASE' - static final def spymemcachedVersion = '2.12.1' - static final def sqliteVersion = '3.14.2.1' - static final def velocityVersion = '1.7' - static final def woodstoxVersion = '4.4.1' - - static final def antVersion = '1.9.7' - static final def awaitilityVersion = '2.0.0' - static final def easyMockVersion = '3.4' - static final def junitVersion = '4.12' - static final def mockitoVersion = '2.2.9' - - static final def libraries = [ - // Ant - ant : "org.apache.ant:ant:$antVersion", - ant_junit : "org.apache.ant:ant-junit:$antVersion", - - // ASM - asm : "org.ow2.asm:asm:$asmVersion", - asm_util : "org.ow2.asm:asm-util:$asmVersion", - asm_commons : "org.ow2.asm:asm-commons:$asmVersion", - - // OSGi - osgi_core : "org.osgi:org.osgi.core:$osgiVersion", - osgi_compendium : "org.osgi:org.osgi.compendium:$osgiVersion", - osgi_enterprise : "org.osgi:org.osgi.enterprise:$osgiVersion", - - // logging - slf4j_api : "org.slf4j:slf4j-api:$slf4jVersion", - slf4j_simple : "org.slf4j:slf4j-simple:$slf4jVersion", - logback : 'ch.qos.logback:logback-classic:' + logbackVersion, - jcl_slf4j : "org.slf4j:jcl-over-slf4j:$slf4jVersion", - jcl_api : 'commons-logging:commons-logging-api:99.0-does-not-exist', //ensure it is never used. - jcl : 'commons-logging:commons-logging:99.0-does-not-exist', // ensure it is never used. - - // org.json - org_json : "org.codeartisans:org.json:$orgJsonVersion", - - // Restlet - restlet : [ "org.restlet.jee:org.restlet:$restletVersion", - "org.restlet.jee:org.restlet.ext.atom:$restletVersion", - "org.restlet.jee:org.restlet.ext.servlet:$restletVersion", - "org.restlet.jee:org.restlet.ext.slf4j:$restletVersion" ], - - // Spring - spring_core : [ "org.springframework:spring-beans:$springVersion", - "org.springframework:spring-context:$springVersion" ], - - spring_testsupport : "org.springframework:spring-test:$springVersion", - - // RDF - sesame : [ "org.openrdf.sesame:sesame-model:$rdfVersion", - "org.openrdf.sesame:sesame-queryparser-sparql:$rdfVersion", - "org.openrdf.sesame:sesame-repository-dataset:$rdfVersion", - "org.openrdf.sesame:sesame-repository-http:$rdfVersion", - "org.openrdf.sesame:sesame-rio-api:$rdfVersion", - "org.openrdf.sesame:sesame-rio-n3:$rdfVersion", - "org.openrdf.sesame:sesame-rio-ntriples:$rdfVersion", - "org.openrdf.sesame:sesame-rio-rdfxml:$rdfVersion", - "org.openrdf.sesame:sesame-rio-trig:$rdfVersion", - "org.openrdf.sesame:sesame-rio-trix:$rdfVersion", - "org.openrdf.sesame:sesame-rio-turtle:$rdfVersion", - "org.openrdf.sesame:sesame-sail-api:$rdfVersion", - "org.openrdf.sesame:sesame-sail-memory:$rdfVersion", - "org.openrdf.sesame:sesame-sail-nativerdf:$rdfVersion", - "org.openrdf.sesame:sesame-sail-rdbms:$rdfVersion" ], - sparql : [ "org.openrdf.sesame:sesame-queryresultio-sparqlxml:$rdfVersion", - "org.openrdf.sesame:sesame-queryresultio-sparqljson:$rdfVersion" ], - - // SOLR - solr : [ "org.apache.solr:solr-core:$solrVersion", - "org.apache.solr:solr-solrj:$solrVersion" ], - - // Jetty - jetty_server : "org.eclipse.jetty:jetty-server:$jettyVersion", - jetty_webapp : "org.eclipse.jetty:jetty-webapp:$jettyVersion", - jetty_servlet : "org.eclipse.jetty:jetty-servlet:$jettyVersion", - jetty_http : "org.eclipse.jetty:jetty-http:$jettyVersion", - jetty_io : "org.eclipse.jetty:jetty-io:$jettyVersion", - jetty_jmx : "org.eclipse.jetty:jetty-jmx:$jettyVersion", - jetty_security : "org.eclipse.jetty:jetty-security:$jettyVersion", - jetty_jsp : "org.eclipse.jetty:jetty-jsp:$jettyVersion", - jetty_util : "org.eclipse.jetty:jetty-util:$jettyVersion", - jetty_continuation : "org.eclipse.jetty:jetty-continuation:$jettyVersion", - jetty_client : "org.eclipse.jetty:jetty-client:$jettyVersion", - jetty_xml : "org.eclipse.jetty:jetty-xml:$jettyVersion", - - // Scripting - groovy : "org.codehaus.groovy:groovy-all:$groovyVersion", - - javascript : "org.mozilla:rhino:$javascriptVersion", - - // Library & Extension dependencies - jackson_mapper : "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion", - ehcache : "org.ehcache:ehcache:$ehcacheVersion", - elasticsearch : [ "org.elasticsearch:elasticsearch:$elasticsearchVersion", - "org.elasticsearch.client:transport:$elasticsearchVersion", - // Elasticsearch 5.0 do not work with log4j 2.7 - "org.apache.logging.log4j:log4j-api:2.6.2", - "org.apache.logging.log4j:log4j-core:2.6.2" ], - geode : "org.apache.geode:geode-core:$geodeVersion", - h2 : "com.h2database:h2:$h2Version", - hazelcast : "com.hazelcast:hazelcast:$hazelcastVersion", - jclouds_core : "org.apache.jclouds:jclouds-core:$jcloudsVersion", - jclouds_blobstore : "org.apache.jclouds:jclouds-allblobstore:$jcloudsVersion", - jclouds_filesystem : "org.apache.jclouds.api:filesystem:$jcloudsVersion", - jdbm : "jdbm:jdbm:$jdbmVersion", - jedis : "redis.clients:jedis:$jedisVersion", - jgoodies_looks : "com.jgoodies:jgoodies-looks:$jgoodiesLooksVersion", - leveldb_api : "org.iq80.leveldb:leveldb-api:$leveldbVersion", - leveldb_java : "org.iq80.leveldb:leveldb:$leveldbVersion", - leveldb_jni_all : "org.fusesource.leveldbjni:leveldbjni-all:$leveldbJniVersion", - mongodb : "org.mongodb:mongo-java-driver:$mongodbVersion", - riak : "com.basho.riak:riak-client:$riakVersion", - jta : "javax.transaction:jta:$jtaVersion", - javaSqlGenerator : "org.java-sql-generator:org.java-sql-generator.api:$javasqlgeneratorVersion", - javaSqlGeneratorImpl: "org.java-sql-generator:org.java-sql-generator.implementation:$javasqlgeneratorVersion", - velocity : "org.apache.velocity:velocity:$velocityVersion", - commons_dbcp : "org.apache.commons:commons-dbcp2:$commonsDbcpVersion", - commons_lang : "org.apache.commons:commons-lang3:$commonsLangVersion", - servlet_api : "javax.servlet:javax.servlet-api:$servletVersion", - http_client : "org.apache.httpcomponents:httpclient:$httpClientVersion", - woodstox : "org.codehaus.woodstox:woodstox-core-asl:$woodstoxVersion", - restlet_xml : "org.restlet.jee:org.restlet.ext.xml:$restletVersion", - bouncy_castle : "org.bouncycastle:bcprov-jdk15on:$bouncyVersion", - dnsjava : "dnsjava:dnsjava:$dnsJavaVersion", - freemarker : "org.freemarker:freemarker:$freemarkerVersion", - shiro : "org.apache.shiro:shiro-core:$shiroVersion", - shiro_web : "org.apache.shiro:shiro-web:$shiroVersion", - bonecp : "com.jolbox:bonecp:$bonecpVersion", - liquibase : "org.liquibase:liquibase-core:$liquibaseVersion", - sked : "org.codeartisans:sked:$skedVersion", - pdfbox : "org.apache.pdfbox:pdfbox:$pdfboxVersion", - prefuse : "de.sciss:prefuse-core:$prefuseVersion", - spymemcached : "net.spy:spymemcached:$spymemcachedVersion", - codahale_metrics : [ "io.dropwizard.metrics:metrics-core:$codahaleMetricsVersion", - "io.dropwizard.metrics:metrics-healthchecks:$codahaleMetricsVersion" ], - - // Testing - junit : "junit:junit:$junitVersion", - hamcrest : [ "org.hamcrest:hamcrest-core:$hamcrestVersion", - "org.hamcrest:hamcrest-library:$hamcrestVersion" ], - awaitility : "org.awaitility:awaitility:$awaitilityVersion", - easymock : "org.easymock:easymock:$easyMockVersion", - mockito : "org.mockito:mockito-core:$mockitoVersion", - - // Tests dependencies - derby : "org.apache.derby:derby:$derbyVersion", - derbyclient : "org.apache.derby:derbyclient:$derbyVersion", - derbynet : "org.apache.derby:derbynet:$derbyVersion", - postgres : "org.postgresql:postgresql:$postgresqlVersion", - mysql_connector : "mysql:mysql-connector-java:$mysqlVersion", - sqlite : "org.xerial:sqlite-jdbc:$sqliteVersion", - ] - - static final Map<String, Object> defaultTestDependencies = [ - testCompile: [ libraries[ 'junit' ], libraries[ 'hamcrest' ], libraries[ 'ant' ], libraries[ 'ant_junit' ] ], - testRuntime: [ libraries[ 'asm' ], libraries[ 'asm_commons' ], libraries[ 'asm_util' ] ] - ] as Map - @Override void apply( final Project project ) { - applyRepositories( project ) - applyLibraries( project ) - applyDependencyResolutionRules( project ) - applyDefaultTestDependencies( project ) + def dependenciesDeclaration = project.rootProject.extensions.getByType( DependenciesDeclarationExtension ) + applyRepositories( project, dependenciesDeclaration ) + applyLibraries( project, dependenciesDeclaration ) + applyDependencyResolutionRules( project, dependenciesDeclaration ) + applyDefaultDependencies( project, dependenciesDeclaration ) } - private static void applyRepositories( Project project ) + private static void applyRepositories( Project project, DependenciesDeclarationExtension declaration ) { - REPOSITORIES_URLS.each { name, url -> + declaration.repositoriesUrls.each { name, url -> project.repositories.maven { MavenArtifactRepository repo -> repo.name = name repo.url = url @@ -260,71 +49,29 @@ class DependenciesPlugin implements Plugin<Project> } } - private static void applyLibraries( Project project ) + private static void applyLibraries( Project project, DependenciesDeclarationExtension declaration ) { - if( project.rootProject == project ) - { - project.extensions.extraProperties.set( 'libraries', libraries ) - } + project.extensions.extraProperties.set 'libraries', declaration.libraries } - private static void applyDependencyResolutionRules( Project project ) + private static void applyDependencyResolutionRules( Project project, DependenciesDeclarationExtension declaration ) { project.configurations.all( { Configuration configuration -> - configuration.resolutionStrategy.dependencySubstitution.all( { DependencySubstitution dep -> - if( dep.requested instanceof ModuleComponentSelector ) - { - def requested = dep.requested as ModuleComponentSelector - // Always resolve SLF4J to the same version - if( requested.group == 'org.slf4j' ) - { - dep.useTarget group: requested.group, name: requested.module, version: slf4jVersion - } - // Always resolve ASM to the same version - if( requested.group == 'org.ow2.asm' ) - { - dep.useTarget group: requested.group, name: requested.module, version: asmVersion - } - // Always resolve OSGi to the same version - if( requested.group == 'org.osgi' ) - { - dep.useTarget group: requested.group, name: requested.module, version: osgiVersion - } - // Always resolve Jackson to the same version - if( requested.group.startsWith( 'com.fasterxml.jackson' ) && requested.module != 'jackson-parent' ) + configuration.resolutionStrategy.dependencySubstitution.all( + { DependencySubstitution dep -> + if( dep.requested instanceof ModuleComponentSelector ) { - dep.useTarget group: requested.group, name: requested.module, version: jacksonVersion + def selector = dep.requested as ModuleComponentSelector + declaration.dependencySubstitutionSpec.execute dep, selector } - // woodstox:wstx-asl is broken (no pom), use org.codehaus.woodstox:wstx-asl instead - if( requested.group == 'woodstox' && requested.module == 'wstx-asl' ) - { - dep.useTarget group: 'org.codehaus.woodstox', name: 'wstx-asl', version: requested.version - } - // some bad citizens have SNAPSHOT parents ... - if( requested.module == 'commons-sandbox-parent' && requested.version == '3-SNAPSHOT' ) - { - dep.useTarget group: requested.group, name: requested.module, version: '3' - } - // GSON 2.3 POM is invalid, use 2.3.1 instead .. see https://github.com/google/gson/issues/588 - if( requested.group == 'com.google.code.gson' && requested.module == 'gson' && requested.version == '2.3' ) - { - dep.useTarget group: requested.group, name: requested.module, version: '2.3.1' - } - // Findbugs Annotation is LGPL, use https://github.com/stephenc/findbugs-annotations which is - // Apache 2 licensed instead - if( requested.group == 'net.sourceforge.findbugs' && requested.module == 'annotations' ) - { - dep.useTarget group: 'com.github.stephenc.findbugs', name: 'findbugs-annotations', version: '1.3.9-1' - } - } - } as Action<DependencySubstitution> ) + } as Action<DependencySubstitution> ) } as Action<Configuration> ) } - private static void applyDefaultTestDependencies( Project project ) + private static void applyDefaultDependencies( Project project, DependenciesDeclarationExtension declaration ) { - defaultTestDependencies.each { String configuration, Object dependencies -> + declaration.defaultDependencies.each { String configuration, List<Object> dependencies -> dependencies.each { dependency -> if( dependency instanceof Collection ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy index 930e68e..8611825 100644 --- a/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy @@ -23,6 +23,7 @@ import org.apache.rat.gradle.RatTask import org.apache.tools.ant.filters.ReplaceTokens import org.apache.zest.gradle.RootProjectPlugin import org.apache.zest.gradle.TaskGroups +import org.apache.zest.gradle.dependencies.DependenciesDeclarationExtension import org.apache.zest.gradle.dependencies.DependenciesPlugin import org.apache.zest.gradle.release.ReleaseSpecExtension import org.apache.zest.gradle.release.ReleaseSpecPlugin @@ -291,13 +292,14 @@ class DistributionPlugin implements Plugin<Project> private static void configureGoOfflineHelpers( Project project ) { + def externalRepos = project.rootProject.extensions.getByType( DependenciesDeclarationExtension ).repositoriesUrls def approvedProjectsTask = project.tasks.getByName( ReleaseSpecPlugin.TaskNames.RELEASE_APPROVED_PROJECTS ) def genOfflineMaven = project.tasks.create( TaskNames.GENERATE_MAVEN_OFFLINE_HELPERS, GoOfflineHelpersTasks.GenerateMaven ) def genOfflineGradle = project.tasks.create( TaskNames.GENERATE_GRADLE_OFFLINE_HELPERS, GoOfflineHelpersTasks.GenerateGradle ) - genOfflineMaven.repositories = DependenciesPlugin.REPOSITORIES_URLS - genOfflineGradle.repositories = DependenciesPlugin.REPOSITORIES_URLS + genOfflineMaven.repositories = externalRepos + genOfflineGradle.repositories = externalRepos [ genOfflineMaven, genOfflineGradle ].each { task -> task.group = TaskGroups.DISTRIBUTION task.dependsOn approvedProjectsTask http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/core/runtime/build.gradle ---------------------------------------------------------------------- diff --git a/core/runtime/build.gradle b/core/runtime/build.gradle index 3b37d9f..d0dbeea 100644 --- a/core/runtime/build.gradle +++ b/core/runtime/build.gradle @@ -30,5 +30,4 @@ dependencies { testCompile zest.core.testsupport testCompile zest.library( 'constraints' ) - testCompile libraries.hamcrest } http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/dependencies.gradle ---------------------------------------------------------------------- diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000..aed45ba --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,255 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +import org.apache.zest.gradle.dependencies.DependenciesDeclarationExtension + +def dependencies = extensions.getByType( DependenciesDeclarationExtension ) + +// Remote repositories +dependencies.repositoriesUrls << [ + mavenCentral: "https://repo1.maven.org/maven2/", + ops4j : "http://repository.ops4j.org/maven2/", + restlet : 'https://maven.restlet.com/', + clojars : "https://clojars.org/repo/", +] + +// Core dependencies +def asmVersion = '5.1' +def orgJsonVersion = '20130213' +def osgiVersion = '4.2.0' // 4.3.0 Fails to compile! - 5.0.0 exists +dependencies.libraries << [ + asm : "org.ow2.asm:asm:$asmVersion", + asm_commons: "org.ow2.asm:asm-commons:$asmVersion", + asm_util : "org.ow2.asm:asm-util:$asmVersion", + org_json : "org.codeartisans:org.json:$orgJsonVersion", + osgi_core : "org.osgi:org.osgi.core:$osgiVersion", +] + +// Extensions, Libraries and Tools dependencies +def bonecpVersion = '0.8.0.RELEASE' +def bouncyVersion = '1.55' +def codahaleMetricsVersion = '3.1.2' +def commonsDbcpVersion = '2.1.1' +def commonsLangVersion = '3.5' +def derbyVersion = '10.13.1.1' +def ehcacheVersion = '3.1.3' +def elasticsearchVersion = '5.0.1' +def freemarkerVersion = '2.3.25-incubating' +def geodeVersion = '1.0.0-incubating' +def groovyVersion = '2.4.7' +def hazelcastVersion = '3.7.3' +def httpClientVersion = '4.5.2' +def jacksonVersion = '2.8.5' +def javascriptVersion = '1.7.7.1' +def javasqlgeneratorVersion = '0.3.2' +def jcloudsVersion = '1.9.2' // 2.0.0 exists +def jdbmVersion = '2.4' +def jedisVersion = '2.9.0' +def jettyVersion = '9.2.17.v20160517' // 9.3.x Tests fail! +def leveldbVersion = '0.9' +def leveldbJniVersion = '1.8' +def liquibaseVersion = '3.5.3' +def mongodbVersion = '3.3.0' +def restletVersion = '2.3.7' +def rdfVersion = '2.7.16' // 2.8.x change query results!! 4.x exists +def riakVersion = '2.1.0' +def servletVersion = '3.1.0' +def shiroVersion = '1.3.2' +def slf4jVersion = '1.7.21' +def solrVersion = "1.4.1" // 4.x Fails to compile! +def springVersion = '4.3.4.RELEASE' +def spymemcachedVersion = '2.12.1' +def velocityVersion = '1.7' +dependencies.libraries << [ + bonecp : "com.jolbox:bonecp:$bonecpVersion", + bouncy_castle : "org.bouncycastle:bcprov-jdk15on:$bouncyVersion", + codahale_metrics : [ "io.dropwizard.metrics:metrics-core:$codahaleMetricsVersion", + "io.dropwizard.metrics:metrics-healthchecks:$codahaleMetricsVersion" ], + commons_dbcp : "org.apache.commons:commons-dbcp2:$commonsDbcpVersion", + commons_lang : "org.apache.commons:commons-lang3:$commonsLangVersion", + ehcache : "org.ehcache:ehcache:$ehcacheVersion", + elasticsearch : [ "org.elasticsearch:elasticsearch:$elasticsearchVersion", + "org.elasticsearch.client:transport:$elasticsearchVersion", + // Elasticsearch 5.0 do not work with log4j 2.7 + "org.apache.logging.log4j:log4j-api:2.6.2", + "org.apache.logging.log4j:log4j-core:2.6.2" ], + freemarker : "org.freemarker:freemarker:$freemarkerVersion", + geode : "org.apache.geode:geode-core:$geodeVersion", + groovy : "org.codehaus.groovy:groovy-all:$groovyVersion", + hazelcast : "com.hazelcast:hazelcast:$hazelcastVersion", + http_client : "org.apache.httpcomponents:httpclient:$httpClientVersion", + jackson_mapper : "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion", + javascript : "org.mozilla:rhino:$javascriptVersion", + javaSqlGenerator : "org.java-sql-generator:org.java-sql-generator.api:$javasqlgeneratorVersion", + javaSqlGeneratorImpl: "org.java-sql-generator:org.java-sql-generator.implementation:$javasqlgeneratorVersion", + jclouds_core : "org.apache.jclouds:jclouds-core:$jcloudsVersion", + jclouds_blobstore : "org.apache.jclouds:jclouds-allblobstore:$jcloudsVersion", + jclouds_filesystem : "org.apache.jclouds.api:filesystem:$jcloudsVersion", + jetty_server : "org.eclipse.jetty:jetty-server:$jettyVersion", + jetty_webapp : "org.eclipse.jetty:jetty-webapp:$jettyVersion", + jetty_servlet : "org.eclipse.jetty:jetty-servlet:$jettyVersion", + jetty_http : "org.eclipse.jetty:jetty-http:$jettyVersion", + jetty_io : "org.eclipse.jetty:jetty-io:$jettyVersion", + jetty_jmx : "org.eclipse.jetty:jetty-jmx:$jettyVersion", + jetty_security : "org.eclipse.jetty:jetty-security:$jettyVersion", + jetty_jsp : "org.eclipse.jetty:jetty-jsp:$jettyVersion", + jetty_util : "org.eclipse.jetty:jetty-util:$jettyVersion", + jetty_continuation : "org.eclipse.jetty:jetty-continuation:$jettyVersion", + jetty_client : "org.eclipse.jetty:jetty-client:$jettyVersion", + jetty_xml : "org.eclipse.jetty:jetty-xml:$jettyVersion", + jdbm : "jdbm:jdbm:$jdbmVersion", + jedis : "redis.clients:jedis:$jedisVersion", + leveldb_api : "org.iq80.leveldb:leveldb-api:$leveldbVersion", + leveldb_java : "org.iq80.leveldb:leveldb:$leveldbVersion", + leveldb_jni_all : "org.fusesource.leveldbjni:leveldbjni-all:$leveldbJniVersion", + liquibase : "org.liquibase:liquibase-core:$liquibaseVersion", + mongodb : "org.mongodb:mongo-java-driver:$mongodbVersion", + osgi_compendium : "org.osgi:org.osgi.compendium:$osgiVersion", + osgi_enterprise : "org.osgi:org.osgi.enterprise:$osgiVersion", + restlet : [ "org.restlet.jee:org.restlet:$restletVersion", + "org.restlet.jee:org.restlet.ext.atom:$restletVersion", + "org.restlet.jee:org.restlet.ext.servlet:$restletVersion", + "org.restlet.jee:org.restlet.ext.slf4j:$restletVersion" ], + restlet_xml : "org.restlet.jee:org.restlet.ext.xml:$restletVersion", + riak : "com.basho.riak:riak-client:$riakVersion", + servlet_api : "javax.servlet:javax.servlet-api:$servletVersion", + sesame : [ "org.openrdf.sesame:sesame-model:$rdfVersion", + "org.openrdf.sesame:sesame-queryparser-sparql:$rdfVersion", + "org.openrdf.sesame:sesame-repository-dataset:$rdfVersion", + "org.openrdf.sesame:sesame-repository-http:$rdfVersion", + "org.openrdf.sesame:sesame-rio-api:$rdfVersion", + "org.openrdf.sesame:sesame-rio-n3:$rdfVersion", + "org.openrdf.sesame:sesame-rio-ntriples:$rdfVersion", + "org.openrdf.sesame:sesame-rio-rdfxml:$rdfVersion", + "org.openrdf.sesame:sesame-rio-trig:$rdfVersion", + "org.openrdf.sesame:sesame-rio-trix:$rdfVersion", + "org.openrdf.sesame:sesame-rio-turtle:$rdfVersion", + "org.openrdf.sesame:sesame-sail-api:$rdfVersion", + "org.openrdf.sesame:sesame-sail-memory:$rdfVersion", + "org.openrdf.sesame:sesame-sail-nativerdf:$rdfVersion", + "org.openrdf.sesame:sesame-sail-rdbms:$rdfVersion" ], + shiro : "org.apache.shiro:shiro-core:$shiroVersion", + shiro_web : "org.apache.shiro:shiro-web:$shiroVersion", + slf4j_api : "org.slf4j:slf4j-api:$slf4jVersion", + solr : [ "org.apache.solr:solr-core:$solrVersion", + "org.apache.solr:solr-solrj:$solrVersion" ], + sparql : [ "org.openrdf.sesame:sesame-queryresultio-sparqlxml:$rdfVersion", + "org.openrdf.sesame:sesame-queryresultio-sparqljson:$rdfVersion" ], + spring_core : [ "org.springframework:spring-beans:$springVersion", + "org.springframework:spring-context:$springVersion" ], + spymemcached : "net.spy:spymemcached:$spymemcachedVersion", + velocity : "org.apache.velocity:velocity:$velocityVersion", +] + +// Tools dependencies +def jgoodiesLooksVersion = '2.7.0' +def pdfboxVersion = '2.0.3' +def prefuseVersion = '1.0.1' +dependencies.libraries << [ + jgoodies_looks: "com.jgoodies:jgoodies-looks:$jgoodiesLooksVersion", + pdfbox : "org.apache.pdfbox:pdfbox:$pdfboxVersion", + prefuse : "de.sciss:prefuse-core:$prefuseVersion", +] + +// Runtime, Test and Samples dependencies +def antVersion = '1.9.7' +def awaitilityVersion = '2.0.0' +def dnsJavaVersion = '2.1.7' +def easyMockVersion = '3.4' +def h2Version = '1.4.193' +def hamcrestVersion = '1.3' +def junitVersion = '4.12' +def logbackVersion = '1.1.7' +def mockitoVersion = '2.2.9' +def mysqlVersion = '6.0.4' +def postgresqlVersion = '9.4.1211' +def sqliteVersion = '3.14.2.1' +dependencies.libraries << [ + ant : "org.apache.ant:ant:$antVersion", + ant_junit : "org.apache.ant:ant-junit:$antVersion", + awaitility : "org.awaitility:awaitility:$awaitilityVersion", + derby : "org.apache.derby:derby:$derbyVersion", + dnsjava : "dnsjava:dnsjava:$dnsJavaVersion", + easymock : "org.easymock:easymock:$easyMockVersion", + h2 : "com.h2database:h2:$h2Version", + hamcrest : [ "org.hamcrest:hamcrest-core:$hamcrestVersion", + "org.hamcrest:hamcrest-library:$hamcrestVersion" ], + junit : "junit:junit:$junitVersion", + logback : "ch.qos.logback:logback-classic:$logbackVersion", + mockito : "org.mockito:mockito-core:$mockitoVersion", + mysql_connector : "mysql:mysql-connector-java:$mysqlVersion", + postgres : "org.postgresql:postgresql:$postgresqlVersion", + spring_testsupport: "org.springframework:spring-test:$springVersion", + sqlite : "org.xerial:sqlite-jdbc:$sqliteVersion", +] + +// Default dependencies +dependencies.defaultDependencies << [ + testCompile: [ dependencies.libraries.junit, + dependencies.libraries.hamcrest, + dependencies.libraries.ant, + dependencies.libraries.ant_junit ], + testRuntime: [ dependencies.libraries.asm, + dependencies.libraries.asm_commons, + dependencies.libraries.asm_util ] +] + +// Resolution rules +dependencies.dependencySubstitutionSpec = { DependencySubstitution dep, ModuleComponentSelector requested -> + // Always resolve ASM to the same version + if( requested.group == 'org.ow2.asm' ) + { + dep.useTarget group: requested.group, name: requested.module, version: asmVersion + } + // Always resolve OSGi to the same version + if( requested.group == 'org.osgi' ) + { + dep.useTarget group: requested.group, name: requested.module, version: osgiVersion + } + // Always resolve SLF4J to the same version + if( requested.group == 'org.slf4j' ) + { + dep.useTarget group: requested.group, name: requested.module, version: slf4jVersion + } + // Always resolve Jackson to the same version + if( requested.group.startsWith( 'com.fasterxml.jackson' ) && requested.module != 'jackson-parent' ) + { + dep.useTarget group: requested.group, name: requested.module, version: jacksonVersion + } + // woodstox:wstx-asl is broken (no pom), use org.codehaus.woodstox:wstx-asl instead + if( requested.group == 'woodstox' && requested.module == 'wstx-asl' ) + { + dep.useTarget group: 'org.codehaus.woodstox', name: 'wstx-asl', version: requested.version + } + // some bad citizens have SNAPSHOT parents ... + if( requested.module == 'commons-sandbox-parent' && requested.version == '3-SNAPSHOT' ) + { + dep.useTarget group: requested.group, name: requested.module, version: '3' + } + // GSON 2.3 POM is invalid, use 2.3.1 instead .. see https://github.com/google/gson/issues/588 + if( requested.group == 'com.google.code.gson' && requested.module == 'gson' && requested.version == + '2.3' ) + { + dep.useTarget group: requested.group, name: requested.module, version: '2.3.1' + } + // Findbugs Annotation is LGPL, use https://github.com/stephenc/findbugs-annotations which is + // Apache 2 licensed instead + if( requested.group == 'net.sourceforge.findbugs' && requested.module == 'annotations' ) + { + dep.useTarget group: 'com.github.stephenc.findbugs', name: 'findbugs-annotations', version: '1.3.9-1' + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/manual/build.gradle ---------------------------------------------------------------------- diff --git a/manual/build.gradle b/manual/build.gradle index b41ed37..c42763c 100644 --- a/manual/build.gradle +++ b/manual/build.gradle @@ -27,6 +27,6 @@ dependencies { compile zest.library( 'logging' ) runtime zest.core.runtime - runtime( libraries.slf4j_simple ) + runtime( libraries.logback ) } http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/samples/sql-support/build.gradle ---------------------------------------------------------------------- diff --git a/samples/sql-support/build.gradle b/samples/sql-support/build.gradle index d1a82e9..d386991 100644 --- a/samples/sql-support/build.gradle +++ b/samples/sql-support/build.gradle @@ -34,7 +34,7 @@ dependencies { runtime zest.core.runtime runtime libraries.postgres - runtime libraries.slf4j_simple + runtime libraries.logback } task( runSqlSupportSample, dependsOn: 'classes', type: JavaExec ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/tests/regression/build.gradle ---------------------------------------------------------------------- diff --git a/tests/regression/build.gradle b/tests/regression/build.gradle index 5bb2a96..f7d5a1b 100644 --- a/tests/regression/build.gradle +++ b/tests/regression/build.gradle @@ -30,7 +30,5 @@ dependencies { compile libraries.junit runtime zest.core.runtime - runtime libraries.asm - runtime libraries.asm_commons - runtime libraries.slf4j_simple + runtime libraries.logback } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/0d573a40/tools/shell/build.gradle ---------------------------------------------------------------------- diff --git a/tools/shell/build.gradle b/tools/shell/build.gradle index f20fbc3..2f91c58 100644 --- a/tools/shell/build.gradle +++ b/tools/shell/build.gradle @@ -31,6 +31,5 @@ jar { } dependencies { - testCompile libraries.junit testRuntime libraries.logback }
