svn commit: r1761519 - /ofbiz/trunk/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: r1761519 - /ofbiz/trunk/build.gradle

Taher Alkhateeb
Author: taher
Date: Tue Sep 20 05:03:59 2016
New Revision: 1761519

URL: http://svn.apache.org/viewvc?rev=1761519&view=rev
Log:
Improved: Gradle settings for eclipse classpath

Refactor the eclipse classpath settings in build.gradle and substantially
improve it by making it denser with only one loop to remove entries. We
also added an exclusion pattern for 'dtd' directories as they were added
recently to the sourcesets block by Jacopo Capellato.

This makes the code block for eclipse settings easier to reason about

Modified:
    ofbiz/trunk/build.gradle

Modified: ofbiz/trunk/build.gradle
URL: http://svn.apache.org/viewvc/ofbiz/trunk/build.gradle?rev=1761519&r1=1761518&r2=1761519&view=diff
==============================================================================
--- ofbiz/trunk/build.gradle (original)
+++ ofbiz/trunk/build.gradle Tue Sep 20 05:03:59 2016
@@ -234,39 +234,20 @@ eclipse.classpath.file.whenMerged { clas
     def osDirSeparator = os.contains('windows') ? '\\' : '/'
 
     iterateOverActiveComponents { component ->
-        def componentName = component.toString() - rootDir.toString()
+        def componentName = component.toString() - rootDir.toString() - osDirSeparator
+        def eclipseEntry = os.contains('windows') ? componentName.replaceAll("\\\\", "/") : componentName
+
         classpath.entries.removeAll { entry ->
             // remove any "src" entries in .classpath of the form /componentName
             entry.kind == 'src' &&
-            entry.path ==~ '.*/+(' + componentName.tokenize(osDirSeparator).last() + ')$'
-        }
-    }
-    classpath.entries.removeAll { entry ->
-        /* remove "src" entries in .classpath named:
-         *   /framework, /applications, /specialpurpose, /themes and /hot-deploy
-         */
-        entry.kind == 'src' &&
+            entry.path ==~ '.*/+(' + componentName.tokenize(osDirSeparator).last() + ')$' ||
             entry.path ==~ /(\/+framework)$/ ||
             entry.path ==~ /(\/+applications)$/ ||
             entry.path ==~ /(\/+specialpurpose)$/ ||
             entry.path ==~ /(\/+themes)$/ ||
-            entry.path ==~ /(\/+hot-deploy)$/
-    }
-    getDirectoryInActiveComponentsIfExists('config').each { configDir ->
-        /* remove any "src" entries in .classpath of the form componentName/config
-         *
-         * windows format: \framework\base\config
-         * Unix format: /framework/base/config
-         * .classpath format: framework/base/config
-         *
-         * Must convert both windows and unix to .classpath format to
-         * be able to remove it from the file
-         */
-        def relativeDir = configDir.toString() - rootDir.toString() - osDirSeparator
-        def eclipseConfigSrc = os.contains('windows') ? relativeDir.replaceAll("\\\\", "/") : relativeDir
-        classpath.entries.removeAll { entry ->
-            entry.kind == 'src' &&
-            entry.path == eclipseConfigSrc
+            entry.path ==~ /(\/+hot-deploy)$/ ||
+            entry.path ==~ eclipseEntry + '/config' ||
+            entry.path ==~ eclipseEntry + '/dtd'
         }
     }
 }