Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yeungeek
Created September 15, 2014 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yeungeek/85f81d5e73ff178e0f3a to your computer and use it in GitHub Desktop.
Save yeungeek/85f81d5e73ff178e0f3a to your computer and use it in GitHub Desktop.
gradle_eclipse
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'android-library'
apply plugin: 'maven'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.jasmine"
minSdkVersion 9
targetSdkVersion 17
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
}
lintOptions
{
abortOnError false
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
////////////////////// configure eclipse //////////////////////
eclipse.classpath.plusConfigurations += configurations.compile
//.classpath
eclipse.classpath.file {
beforeMerged { classpath ->
classpath.entries.removeAll() { c ->
c.kind == 'src'
}
}
// Direct manipulation of the generated classpath XML
withXml {
def node = it.asNode()
// Main source
node.appendNode('classpathentry kind="src" path="src"')
// test build type source directory
// node.appendNode('classpathentry kind="src" path="src/test/java"')
// Generated code directory
node.appendNode('classpathentry kind="src" path="gen"')
// Filter out dependencies unwanted for Eclipse
node.children().removeAll() { c ->
def path = c.attribute('path')
path != null && (
path.contains('/com.android.support/support-v4')
)
}
}
}
//.project
eclipse.project {
name = 'playpay-sdk'
// Letting Eclipse know that the project is Android
natures 'com.android.ide.eclipse.adt.AndroidNature'
buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
buildCommand 'com.android.ide.eclipse.adt.ApkBuilder'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment