sourcegraph/srclib-java — pull request #19 by bsummer4 (2014-11-13 18:54:34+00:00)
Title: Make the gradle build analysis more robust

# Make the gradle build analysis more robust
This PR is definitely not ready to merge!

The goal of this PR is to have the Gradle build working for most of the android projects that are available on Github.

## Installing the android SDK

$ android=~/android
$ mkdir -p $android
$ cd $android
$ curl https://dl.google.com/android/android-sdk_r23.0.2-linux.tgz | tar xz

$ export ANDROID_HOME=$android/android-sdk-linux
$ export PATH=$ANDROID_HOME/tools:$PATH

# This will take a very long time and use 30GB of space.
# It is possible to install fewer packages, but I'm not yet sure which are important.
$ android update sdk --all --no-ui

## The `gradle-info` script.
I've been debugging the gradle detection code using a shell script for faster
turn-around time. These changes should be incorporated into the Java code
once they stabilize.

```
#!/bin/sh

set -e

initScript=/tmp/srclib-collect-meta-information.gradle

cat >$initScript <
conf.resolvedConfiguration.getResolvedArtifacts().each {
String group = it.moduleVersion.id.group
String name = it.moduleVersion.id.name
String version = it.moduleVersion.id.version
String file = it.file
println "DEPENDENCY \$conf.name:\$group:\$name:\$version:\$file"
}
}
}
catch (Exception e) {}
}
}
!

gradle=gradle

if [ -e ./gradlew ]
then gradle='bash ./gradlew'
fi

echo $gradle -I $initScript --continue srclibCollectMetaInformation
$gradle -I $initScript --continue srclibCollectMetaInformation
```