Skip to content

Commit 0e84f8e

Browse files
authored
Merge pull request #142 from gradle/dd/build-improvements
Improve the cache-fix plugin build
2 parents a702ea1 + b8eccb3 commit 0e84f8e

File tree

4 files changed

+24
-28
lines changed

4 files changed

+24
-28
lines changed

build.gradle

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import groovy.json.JsonBuilder
22

33
plugins {
4-
id "com.gradle.plugin-publish" version "0.12.0"
54
id 'groovy'
65
id 'java-gradle-plugin'
6+
id 'maven-publish'
77
id 'codenarc'
8+
id "com.gradle.plugin-publish" version "0.12.0"
89
id "org.gradle.test-retry" version "1.2.0"
910
}
1011

@@ -43,8 +44,11 @@ dependencies {
4344
testRuntime 'org.objenesis:objenesis:3.1'
4445
}
4546

46-
sourceCompatibility = "1.8"
47-
targetCompatibility = "1.8"
47+
java {
48+
toolchain {
49+
languageVersion = JavaLanguageVersion.of(8)
50+
}
51+
}
4852

4953
def generatedResources = "$buildDir/generated-resources/main"
5054

@@ -67,48 +71,39 @@ sourceSets {
6771
}
6872
}
6973

70-
pluginBundle {
71-
website = 'https://github.com/gradle/android-cache-fix-gradle-plugin'
72-
vcsUrl = 'https://github.com/gradle/android-cache-fix-gradle-plugin'
73-
74-
description = 'Gradle plugin to fix Android caching problems'
75-
74+
gradlePlugin {
7675
plugins {
7776
androidCacheFixPlugin {
7877
id = 'org.gradle.android.cache-fix'
7978
displayName = 'Gradle Android cache fix plugin'
80-
tags = ['android', 'cache', 'fix']
81-
version = project.version
79+
description = 'Gradle plugin to fix Android caching problems'
80+
implementationClass = 'org.gradle.android.AndroidCacheFixPlugin'
8281
}
8382
}
8483
}
8584

86-
def localRepo = file("$buildDir/local-repo")
85+
pluginBundle {
86+
website = 'https://github.com/gradle/android-cache-fix-gradle-plugin'
87+
vcsUrl = 'https://github.com/gradle/android-cache-fix-gradle-plugin'
8788

88-
artifacts {
89-
runtime jar
89+
tags = ['android', 'cache', 'fix']
9090
}
9191

92-
tasks.register('install', Upload) {
92+
def localRepo = file("$buildDir/local-repo")
93+
94+
publishing {
9395
repositories {
94-
ivy {
96+
maven {
9597
url = localRepo.toURI()
9698
}
9799
}
98-
descriptorDestination = file("$buildDir/ivy/ivy.xml")
99-
uploadDescriptor = true
100-
configuration = configurations.runtime
101100
}
102101

103102
tasks.withType(Test).configureEach {
104-
dependsOn install
103+
dependsOn publish
105104
systemProperty "local.repo", localRepo.toURI()
106105
retry {
107106
maxRetries = 3
108107
maxFailures = 20
109108
}
110-
}
111-
112-
if (!JavaVersion.current().java8) {
113-
throw new RuntimeException("Java 8 is required to execute the build")
114-
}
109+
}

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
systemProp.gradle.publish.skip.namespace.check=true
1+
systemProp.gradle.publish.skip.namespace.check=true
2+
3+
org.gradle.caching=true

src/main/resources/META-INF/gradle-plugins/org.gradle.android.cache-fix.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/test/groovy/org/gradle/android/SimpleAndroidApp.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SimpleAndroidApp {
4848
repositories {
4949
google()
5050
jcenter()
51-
ivy {
51+
maven {
5252
url = "${System.getProperty("local.repo")}"
5353
}
5454
}

0 commit comments

Comments
 (0)