|
| 1 | +/* |
| 2 | + * The MIT License (MIT) |
| 3 | + * |
| 4 | + * Copyright (c) 2016 oEmbedler Inc. and Contributors |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
| 7 | + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the |
| 8 | + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 | + * persons to whom the Software is furnished to do so, subject to the following conditions: |
| 10 | + * |
| 11 | + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
| 12 | + * |
| 13 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| 14 | + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 15 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 16 | + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 17 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 18 | + */ |
| 19 | + |
1 | 20 | buildscript {
|
2 | 21 | repositories {
|
3 |
| - jcenter() |
| 22 | + mavenLocal() |
4 | 23 | mavenCentral()
|
| 24 | + jcenter() |
| 25 | + maven { url "https://dl.bintray.com/graphql-java-kickstart/releases" } |
| 26 | + maven { url "https://plugins.gradle.org/m2/" } |
| 27 | + maven { url 'https://repo.spring.io/plugins-release' } |
5 | 28 | }
|
6 | 29 | dependencies {
|
7 |
| - classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:3.1.0' |
| 30 | + classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+" |
| 31 | + classpath 'net.researchgate:gradle-release:2.7.0' |
8 | 32 | }
|
9 | 33 | }
|
| 34 | + |
10 | 35 | plugins {
|
11 |
| - id "com.jfrog.bintray" version "1.8.4" |
12 |
| - id "com.jfrog.artifactory" version "4.8.1" |
13 | 36 | id 'net.researchgate.release' version '2.7.0'
|
| 37 | + id 'io.franzbecker.gradle-lombok' version '3.2.0' apply false |
| 38 | + id "com.jfrog.artifactory" version "4.11.0" apply false |
| 39 | + id "biz.aQute.bnd" version "4.3.1" apply false |
14 | 40 | }
|
15 | 41 |
|
16 |
| -apply plugin: 'java' |
17 |
| -sourceCompatibility = 1.8 |
18 |
| -targetCompatibility = 1.8 |
| 42 | +subprojects { |
| 43 | + apply plugin: 'idea' |
| 44 | + apply plugin: 'java' |
| 45 | + apply plugin: 'maven-publish' |
| 46 | + apply plugin: "com.jfrog.bintray" |
| 47 | + apply plugin: 'io.franzbecker.gradle-lombok' |
| 48 | + apply plugin: 'com.jfrog.artifactory' |
19 | 49 |
|
20 |
| -// Tests |
21 |
| -apply plugin: 'groovy' |
| 50 | + repositories { |
| 51 | + mavenLocal() |
| 52 | + mavenCentral() |
| 53 | + jcenter() |
| 54 | + maven { url "https://dl.bintray.com/graphql-java-kickstart/releases" } |
| 55 | + maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" } |
| 56 | + maven { url "https://repo.spring.io/libs-milestone" } |
| 57 | + } |
22 | 58 |
|
23 |
| -repositories { |
24 |
| - mavenLocal() |
25 |
| - mavenCentral() |
26 |
| -} |
| 59 | + idea { |
| 60 | + module { |
| 61 | + downloadJavadoc = true |
| 62 | + downloadSources = true |
| 63 | + } |
| 64 | + } |
27 | 65 |
|
28 |
| -configurations.all { |
29 |
| - exclude group:"org.projectlombok", module: "lombok" |
30 |
| -} |
| 66 | + compileJava { |
| 67 | + sourceCompatibility = SOURCE_COMPATIBILITY |
| 68 | + targetCompatibility = TARGET_COMPATIBILITY |
| 69 | + } |
31 | 70 |
|
32 |
| -dependencies { |
33 |
| - compile 'org.slf4j:slf4j-api:1.7.21' |
34 |
| - |
35 |
| - // Useful utilities |
36 |
| - compile 'com.google.guava:guava:24.1.1-jre' |
37 |
| - |
38 |
| - // Unit testing |
39 |
| - testCompile "org.codehaus.groovy:groovy-all:2.4.1" |
40 |
| - testCompile "org.spockframework:spock-core:1.1-groovy-2.4-rc-3" |
41 |
| - testRuntime "cglib:cglib-nodep:3.2.4" |
42 |
| - testRuntime "org.objenesis:objenesis:2.5.1" |
43 |
| - testCompile 'org.slf4j:slf4j-simple:1.7.24' |
44 |
| - testCompile 'org.springframework:spring-test:4.3.7.RELEASE' |
45 |
| - testRuntime 'org.springframework:spring-web:4.3.7.RELEASE' |
46 |
| - |
47 |
| - // OSGi |
48 |
| - compileOnly 'org.osgi:org.osgi.core:6.0.0' |
49 |
| - compileOnly 'org.osgi:org.osgi.service.cm:1.5.0' |
50 |
| - compileOnly 'org.osgi:org.osgi.service.component:1.3.0' |
51 |
| - compileOnly 'biz.aQute.bnd:biz.aQute.bndlib:3.1.0' |
52 |
| - |
53 |
| - // Servlet |
54 |
| - compile 'javax.servlet:javax.servlet-api:3.1.0' |
55 |
| - compile 'javax.websocket:javax.websocket-api:1.1' |
56 |
| - |
57 |
| - // GraphQL |
58 |
| - compile "com.graphql-java:graphql-java:$LIB_GRAPHQL_JAVA_VER" |
59 |
| - |
60 |
| - testCompile 'io.github.graphql-java:graphql-java-annotations:5.2' |
61 |
| - |
62 |
| - // JSON |
63 |
| - compile "com.fasterxml.jackson.core:jackson-core:$LIB_JACKSON_VER" |
64 |
| - compile "com.fasterxml.jackson.core:jackson-annotations:$LIB_JACKSON_VER" |
65 |
| - compile "com.fasterxml.jackson.core:jackson-databind:$LIB_JACKSON_VER" |
66 |
| - compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$LIB_JACKSON_VER" |
67 |
| -} |
| 71 | + compileJava.dependsOn(processResources) |
68 | 72 |
|
69 |
| -apply plugin: 'osgi' |
70 |
| -apply plugin: 'java-library-distribution' |
71 |
| -apply plugin: 'biz.aQute.bnd.builder' |
72 |
| -apply plugin: 'com.jfrog.bintray' |
73 |
| -apply plugin: 'maven-publish' |
74 |
| -apply plugin: 'idea' |
75 |
| -apply plugin: 'maven' |
76 |
| - |
77 |
| -jar { |
78 |
| - manifest { |
79 |
| - instruction 'Require-Capability', 'osgi.extender' |
| 73 | + lombok { |
| 74 | + version = "1.18.4" |
| 75 | + sha256 = "" |
80 | 76 | }
|
81 |
| -} |
82 | 77 |
|
83 |
| -// custom tasks for creating source/javadoc jars |
84 |
| -task sourcesJar(type: Jar, dependsOn: classes) { |
85 |
| - classifier = 'sources' |
86 |
| - from sourceSets.main.allSource |
87 |
| -} |
88 | 78 |
|
89 |
| -task javadocJar(type: Jar, dependsOn: javadoc) { |
90 |
| - classifier = 'javadoc' |
91 |
| - from javadoc.destinationDir |
92 |
| -} |
| 79 | + if (!it.name.startsWith('example')) { |
93 | 80 |
|
94 |
| -publishing { |
95 |
| - publications { |
96 |
| - maven(MavenPublication) { |
97 |
| - from components.java |
98 |
| - groupId 'com.graphql-java-kickstart' |
99 |
| - artifactId project.name |
100 |
| - version project.version |
101 |
| - |
102 |
| - artifact sourcesJar |
103 |
| - artifact javadocJar |
104 |
| - |
105 |
| - pom.withXml { |
106 |
| - asNode().children().last() + { |
107 |
| - resolveStrategy = Closure.DELEGATE_FIRST |
108 |
| - name 'graphql-java-servlet' |
109 |
| - description 'relay.js-compatible GraphQL servlet' |
110 |
| - url 'https://github.com/graphql-java-kickstart/graphql-java-servlet' |
111 |
| - inceptionYear '2016' |
112 |
| - |
113 |
| - scm { |
114 |
| - url 'https://github.com/graphql-java-kickstart/graphql-java-servlet' |
115 |
| - connection 'scm:https://github.com/graphql-java-kickstart/graphql-java-servlet.git' |
116 |
| - developerConnection 'scm:git://github.com/graphql-java-kickstart/graphql-java-servlet.git' |
117 |
| - } |
| 81 | + jar { |
| 82 | + from "LICENSE.md" |
| 83 | + } |
118 | 84 |
|
119 |
| - licenses { |
120 |
| - license { |
121 |
| - name 'The Apache Software License, Version 2.0' |
122 |
| - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
123 |
| - distribution 'repo' |
124 |
| - } |
| 85 | + task sourcesJar(type: Jar) { |
| 86 | + dependsOn classes |
| 87 | + classifier 'sources' |
| 88 | + from sourceSets.main.allSource |
| 89 | + } |
| 90 | + |
| 91 | + task javadocJar(type: Jar, dependsOn: javadoc) { |
| 92 | + classifier = 'javadoc' |
| 93 | + from javadoc.destinationDir |
| 94 | + } |
| 95 | + |
| 96 | + artifacts { |
| 97 | + archives sourcesJar |
| 98 | + archives javadocJar |
| 99 | + } |
| 100 | + |
| 101 | + publishing { |
| 102 | + publications { |
| 103 | + mainProjectPublication(MavenPublication) { |
| 104 | + version version |
| 105 | + from components.java |
| 106 | + |
| 107 | + artifact sourcesJar { |
| 108 | + classifier "sources" |
| 109 | + } |
| 110 | + artifact javadocJar { |
| 111 | + classifier "javadoc" |
125 | 112 | }
|
126 | 113 |
|
127 |
| - developers { |
128 |
| - developer { |
129 |
| - id 'yrashk' |
130 |
| - name 'Yurii Rashkovskii' |
131 |
| - |
132 |
| - } |
133 |
| - developer { |
134 |
| - id 'apottere' |
135 |
| - name 'Andrew Potter' |
136 |
| - |
| 114 | + pom.withXml { |
| 115 | + asNode().children().last() + { |
| 116 | + resolveStrategy = Closure.DELEGATE_FIRST |
| 117 | + name 'graphql-java-servlet' |
| 118 | + description 'relay.js-compatible GraphQL servlet' |
| 119 | + url 'https://github.com/graphql-java-kickstart/graphql-java-servlet' |
| 120 | + inceptionYear '2016' |
| 121 | + |
| 122 | + scm { |
| 123 | + url 'https://github.com/graphql-java-kickstart/graphql-java-servlet' |
| 124 | + connection 'scm:https://github.com/graphql-java-kickstart/graphql-java-servlet.git' |
| 125 | + developerConnection 'scm:git://github.com/graphql-java-kickstart/graphql-java-servlet.git' |
| 126 | + } |
| 127 | + |
| 128 | + licenses { |
| 129 | + license { |
| 130 | + name 'The Apache Software License, Version 2.0' |
| 131 | + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 132 | + distribution 'repo' |
| 133 | + } |
| 134 | + } |
| 135 | + |
| 136 | + developers { |
| 137 | + developer { |
| 138 | + id 'yrashk' |
| 139 | + name 'Yurii Rashkovskii' |
| 140 | + |
| 141 | + } |
| 142 | + developer { |
| 143 | + id 'apottere' |
| 144 | + name 'Andrew Potter' |
| 145 | + |
| 146 | + } |
| 147 | + } |
137 | 148 | }
|
| 149 | + // https://discuss.gradle.org/t/maven-publish-plugin-generated-pom-making-dependency-scope-runtime/7494/10 |
| 150 | + asNode().dependencies.'*'.findAll() { |
| 151 | + it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep -> |
| 152 | + dep.name == it.artifactId.text() |
| 153 | + } |
| 154 | + }.each { it.scope*.value = 'compile'} |
138 | 155 | }
|
139 | 156 | }
|
140 |
| - // https://discuss.gradle.org/t/maven-publish-plugin-generated-pom-making-dependency-scope-runtime/7494/10 |
141 |
| - asNode().dependencies.'*'.findAll() { |
142 |
| - it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep -> |
143 |
| - dep.name == it.artifactId.text() |
144 |
| - } |
145 |
| - }.each { it.scope*.value = 'compile'} |
146 | 157 | }
|
147 | 158 | }
|
148 |
| - } |
149 |
| -} |
150 |
| - |
151 |
| -release { |
152 |
| - tagTemplate = 'v${version}' |
153 |
| - failOnPublishNeeded = false |
154 |
| - ignoredSnapshotDependencies = ['com.graphql-java-kickstart:graphql-java-servlet'] |
155 |
| -} |
156 | 159 |
|
157 |
| -afterReleaseBuild.dependsOn bintrayUpload |
158 |
| - |
159 |
| -bintray { |
160 |
| - user = System.env.BINTRAY_USER ?: project.findProperty('BINTRAY_USER') ?: '' |
161 |
| - key = System.env.BINTRAY_PASS ?: project.findProperty('BINTRAY_PASS') ?: '' |
162 |
| - publications = ['maven'] |
163 |
| - publish = true |
164 |
| - pkg { |
165 |
| - repo = 'releases' |
166 |
| - name = project.name |
167 |
| - licenses = ['Apache-2.0'] |
168 |
| - vcsUrl = 'https://github.com/graphql-java-kickstart/graphql-java-servlet' |
169 |
| - userOrg = 'graphql-java-kickstart' |
170 |
| - version { |
171 |
| - name = project.version |
172 |
| - mavenCentralSync { |
173 |
| - close = '1' |
| 160 | + bintray { |
| 161 | + user = System.env.BINTRAY_USER ?: project.findProperty('BINTRAY_USER') ?: '' |
| 162 | + key = System.env.BINTRAY_PASS ?: project.findProperty('BINTRAY_PASS') ?: '' |
| 163 | + publications = ['mainProjectPublication'] |
| 164 | + publish = true |
| 165 | + pkg { |
| 166 | + repo = 'releases' |
| 167 | + name = PROJECT_NAME |
| 168 | + desc = PROJECT_DESC |
| 169 | + licenses = [PROJECT_LICENSE] |
| 170 | + vcsUrl = PROJECT_GIT_REPO_URL |
| 171 | + userOrg = 'graphql-java-kickstart' |
| 172 | + version { |
| 173 | + name = project.version |
| 174 | + mavenCentralSync { |
| 175 | + close = '1' |
| 176 | + } |
| 177 | + } |
174 | 178 | }
|
175 | 179 | }
|
176 |
| - } |
177 |
| -} |
178 | 180 |
|
179 |
| -artifactory { |
180 |
| - contextUrl = 'https://oss.jfrog.org' |
181 |
| - publish { |
182 |
| - repository { |
183 |
| - repoKey = 'oss-snapshot-local' |
| 181 | + artifactory { |
| 182 | + contextUrl = 'https://oss.jfrog.org' |
| 183 | + publish { |
| 184 | + repository { |
| 185 | + repoKey = 'oss-snapshot-local' |
184 | 186 |
|
185 |
| - username = System.env.BINTRAY_USER ?: System.getProperty('BINTRAY_USER') |
186 |
| - password = System.env.BINTRAY_PASS ?: System.getProperty('BINTRAY_PASS') |
| 187 | + username = System.env.BINTRAY_USER ?: System.getProperty('BINTRAY_USER') |
| 188 | + password = System.env.BINTRAY_PASS ?: System.getProperty('BINTRAY_PASS') |
187 | 189 |
|
188 |
| - maven = true |
189 |
| - } |
190 |
| - defaults { |
191 |
| - publications 'maven' |
192 |
| - publishArtifacts = true |
193 |
| - publishPom = true |
194 |
| - } |
195 |
| - } |
196 |
| - resolve { |
197 |
| - repository { |
198 |
| - repoKey = 'jcenter' |
| 190 | + maven = true |
| 191 | + } |
| 192 | + defaults { |
| 193 | + publications 'maven' |
| 194 | + publishArtifacts = true |
| 195 | + publishPom = true |
| 196 | + } |
| 197 | + } |
| 198 | + resolve { |
| 199 | + repository { |
| 200 | + repoKey = 'jcenter' |
| 201 | + } |
| 202 | + } |
199 | 203 | }
|
200 | 204 | }
|
201 | 205 | }
|
202 | 206 |
|
203 |
| -idea { |
204 |
| - project { |
205 |
| - languageLevel = '11' |
206 |
| - vcs = 'Git' |
207 |
| - } |
| 207 | +release { |
| 208 | + tagTemplate = 'v${version}' |
| 209 | + failOnPublishNeeded = false |
| 210 | + ignoredSnapshotDependencies = ['com.graphql-java-kickstart:graphql-java-servlet'] |
| 211 | +} |
| 212 | + |
| 213 | +task build { |
| 214 | + dependsOn subprojects.findResults { it.tasks.findByName('assemble') } |
| 215 | + dependsOn subprojects.findResults { it.tasks.findByName('check') } |
| 216 | + dependsOn subprojects.findResults { it.tasks.findByName('bintray') } |
208 | 217 | }
|
209 | 218 |
|
210 | 219 | wrapper {
|
211 |
| - gradleVersion = '4.10.3' |
| 220 | + gradleVersion = "${GRADLE_WRAPPER_VER}" |
212 | 221 | }
|
0 commit comments