| ext { |
| githubBranch = "7.1.x" |
| checkOutDir = "build/checkout" |
| zipFile = "build/source.zip" |
| |
| coreProjects = [ |
| 'core', |
| 'gorm' |
| ] |
| |
| } |
| |
| version rootProject.version |
| |
| apply plugin: 'org.asciidoctor.convert' |
| apply plugin: 'groovy' |
| |
| configurations.all { |
| resolutionStrategy.eachDependency { DependencyResolveDetails details -> |
| if (details.requested.group == 'org.codehaus.groovy' && details.requested.name.startsWith('groovy')) { |
| details.useVersion(groovyVersion) |
| } |
| if (details.requested.group == 'org.springframework') { |
| details.useVersion(springVersion) |
| } |
| if (details.requested.group == "org.springframework.boot") { |
| details.useVersion(springBootVersion) |
| } |
| } |
| } |
| |
| dependencies { |
| documentation "org.grails:grails-core:$grailsVersion" |
| documentation "org.grails:grails-bootstrap:$grailsVersion" |
| documentation "org.grails:grails-spring:$grailsVersion" |
| documentation "info.picocli:picocli:$picocliVersion" |
| documentation "org.fusesource.jansi:jansi:$jansiVersion" |
| documentation "org.codehaus.groovy:groovy-dateutil:$groovyVersion" |
| documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion" |
| |
| documentation "org.fusesource.jansi:jansi:$jansiVersion" |
| for(p in coreProjects) { |
| documentation "org.grails:grails-datastore-$p:$gormVersion" |
| } |
| project.rootProject.subprojects.each { subproject -> |
| if(subproject.name != "docs" && !subproject.name.startsWith('examples')) { |
| documentation project(":$subproject.name") |
| } |
| } |
| } |
| |
| asciidoctor { |
| resources { |
| from("${project.projectDir}/src/docs/asciidoc/images") |
| into "./images" |
| } |
| |
| attributes 'experimental' : 'true', |
| 'compat-mode' : 'true', |
| 'icons' : 'font', |
| 'reproducible' : '', |
| 'version' : project.version, |
| 'pluginVersion' : project.version, |
| 'sourcedir' : "${project.projectDir}/src/main/groovy" |
| } |
| |
| asciidoctorj { |
| version = '1.5.4' |
| } |
| |
| task fetchSource { |
| doLast { |
| ant.mkdir dir: project.buildDir |
| ant.mkdir dir: checkOutDir |
| |
| println "Downloading GORM source code." |
| def tag = System.getenv('TRAVIS_TAG') |
| if (tag) { |
| ant.get src: "https://github.com/grails/grails-data-mapping/archive/${tag}.zip", dest: zipFile, verbose: true |
| } else { |
| ant.get src: "https://github.com/grails/grails-data-mapping/zipball/${githubBranch}", dest: zipFile, verbose: true |
| } |
| |
| ant.unzip src: zipFile, dest: checkOutDir, { |
| mapper type: "regexp", from: "(grails-\\S*?/)(.*)", to: "gorm-src/\\2" |
| } |
| println "GORM source code downloaded." |
| } |
| } |
| |
| fetchSource.inputs.properties(branch:githubBranch) |
| fetchSource.outputs.dir checkOutDir |
| |
| |
| task copyDocs(type:Copy, dependsOn:asciidoctor) { |
| from "${project.buildDir}/asciidoc/html5" |
| into "${project.buildDir}/docs/manual" |
| } |
| |
| tasks.withType(Groovydoc) { |
| dependsOn('fetchSource') |
| docTitle = "GORM for Hibernate 5 - ${project.version}" |
| destinationDir = project.file("build/docs/api") |
| |
| def files |
| for (p in coreProjects) { |
| if (files == null) { |
| files = project.files("${checkOutDir}/gorm-src/grails-datastore-${p}/src/main/groovy") |
| } else { |
| files += project.files("${checkOutDir}/gorm-src/grails-datastore-${p}/src/main/groovy") |
| } |
| } |
| project.rootProject.subprojects |
| .findAll { !it.name.contains('-rx-') && !it.name.startsWith('examples') } |
| .each { subproject -> |
| if (subproject.file('src/main/groovy').exists()) { |
| files += subproject.files("src/main/groovy") |
| } |
| } |
| source = files |
| classpath += configurations.documentation |
| } |
| |
| task copyResources(type:Copy) { |
| from 'src/docs/resources' |
| into "${project.buildDir}/docs" |
| } |
| |
| task docs(dependsOn:[asciidoctor, groovydoc, copyDocs, copyResources] + |
| subprojects.findAll { project -> project.tasks.findByName('groovydoc')} |
| .collect { project -> project.tasks.groovydoc } |
| ) |
| |
| //task assemble(type: Zip, dependsOn:docs) { |
| // from "${project.buildDir}/docs" |
| // baseName = "${project.name}-${project.version}" |
| // destinationDir = project.file("${project.buildDir}/distributions") |
| //} |