Skip to content

Commit

Permalink
build(docs): update project build configuration to fix docs task (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetbehl committed Mar 18, 2024
1 parent 5eb7f9f commit 7df3c3d
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 7 deletions.
71 changes: 69 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ buildscript {
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.6.1'
classpath "gradle.plugin.com.github.erdi.webdriver-binaries:webdriver-binaries-gradle-plugin:$webdriverBinariesVersion"
classpath "com.github.erdi:webdriver-binaries-gradle-plugin:$webdriverBinariesVersion"
classpath "org.grails:grails-docs:${project.ext.properties.grailsDocsVersion ?: grailsVersion}"
}
}

Expand All @@ -14,15 +15,31 @@ group "org.grails.plugins"

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: "com.github.erdi.webdriver-binaries"
apply from:"https://raw.githubusercontent.com/grails/grails-common-build/master/common-docs.gradle"
apply plugin:"org.grails.grails-plugin"
apply plugin:"org.grails.internal.grails-plugin-publish"

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}

configurations {
documentation.extendsFrom(compileClasspath)
}

configurations {
all {
resolutionStrategy.eachDependency { DependencyResolveDetails details->
if (details.requested.group == 'org.seleniumhq.selenium') {
details.useVersion(seleniumVersion)
}
}
}
}

dependencies {
api "org.springframework.boot:spring-boot-starter-logging"
api "org.springframework.boot:spring-boot-autoconfigure"
Expand Down Expand Up @@ -91,6 +108,49 @@ tasks.withType(Test) {
}
}

task publishGuide(type: grails.doc.gradle.PublishGuide) {
group = 'documentation'
description = 'Generate Guide'

targetDir = project.file("${buildDir}/docs")
sourceRepo = "https://github.com/${githubSlug}/edit/${githubBranch}/src/main/docs"
sourceDir = new File(projectDir, "src/main/docs")
propertiesFiles = [ new File(rootProject.projectDir, "gradle.properties") ]
asciidoc = true
properties = [
'safe':'UNSAFE',
'version': project.version,
'subtitle': project.projectDesc,
'api': '../api',
'sourceDir':rootProject.projectDir.absolutePath,
'sourcedir':rootProject.projectDir.absolutePath,
'javaee': 'https://docs.oracle.com/javaee/7/api/',
'javase': 'https://docs.oracle.com/javase/7/docs/api/',
'groovyapi': 'https://docs.groovy-lang.org/latest/html/gapi/',
'grailsapi': 'https://docs.grails.org/latest/api/',
'gormapi': 'https://gorm.grails.org/latest/api/',
'springapi': 'https://docs.spring.io/spring/docs/current/javadoc-api/'
]
doLast {
ant.move(file:"${project.buildDir}/docs/guide/single.html",
tofile:"${project.buildDir}/docs/guide/index.html", overwrite:true)
new File(project.buildDir, "docs/index.html").text = '''
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:https://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="refresh" content="0; url=guide/index.html" />
</head>
</body>
</html>
'''
}
}

task docs(dependsOn:[groovydoc, publishGuide]) {
group = 'documentation'
}

bootRun {
jvmArgs(
'-Dspring.output.ansi.enabled=always',
Expand All @@ -101,8 +161,10 @@ bootRun {
String springProfilesActive = 'spring.profiles.active'
systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}

// enable if you wish to package this plugin as a standalone application
bootJar.enabled = false

grailsPublish {
userOrg = 'grails'
githubSlug = 'grails/grails-cache'
Expand All @@ -125,3 +187,8 @@ jar {
includeEmptyDirs = false
exclude 'com/demo/**'
}

tasks.named("build") {
finalizedBy("docs")
}

8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
projectVersion=6.0.0-SNAPSHOT
grailsVersion=5.2.5
grailsGradlePluginVersion=5.2.4
grailsVersion=5.3.6
groovyVersion=3.0.11
grailsGradlePluginVersion=5.3.1
gormVersion=7.2.1
groovyVersion=3.0.7
githubSlug=grails/grails-cache
githubBranch=6.0.x
title=Cache Plugin
Expand All @@ -11,7 +11,7 @@ guide=../../guide
tags=../ref/Tags
gebVersion=6.0
seleniumVersion=4.6.0
webdriverBinariesVersion=2.7
webdriverBinariesVersion=3.2
hibernateCoreVersion=5.1.5.Final
geckodriverVersion=0.32.2
chromeDriverVersion=110.0.5481.77
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\:https://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 7df3c3d

Please sign in to comment.