Author: taher
Date: Fri Dec 30 21:46:27 2016 New Revision: 1776642 URL: http://svn.apache.org/viewvc?rev=1776642&view=rev Log: Implemented: replace leftshift operators with doLast clojures in build.gradle (OFBIZ-9160) Gradle 3+ has deprecated the leftshift operator "<<" in favor of using the doLast closure. Hence all instances of the leftshift operator are replaced with doLast in build.gradle. Modified: ofbiz/trunk/build.gradle Modified: ofbiz/trunk/build.gradle URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.gradle?rev=1776642&r1=1776641&r2=1776642&view=diff ============================================================================== --- ofbiz/trunk/build.gradle (original) +++ ofbiz/trunk/build.gradle Fri Dec 30 21:46:27 2016 @@ -314,18 +314,20 @@ task testIntegration(group: ofbizServer) } task terminateOfbiz(group: ofbizServer, - description: 'Force termination of any running OFBiz servers, only use if \"--shutdown\" command fails') << { - if (os.contains('windows')) { - Runtime.getRuntime().exec("wmic process where \"CommandLine Like \'%org.apache.ofbiz.base.start.Start%\'\" Call Terminate") - } else { - def processOutput = new ByteArrayOutputStream() - exec { - commandLine 'ps', 'ax' - standardOutput = processOutput - } - processOutput.toString().split(System.lineSeparator()).each { line -> - if (line ==~ /.*org\.apache\.ofbiz\.base\.start\.Start.*/) { - exec { commandLine 'kill', '-9', line.tokenize().first() } + description: 'Force termination of any running OFBiz servers, only use if \"--shutdown\" command fails') { + doLast { + if (os.contains('windows')) { + Runtime.getRuntime().exec("wmic process where \"CommandLine Like \'%org.apache.ofbiz.base.start.Start%\'\" Call Terminate") + } else { + def processOutput = new ByteArrayOutputStream() + exec { + commandLine 'ps', 'ax' + standardOutput = processOutput + } + processOutput.toString().split(System.lineSeparator()).each { line -> + if (line ==~ /.*org\.apache\.ofbiz\.base\.start\.Start.*/) { + exec { commandLine 'kill', '-9', line.tokenize().first() } + } } } } @@ -379,44 +381,50 @@ task createTenant(group: ofbizServer, de def databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-Derby.xml" - task prepareAndValidateTenantArguments << { - if (!project.hasProperty('tenantId')) { - throw new GradleException('Project property tenantId is missing') - } - // dbPlatform values: D(Derby), M(MySQL), O(Oracle), P(PostgreSQL) (default D) - if (project.hasProperty('dbPlatform')) { - if (dbPlatform == 'D') { - databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-Derby.xml" - } else if (dbPlatform == 'M') { - databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-MySQL.xml" - } else if (dbPlatform == 'O') { - databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-Oracle.xml" - } else if (dbPlatform == 'P') { - databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml" - } else { - throw new GradleException('Invalid value for property dbPlatform: ' + "${dbPlatform}") + task prepareAndValidateTenantArguments { + doLast { + if (!project.hasProperty('tenantId')) { + throw new GradleException('Project property tenantId is missing') + } + // dbPlatform values: D(Derby), M(MySQL), O(Oracle), P(PostgreSQL) (default D) + if (project.hasProperty('dbPlatform')) { + if (dbPlatform == 'D') { + databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-Derby.xml" + } else if (dbPlatform == 'M') { + databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-MySQL.xml" + } else if (dbPlatform == 'O') { + databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-Oracle.xml" + } else if (dbPlatform == 'P') { + databaseTemplateFile = "${rootDir}/framework/resources/templates/AdminNewTenantData-PostgreSQL.xml" + } else { + throw new GradleException('Invalid value for property dbPlatform: ' + "${dbPlatform}") + } } } } - task generateDatabaseTemplateFile(dependsOn: prepareAndValidateTenantArguments) << { - def filterTokens = ['tenantId': tenantId, - 'tenantName': project.hasProperty('tenantName')? tenantName : tenantId, - 'domainName': project.hasProperty('domainName')? domainName : 'org.apache.ofbiz', - 'db-IP': project.hasProperty('dbIp')? dbIp : '', - 'db-User': project.hasProperty('dbUser')? dbUser : '', - 'db-Password': project.hasProperty('dbPassword')? dbPassword : ''] - - generateFileFromTemplate(databaseTemplateFile, 'runtime/tmp', - filterTokens, 'tmpFilteredTenantData.xml') + task generateDatabaseTemplateFile(dependsOn: prepareAndValidateTenantArguments) { + doLast { + def filterTokens = ['tenantId': tenantId, + 'tenantName': project.hasProperty('tenantName')? tenantName : tenantId, + 'domainName': project.hasProperty('domainName')? domainName : 'org.apache.ofbiz', + 'db-IP': project.hasProperty('dbIp')? dbIp : '', + 'db-User': project.hasProperty('dbUser')? dbUser : '', + 'db-Password': project.hasProperty('dbPassword')? dbPassword : ''] + + generateFileFromTemplate(databaseTemplateFile, 'runtime/tmp', + filterTokens, 'tmpFilteredTenantData.xml') + } } - task generateAdminUserTemplateFile(dependsOn: prepareAndValidateTenantArguments) << { - generateFileFromTemplate( - "${rootDir}/framework/resources/templates/AdminUserLoginData.xml", - 'runtime/tmp', - ['userLoginId': "${tenantId}-admin".toString()], - 'tmpFilteredUserLogin.xml') + task generateAdminUserTemplateFile(dependsOn: prepareAndValidateTenantArguments) { + doLast { + generateFileFromTemplate( + "${rootDir}/framework/resources/templates/AdminUserLoginData.xml", + 'runtime/tmp', + ['userLoginId': "${tenantId}-admin".toString()], + 'tmpFilteredUserLogin.xml') + } } // Load the tenants master database @@ -460,15 +468,17 @@ task createTenant(group: ofbizServer, de } // ========== System Administration tasks ========== -task createTestReports(group: sysadminGroup, description: 'Generate HTML reports from junit XML output') << { - ant.taskdef(name: 'junitreport', - classname: 'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator', - classpath: configurations.junitReport.asPath) - ant.junitreport(todir: './runtime/logs/test-results') { - fileset(dir: './runtime/logs/test-results') { - include(name: '*.xml') +task createTestReports(group: sysadminGroup, description: 'Generate HTML reports from junit XML output') { + doLast { + ant.taskdef(name: 'junitreport', + classname: 'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator', + classpath: configurations.junitReport.asPath) + ant.junitreport(todir: './runtime/logs/test-results') { + fileset(dir: './runtime/logs/test-results') { + include(name: '*.xml') + } + report(format:'frames', todir:'./runtime/logs/test-results/html') } - report(format:'frames', todir:'./runtime/logs/test-results/html') } } /* @@ -483,90 +493,92 @@ gradle.taskGraph.afterTask { Task task, } // ========== OFBiz Plugin Management ========== -task createPlugin(group: ofbizPlugin, description: 'create a new plugin component based on specified templates') << { - if (!project.hasProperty('pluginResourceName')) { - ext.pluginResourceName = pluginId.capitalize() - } - if (!project.hasProperty('webappName')) { - ext.webappName = pluginId - } - if (!project.hasProperty('basePermission')) { - ext.basePermission = pluginId.toUpperCase() - } - - def filterTokens = ['component-name': pluginId, - 'component-resource-name': pluginResourceName, - 'webapp-name': webappName, - 'base-permission': basePermission] - def templateDir = "${rootDir}/framework/resources/templates" - def pluginDir = "${pluginsDir}/${pluginId}" - - mkdir pluginDir - mkdir pluginDir+"/config" - mkdir pluginDir+"/data" - mkdir pluginDir+"/data/helpdata" - mkdir pluginDir+"/dtd" - mkdir pluginDir+"/documents" - mkdir pluginDir+"/entitydef" - mkdir pluginDir+"/lib" - mkdir pluginDir+"/patches" - mkdir pluginDir+"/patches/test" - mkdir pluginDir+"/patches/qa" - mkdir pluginDir+"/patches/production" - mkdir pluginDir+"/script" - mkdir pluginDir+"/servicedef" - mkdir pluginDir+"/src" - mkdir pluginDir+"/testdef" - mkdir pluginDir+"/webapp" - mkdir pluginDir+"/webapp/${webappName}" - mkdir pluginDir+"/webapp/${webappName}/error" - mkdir pluginDir+"/webapp/${webappName}/WEB-INF" - mkdir pluginDir+"/webapp/${webappName}/WEB-INF/actions" - mkdir pluginDir+"/widget/" - - generateFileFromTemplate(templateDir+"/ofbiz-component.xml", pluginDir, - filterTokens, "ofbiz-component.xml") - generateFileFromTemplate(templateDir+"/TypeData.xml", pluginDir+"/data", - filterTokens, "${pluginResourceName}TypeData.xml") - generateFileFromTemplate(templateDir+"/SecurityPermissionSeedData.xml", pluginDir+"/data", - filterTokens, "${pluginResourceName}SecurityPermissionSeedData.xml") - generateFileFromTemplate(templateDir+"/SecurityGroupDemoData.xml", pluginDir+"/data", - filterTokens, "${pluginResourceName}SecurityGroupDemoData.xml") - generateFileFromTemplate(templateDir+"/DemoData.xml", pluginDir+"/data", - filterTokens, "${pluginResourceName}DemoData.xml") - generateFileFromTemplate(templateDir+"/HELP.xml", pluginDir+"/data/helpdata", - filterTokens, "HELP_${pluginResourceName}.xml") - generateFileFromTemplate(templateDir+"/document.xml", pluginDir+"/documents", - filterTokens, "${pluginResourceName}.xml") - generateFileFromTemplate(templateDir+"/entitymodel.xml", pluginDir+"/entitydef", - filterTokens, "entitymodel.xml") - generateFileFromTemplate(templateDir+"/services.xml", pluginDir+"/servicedef", - filterTokens, "services.xml") - generateFileFromTemplate(templateDir+"/Tests.xml", pluginDir+"/testdef", - filterTokens, "${pluginResourceName}Tests.xml") - generateFileFromTemplate(templateDir+"/UiLabels.xml", pluginDir+"/config", - filterTokens, "${pluginResourceName}UiLabels.xml") - generateFileFromTemplate(templateDir+"/index.jsp", pluginDir+"/webapp/${webappName}", - filterTokens, "index.jsp") - generateFileFromTemplate(templateDir+"/error.jsp", pluginDir+"/webapp/${webappName}/error", - filterTokens, "error.jsp") - generateFileFromTemplate(templateDir+"/controller.xml", pluginDir+"/webapp/${webappName}/WEB-INF", - filterTokens, "controller.xml") - generateFileFromTemplate(templateDir+"/web.xml", pluginDir+"/webapp/${webappName}/WEB-INF", - filterTokens, "web.xml") - generateFileFromTemplate(templateDir+"/CommonScreens.xml", pluginDir+"/widget", - filterTokens, "CommonScreens.xml") - generateFileFromTemplate(templateDir+"/Screens.xml", pluginDir+"/widget", - filterTokens, "${pluginResourceName}Screens.xml") - generateFileFromTemplate(templateDir+"/Menus.xml", pluginDir+"/widget", - filterTokens, "${pluginResourceName}Menus.xml") - generateFileFromTemplate(templateDir+"/Forms.xml", pluginDir+"/widget", - filterTokens, "${pluginResourceName}Forms.xml") - generateFileFromTemplate(templateDir+"/build.gradle", pluginDir, - filterTokens, "build.gradle") - - activatePlugin pluginId - println "plugin successfully created in directory ${pluginsDir}/${pluginId}." +task createPlugin(group: ofbizPlugin, description: 'create a new plugin component based on specified templates') { + doLast { + if (!project.hasProperty('pluginResourceName')) { + ext.pluginResourceName = pluginId.capitalize() + } + if (!project.hasProperty('webappName')) { + ext.webappName = pluginId + } + if (!project.hasProperty('basePermission')) { + ext.basePermission = pluginId.toUpperCase() + } + + def filterTokens = ['component-name': pluginId, + 'component-resource-name': pluginResourceName, + 'webapp-name': webappName, + 'base-permission': basePermission] + def templateDir = "${rootDir}/framework/resources/templates" + def pluginDir = "${pluginsDir}/${pluginId}" + + mkdir pluginDir + mkdir pluginDir+"/config" + mkdir pluginDir+"/data" + mkdir pluginDir+"/data/helpdata" + mkdir pluginDir+"/dtd" + mkdir pluginDir+"/documents" + mkdir pluginDir+"/entitydef" + mkdir pluginDir+"/lib" + mkdir pluginDir+"/patches" + mkdir pluginDir+"/patches/test" + mkdir pluginDir+"/patches/qa" + mkdir pluginDir+"/patches/production" + mkdir pluginDir+"/script" + mkdir pluginDir+"/servicedef" + mkdir pluginDir+"/src" + mkdir pluginDir+"/testdef" + mkdir pluginDir+"/webapp" + mkdir pluginDir+"/webapp/${webappName}" + mkdir pluginDir+"/webapp/${webappName}/error" + mkdir pluginDir+"/webapp/${webappName}/WEB-INF" + mkdir pluginDir+"/webapp/${webappName}/WEB-INF/actions" + mkdir pluginDir+"/widget/" + + generateFileFromTemplate(templateDir+"/ofbiz-component.xml", pluginDir, + filterTokens, "ofbiz-component.xml") + generateFileFromTemplate(templateDir+"/TypeData.xml", pluginDir+"/data", + filterTokens, "${pluginResourceName}TypeData.xml") + generateFileFromTemplate(templateDir+"/SecurityPermissionSeedData.xml", pluginDir+"/data", + filterTokens, "${pluginResourceName}SecurityPermissionSeedData.xml") + generateFileFromTemplate(templateDir+"/SecurityGroupDemoData.xml", pluginDir+"/data", + filterTokens, "${pluginResourceName}SecurityGroupDemoData.xml") + generateFileFromTemplate(templateDir+"/DemoData.xml", pluginDir+"/data", + filterTokens, "${pluginResourceName}DemoData.xml") + generateFileFromTemplate(templateDir+"/HELP.xml", pluginDir+"/data/helpdata", + filterTokens, "HELP_${pluginResourceName}.xml") + generateFileFromTemplate(templateDir+"/document.xml", pluginDir+"/documents", + filterTokens, "${pluginResourceName}.xml") + generateFileFromTemplate(templateDir+"/entitymodel.xml", pluginDir+"/entitydef", + filterTokens, "entitymodel.xml") + generateFileFromTemplate(templateDir+"/services.xml", pluginDir+"/servicedef", + filterTokens, "services.xml") + generateFileFromTemplate(templateDir+"/Tests.xml", pluginDir+"/testdef", + filterTokens, "${pluginResourceName}Tests.xml") + generateFileFromTemplate(templateDir+"/UiLabels.xml", pluginDir+"/config", + filterTokens, "${pluginResourceName}UiLabels.xml") + generateFileFromTemplate(templateDir+"/index.jsp", pluginDir+"/webapp/${webappName}", + filterTokens, "index.jsp") + generateFileFromTemplate(templateDir+"/error.jsp", pluginDir+"/webapp/${webappName}/error", + filterTokens, "error.jsp") + generateFileFromTemplate(templateDir+"/controller.xml", pluginDir+"/webapp/${webappName}/WEB-INF", + filterTokens, "controller.xml") + generateFileFromTemplate(templateDir+"/web.xml", pluginDir+"/webapp/${webappName}/WEB-INF", + filterTokens, "web.xml") + generateFileFromTemplate(templateDir+"/CommonScreens.xml", pluginDir+"/widget", + filterTokens, "CommonScreens.xml") + generateFileFromTemplate(templateDir+"/Screens.xml", pluginDir+"/widget", + filterTokens, "${pluginResourceName}Screens.xml") + generateFileFromTemplate(templateDir+"/Menus.xml", pluginDir+"/widget", + filterTokens, "${pluginResourceName}Menus.xml") + generateFileFromTemplate(templateDir+"/Forms.xml", pluginDir+"/widget", + filterTokens, "${pluginResourceName}Forms.xml") + generateFileFromTemplate(templateDir+"/build.gradle", pluginDir, + filterTokens, "build.gradle") + + activatePlugin pluginId + println "plugin successfully created in directory ${pluginsDir}/${pluginId}." + } } task installPlugin(group: ofbizPlugin, description: 'activate a plugin and run its install task if it exists') { @@ -672,94 +684,107 @@ task pushPlugin(group: ofbizPlugin, desc } } -task pullPlugin(group: ofbizPlugin, description: 'Download and install a plugin with all dependencies') << { - if (!project.hasProperty('dependencyId')) { - throw new GradleException('You must pass the dependencyId of the plugin') - } - - // Connect to a remote maven repository if defined - if (project.hasProperty('repoUrl')) { - repositories { - maven { - url repoUrl - if (project.hasProperty('repoUser') && project.hasProperty('repoPassword')) { - credentials { - username repoUser - password repoPassword +task pullPlugin(group: ofbizPlugin, description: 'Download and install a plugin with all dependencies') { + doLast { + if (!project.hasProperty('dependencyId')) { + throw new GradleException('You must pass the dependencyId of the plugin') + } + + // Connect to a remote maven repository if defined + if (project.hasProperty('repoUrl')) { + repositories { + maven { + url repoUrl + if (project.hasProperty('repoUser') && project.hasProperty('repoPassword')) { + credentials { + username repoUser + password repoPassword + } } } } } - } - - // download plugin and dependencies - dependencies { - ofbizPlugins dependencyId - } - - // reverse the order of dependencies to install them before the plugin - def ofbizPluginArchives = new ArrayList(configurations.ofbizPlugins.files) - Collections.reverse(ofbizPluginArchives) - - // Extract and install plugin and dependencies - ofbizPluginArchives.each { pluginArchive -> - ext.pluginId = dependencyId.tokenize(':').get(1) - println "installing plugin: ${pluginId}" - copy { - from zipTree(pluginArchive) - into "${pluginsDir}/${pluginId}" + + // download plugin and dependencies + dependencies { + ofbizPlugins dependencyId + } + + // reverse the order of dependencies to install them before the plugin + def ofbizPluginArchives = new ArrayList(configurations.ofbizPlugins.files) + Collections.reverse(ofbizPluginArchives) + + // Extract and install plugin and dependencies + ofbizPluginArchives.each { pluginArchive -> + ext.pluginId = dependencyId.tokenize(':').get(1) + println "installing plugin: ${pluginId}" + copy { + from zipTree(pluginArchive) + into "${pluginsDir}/${pluginId}" + } + activateAndInstallPlugin pluginId } - activateAndInstallPlugin pluginId } } // ========== Clean up tasks ========== -task cleanCatalina(group: cleanupGroup, description: 'Clean Catalina data in runtime/catalina/work') << { - delete "${rootDir}/runtime/catalina/work" +task cleanCatalina(group: cleanupGroup, description: 'Clean Catalina data in runtime/catalina/work') { + doLast { delete "${rootDir}/runtime/catalina/work" } } -task cleanData(group: cleanupGroup, description: 'Clean all DB data (Derby) under runtime/data') << { - deleteAllInDirWithExclusions("${rootDir}/runtime/data/", ['README', 'derby.properties']) +task cleanData(group: cleanupGroup, description: 'Clean all DB data (Derby) under runtime/data') { + doLast { deleteAllInDirWithExclusions("${rootDir}/runtime/data/", ['README', 'derby.properties']) } } -task cleanDownloads(group: cleanupGroup, description: 'Clean all downloaded files') << { - delete fileTree(dir: "${rootDir}/framework/base/lib", includes: ['activemq-*.jar']) - delete fileTree(dir: "${rootDir}/framework/entity/lib/jdbc", includes: ['postgresql-*.jar']) - delete fileTree(dir: "${rootDir}/framework/entity/lib/jdbc", includes: ['mysql-*.jar']) +task cleanDownloads(group: cleanupGroup, description: 'Clean all downloaded files') { + doLast { + delete fileTree(dir: "${rootDir}/framework/base/lib", includes: ['activemq-*.jar']) + delete fileTree(dir: "${rootDir}/framework/entity/lib/jdbc", includes: ['postgresql-*.jar']) + delete fileTree(dir: "${rootDir}/framework/entity/lib/jdbc", includes: ['mysql-*.jar']) + } } -task cleanLogs(group: cleanupGroup, description: 'Clean all logs in runtime/logs') << { - deleteAllInDirWithExclusions("${rootDir}/runtime/logs/", ['README']) +task cleanLogs(group: cleanupGroup, description: 'Clean all logs in runtime/logs') { + doLast { deleteAllInDirWithExclusions("${rootDir}/runtime/logs/", ['README']) } } -task cleanOutput(group: cleanupGroup, description: 'Clean runtime/output directory') << { - deleteAllInDirWithExclusions("${rootDir}/runtime/output/", ['README']) +task cleanOutput(group: cleanupGroup, description: 'Clean runtime/output directory') { + doLast { deleteAllInDirWithExclusions("${rootDir}/runtime/output/", ['README']) } } -task cleanIndexes(group: cleanupGroup, description: 'Remove search indexes (e.g. Lucene) from runtime/indexes') << { - deleteAllInDirWithExclusions("${rootDir}/runtime/indexes/", ['README', 'index.properties']) +task cleanIndexes(group: cleanupGroup, description: 'Remove search indexes (e.g. Lucene) from runtime/indexes') { + doLast { deleteAllInDirWithExclusions("${rootDir}/runtime/indexes/", ['README', 'index.properties']) } } -task cleanTempfiles(group: cleanupGroup, description: 'Remove file in runtime/tempfiles') << { - deleteAllInDirWithExclusions("${rootDir}/runtime/tempfiles/", ['README']) - deleteAllInDirWithExclusions("${rootDir}/runtime/tmp/", ['README']) +task cleanTempfiles(group: cleanupGroup, description: 'Remove file in runtime/tempfiles') { + doLast { + deleteAllInDirWithExclusions("${rootDir}/runtime/tempfiles/", ['README']) + deleteAllInDirWithExclusions("${rootDir}/runtime/tmp/", ['README']) + } } -task cleanUploads(group: cleanupGroup, description: 'Remove uploaded files.') << { - deleteAllInDirWithExclusions("${rootDir}/runtime/uploads/", []) +task cleanUploads(group: cleanupGroup, description: 'Remove uploaded files.') { + doLast { deleteAllInDirWithExclusions("${rootDir}/runtime/uploads/", []) } } -task cleanXtra(group: cleanupGroup, description: 'Clean extra generated files like .rej, .DS_Store, etc.') << { - delete fileTree(dir: "${rootDir}", includes: ['**/.nbattrs', '**/*~','**/.#*', '**/.DS_Store', '**/*.rej', '**/*.orig']) +task cleanXtra(group: cleanupGroup, description: 'Clean extra generated files like .rej, .DS_Store, etc.') { + doLast { + delete fileTree(dir: "${rootDir}", + includes: ['**/.nbattrs', '**/*~','**/.#*', '**/.DS_Store', '**/*.rej', '**/*.orig']) + } } -task cleanGradle(group: cleanupGroup, description: 'clean generated files from Gradle') << { - delete file("${rootDir}/.gradle") +task cleanGradle(group: cleanupGroup, description: 'clean generated files from Gradle') { + doLast { delete file("${rootDir}/.gradle") } } -task cleanFooterFiles(group: cleanupGroup, description: 'clean generated footer files') << { - delete gitFooterFile - delete svnFooterFile +task cleanFooterFiles(group: cleanupGroup, description: 'clean generated footer files') { + doLast { + delete gitFooterFile + delete svnFooterFile + } } -task cleanAnt(group: cleanupGroup, type: Delete, description: "clean old artifacts generated by Ant") << { +task cleanAnt(group: cleanupGroup, type: Delete, description: "clean old artifacts generated by Ant") { /* TODO this task is temporary and should be deleted after some * time when users have updated their trees. */ - ['framework', 'specialpurpose', 'applications'].each { componentGroup -> - file(componentGroup).eachDir { component -> - delete file(component.toString() + '/build') + doLast { + ['framework', 'specialpurpose', 'applications'].each { componentGroup -> + file(componentGroup).eachDir { component -> + delete file(component.toString() + '/build') + } } + delete 'ofbiz.jar' } - delete 'ofbiz.jar' } /* @@ -774,73 +799,79 @@ task cleanAll(group: cleanupGroup, depen // ========== Tasks for OFBiz committers ========== def websiteDir = "${rootDir}/../site" -task copyDtds(group: committerGroup, description: 'Copy all DTDs from OFBiz instance to website') << { - mkdir websiteDir+'/dtds' - copy { - from (fileTree("${rootDir}").files) { - include '**/*.xsd' - exclude '**/002*.xsd' - exclude '**/068*.xsd' - exclude '**/161*.xsd' - exclude '**/196*.xsd' - exclude '**/197*.xsd' - } - into websiteDir+'/dtds' - } -} - -task gitInfoFooter(group: committerGroup, description: 'Update the Git Branch-revision info in the footer if Git is used') << { - def branch - def revision - def timestamp = new Date().format 'yyyy-MM-dd HH:mm:ss' - def gitFolder = new File('.git') - - if (!gitFolder.exists()) { - println ("Git is not used") - return - } - - def branchOutput = new ByteArrayOutputStream() - exec{ - commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD' - standardOutput = branchOutput - } - branch = branchOutput.toString() - def revisionOutput = new ByteArrayOutputStream() - exec{ - commandLine 'git', 'rev-parse', 'HEAD' - standardOutput = revisionOutput - } - revision = revisionOutput.toString() - gitFooterFile.delete() - gitFooterFile.createNewFile() - gitFooterFile << '${uiLabelMap.CommonBranch} : ' + "${branch}" + System.lineSeparator() - gitFooterFile << '${uiLabelMap.CommonRevision} : ' + "${revision}" + System.lineSeparator() - gitFooterFile << '${uiLabelMap.CommonBuiltOn} : ' + "${timestamp}" + System.lineSeparator() - gitFooterFile << '${uiLabelMap.CommonJavaVersion} : ' + "${org.gradle.internal.jvm.Jvm.current()}" -} - -task svnInfoFooter(group: committerGroup, description: 'Update the Subversion revision info in the footer if Subversion is used') << { - def timestamp = new Date().format 'yyyy-MM-dd HH:mm:ss' - def svnOutput = new ByteArrayOutputStream() - def svnFolder = new File('.svn') - - if (!svnFolder.exists()) { - println ("Subversion is not used") - return - } - - exec{ - commandLine 'svn', 'info', '--xml' - standardOutput = svnOutput - } - def info = new XmlParser().parseText(svnOutput.toString()) - svnFooterFile.delete() - svnFooterFile.createNewFile() - svnFooterFile << '${uiLabelMap.CommonBranch} : ' + "${info.entry.url.text()}" + System.lineSeparator() - svnFooterFile << '${uiLabelMap.CommonRevision} : ' + "${info.entry.commit.@revision}" + System.lineSeparator() - svnFooterFile << '${uiLabelMap.CommonBuiltOn} : ' + "${timestamp}" + System.lineSeparator() - svnFooterFile << '${uiLabelMap.CommonJavaVersion} : ' + "${org.gradle.internal.jvm.Jvm.current()}" +task copyDtds(group: committerGroup, description: 'Copy all DTDs from OFBiz instance to website') { + doLast { + mkdir websiteDir+'/dtds' + copy { + from (fileTree("${rootDir}").files) { + include '**/*.xsd' + exclude '**/002*.xsd' + exclude '**/068*.xsd' + exclude '**/161*.xsd' + exclude '**/196*.xsd' + exclude '**/197*.xsd' + } + into websiteDir+'/dtds' + } + } +} + +task gitInfoFooter(group: committerGroup, description: 'Update the Git Branch-revision info in the footer if Git is used') { + doLast { + def branch + def revision + def timestamp = new Date().format 'yyyy-MM-dd HH:mm:ss' + def gitFolder = new File('.git') + + if (!gitFolder.exists()) { + println ("Git is not used") + return + } + + def branchOutput = new ByteArrayOutputStream() + exec{ + commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD' + standardOutput = branchOutput + } + branch = branchOutput.toString() + def revisionOutput = new ByteArrayOutputStream() + exec{ + commandLine 'git', 'rev-parse', 'HEAD' + standardOutput = revisionOutput + } + revision = revisionOutput.toString() + gitFooterFile.delete() + gitFooterFile.createNewFile() + gitFooterFile << '${uiLabelMap.CommonBranch} : ' + "${branch}" + System.lineSeparator() + gitFooterFile << '${uiLabelMap.CommonRevision} : ' + "${revision}" + System.lineSeparator() + gitFooterFile << '${uiLabelMap.CommonBuiltOn} : ' + "${timestamp}" + System.lineSeparator() + gitFooterFile << '${uiLabelMap.CommonJavaVersion} : ' + "${org.gradle.internal.jvm.Jvm.current()}" + } +} + +task svnInfoFooter(group: committerGroup, description: 'Update the Subversion revision info in the footer if Subversion is used') { + doLast { + def timestamp = new Date().format 'yyyy-MM-dd HH:mm:ss' + def svnOutput = new ByteArrayOutputStream() + def svnFolder = new File('.svn') + + if (!svnFolder.exists()) { + println ("Subversion is not used") + return + } + + exec{ + commandLine 'svn', 'info', '--xml' + standardOutput = svnOutput + } + def info = new XmlParser().parseText(svnOutput.toString()) + svnFooterFile.delete() + svnFooterFile.createNewFile() + svnFooterFile << '${uiLabelMap.CommonBranch} : ' + "${info.entry.url.text()}" + System.lineSeparator() + svnFooterFile << '${uiLabelMap.CommonRevision} : ' + "${info.entry.commit.@revision}" + System.lineSeparator() + svnFooterFile << '${uiLabelMap.CommonBuiltOn} : ' + "${timestamp}" + System.lineSeparator() + svnFooterFile << '${uiLabelMap.CommonJavaVersion} : ' + "${org.gradle.internal.jvm.Jvm.current()}" + } } /* ======================================================== |
Free forum by Nabble | Edit this page |