You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2016/09/22 17:04:24 UTC

Formatting in *.gradle files

Hi,

This is mostly for Taher but concern all of us.

I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)

https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions

We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add 
http://www.groovy-lang.org/style-guide.html

Jacques


Re: Formatting in *.gradle files

Posted by Jacques Le Roux <ja...@les7arts.com>.
This seems basically done with r1761998, not much was actually needed

Jacques

Le 22/09/2016 � 19:04, Jacques Le Roux a �crit :
> Hi,
>
> This is mostly for Taher but concern all of us.
>
> I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)
>
> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>
> We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add 
> http://www.groovy-lang.org/style-guide.html
>
> Jacques
>
>


Re: Formatting in *.gradle files

Posted by Jacques Le Roux <ja...@les7arts.com>.
In Eclipse, after checking the Minimalist Gradle Editor, The Gradle Build Script editor and the Groovy Editor have no formatting options,
I tried to automatically format common.gradle (which is actually well formatted) using the Java editor and the result is worse (less legible)

Index: common.gradle
===================================================================
--- common.gradle    (revision 1761976)
+++ common.gradle    (working copy)
@@ -33,14 +33,8 @@
          applyFunction file("${rootDir}/specialpurpose/"+component.@"component-location")
      }

-    file("${rootDir}/themes").eachDir { component ->
-        applyFunction(component)
-    }
-    file("${rootDir}/hot-deploy").eachDir { component ->
-        applyFunction(component)
-    }
+    file("${rootDir}/themes").eachDir { component -> applyFunction(component) }
+    file("${rootDir}/hot-deploy").eachDir { component -> applyFunction(component) }
  }

-ext{
-    iterateOverActiveComponents = this.&iterateOverActiveComponents
-}
\ No newline at end of file
+ext{ iterateOverActiveComponents = this.&iterateOverActiveComponents }

===================================================================

So we need to do it by hand, and wait for an hypothetical formatter https://stackoverflow.com/questions/23273098/formatting-build-gradle-automatically

Fortunately the main build.gradle seems mostly well formatted :)

Jacques


Le 22/09/2016 � 19:04, Jacques Le Roux a �crit :
> Hi,
>
> This is mostly for Taher but concern all of us.
>
> I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)
>
> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>
> We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add 
> http://www.groovy-lang.org/style-guide.html
>
> Jacques
>
>


Re: Formatting in *.gradle files

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Nicolas,

If you are interested by adding http://www.groovy-lang.org/style-guide.html, please confirm in the "Groovy Style guide" thread

Thanks!

Jacques


Le 23/09/2016 � 21:43, Nicolas Malin a �crit :
> Yes I like
>
>
> Le 22/09/2016 � 19:04, Jacques Le Roux a �crit :
>> Hi,
>>
>> This is mostly for Taher but concern all of us.
>>
>> I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)
>>
>> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>>
>> We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add 
>> http://www.groovy-lang.org/style-guide.html
>>
>> Jacques
>>
>>
>
>


Re: Formatting in *.gradle files

Posted by Nicolas Malin <ni...@nereide.fr>.
Yes I like


Le 22/09/2016 � 19:04, Jacques Le Roux a �crit :
> Hi,
>
> This is mostly for Taher but concern all of us.
>
> I noticed several times that we don't always format *.gradle files 
> following the Java Code Conventions we follow for the rest (ie *.java 
> and *.groovy)
>
> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>
> We should use the same for *.gradle file. I think we can easily infer 
> how to indent new idioms following "old" Java else we can add 
> http://www.groovy-lang.org/style-guide.html
>
> Jacques
>
>