forked from sherter/google-java-format-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
123 lines (104 loc) · 3.74 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
plugins {
id 'groovy'
id 'maven-publish'
id 'com.gradle.plugin-publish' version '0.12.0'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id "com.github.sherter.google-java-format" version '0.8'
}
version = file('src/main/resources/VERSION').text.trim()
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
sourceSets {
integTest
}
configurations {
bundle
compile.extendsFrom bundle
integTestCompile.extendsFrom testCompile
}
dependencies {
implementation gradleApi()
bundle(project(':format')) {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
bundle 'com.google.guava:guava:30.0-jre'
bundle 'com.google.dagger:dagger:2.23.2'
annotationProcessor 'com.google.dagger:dagger-compiler:2.23.2'
annotationProcessor 'com.google.auto.value:auto-value:1.6.5'
compileOnly 'com.google.auto.value:auto-value-annotations:1.6.5'
testImplementation('org.spockframework:spock-core:1.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy'
}
testImplementation 'com.google.jimfs:jimfs:1.1'
integTestImplementation project(':test')
integTestImplementation gradleTestKit()
integTestImplementation('org.spockframework:spock-core:1.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy'
}
integTestImplementation sourceSets.main.output
}
def integTestGradleVersion = System.getenv('GRADLE_VERSION') ?: '2.6'
tasks.register("integrationTest", Test) {
dependsOn publishToMavenLocal
group 'Verification'
testClassesDirs = sourceSets.integTest.output.classesDirs
classpath = sourceSets.integTest.runtimeClasspath
systemProperty 'GRADLE_VERSION', integTestGradleVersion
reports.html.destination = new File(reportsDir, 'integrationTest' + File.separator + integTestGradleVersion)
mustRunAfter tasks.named("test")
}
tasks.named("check").configure {
dependsOn integrationTest
}
tasks.shadowJar {
classifier = null // necessary for com.gradle.plugin-publish to pick this artifact up
configurations = [project.configurations.bundle]
relocate('dagger', 'com.github.sherter.googlejavaformat.dagger')
relocate('com.google.common', 'com.github.sherter.googlejavaformatgradleplugin.com.google.common')
exclude('META-INF/maven/**/*')
}
// removes the dependsOn relation between "publishPlugins" and "jar" and forces
// the correct (the shadowed) artifact to be uploaded to the plugin portal
configurations.archives.artifacts.clear()
artifacts {
archives tasks.shadowJar
}
pluginBundle {
website = 'https://github.com/sherter/google-java-format-gradle-plugin'
vcsUrl = 'https://github.com/sherter/google-java-format-gradle-plugin.git'
description = 'Format your Java source files with google-java-format'
tags = ['java', 'format', 'style']
plugins {
googleJavaFormatGradlePlugin {
id = 'com.github.sherter.google-java-format'
displayName = 'google-java-format gradle plugin'
}
}
withDependencies { List<Dependency> list ->
list.clear()
}
}
publishing {
publications {
maven(MavenPublication) {
groupId 'com.github.sherter.googlejavaformatgradleplugin'
artifactId 'google-java-format-gradle-plugin'
project.shadow.component(it)
}
}
if (version.endsWith('-SNAPSHOT')) {
repositories {
maven {
name = 'SonatypeSnapshot'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
credentials {
username System.env.SONATYPE_SNAPSHOTS_USERNAME
password System.env.SONATYPE_SNAPSHOTS_PASSWORD
}
}
}
}
}