Skip to content

Commit 2c4ddda

Browse files
committed
Bump build
1 parent 5368f93 commit 2c4ddda

File tree

3 files changed

+45
-221
lines changed

3 files changed

+45
-221
lines changed

build.gradle

Lines changed: 8 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -1,216 +1,20 @@
11
plugins {
2-
// code formatting
3-
id "com.diffplug.gradle.spotless" version "1.3.0"
4-
// bintray uploading
5-
id "com.jfrog.bintray" version "1.3.1"
2+
id 'com.diffplug.blowdryer'
3+
id 'com.diffplug.spotless-changelog'
64
}
75

86
repositories {
97
mavenCentral()
10-
// SNAPSHOT versions are free to rely on other SNAPSHOT libraries
11-
if (project.version.endsWith('-SNAPSHOT')) {
12-
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
13-
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' }
14-
}
158
}
169

17-
//////////
18-
// JAVA //
19-
//////////
20-
apply plugin: 'java'
21-
sourceCompatibility = VER_JAVA
22-
targetCompatibility = VER_JAVA
10+
apply from: 干.file('base/java.gradle')
11+
apply from: 干.file('spotless/java.gradle')
12+
apply plugin: 'java-library'
2313

24-
dependencies {
25-
testCompile "junit:junit:${VER_JUNIT}"
26-
}
27-
28-
/////////////
29-
// ECLIPSE //
30-
/////////////
31-
apply plugin: 'eclipse'
32-
eclipse {
33-
classpath {
34-
downloadSources true
35-
downloadJavadoc true
36-
}
37-
jdt {
38-
sourceCompatibility VER_JAVA
39-
targetCompatibility VER_JAVA
40-
}
41-
}
42-
// always create fresh projects
43-
tasks.eclipse.dependsOn(cleanEclipse)
44-
45-
////////////
46-
// FORMAT //
47-
////////////
48-
apply plugin: 'com.diffplug.gradle.spotless'
49-
spotless {
50-
java {
51-
licenseHeaderFile 'spotless.license.java' // License header file
52-
importOrderFile 'spotless.importorder' // An import ordering file, exported from Eclipse
53-
eclipseFormatFile 'spotless.eclipseformat.xml' // XML file dumped out by the Eclipse formatter
54-
// Eclipse formatter puts excess whitespace after lambda blocks
55-
// funcThatTakesLambdas(x -> {} , y -> {} ) // what Eclipse does
56-
// funcThatTakesLambdas(x -> {}, y -> {}) // what I wish Eclipse did
57-
custom 'Lambda fix', { it.replace('} )', '})').replace('} ,', '},') }
58-
}
59-
format 'misc', {
60-
target '**/.gitignore', '**/*.gradle', '**/*.md', '**/*.sh'
61-
indentWithTabs()
62-
trimTrailingWhitespace()
63-
endWithNewline()
64-
}
65-
freshmark {}
66-
}
6714

68-
//////////////
69-
// FINDBUGS //
70-
//////////////
71-
apply plugin: 'findbugs'
72-
findbugs {
73-
toolVersion = VER_FINDBUGS
74-
sourceSets = [sourceSets.main] // don't check the test code
75-
ignoreFailures = false // bug free or it doesn't ship!
76-
reportsDir = file('build/findbugs')
77-
effort = 'max' // min|default|max
78-
reportLevel = 'low' // low|medium|high (low = sensitive to even minor mistakes)
79-
omitVisitors = [] // bugs that we want to ignore
80-
}
81-
// HTML instead of XML
82-
tasks.withType(FindBugs) {
83-
reports {
84-
xml.enabled = false
85-
html.enabled = true
86-
}
87-
}
88-
// we'll want the findbugs annotations (they don't have a 3.0.1 version)
8915
dependencies {
90-
compile 'com.google.code.findbugs:annotations:3.0.0'
91-
compile 'com.google.code.findbugs:jsr305:3.0.0'
92-
}
93-
94-
///////////
95-
// MAVEN //
96-
///////////
97-
apply plugin: 'maven-publish'
98-
99-
task sourcesJar(type: Jar) {
100-
classifier = 'sources'
101-
from sourceSets.main.allJava
16+
testImplementation 'junit:junit:4.13.2'
10217
}
10318

