plugins { id "io.freefair.lombok" version "5.3.0" } import org.apache.tools.ant.filters.ReplaceTokens apply plugin: 'io.spring.convention.docs' apply plugin: 'io.spring.convention.spring-test' description = "Generate Javadoc and Reference Documentation on Spring Boot for Apache Geode" repositories { maven { url "https://repo.spring.io/release" } } dependencies { compile project(':spring-geode-starter') optional project(":spring-geode-starter-logging") compile "org.assertj:assertj-core" compile "org.projectlombok:lombok" testCompile "junit:junit" testCompile "org.mockito:mockito-core" testCompile "edu.umd.cs.mtc:multithreadedtc" testCompile project(":spring-geode-starter-test") } def versions = dependencyManagement.managedVersions asciidoctor { clearSources() sources { include "index.adoc" include "guides/*.adoc" } } asciidoctorj { def javaVersion = JavaVersion.current() def apacheGeodeDocVersion = resolveApacheGeodeDocVersion("${apacheGeodeVersion}") def githubBaseUrl = "https://github.com/spring-projects/spring-boot-data-geode" def githubTag = snapshotBuild ? 'master' : project.version def githubUrl = "$githubBaseUrl/tree/$githubTag" attributes 'version' : project.version, 'version-snapshot': snapshotBuild, 'version-milestone': milestoneBuild, 'version-release': releaseBuild, 'download-url' : "${githubBaseUrl}/archive/${githubTag}.zip", 'github-url': githubUrl, 'github-samples-url': "${githubUrl}/spring-geode-samples", 'highlightjsdir@': "js/highlight", 'docinfodir@': ".", 'java-version' : "$javaVersion", 'apache-geode-artifact-version' : "${apacheGeodeVersion}", 'apache-geode-doc-version' : apacheGeodeDocVersion, 'apache-geode-src' : "https://github.com/apache/geode/blob/rel/v${apacheGeodeVersion}", 'pivotal-cloudcache-artifact-version' : "${pivotalCloudCacheVersion}", 'pivotal-cloudcache-doc-version' : "1-13", 'pivotal-gemfire-artifact-version' : "${pivotalGemFireVersion}", 'pivotal-gemfire-doc-version' : "910", 'spring-version' : versions['org.springframework:spring-core'], 'spring-boot-version' : "${springBootVersion}", 'spring-boot-data-geode-version' : project.version, 'spring-data-commons-version' : "${springDataBomVersion}", 'spring-data-geode-version' : "${springDataGeodeVersion}", 'spring-session-data-gemfire-version' : "${springSessionDataGeodeVersion}", 'spring-session-data-geode-version' : "${springSessionDataGeodeVersion}", 'spring-test-data-gemfire-version' : "${springDataGeodeTestVersion}", 'spring-test-data-geode-version' : "${springDataGeodeTestVersion}", 'docs-dir' : rootProject.projectDir.path + '/spring-geode-docs', 'docs-src-dir' : rootProject.projectDir.path + '/spring-geode-docs/src/main/java', 'docs-resources-dir' : rootProject.projectDir.path + '/spring-geode-docs/src/main/resources', 'examples-dir' : rootProject.projectDir.path + '/spring-geode-examples', 'samples-dir' : rootProject.projectDir.path + '/spring-geode-samples', 'starter-logging-dir' : rootProject.projectDir.path + '/spring-geode-starter-logging', 'starter-logging-src-dir' : rootProject.projectDir.path + '/spring-geode-starter-logging/src/main/src', 'starter-logging-resources-dir' : rootProject.projectDir.path + '/spring-geode-starter-logging/src/main/resources' } asciidoctorPdf { clearSources() sources { include "index.adoc" // include "guides/*.adoc" } } javadoc { configure(options) { links = [ "https://docs.spring.io/spring/docs/current/javadoc-api/", "https://docs.spring.io/spring-boot/docs/current/api/", "https://docs.spring.io/spring-boot-data-geode/docs/${project.version}/api/", "https://docs.spring.io/spring-data/commons/docs/current/api/", "https://docs.spring.io/spring-data/geode/docs/current/api/", "https://geode.apache.org/releases/latest/javadoc/", ] } } processResources { eachFile { file -> if (!file.name.endsWith(".jks")) { file.filter ReplaceTokens, tokens: [ 'project-dir' : rootProject.projectDir.path, 'project-version' : project.version, 'docs-dir' : rootProject.projectDir.path + '/spring-geode-docs', 'samples-dir' : rootProject.projectDir.path + '/spring-geode-samples' ] } } } String resolveApacheGeodeDocVersion(String apacheGeodeVersion) { def apacheGeodeDocVersion = '' def index = apacheGeodeVersion.lastIndexOf(".") apacheGeodeVersion = index > -1 ? apacheGeodeVersion.substring(0, index) : apacheGeodeVersion for (char character : apacheGeodeVersion.toCharArray()) { if (Character.isDigit(character)) { apacheGeodeDocVersion += character } } return apacheGeodeDocVersion }