svn commit: r1757359 - in /ofbiz/trunk: README.md build.gradle

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1757359 - in /ofbiz/trunk: README.md build.gradle

Taher Alkhateeb
Author: taher
Date: Tue Aug 23 11:28:30 2016
New Revision: 1757359

URL: http://svn.apache.org/viewvc?rev=1757359&view=rev
Log:
apply changes to simplify and shorten gradle task calls - OFBIZ-7968

Apply the following changes to the gradle build script:

- Make only the "componentName" argument mandatory for the createComponent
  task and all other arguments are optional.
- Make only the "tenantId" argument mandatory for the createTenant task
  and all other arguments are optional
- update the documentation accordingly in README.md

This simplifies the calls to these tasks and relives us from the need to
create any interactive tasks in the build system.

Modified:
    ofbiz/trunk/README.md
    ofbiz/trunk/build.gradle

Modified: ofbiz/trunk/README.md
URL: http://svn.apache.org/viewvc/ofbiz/trunk/README.md?rev=1757359&r1=1757358&r2=1757359&view=diff
==============================================================================
--- ofbiz/trunk/README.md (original)
+++ ofbiz/trunk/README.md Tue Aug 23 11:28:30 2016
@@ -312,7 +312,7 @@ initial data with admin-user and passwor
 general.properties). The following project parameters are passed:
 
 - tenantId: mandatory
-- tenantName: mandatory, name of the tenant
+- tenantName: optional, default is value of tenantId
 - domainName: optional, default is org.apache.ofbiz
 - tenantReaders: optional, default value is seed,seed-initial,demo
 - dbPlatform: optional, D(Derby), M(MySQL), O(Oracle), P(PostgreSQL) (default D)
@@ -320,7 +320,7 @@ general.properties). The following proje
 - dbUser: optional, username of the database
 - dbPassword: optional, password of the database
 
-`gradlew createTenant -PtenantId=mytenant -PtenantName="My Name"`
+`gradlew createTenant -PtenantId=mytenant`
 
 `gradlew createTenant -PtenantId=mytenant -PtenantName="My Name" -PdomainName=com.example -PtenantReaders=seed,seed-initial,ext -PdbPlatform=M -PdbIp=127.0.0.1 -PdbUser=mydbuser -PdbPassword=mydbpass`
 
@@ -412,7 +412,16 @@ in a list of favorites for frequent reus
 
 #### Create a custom component in hot-deploy
 
-`gradlew createComponent -PcomponentName=Custom -PcomponentResourceName=Custom -PwebappName=customweb -PbasePermission=OFBTOOLS,CUSTOM_SECURITY`
+Create a new custom component. The following project parameters are passed:
+
+- componentName: mandatory
+- componentResourceName: optional, default is the value of componentName
+- webappName: optional, default is the value of componentName
+- basePermission: optional, default is the UPPERCASE value of componentName
+
+`gradlew createComponent -PcomponentName=Custom`
+
+`gradlew createComponent -PcomponentName=Custom -PcomponentResourceName=Custom -PwebappName=customweb -PbasePermission=MYSECURITY`
 
 #### Create an admin user account
 

Modified: ofbiz/trunk/build.gradle
URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.gradle?rev=1757359&r1=1757358&r2=1757359&view=diff
==============================================================================
--- ofbiz/trunk/build.gradle (original)
+++ ofbiz/trunk/build.gradle Tue Aug 23 11:28:30 2016
@@ -355,9 +355,6 @@ task createTenant(group: ofbizServer, de
         if(!project.hasProperty('tenantId')) {
             throw new GradleException('Project property tenantId is missing')
         }
-        if(!project.hasProperty('tenantName')) {
-            throw new GradleException('Project property tenantName is missing')
-        }
         // dbPlatform values: D(Derby), M(MySQL), O(Oracle), P(PostgreSQL) (default D)
         if(project.hasProperty('dbPlatform')) {
             if(dbPlatform == 'D') {
@@ -376,7 +373,7 @@ task createTenant(group: ofbizServer, de
 
     task generateDatabaseTemplateFile(dependsOn: prepareAndValidateTenantArguments) << {
         def filterTokens = ['tenantId': tenantId,
-            'tenantName': tenantName,
+            '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}":'',
@@ -437,6 +434,16 @@ task createTenant(group: ofbizServer, de
 // ========== System Administration tasks ==========
 task createComponent(group: sysadminGroup, description: 'Create the layout of an OFBiz component in the hot-deploy folder.') << {
 
+    if(!project.hasProperty('componentResourceName')) {
+        ext.componentResourceName = componentName
+    }
+    if(!project.hasProperty('webappName')) {
+        ext.webappName = componentName
+    }
+    if(!project.hasProperty('basePermission')) {
+        ext.basePermission = componentName.toUpperCase()
+    }
+
     def filterTokens = ['component-name': componentName,
         'component-resource-name': componentResourceName,
         'webapp-name': webappName,