Last active
December 20, 2015 19:19
-
-
Save gipi/6182731 to your computer and use it in GitHub Desktop.
#gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.5.+' | |
} | |
} | |
apply plugin: 'android' | |
dependencies { | |
compile project(':actionbarsherlock') | |
compile project(':viewpagerindicator') | |
compile project(':facebook') | |
compile project(':dragdrop') | |
compile fileTree('libs') | |
compile 'com.android.support:support-v4:13.0.+' | |
} | |
android { | |
signingConfigs { | |
release { | |
keyAlias = "miao" | |
} | |
} | |
// BuildConfig.DEBUG is not reliable, we define our own variable | |
buildTypes { | |
debug { | |
buildConfig "public final static boolean TEST = true;" | |
} | |
release { | |
buildConfig "public final static boolean TEST = false;" | |
signingConfig signingConfigs.release | |
} | |
} | |
if (project.hasProperty('storeFile') && | |
project.hasProperty('storePassword') && | |
project.hasProperty('keyPassword')) { | |
android.signingConfigs.release.storeFile = file(storeFile) | |
android.signingConfigs.release.storePassword = storePassword | |
android.signingConfigs.release.keyPassword = keyPassword | |
} else { | |
buildTypes.release.signingConfig = null | |
} | |
compileSdkVersion 17 | |
buildToolsVersion "17.0.0" | |
defaultConfig { | |
minSdkVersion 8 | |
targetSdkVersion 17 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
} | |
apply plugin: 'java' | |
sourceSets { | |
main { | |
java { | |
srcDir 'src' | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
def gitSha(File rootDir) { | |
def res = 'git describe --tags --always --dirty'.execute([], rootDir).text.trim() | |
return res | |
} | |
// http://groovy.codehaus.org/Process+Management | |
// http://groovy.codehaus.org/Executing+External+Processes+From+Groovy | |
def gitRef(File rootDir) { | |
def remotes = 'git remote -v'.execute([], rootDir) | |
def cutOnlyRepository = ['awk', '{print $2}'].execute() | |
def firstLine = 'head -n 1'.execute() | |
remotes | cutOnlyRepository | firstLine | |
firstLine.waitFor() | |
return firstLine.text.trim() | |
} | |
allprojects { | |
task repoDependencies << {task -> | |
print "$task.project.name\t$task.project.projectDir\t" | |
print "${gitRef(task.project.projectDir)}\t" | |
println "${gitSha(task.project.projectDir)}" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
task hello << {task -> println "I'm $task.project.name in $task.project.projectDir" } | |
} | |
def gitSha() { | |
def res = 'git describe --tags --always --dirty'.execute([], project.rootDir).text.trim() | |
def diff = 'git diff'.execute([], project.rootDir).text.trim() | |
if (diff != null && diff.length() > 0) { | |
res += "-dirty" | |
} | |
return res | |
} | |
android { | |
compileSdkVersion 18 | |
buildToolsVersion "18.0.1" | |
defaultConfig { | |
minSdkVersion 8 | |
targetSdkVersion 18 | |
versionName "${gitSha()}" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include ':Miao' | |
include 'actionbarsherlock', 'viewpagerindicator', 'facebook', 'dragdrop' | |
project(':actionbarsherlock').projectDir = new File(settingsDir, '../JakeWharton-ActionBarSherlock-071a61c/actionbarsherlock/') | |
project(':viewpagerindicator').projectDir = new File(settingsDir, '../JakeWharton-Android-ViewPagerIndicator-8cd549f/library/') | |
project(':facebook').projectDir = new File(settingsDir, '../facebook-android-sdk-3.0.1/facebook/') | |
project(':dragdrop').projectDir = new File(settingsDir, '../DragNDropList/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.6.+' | |
} | |
} | |
apply plugin: 'android-library' | |
dependencies { | |
compile 'com.android.support:support-v4:13.0.0' | |
} | |
android { | |
compileSdkVersion 17 | |
buildToolsVersion "17.0.0" | |
sourceSets { | |
main { | |
manifest.srcFile 'AndroidManifest.xml' | |
java.srcDirs = ['src'] | |
resources.srcDirs = ['src'] | |
res.srcDirs = ['res'] | |
assets.srcDirs = ['assets'] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this creates a maven repository in the /tmp directory | |
apply plugin: 'maven' | |
uploadArchives { | |
repositories.mavenDeployer { | |
repository(url: "file:///tmp/") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment