Changeset 4824
- Timestamp:
- 12/27/06 16:03:46 (2 years ago)
- Files:
-
- trunk/src/build (modified) (1 prop)
- trunk/src/build.xml (modified) (11 diffs)
- trunk/src/build/importStyle.php (added)
- trunk/src/build/installMidcomDir.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/build
- Property svn:ignore set to
–F
- Property svn:ignore set to
trunk/src/build.xml
r4135 r4824 3 3 <!-- edit the properties in this file to your liking. 4 4 --> 5 <property file="build.properties" /> 5 <property file="build.properties" /> 6 6 <property name="absolute_basedir" value="" /> 7 7 <resolvepath propertyName="absolute_basedir" file="${project.basedir}"/> 8 9 <taskdef classname="build.installMidcomDir" 10 name="installMidcomDir" 8 9 <taskdef classname="build.installMidcomDir" 10 name="installMidcomDir" 11 11 classpath="/${project.basedir}" 12 12 /> 13 <taskdef classname="build.makeProjectList" 14 name="makeProjectList" 13 <taskdef classname="build.makeProjectList" 14 name="makeProjectList" 15 15 classpath="/${project.basedir}" 16 16 /> 17 <taskdef classname="build.installMidcomCore" 18 name="installMidcomCore" 17 <taskdef classname="build.installMidcomCore" 18 name="installMidcomCore" 19 19 classpath="/${project.basedir}" 20 20 /> 21 <taskdef classname="build.packageMidCOM" 22 name="packageMidCOM" 21 <taskdef classname="build.packageMidCOM" 22 name="packageMidCOM" 23 23 classpath="/${project.basedir}" 24 24 /> 25 25 <!-- task to package static-icons for now --> 26 <taskdef classname="build.packageStatic" 27 name="packageStatic" 26 <taskdef classname="build.packageStatic" 27 name="packageStatic" 28 28 classpath="/${project.basedir}" 29 29 /> 30 <taskdef classname="build.generateSchemaFile" 31 name="generateSchemaFile" 30 <taskdef classname="build.generateSchemaFile" 31 name="generateSchemaFile" 32 32 classpath="/${project.basedir}" 33 33 /> 34 34 <taskdef classname="build.importStyle" 35 name="importStyle" 36 classpath="/${project.basedir}" 37 /> 38 35 39 <target name="schemafile"> 36 40 <generateSchemaFile root="${project.basedir}" returnProperty="fileLocation" /> … … 42 46 <target name="package"> 43 47 <mkdir dir="${target_dir}"/> 44 <packageMidCOM 45 path="${project.basedir}" 48 <packageMidCOM 49 path="${project.basedir}" 46 50 package="${package}" 47 51 target_dir="${target_dir}" 48 52 returnProperty="pear_name" 49 53 > 50 54 51 55 </packageMidCOM> 52 56 <echo>Package ${pear_name} created in ${target_dir}</echo> 53 57 </target> 54 58 <target name="package-all"> 55 <makeProjectList path="${project.basedir}" 59 <makeProjectList path="${project.basedir}" 56 60 returnProperty="projects" /> 57 61 <foreach list="${projects}" param="package" target="package"/> … … 67 71 phing scaffold -Dmodule=com.example.mymodule 68 72 To generate a suggested schemafile to place in the midgard schemadirectory: 69 phing schemafile 73 phing schemafile 70 74 You can set install_dir, target_dir and other vars in build.properties. 71 75 Current settings: 72 76 install_dir = ${install_dir} // this is the dir that is linked to this checkout. 73 77 target_dir = ${target_dir} // this is where pear packages are saved. 74 78 75 79 </echo> 76 80 </target> … … 78 82 <target name="install"> 79 83 <mkdir dir="${install_dir}" /> 80 <mkdir dir="${lib_dir}" /> 84 <mkdir dir="${lib_dir}" /> 81 85 <mkdir dir="${static_dir}" /> 82 86 <phingcall target="install_midcom"/> 83 87 <phingcall target="install_static_packages" /> 84 <makeProjectList path="${project.basedir}" 88 <makeProjectList path="${project.basedir}" 85 89 returnProperty="projects" /> 86 90 <foreach list="${projects}" param="project" target="install_module_symlink"/> … … 101 105 <resolvePath propertyName="static_path" file="${project.basedir}/../static"/> 102 106 <resolvePath propertyName="template_path" file="${project.basedir}/../templates"/> 103 <exec 104 command="ln -s ${static_path}/stock-icons ${static_dir}/stock-icons " 107 <exec 108 command="ln -s ${static_path}/stock-icons ${static_dir}/stock-icons " 105 109 dir="${project.basedir}/../static" /> 106 <exec 107 command="ln -s ${static_path}/Javascript_protoToolkit ${static_dir}/Javascript_protoToolkit" 110 <exec 111 command="ln -s ${static_path}/Javascript_protoToolkit ${static_dir}/Javascript_protoToolkit" 108 112 dir="${project.basedir}/../static" /> 109 <exec 110 command="ln -s ${template_path}/* ${static_dir}/" 113 <exec 114 command="ln -s ${template_path}/* ${static_dir}/" 111 115 dir="${template_path}" /> 112 116 </target> 113 117 <target name="install_midcom"> 114 118 <mkdir dir="${lib_dir}/midcom" /> 115 <installMidcomCore install_dir="${lib_dir}" 116 project_dir="${absolute_basedir}" 117 static_dir="${static_dir}" 119 <installMidcomCore install_dir="${lib_dir}" 120 project_dir="${absolute_basedir}" 121 static_dir="${static_dir}" 118 122 /> 119 123 </target> 120 124 <target name="install_module_symlink"> 121 <echo>Installing to ${install_dir} </echo> 122 <installMidcomDir install_dir="${lib_dir}" 125 <echo>Installing to ${install_dir} </echo> 126 <installMidcomDir install_dir="${lib_dir}" 123 127 project_dir="${absolute_basedir}" 124 module="${project}" 125 static_dir="${static_dir}" 128 module="${project}" 129 static_dir="${static_dir}" 130 schema_dir="${schema_dir}" 126 131 umask="${install_umask}" /> 127 132 </target> … … 137 142 138 143 </target> 139 144 140 145 <target name="resolve_module_to_dir" > 141 146 142 147 <php function="str_replace" returnProperty="module_dir_basic"> 143 148 <param value="."/> … … 155 160 <param value="Y-M-D" /> 156 161 </php> 157 158 <available 159 file="${basedir}/${module_dir}" 160 property="module_dir_exists" 161 value="yes" 162 163 <available 164 file="${basedir}/${module_dir}" 165 property="module_dir_exists" 166 value="yes" 162 167 type="dir" 163 168 /> 164 169 <property name="midcom_root" value="${project.basedir}" /> 165 170 </target> 166 171 167 172 <target name="create_module" if="module_dir" unless="module_dir_exists"> 168 173 <mkdir dir="${module_dir}"/> … … 174 179 <mkdir dir="${module_dir}/locale" /> 175 180 <mkdir dir="${module_dir}/static" /> 176 177 <input propertyname="module_description" 181 182 <input propertyname="module_description" 178 183 defaultValue="MidCOM module ${module}" 179 184 > 180 185 Enter module description: 181 186 </input> 182 187 183 188 <copy todir="${module_dir}"> 184 189 <filterchain> … … 191 196 </fileset> 192 197 </copy> 193 198 194 199 <copy todir="${module_dir}/config"> 195 200 <filterchain> … … 242 247 </copy> 243 248 </target> 244 249 245 250 <target name="package-static"> 246 251 <mkdir dir="${target_dir}"/> 247 252 <packageStatic 248 path="${project.basedir}/../static/" 253 path="${project.basedir}/../static/" 249 254 package="${package}" 250 255 target_dir="${target_dir}" … … 254 259 <echo>Package ${pear_name} created in ${target_dir}</echo> 255 260 </target> 261 262 <target name="import_style" > 263 <fail unless="style" 264 message="You must set a template to upload. -Dstyle=[templatename]" /> 265 <resolvepath propertyName="template_dir" file="${project.basedir}/../templates"/> 266 <importStyle template="${style}" 267 path="${template_dir}" 268 269 /> 270 </target> 271 256 272 </project> 257 273 trunk/src/build/installMidcomDir.php
r3772 r4824 6 6 * @copyright The Midgard Project, http://www.midgard-project.org 7 7 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License 8 * 8 * 9 9 * Creates the module directory based on the path and module name 10 * 10 * 11 11 */ 12 12 13 13 require_once "phing/Task.php"; 14 14 … … 24 24 */ 25 25 protected $install_dir = "/tmp"; 26 26 27 27 public function setInstall_dir($str) { 28 28 $this->install_dir = $str; … … 32 32 */ 33 33 protected $project_dir = null; 34 34 35 35 public function setProject_dir($str) { 36 36 $this->project_dir = $str; … … 47 47 $this->umask = $str; 48 48 } 49 49 50 50 public function setModule($str) { 51 51 $this->module = $str; 52 52 } 53 53 protected $schema_dir = ""; 54 public function setSchema_dir($str) { 55 $this->schema_dir = $str; 56 } 54 57 /** 55 58 * The init method: Do init steps. … … 60 63 61 64 /** 62 * Create the projectdir and then make a symlink into the structure. 65 * Create the projectdir and then make a symlink into the structure. 63 66 */ 64 67 public function main() { … … 70 73 $module_path = $this->install_dir . "/" . implode('/',$dirs); 71 74 //echo "module_path: " . $module_path . "\n"; 72 75 73 76 if (!file_exists($module_path) && !mkdir ($module_path,0777, true)) { 74 77 echo "Failed to create directory {$module_path}\n"; … … 77 80 $from = "{$this->project_dir}/{$this->module}"; 78 81 $this->make_symlink($from,$link); 79 82 80 83 $static = sprintf("%s/%s/static", $this->project_dir, $this->module); 81 84 $link = sprintf("%s/%s",$this->static_dir, $this->module ); 82 85 if (is_dir($static)) { 83 $this->make_symlink($static, $link ); 86 $this->make_symlink($static, $link ); 84 87 } 85 88 89 $schema = sprintf("%s/%s/config/mgdschema.xml", $this->project_dir, $this->module); 90 if (file_exists($schema)) 91 { 92 echo "Symlinking schema {$schema} to " . $this->schema_dir . "/" . $this->module . ".xml"; 93 $this->make_symlink($schema, $this->schema_dir . "/" . $this->module . ".xml"); 94 } 95 86 96 } 87 97 88 98 /** 89 99 * Creates a symlink to the file or directory … … 92 102 private function make_symlink($from , $link, $debug = false) 93 103 { 94 if (is_link($link)) 104 if (is_link($link)) 95 105 { 96 106 return; 97 } 107 } 98 108 $command = sprintf("ln -s %s %s", $from, $link); 99 109 $this->exec_command($command, $debug); 100 110 } 101 111 102 112 /** 103 113 * Executes a given command. … … 105 115 * @throws exception 106 116 * @param string $command the command to be executed 107 * @param boolean $debug set to true if you want to just se the 117 * @param boolean $debug set to true if you want to just se the 108 118 * command to be executed. 109 119 */ … … 119 129 throw new Exception("Exec of $command returned non zero code $ret"); 120 130 } 121 131 122 132 } 123 133 }
