From 6faf8ff5ced4739eed590a44ca0b1a82c5eb87f7 Mon Sep 17 00:00:00 2001
From: Marek Goldmann <goldmann@fedoraproject.org>
Date: Mon, 30 Jul 2012 18:27:50 +0200
Subject: [PATCH 25/25] Use local available libraries

---
 build.gradle                                       | 34 ++++++++++++----------
 buildSrc/build.gradle                              |  6 ++--
 gradle/groovyProject.gradle                        |  4 +--
 subprojects/core-impl/core-impl.gradle             |  2 ++
 subprojects/core/core.gradle                       |  5 ++--
 .../internal/classpath/DefaultModuleRegistry.java  |  6 ++++
 6 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/build.gradle b/build.gradle
index 1a5aada..c68d650 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,7 +46,7 @@ ext {
         ant: dependencies.module('org.apache.ant:ant:1.8.2') {
             dependency 'org.apache.ant:ant-launcher:1.8.2@jar'
         },
-        asm: 'asm:asm-all:3.3.1@jar',
+        asm: 'asm:objectweb-asm/asm-all:3.3.1@jar',
         commons_cli: 'commons-cli:commons-cli:1.2@jar',
         commons_io: dependencies.module(versions.commons_io),
         commons_lang: 'commons-lang:commons-lang:2.6@jar',
@@ -60,18 +60,18 @@ ext {
 }
 
 // Logging
-libraries.slf4j_api = 'org.slf4j:slf4j-api:1.6.4@jar'
-libraries.jcl_to_slf4j = dependencies.module('org.slf4j:jcl-over-slf4j:1.6.4') {
+libraries.slf4j_api = 'org.slf4j:slf4j/api:1.6.4@jar'
+libraries.jcl_to_slf4j = dependencies.module('org.slf4j:slf4j/jcl-over-slf4j:1.6.4') {
     dependency libraries.slf4j_api
 }
-libraries.jul_to_slf4j = dependencies.module('org.slf4j:jul-to-slf4j:1.6.4') {
+libraries.jul_to_slf4j = dependencies.module('org.slf4j:slf4j/jul-to-slf4j:1.6.4') {
     dependency libraries.slf4j_api
 }
-libraries.log4j_to_slf4j = dependencies.module('org.slf4j:log4j-over-slf4j:1.6.4') {
+libraries.log4j_to_slf4j = dependencies.module('org.slf4j:slf4j/log4j-over-slf4j:1.6.4') {
     dependency libraries.slf4j_api
 }
-libraries.logback_core = 'ch.qos.logback:logback-core:1.0.0@jar'
-libraries.logback_classic = dependencies.module('ch.qos.logback:logback-classic:1.0.0') {
+libraries.logback_core = 'ch.qos.logback:logback/logback-core:1.0.0@jar'
+libraries.logback_classic = dependencies.module('ch.qos.logback:logback/logback-classic:1.0.0') {
     dependency libraries.logback_core
     dependency libraries.slf4j_api
 }
@@ -87,8 +87,8 @@ libraries.jetty = dependencies.module("org.mortbay.jetty:jetty:6.1.25") {
     dependency libraries.servlet_api
 }
 
-libraries.commons_httpclient = dependencies.module('org.apache.httpcomponents:httpclient:4.1.2') {
-    dependency "org.apache.httpcomponents:httpcore:4.1.2@jar"
+libraries.commons_httpclient = dependencies.module('org.apache.httpcomponents:httpcomponents/httpclient:4.1.2') {
+    dependency "org.apache.httpcomponents:httpcomponents/httpcore:4.1.2@jar"
     dependency libraries.jcl_to_slf4j
     dependency "commons-codec:commons-codec:1.4@jar"
     dependency "org.samba.jcifs:jcifs:1.3.17"
@@ -99,14 +99,14 @@ libraries.maven_ant_tasks = dependencies.module("org.apache.maven:maven-ant-task
 }
 
 libraries += [
-        ant_junit: 'org.apache.ant:ant-junit:1.8.2@jar',
-        ant_antlr: 'org.apache.ant:ant-antlr:1.8.2@jar',
+        ant_junit: 'org.apache.ant:ant/ant-junit:1.8.2@jar',
+        ant_antlr: 'org.apache.ant:ant/ant-antlr:1.8.2@jar',
         antlr: 'antlr:antlr:2.7.7@jar',
         dom4j: 'dom4j:dom4j:1.6.1@jar',
         guava: 'com.google.guava:guava:11.0.1@jar',
         groovy: [
                 'org.codehaus.groovy:groovy:1.8.6@jar',
-                'asm:asm-all:3.3.1@jar',
+                'asm:objectweb-asm/asm-all:3.3.1@jar',
                 'antlr:antlr:2.7.7@jar',
                 'commons-cli:commons-cli:1.2@jar'
         ],
@@ -121,14 +121,14 @@ libraries += [
 libraries.spock = ['org.spockframework:spock-core:0.6-groovy-1.8@jar',
         libraries.groovy,
         'org.objenesis:objenesis:1.2',
-        'cglib:cglib-nodep:2.2']
+        'cglib:cglib:2.2']
 libraries.jmock = ['org.jmock:jmock:2.5.1',
         'org.hamcrest:hamcrest-core:1.1',
         'org.hamcrest:hamcrest-library:1.1',
         'org.jmock:jmock-junit4:2.5.1',
         'org.jmock:jmock-legacy:2.5.1',
         'org.objenesis:objenesis:1.2',
-        'cglib:cglib-nodep:2.2']
+        'cglib:cglib:2.2']
 
 allprojects {
     group = 'org.gradle'
@@ -139,8 +139,10 @@ allprojects {
     }
 
     repositories {
-        maven { url 'http://repo.gradle.org/gradle/libs' }
-        maven { url 'http://repository.codehaus.org/' }
+        ivy {
+            artifactPattern "/usr/share/java/[module]-[revision].[ext]"
+            artifactPattern "/usr/share/java/[module].[ext]"
+        }
     }
 
     configurations {
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 46f4683..69dad55 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -21,8 +21,10 @@ apply plugin: 'idea'
 apply plugin: 'eclipse'
 
 repositories {
-    maven { url 'http://repo.gradle.org/gradle/libs' }
-    mavenCentral()
+     ivy {
+         artifactPattern "/usr/share/java/[module]-[revision].[ext]"
+         artifactPattern "/usr/share/java/[module].[ext]"
+     }
 }
 
 dependencies {
diff --git a/gradle/groovyProject.gradle b/gradle/groovyProject.gradle
index ffe1e17..4c34acc 100644
--- a/gradle/groovyProject.gradle
+++ b/gradle/groovyProject.gradle
@@ -59,7 +59,7 @@ class ClasspathManifest extends DefaultTask {
     @Input
     Properties getProperties() {
         def properties = new Properties()
-        properties.runtime = project.configurations.runtime.fileCollection { it instanceof ExternalDependency }.collect {it.name}.join(',')
+        properties.runtime = project.configurations.runtime.fileCollection { it instanceof ExternalDependency }.collect {it.absolutePath.replaceFirst('/usr/share/java/', '')}.join(',')
         properties.projects = project.configurations.runtime.allDependencies.withType(ProjectDependency).collect {it.dependencyProject.archivesBaseName}.join(',')
         return properties
     }
@@ -68,4 +68,4 @@ class ClasspathManifest extends DefaultTask {
     def generate() {
         manifestFile.withOutputStream { properties.save(it, 'module definition') }
     }
-}
\ No newline at end of file
+}
diff --git a/subprojects/core-impl/core-impl.gradle b/subprojects/core-impl/core-impl.gradle
index 064d6ed..fd70969 100644
--- a/subprojects/core-impl/core-impl.gradle
+++ b/subprojects/core-impl/core-impl.gradle
@@ -11,6 +11,8 @@ dependencies {
     compile libraries.ivy
     compile libraries.slf4j_api
     compile libraries.maven_ant_tasks
+    // This is unbundled from  maven-ant-tasks
+    compile "org.codehaus.plexus:plexus/container-default:1.0"
 
     testCompile libraries.junit
 }
diff --git a/subprojects/core/core.gradle b/subprojects/core/core.gradle
index 15b2e45..9b3ecdd 100755
--- a/subprojects/core/core.gradle
+++ b/subprojects/core/core.gradle
@@ -54,7 +54,8 @@ dependencies {
 
     integTestCompile project(":internalIntegTesting")
 
-    reports 'css3-pie:css3-pie:1.0beta3'
+// Not available in Fedora
+//    reports 'css3-pie:css3-pie:1.0beta3'
 }
 
 test {
@@ -94,4 +95,4 @@ class PluginsManifest extends DefaultTask {
     def generate() {
         propertiesFile.withOutputStream { pluginProperties.save(it, 'plugin definitions') }
     }
-}
\ No newline at end of file
+}
diff --git a/subprojects/core/src/main/groovy/org/gradle/api/internal/classpath/DefaultModuleRegistry.java b/subprojects/core/src/main/groovy/org/gradle/api/internal/classpath/DefaultModuleRegistry.java
index 126024d..da4d227 100644
--- a/subprojects/core/src/main/groovy/org/gradle/api/internal/classpath/DefaultModuleRegistry.java
+++ b/subprojects/core/src/main/groovy/org/gradle/api/internal/classpath/DefaultModuleRegistry.java
@@ -257,6 +257,12 @@ public class DefaultModuleRegistry implements ModuleRegistry, GradleDistribution
                 return jarFile;
             }
         }
+        // Last chance, look for libary in system-wide java directory
+        jarFile = new File("/usr/share/java/", name);
+
+        if (jarFile.isFile()) {
+            return jarFile;
+        }
         throw new IllegalArgumentException(String.format("Cannot find JAR '%s' required by module '%s' using classpath or distribution directory '%s'", name, module, distDir));
     }
 
-- 
1.7.11.2