104-
// Where it's possible to name parameters and methods clearly enough
105-
// that javadoc is not necessary, why make the code bigger?
106-
//
107-
// Thus, no javadoc warnings.
108-
def makeLink = { url, text -> "<a href=\"${url}\" style=\"text-transform: none;\">${text}</a>" }
109-
def javadocInfo = '<h2>' + makeLink("https://github.com/${org}/${name}", "${group}:${name}:${version}") +
110-
' by ' + makeLink('http://www.diffplug.com', 'DiffPlug') + '</h2>'
111-
javadoc {
112-
options.addStringOption('Xdoclint:none', '-quiet')
113-
options.header javadocInfo
114-
options.footer javadocInfo
115-
options.links('https://docs.oracle.com/javase/8/docs/api/')
116-
}
117-
118-
task javadocJar(type: Jar, dependsOn: javadoc) {
119-
classifier = 'javadoc'
120-
from javadoc.destinationDir
121-
}
122-
123-
////////////////
124-
// PUBLISHING //
125-
////////////////
126-
def isSnapshot = project.version.endsWith('-SNAPSHOT')
127-
// pulls the credentials from either the environment variable or gradle.properties
128-
def cred = {
129-
if (System.env[it] != null) {
130-
return System.env[it]
131-
} else if (project.hasProperty(it)) {
132-
return project[it]
133-
} else {
134-
return 'unknown_' + it
135-
}
136-
}
137-
138-
publishing {
139-
publications {
140-
mavenJava(MavenPublication) {
141-
from components.java
142-
artifact sourcesJar
143-
artifact javadocJar
144-
pom.withXml {
145-
// findbugs annotations should have scope "provided"
146-
asNode().dependencies.'*'.findAll() { it.groupId.text() == 'com.google.code.findbugs' }.each() { it.scope*.value = 'provided' }
147-
// add MavenCentral requirements to the POM
148-
asNode().children().last() + {
149-
resolveStrategy = Closure.DELEGATE_FIRST
150-
name project.name
151-
description project.description
152-
url "https://github.com/${project.org}/${project.name}"
153-
scm {
154-
url "https://github.com/${project.org}/${project.name}"
155-
connection "scm:git:git://github.com/${project.org}/${project.name}"
156-
developerConnection "scm:git:ssh:[email protected]/${project.org}/${project.name}"
157-
}
158-
licenses {
159-
license {
160-
name 'The Apache Software License, Version 2.0'
161-
url 'http://www.apache.org/license/LICENSE-2.0.txt'
162-
distribution 'repo'
163-
}
164-
}
165-
developers {
166-
developer {
167-
id 'nedtwigg'
168-
name 'Ned Twigg'
169-
170-
}
171-
}
172-
}
173-
}
174-
}
175-
}
176-
if (isSnapshot) {
177-
// upload snapshots to oss.sonatype.org
178-
repositories { maven {
179-
url = 'https://oss.sonatype.org/content/repositories/snapshots'
180-
credentials {
181-
username = cred('nexus_user')
182-
password = cred('nexus_pass')
183-
}
184-
} }
185-
}
186-
}
187-
188-
if (!isSnapshot) {
189-
// upload releases to bintray and then mavenCentral
190-
bintray {
191-
user = cred('bintray_user')
192-
key = cred('bintray_pass')
193-
publications = ['mavenJava']
194-
publish = true
195-
pkg {
196-
repo = 'opensource'
197-
name = project.name
198-
userOrg = project.org
199-
version {
200-
name = project.version
201-
mavenCentralSync {
202-
user = cred('nexus_user')
203-
password = cred('nexus_pass')
204-
}
205-
}
206-
}
207-
}
208-
209-
publish.dependsOn(bintrayUpload)
210-
bintrayUpload.dependsOn(['generatePomFileForMavenJavaPublication', jar, sourcesJar, javadocJar])
211-
}
212-
213-
// helps external scripts detect version
214-
task printVersion << {
215-
println version
216-
}
19+
apply from: 干.file('base/maven.gradle')
20+
apply from: 干.file('base/sonatype.gradle')

gradle.properties

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1-
stable=3.0.0
2-
version=3.1.0-SNAPSHOT
3-
name=jscriptbox
4-
group=com.diffplug.jscriptbox
5-
description=JScriptBox: Make your scripting API language-independent
6-
org=diffplug
1+
git_url=github.com/diffplug/jscriptbox
2+
maven_group=com.diffplug.jscriptbox
3+
maven_name=jscriptbox
4+
maven_desc=JScriptBox: Make your scripting API language-independent
5+
license=apache
76

8-
# Build requirements
9-
VER_GRADLE=2.7
10-
VER_JAVA=1.8
11-
VER_BINTRAY=1.1
12-
VER_FINDBUGS=3.0.1
13-
14-
# Dependencies
15-
VER_GUAVA=18.0
16-
17-
# Testing
18-
VER_JUNIT=4.12
7+
ver_java=8
8+
javadoc_links=

settings.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
pluginManagement {
2+
repositories {
3+
mavenCentral()
4+
gradlePluginPortal()
5+
}
6+
}
7+
plugins {
8+
// https://github.com/diffplug/blowdryer/blob/main/CHANGELOG.md
9+
id 'com.diffplug.blowdryerSetup' version '1.7.0'
10+
// https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md
11+
id 'com.diffplug.spotless' version '6.14.0' apply false
12+
// https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md
13+
id 'com.diffplug.spotless-changelog' version '2.4.1' apply false
14+
// https://plugins.gradle.org/plugin/com.gradle.plugin-publish
15+
id 'com.gradle.plugin-publish' version '1.1.0' apply false
16+
// https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md
17+
id 'dev.equo.ide' version '0.12.1' apply false
18+
// https://github.com/gradle-nexus/publish-plugin/releases
19+
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' apply false
20+
}
21+
22+
blowdryerSetup {
23+
github 'diffplug/blowdryer-diffplug', 'tag', '7.0.0'
24+
//devLocal '../blowdryer-diffplug'
25+
setPluginsBlockTo {
26+
it.file 'plugin.versions'
27+
}
28+
}
29+
30+
rootProject.name = 'jscriptbox'

0 commit comments

Comments
 (0)