Improved generator for 'builder/package.deps.rake' build file. jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 02 Feb 2016 10:23:30 +0000
branchjv
changeset 19151 9256c2c0a14f
parent 19137 199b5e15b1da
child 19152 c3f403c69641
Improved generator for 'builder/package.deps.rake' build file. Using all prerequisites when generating rake dependencies leads to circular dependencies as some packages refer each other. To avoid that, only mandatory dependencies are used to define dependencies between packages (to get the build order right). To ensure linkage of all prerequsiites to the application, the application itself is made as dependent on all its prerequisites (both mandatory and referenced, recursively)
ProjectDefinition.st
--- a/ProjectDefinition.st	Tue Feb 02 07:03:45 2016 +0100
+++ b/ProjectDefinition.st	Tue Feb 02 10:23:30 2016 +0000
@@ -1993,6 +1993,7 @@
     "Modified: / 29-03-2012 / 18:43:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+
 !ProjectDefinition class methodsFor:'defaults'!
 
 applicationTypes
@@ -3994,22 +3995,24 @@
 package_dot_deps_dot_rake_mappings
     |dependencies|
 
-    dependencies := String
-            streamContents:[:s |
-                self allPreRequisites do:[:package |
-                    (self preRequisitesFor:package) do:[:prereq |
-                        s
-                            nextPutAll:('task "%1" => "%2"' bindWith:package with:prereq);
-                            cr
-                    ].
-                    s cr
-                ].
-                self effectivePreRequisites do:[:prereq |
-                    s
-                        nextPutAll:('task "%1" => "%2"' bindWith:self package with:prereq);
-                        cr
-                ].
+    dependencies := String streamContents:[:s |
+        "/ Generate dependencies based on mandatory prereqs to define
+        "/ build order
+        self allPreRequisites asSortedCollection do:[:pkg |
+            (ProjectDefinition definitionClassForPackage:pkg) mandatoryPreRequisites asSortedCollection do:[:prereq |
+                s nextPutAll:'task "'; nextPutAll: pkg; nextPutAll: '" => "'; nextPutAll: prereq; nextPut: $"; cr.
             ].
+            s cr.
+        ].
+        s cr.
+
+        "/ Now make sure all required libraries are included in the build
+        "/ by creating dependency from application to to each prerequisite (both mandatory
+        "/ and referenced)
+        self allPreRequisites asSortedCollection do:[:prereq |
+            s nextPutAll:'task "'; nextPutAll: self package; nextPutAll: '" => "'; nextPutAll: prereq; nextPut: $"; cr.
+        ].
+    ].
 
     ^ (Dictionary new)
         at:'DEPENDENCIES' put:dependencies;
@@ -4017,9 +4020,11 @@
 
     "
         stx_libjava generate_package_dot_deps_dot_rake
+        cvut_fel_izar_application generate_package_dot_deps_dot_rake
     "
 
     "Created: / 24-02-2011 / 22:32:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-02-2016 / 09:34:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 replaceMappings: mappings in: fileTemplate