vidakovic commented on code in PR #2305: URL: https://github.com/apache/fineract/pull/2305#discussion_r864264625
########## buildSrc/src/main/groovy/org/apache/fineract/gradle/FineractPlugin.groovy: ########## @@ -0,0 +1,571 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.gradle + +import groovy.json.JsonSlurper +import org.apache.commons.io.FileUtils +import org.apache.commons.io.filefilter.NotFileFilter +import org.apache.commons.io.filefilter.PrefixFileFilter +import org.apache.fineract.gradle.service.* +import org.beryx.textio.TextIO +import org.beryx.textio.TextIoFactory +import org.beryx.textio.TextTerminal +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +class FineractPlugin implements Plugin<Project> { + private static final Logger log = LoggerFactory.getLogger(FineractPlugin.class) + + private JiraService jiraService + private ConfluenceService confluenceService + private SubversionService subversionService + private EmailService emailService + private GpgService gpgService + private TemplateService templateService + private GitService gitService + private Map<String, ?> context; + + static { + System.setProperty("org.beryx.textio.TextTerminal", "org.beryx.textio.system.SystemTextTerminal") + } + + void apply(Project project) { + def extension = project.extensions.create("fineract", FineractPluginExtension, project) + + project.fineract.extensions.create("config", FineractPluginExtension.FineractPluginConfig) + project.fineract.config.extensions.create("doc", FineractPluginExtension.FineractPluginConfigDoc) + project.fineract.config.extensions.create("template", FineractPluginExtension.FineractPluginConfigTemplate) + project.fineract.config.extensions.create("smtp", FineractPluginExtension.FineractPluginConfigSmtp) + project.fineract.config.extensions.create("subversion", FineractPluginExtension.FineractPluginConfigSubversion) + project.fineract.config.extensions.create("jira", FineractPluginExtension.FineractPluginConfigJira) + project.fineract.config.extensions.create("confluence", FineractPluginExtension.FineractPluginConfigConfluence) + project.fineract.config.extensions.create("gpg", FineractPluginExtension.FineractPluginConfigGpg) + project.fineract.config.extensions.create("git", FineractPluginExtension.FineractPluginConfigGit) + + project.afterEvaluate { + this.templateService = new TemplateService(extension.config.template) + this.jiraService = new JiraService(extension.config.jira) + this.confluenceService = new ConfluenceService(extension.config.confluence) + this.subversionService = new SubversionService(extension.config.subversion) + this.emailService = new EmailService(extension.config.smtp) + this.gpgService = new GpgService(extension.config.gpg) + this.gitService = new GitService(extension.config.git, extension.config.gpg) + this.context = context(project) + } + + project.tasks.register("fineractDocPublish") { + dependsOn(":fineract-doc:doc") + + doLast { + log.warn("Fineract Publish Doc...") + + def url = extension.config.doc.url?:"[email protected]:apache/fineract-site.git"; + def branch = extension.config.doc.branch?:"asf-site" + def directory = extension.config.doc.directory?:System.getProperty("java.io.tmpdir")+"/fineract-site" + + def d = new File(directory) + + if(d.exists()) { + gitService.pull(directory) + } else { + gitService.clone(url, branch, directory) + + gitService.config(directory, extension.config.git.sections) + } + + def source = new File("fineract-doc/build/docs/html/en"); + def target = new File(directory + "/docs/current") + + if(!target.name) { + target.mkdirs() + } + + FileUtils.copyDirectory(source, target, new NotFileFilter(new PrefixFileFilter(".asciidoctor")), true) + + gitService.commit(directory) + } + } + + project.tasks.register("fineractReleaseTest") { + doFirst { + // emojis: + // https://gist.github.com/parmentf/035de27d6ed1dce0b36a + // https://emojipedia.org/ + // https://unicode.org/emoji/charts/full-emoji-list.html + + FineractPluginExtension.FineractPluginStep step = step(extension, "test") + + // TODO: + // - jira: + // - move tickets to new version + + // jira query + FineractPluginExtension.FineractPluginJiraParams result = jiraService.search(step.jira) + log.warn(">>>>>>>>>>>>>>>> ISSUE: ${result.result[0]?.id} - ${result.result[0]?.key} - ${result.result[0]?.fields?['summary']} - ${result.result[0]?.fields?['fixVersions']}") + + /* + + // confluence create + def content = new ConfluenceService.ConfluenceContent(title: "1.7.0 - Apache Fineract", Review Comment: It's just a collection of examples for the missing steps/tasks. In the next rounds these will disappear (and the test step for that matter). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
