Skip to content

Commit

Permalink
plugin updates
Browse files Browse the repository at this point in the history
style fixes
bug fixes
  • Loading branch information
evanchooly authored and jyemin committed Oct 20, 2017
1 parent cb56f27 commit 48f65ab
Show file tree
Hide file tree
Showing 89 changed files with 797 additions and 773 deletions.
35 changes: 19 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
ext.configDir = new File(rootDir, 'config')
import org.kordamp.gradle.clirr.ClirrReportTask

import static java.util.stream.Collectors.toList

ext.rootConfig = new File(rootDir, 'config')
ext.git = find('git')
ext.majorVersion = major(version)

Expand Down Expand Up @@ -27,7 +31,7 @@ buildscript {
}

task wrapper(type: Wrapper) {
gradleVersion = '2.13'
gradleVersion = '4.2.1'
}

configure(subprojects.findAll { it.name != 'util' }) {
Expand Down Expand Up @@ -57,20 +61,14 @@ configure(subprojects.findAll { it.name != 'util' }) {

project.archivesBaseName = "morphia-${project.name}"

task listDependencies << {
configurations.compile.each { File file -> println file }
}

task testCoverage(dependsOn: check)

checkstyle {
toolVersion = "6.7"
configFile = new File("$configDir/checkstyle.xml")
configDir = rootConfig
}

findbugs {
excludeFilter = new File("$configDir/findbugs-exclude.xml")
toolVersion = '3.0.0'
excludeFilter = new File("$rootConfig/findbugs-exclude.xml")
sourceSets = [sourceSets.main]
}

Expand Down Expand Up @@ -141,12 +139,15 @@ configure(subprojects.findAll { it.name != 'util' }) {
javadoc {
exclude "**/internal/**"

dependsOn project(':util').compileJava //We need taglets to be compiled
dependsOn project.project(':util').compileJava //We need taglets to be compiled

options.author = true
options.version = true
options.tagletPath project(':util').sourceSets.main.output.classesDir
options.setTaglets([ 'taglets.ManualTaglet', 'taglets.ServerReleaseTaglet' ])
options.tagletPath project.project(":util").sourceSets.main.output.files
.stream()
.map { file(it) }
.collect(toList())
options.setTaglets(['taglets.ManualTaglet', 'taglets.ServerReleaseTaglet'])
options.links 'http://docs.oracle.com/javase/6/docs/api/'
options.links 'http://api.mongodb.org/java/3.0/'
title "Morphia ${majorVersion} API"
Expand All @@ -156,9 +157,11 @@ configure(subprojects.findAll { it.name != 'util' }) {
}
}

task clirrRootReport(type: org.kordamp.gradle.clirr.ClirrReportTask) << {
dependsOn = subprojects.tasks.clirr
reports = files((subprojects.findAll { it.clirr.enabled == true }).tasks.clirr.xmlReport)
task clirrRootReport(type: ClirrReportTask) {
doLast {
dependsOn = subprojects.tasks.clirr
reports = files((subprojects.findAll { it.clirr.enabled == true }).tasks.clirr.xmlReport)
}
}

def buildingWith(n) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/**
* @author us@thomas-daily.de
*/
@SuppressWarnings("deprecation")
public class EntityScannerTest {
@Test
public void testScanning() throws Exception {
Expand Down
258 changes: 138 additions & 120 deletions gradle/docs.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,169 +5,187 @@ def ghPages = file("build/gh-pages")

ext.hugo = find('hugo')

task showExecutables << {
task showExecutables { doLast {
println "hugo = $hugo"
println "git = $git"
}
} }

def forceLanding() {
gitVersion() == 'master' || buildingWith('forceLanding')
}

task cleanDocs() << {
delete {
delete 'build', 'classes'
task cleanDocs() {
doLast {
delete {
delete 'build', 'classes'
}
}
}

task publishReference(dependsOn : [ 'reference', 'clonePages']) << {
task publishReference(dependsOn: ['reference', 'clonePages']) {
doLast {

def referencePage = new File(ghPages, urlVersion)
referencePage.mkdirs()
copy {
from 'docs/reference/public'
into referencePage
}
exec {
workingDir referencePage
commandLine git
args("add", ".")
def referencePage = new File(ghPages, urlVersion)
referencePage.mkdirs()
copy {
from 'docs/reference/public'
into referencePage
}
exec {
workingDir referencePage
commandLine git
args("add", ".")
}
}
}

task publishLanding(dependsOn : [ 'landing', 'clonePages']) << {
ghPages.mkdirs()
copy {
from 'docs/landing/public'
into ghPages
}
exec {
workingDir ghPages
environment System.getenv()
commandLine git
args("add", ".")
task publishLanding(dependsOn: ['landing', 'clonePages']) {
doLast {
ghPages.mkdirs()
copy {
from 'docs/landing/public'
into ghPages
}
exec {
workingDir ghPages
environment System.getenv()
commandLine git
args("add", ".")
}
}
}

task pushDocs(dependsOn : [ 'cleanDocs', 'publishReference', 'publishLanding' ]) << {
exec {
workingDir ghPages
environment System.getenv()
commandLine git
ignoreExitValue true
args("commit", "-a", "-m", "pushing docs updates")
}
exec {
workingDir ghPages
environment System.getenv()
commandLine git
args("push")
}
task pushDocs(dependsOn: ['cleanDocs', 'publishReference', 'publishLanding']) {
doLast {
exec {
workingDir ghPages
environment System.getenv()
commandLine git
ignoreExitValue true
args("commit", "-a", "-m", "pushing docs updates")
}
exec {
workingDir ghPages
environment System.getenv()
commandLine git
args("push")
}

}
}

task landing << {
def file = file('docs/landing/data/releases.toml')
if (!file.text.contains(latest_release)) {
throw new TaskExecutionException(it, new Exception("Latest release not listed in $file"))
}
task landing {
doLast {
def file = file('docs/landing/data/releases.toml')
if (!file.text.contains(latest_release)) {
throw new TaskExecutionException(it, new Exception("Latest release not listed in $file"))
}

update('docs/landing/layouts/partials/hero.html', [
[ ' <a id="latest" ', " <a id=\"latest\" href=\"${major(latest_release)}\""]
])
update('docs/landing/layouts/partials/hero.html', [
[' <a id="latest" ', " <a id=\"latest\" href=\"${major(latest_release)}\""]
])

exec {
workingDir 'docs/landing'
environment System.getenv()
commandLine hugo
exec {
workingDir 'docs/landing'
environment System.getenv()
commandLine hugo
}
}
}

landing.onlyIf { forceLanding() }
publishLanding.onlyIf { forceLanding() }

task reference(dependsOn: ':morphia:javadoc') << {
exec {
workingDir 'docs/reference'
environment System.getenv()
commandLine hugo
}
copy {
from 'morphia/build/docs'
into 'docs/reference/public'
}

update('docs/reference/content/getting-started/installation-guide.md', [
[ '{{< install version', "{{< install version=\"${latest}\" >}}"]
])
task reference(dependsOn: ':morphia:javadoc') {
doLast {
exec {
workingDir 'docs/reference'
environment System.getenv()
commandLine hugo
}
copy {
from 'morphia/build/docs'
into 'docs/reference/public'
}

update('docs/reference/content/guides/jrebel.md', [
[' <version>', " <version>${latest}</version>"]
])
update('docs/reference/content/getting-started/installation-guide.md', [
['{{< install version', "{{< install version=\"${latest}\" >}}"]
])

update('docs/reference/content/guides/validationExtension.md', [
[' <version>', " <version>${latest}</version>"]
])
update('docs/reference/content/guides/jrebel.md', [
[' <version>', " <version>${latest}</version>"]
])

update('docs/reference/config.toml', [
['baseurl = "', "baseurl = \"/morphia/${urlVersion}\""]
])
update('docs/reference/content/guides/validationExtension.md', [
[' <version>', " <version>${latest}</version>"]
])

update('docs/reference/data/mongodb.toml', [
['githubBranch = "', "githubBranch = \"${gitVersion()}\""],
['currentVersion = "', "currentVersion = \"${majorVersion}\""],
['coreApiUrl = "', "coreApiUrl = \"http://api.mongodb.org/java/${major(driverVersion)}/\""]
])
}
update('docs/reference/config.toml', [
['baseurl = "', "baseurl = \"/morphia/${urlVersion}\""]
])

task viewLanding(dependsOn: 'landing') << {
exec {
workingDir 'docs/landing'
environment System.getenv()
commandLine hugo
args("server", "--baseUrl=http://localhost/", "--buildDrafts", "--watch")
update('docs/reference/data/mongodb.toml', [
['githubBranch = "', "githubBranch = \"${gitVersion()}\""],
['currentVersion = "', "currentVersion = \"${majorVersion}\""],
['coreApiUrl = "', "coreApiUrl = \"http://api.mongodb.org/java/${major(driverVersion)}/\""]
])
}
}

task viewReference(dependsOn: 'reference') << {
exec {
workingDir 'docs/reference'
environment System.getenv()
commandLine hugo
args("server", "--baseUrl=http://localhost/", "--buildDrafts", "--watch")
}
}

task clonePages << {
def pages = new File("build/gh-pages")
if (!pages.exists()) {
def stream = new ByteArrayOutputStream()

task viewLanding(dependsOn: 'landing') {
doLast {
exec {
workingDir rootDir
workingDir 'docs/landing'
environment System.getenv()
commandLine git
args("config", "--get", "remote.origin.url")
standardOutput = stream
commandLine hugo
args("server", "--baseUrl=http://localhost/", "--buildDrafts", "--watch")
}
}
}

def url = new String(stream.toByteArray()).trim()
new File("build").mkdirs()
task viewReference(dependsOn: 'reference') {
doLast {
exec {
workingDir 'build'
workingDir 'docs/reference'
environment System.getenv()
commandLine git
args("clone", url, "-b", "gh-pages", "gh-pages")
}
} else {
println "${pages} already exists. skipping clone."
exec {
workingDir 'build/gh-pages'
environment System.getenv()
commandLine git
args("pull")
commandLine hugo
args("server", "--baseUrl=http://localhost/", "--buildDrafts", "--watch")
}
}
}

task clonePages {
doLast {
def pages = new File("build/gh-pages")
if (!pages.exists()) {
def stream = new ByteArrayOutputStream()

exec {
workingDir rootDir
environment System.getenv()
commandLine git
args("config", "--get", "remote.origin.url")
standardOutput = stream
}

def url = new String(stream.toByteArray()).trim()
new File("build").mkdirs()
exec {
workingDir 'build'
environment System.getenv()
commandLine git
args("clone", url, "-b", "gh-pages", "gh-pages")
}
} else {
println "${pages} already exists. skipping clone."
exec {
workingDir 'build/gh-pages'
environment System.getenv()
commandLine git
args("pull")
}

}
}
}

Expand All @@ -189,4 +207,4 @@ def update(input, replacements) {
throw new BuildException("Found an unmatched file update for ${input}: ${replacements}".toString(), null)
}
file(temp).renameTo(file(input))
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading

0 comments on commit 48f65ab

Please sign in to comment.