diff --git a/publishing/utils.groovy b/publishing/utils.groovy index 145a7e9..2ab4059 100644 --- a/publishing/utils.groovy +++ b/publishing/utils.groovy @@ -1,8 +1,23 @@ + +// The filepath must end in "/**" or "/" - Glob wildcard - as a git sparse checkout +def checkallowed(String filepath) { + if (filepath.endsWith('/**') || filepath.endsWith('/')) { + def files = findFiles glob: filepath + if (files.length > 0) { + return + } else { + error "There are no files/folders under the publishable item: ${filepath}" + } + } + error "The publishable item: ${filepath} does not end in /** or / (for git sparse checkouts)" +} + // Generate a list of artifact files that are publishable to outside parties def generatelist(meta, publishable) { filelist = [] for (filepath in publishable) { + checkallowed(filepath) meta.addPublishable(filepath) } }