Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
yshrsmz committed Mar 7, 2017
1 parent 6f0d75a commit 2005391
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 58 deletions.
63 changes: 41 additions & 22 deletions build.gradle
Expand Up @@ -2,45 +2,62 @@
apply from: "${project.rootDir}/gradle/version/version.gradle"
apply from: "${project.rootDir}/metadata.gradle"

final ANDROID_SDK_PATH = {
final localProperties = new Properties()
try {
localProperties.load(new FileInputStream("${project.rootProject.projectDir}/local.properties"))
} catch (IOException e) { /* ignore errors */
}
def androidSdkPath = localProperties['sdk.dir'] ?: System.getenv('ANDROID_HOME')
if (!androidSdkPath) {
throw new RuntimeException("Missing local.properties")
}
androidSdkPath
}()
final ANDROID_SUPPORT_REPOSITORY = "${ANDROID_SDK_PATH}/extras/android/m2repository"


buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.novoda:bintray-release:0.3.4' // https://github.com/novoda/bintray-release
}
}

allprojects {
repositories {
maven { url ANDROID_SUPPORT_REPOSITORY }
jcenter()
}
}

ext {
deps = [// Android
android : 'com.google.android:android:4.1.1.4',
supportv4 : 'com.android.support:support-v4:23.2.1',
appcompat : 'com.android.support:appcompat-v7:23.2.1',
supportAnnotations: 'com.android.support:support-annotations:23.2.1',
supportv4 : 'com.android.support:support-v4:25.2.0',
appcompat : 'com.android.support:appcompat-v7:25.2.0',
supportAnnotations: 'com.android.support:support-annotations:25.2.0',

// Square
javapoet : 'com.squareup:javapoet:1.7.0',

// Test dependencies
junit : 'junit:junit:4.12',
truth : 'com.google.truth:truth:0.30',
truth : 'com.google.truth:truth:0.32',
robolectric : 'org.robolectric:robolectric:3.1.2',
compiletesting : 'com.google.testing.compile:compile-testing:0.9',
autoservice : 'com.google.auto.service:auto-service:1.0-rc2',
autocommon : 'com.google.auto:auto-common:0.6',
commonsio : 'commons-io:commons-io:2.4']
compiletesting : 'com.google.testing.compile:compile-testing:0.10',
autoservice : 'com.google.auto.service:auto-service:1.0-rc3',
autocommon : 'com.google.auto:auto-common:0.8',
commonsio : 'commons-io:commons-io:2.5']

ANDROID_JAR = fileTree(dir: "${ANDROID_SDK_PATH}/platforms/android-25/", include: 'android.jar')

metadata.version = ext.versionName()
}
Expand All @@ -62,18 +79,20 @@ String shell(String command) {
return proc.in.text;
}

task releng << {
def tag = "v" + versionName()
println "Release engineering for ${tag}"
task releng {
doLast {
def tag = "v" + versionName()
println "Release engineering for ${tag}"

def changes = shell "git status -s"
if (changes.trim()) {
throw new RuntimeException("There are changes not commited yet.\n${changes}")
}
def changes = shell "git status -s"
if (changes.trim()) {
throw new RuntimeException("There are changes not commited yet.\n${changes}")
}

println "> git tag ${tag}"
shell "git tag ${tag}"
println "> git push origin ${tag}"
shell "git push origin ${tag}"
shell "git push origin master"
println "> git tag ${tag}"
shell "git tag ${tag}"
println "> git push origin ${tag}"
shell "git push origin ${tag}"
shell "git push origin master"
}
}
9 changes: 4 additions & 5 deletions example/build.gradle
@@ -1,15 +1,14 @@
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'android-apt'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
applicationId "net.yslibrary.simplepreferences.example"
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
Expand All @@ -28,7 +27,7 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':library')
apt project(':processor')
annotationProcessor project(':processor')

testCompile deps.junit
compile deps.supportv4
Expand Down
42 changes: 25 additions & 17 deletions gradle/version/version.gradle
@@ -1,29 +1,37 @@
task bumpMajor << {
ant.propertyfile(file: "${project.rootDir}/gradle/version/version.properties") {
entry(key: 'major', type: 'int', operation: '+', value: 1)
entry(key: 'minor', type: 'int', operation: '=', value: 0)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
task bumpMajor {
doLast {
ant.propertyfile(file: "${project.rootDir}/gradle/version/version.properties") {
entry(key: 'major', type: 'int', operation: '+', value: 1)
entry(key: 'minor', type: 'int', operation: '=', value: 0)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
}
tasks.version.execute()
}
tasks.version.execute()
}

task bumpMinor << {
ant.propertyfile(file: "${project.rootDir}/gradle/version/version.properties") {
entry(key: 'minor', type: 'int', operation: '+', value: 1)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
task bumpMinor {
doLast {
ant.propertyfile(file: "${project.rootDir}/gradle/version/version.properties") {
entry(key: 'minor', type: 'int', operation: '+', value: 1)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
}
tasks.version.execute()
}
tasks.version.execute()
}

task bumpPatch << {
ant.propertyfile(file: "${project.rootDir}/gradle/version/version.properties") {
entry(key: 'patch', type: 'int', operation: '+', value: 1)
task bumpPatch {
doLast {
ant.propertyfile(file: "${project.rootDir}/gradle/version/version.properties") {
entry(key: 'patch', type: 'int', operation: '+', value: 1)
}
tasks.version.execute()
}
tasks.version.execute()
}

task version << {
println versionName()
task version {
doLast {
println versionName()
}
}

ext.versionName = {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 changes: 3 additions & 4 deletions library/build.gradle
@@ -1,15 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.novoda.bintray-release'
apply plugin: 'com.github.ben-manes.versions'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion 25
buildToolsVersion "25.0.2"

defaultConfig {
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName rootProject.ext.metadata.version

Expand Down
10 changes: 1 addition & 9 deletions processor/build.gradle
Expand Up @@ -5,14 +5,6 @@ apply plugin: 'com.github.ben-manes.versions'
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8

def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger)
def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
for (File file : sdkHandler.sdkLoader.repositories) {
repositories.maven {
url = file.toURI()
}
}

task copyTestResources(type: Copy) {
from "${projectDir}/src/test/resources"
into "${buildDir}/classes/test"
Expand All @@ -34,7 +26,7 @@ dependencies {
testCompile deps.commonsio
testCompile deps.android
testCompile deps.supportAnnotations
testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar())
testCompile project.rootProject.ext.ANDROID_JAR
}

publish {
Expand Down

0 comments on commit 2005391

Please sign in to comment.