1975df9ddSRobert Muir/* 2975df9ddSRobert Muir * Licensed to the Apache Software Foundation (ASF) under one or more 3975df9ddSRobert Muir * contributor license agreements. See the NOTICE file distributed with 4975df9ddSRobert Muir * this work for additional information regarding copyright ownership. 5975df9ddSRobert Muir * The ASF licenses this file to You under the Apache License, Version 2.0 6975df9ddSRobert Muir * (the "License"); you may not use this file except in compliance with 7975df9ddSRobert Muir * the License. You may obtain a copy of the License at 8975df9ddSRobert Muir * 9975df9ddSRobert Muir * http://www.apache.org/licenses/LICENSE-2.0 10975df9ddSRobert Muir * 11975df9ddSRobert Muir * Unless required by applicable law or agreed to in writing, software 12975df9ddSRobert Muir * distributed under the License is distributed on an "AS IS" BASIS, 13975df9ddSRobert Muir * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14975df9ddSRobert Muir * See the License for the specific language governing permissions and 15975df9ddSRobert Muir * limitations under the License. 16975df9ddSRobert Muir */ 17975df9ddSRobert Muir 18d4a98423SDawid Weiss// Add "help" tasks which display plain text files under 'help' folder. 19d4a98423SDawid Weiss 20d4a98423SDawid Weissconfigure(rootProject) { 21d4a98423SDawid Weiss def helpFiles = [ 22d4a98423SDawid Weiss ["Workflow", "help/workflow.txt", "Typical workflow commands."], 23d4a98423SDawid Weiss ["Tests", "help/tests.txt", "Tests, filtering, beasting, etc."], 24c94b035dSDawid Weiss ["Formatting", "help/formatting.txt", "Code formatting conventions."], 258ebf2d0bSDawid Weiss ["Jvms", "help/jvms.txt", "Using alternative or EA JVM toolchains."], 264d304023SDawid Weiss ["Deps", "help/dependencies.txt", "Declaring, inspecting and excluding dependencies."], 2764619091SDawid Weiss ["ForbiddenApis", "help/forbiddenApis.txt", "How to add/apply rules for forbidden APIs."], 284d304023SDawid Weiss ["LocalSettings", "help/localSettings.txt", "Local settings, overrides and build performance tweaks."], 299d15435bSRobert Muir ["Regeneration", "help/regeneration.txt", "How to refresh generated and derived resources."], 30ae2e4f3aSDawid Weiss ["Git", "help/git.txt", "Git assistance and guides."], 31f9196726SHouston Putman ["IDEs", "help/IDEs.txt", "IDE support."], 328bcc3dc4SDawid Weiss ["Publishing", "help/publishing.txt", "Maven and other artifact publishing, signing, etc."], 33d4a98423SDawid Weiss ] 34d4a98423SDawid Weiss 35d4a98423SDawid Weiss helpFiles.each { section, path, sectionInfo -> 36d4a98423SDawid Weiss task "help${section}" { 37d4a98423SDawid Weiss group = 'Help (developer guides and hints)' 38d4a98423SDawid Weiss description = sectionInfo 39d4a98423SDawid Weiss doFirst { 40d4a98423SDawid Weiss println "\n" + rootProject.file(path).getText("UTF-8") 41d4a98423SDawid Weiss } 42d4a98423SDawid Weiss } 43d4a98423SDawid Weiss } 44d4a98423SDawid Weiss 45d4a98423SDawid Weiss help { 46d4a98423SDawid Weiss doLast { 47d4a98423SDawid Weiss println "" 48d4a98423SDawid Weiss println "This is an experimental Lucene/Solr gradle build. See some" 49d4a98423SDawid Weiss println "guidelines, ant-equivalent commands etc. under help/*; or type:" 508c5ce090SErick Erickson println "" 5127f4b02aSDawid Weiss helpFiles.each { section, path, sectionInfo -> 52bf7d1154SDawid Weiss println String.format(Locale.ROOT, 533af165b3SErick Erickson " gradlew :help%-16s # %s", section, sectionInfo) 54d4a98423SDawid Weiss } 558c5ce090SErick Erickson println "" 56*780846a7SDawid Weiss println "For the impatient, build the project with 'gradlew assemble'" 57d4a98423SDawid Weiss } 58d4a98423SDawid Weiss } 5927f4b02aSDawid Weiss 6027f4b02aSDawid Weiss task allHelpFilesExit() { 6127f4b02aSDawid Weiss doFirst { 6227f4b02aSDawid Weiss helpFiles.each { section, path, sectionInfo -> 6327f4b02aSDawid Weiss if (!rootProject.file(path).exists()) { 6427f4b02aSDawid Weiss throw new GradleException("Help file missing: ${path} (correct help.gradle)") 6527f4b02aSDawid Weiss } 6627f4b02aSDawid Weiss } 6727f4b02aSDawid Weiss } 6827f4b02aSDawid Weiss } 6927f4b02aSDawid Weiss 7027f4b02aSDawid Weiss check.dependsOn allHelpFilesExit 71d4a98423SDawid Weiss} 72