Changeset 30112 in osm for applications/editors/josm
- Timestamp:
- 2013-12-07T20:50:29+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/OpeningHoursEditor
- Files:
-
- 3 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/OpeningHoursEditor/build.xml
r29854 r30112 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 6 <property name="plugin.main.version" value="6162"/> 7 <!-- 8 ************************************************ 9 ** should not be necessary to change the following properties 10 --> 11 <property name="josm" location="../../core/dist/josm-custom.jar"/> 12 <property name="plugin.build.dir" value="build"/> 13 <property name="plugin.src.dir" value="src"/> 14 <!-- this is the directory where the plugin jar is copied to --> 15 <property name="plugin.dist.dir" value="../../dist"/> 16 <property name="ant.build.javac.target" value="1.6"/> 17 <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/> 18 <!-- 7 8 <property name="plugin.author" value="Falko Thomale"/> 9 <property name="plugin.class" value="org.openstreetmap.josm.plugins.ohe.OhePlugin"/> 10 <property name="plugin.description" value="extended options for editing opening_hours"/> 11 <property name="plugin.icon" value="images/opening_hours.png"/> 12 <property name="plugin.link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpeningHoursEditor"/> 13 14 <!-- ** include targets that all plugins have in common ** --> 15 <import file="../build-common.xml"/> 16 17 <property name="javacc.home" location="../../core/tools"/> 18 <property name="parser.dir" location="${plugin.src.dir}/org/openstreetmap/josm/plugins/ohe/parser"/> 19 20 <target name="javacc" depends="init" unless="javacc.notRequired"> 21 <exec append="false" executable="java" failifexecutionfails="true"> 22 <arg value="-cp"/> 23 <arg value="${javacc.home}/javacc.jar"/> 24 <arg value="javacc"/> 25 <arg value="-JDK_VERSION=1.6"/> 26 <arg value="-GRAMMAR_ENCODING=UTF-8"/> 27 <arg value="-UNICODE_INPUT"/> 28 <arg value="-OUTPUT_DIRECTORY=${parser.dir}"/> 29 <arg value="${parser.dir}/OpeningTimeCompiler.jj"/> 30 </exec> 31 </target> 32 33 <!-- 19 34 ********************************************************** 20 ** javacc-otc - compiles OpeningTimeCompiler 21 ** 22 ** can be changed see http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-moz.htm#tth_sEc2.5 35 ** compile - compiles the source tree 23 36 ********************************************************** 24 37 --> 25 <target name="javacc-otc"> 26 <echo message="compiling OpeningTimeCompiler with javacc ... "/> 27 <exec executable="javacc" dir="src/org/openstreetmap/josm/plugins/ohe/parser/"> 28 <arg value="OpeningTimeCompiler.jj"/> 29 </exec> 30 </target> 31 <!-- 32 ********************************************************** 33 ** init - initializes the build 34 ********************************************************** 35 --> 36 <target name="init"> 37 <mkdir dir="${plugin.build.dir}"/> 38 </target> 39 <!-- 40 ********************************************************** 41 ** compile - complies the source tree 42 ********************************************************** 43 --> 44 <target name="compile" depends="init"> 45 <echo message="compiling sources for ${plugin.jar} ... "/> 46 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}"> 38 <target name="compile" depends="init, javacc"> 39 <echo message="compiling sources for ${plugin.jar} ... "/> 40 <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="UTF-8"> 41 <classpath> 42 <pathelement path="${plugin.build.dir}"/> 43 <pathelement location="${josm}"/> 44 </classpath> 47 45 <compilerarg value="-Xlint:deprecation"/> 48 46 <compilerarg value="-Xlint:unchecked"/> 49 47 </javac> 50 48 </target> 51 <!-- 52 ********************************************************** 53 ** dist - creates the plugin jar 54 ********************************************************** 55 --> 56 <target name="dist" depends="compile,revision"> 57 <echo message="creating ${ant.project.name}.jar ... "/> 58 <copy todir="${plugin.build.dir}/images"> 59 <fileset dir="images"/> 60 </copy> 61 <copy todir="${plugin.build.dir}/data"> 62 <fileset dir="data"/> 63 </copy> 64 <copy todir="${plugin.build.dir}"> 65 <fileset dir="."> 66 <include name="README"/> 67 <include name="LICENSE"/> 68 </fileset> 69 </copy> 70 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}"> 71 <!-- 72 ************************************************ 73 ** configure these properties. Most of them will be copied to the plugins 74 ** manifest file. Property values will also show up in the list available 75 ** plugins: http://josm.openstreetmap.de/wiki/Plugins. 76 ** 77 ************************************************ 78 --> 79 <manifest> 80 <attribute name="Author" value="Falko Thomale"/> 81 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.ohe.OhePlugin"/> 82 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/> 83 <attribute name="Plugin-Description" value="extended options for editing opening_hours"/> 84 <attribute name="Plugin-Icon" value="images/opening_hours.png"/> 85 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpeningHoursEditor"/> 86 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/> 87 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 88 </manifest> 89 </jar> 90 </target> 91 <!-- 92 ********************************************************** 93 ** revision - extracts the current revision number for the 94 ** file build.number and stores it in the XML property 95 ** version.* 96 ********************************************************** 97 --> 98 <target name="revision"> 99 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false"> 100 <env key="LANG" value="C"/> 101 <arg value="info"/> 102 <arg value="--xml"/> 103 <arg value="."/> 104 </exec> 105 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/> 106 <delete file="REVISION"/> 107 </target> 108 <!-- 109 ********************************************************** 110 ** clean - clean up the build environment 111 ********************************************************** 112 --> 113 <target name="clean"> 114 <delete dir="${plugin.build.dir}"/> 115 <delete file="${plugin.jar}"/> 116 </target> 117 <!-- 118 ********************************************************** 119 ** install - install the plugin in your local JOSM installation 120 ********************************************************** 121 --> 122 <target name="install" depends="dist"> 123 <property environment="env"/> 124 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins"> 125 <and> 126 <os family="windows"/> 127 </and> 128 </condition> 129 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/> 130 </target> 131 <!-- 132 ************************** Publishing the plugin *********************************** 133 --> 134 <!-- 135 ** extracts the JOSM release for the JOSM version in ../core and saves it in the 136 ** property ${coreversion.info.entry.revision} 137 ** 138 --> 139 <target name="core-info"> 140 <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false"> 141 <env key="LANG" value="C"/> 142 <arg value="info"/> 143 <arg value="--xml"/> 144 <arg value="../../core"/> 145 </exec> 146 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/> 147 <echo>Building against core revision ${coreversion.info.entry.revision}.</echo> 148 <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo> 149 <delete file="core.info.xml"/> 150 </target> 151 <!-- 152 ** commits the source tree for this plugin 153 --> 154 <target name="commit-current"> 155 <echo>Commiting the plugin source with message '${commit.message}' ...</echo> 156 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false"> 157 <env key="LANG" value="C"/> 158 <arg value="commit"/> 159 <arg value="-m '${commit.message}'"/> 160 <arg value="."/> 161 </exec> 162 </target> 163 <!-- 164 ** updates (svn up) the source tree for this plugin 165 --> 166 <target name="update-current"> 167 <echo>Updating plugin source ...</echo> 168 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false"> 169 <env key="LANG" value="C"/> 170 <arg value="up"/> 171 <arg value="."/> 172 </exec> 173 <echo>Updating ${plugin.jar} ...</echo> 174 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false"> 175 <env key="LANG" value="C"/> 176 <arg value="up"/> 177 <arg value="../dist/${plugin.jar}"/> 178 </exec> 179 </target> 180 <!-- 181 ** commits the plugin.jar 182 --> 183 <target name="commit-dist"> 184 <echo> 185 ***** Properties of published ${plugin.jar} ***** 186 Commit message : '${commit.message}' 187 Plugin-Mainversion: ${plugin.main.version} 188 JOSM build version: ${coreversion.info.entry.revision} 189 Plugin-Version : ${version.entry.commit.revision} 190 ***** / Properties of published ${plugin.jar} ***** 191 192 Now commiting ${plugin.jar} ... 193 </echo> 194 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false"> 195 <env key="LANG" value="C"/> 196 <arg value="-m '${commit.message}'"/> 197 <arg value="commit"/> 198 <arg value="${plugin.jar}"/> 199 </exec> 200 </target> 201 <!-- ** make sure svn is present as a command line tool ** --> 202 <target name="ensure-svn-present"> 203 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code"> 204 <env key="LANG" value="C"/> 205 <arg value="--version"/> 206 </exec> 207 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system."> 208 <!-- return code not set at all? Most likely svn isn't installed --> 209 <condition> 210 <not> 211 <isset property="svn.exit.code"/> 212 </not> 213 </condition> 214 </fail> 215 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system."> 216 <!-- error code from SVN? Most likely svn is not what we are looking on this system --> 217 <condition> 218 <isfailure code="${svn.exit.code}"/> 219 </condition> 220 </fail> 221 </target> 222 <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist"> 223 </target> 49 224 50 </project> -
applications/editors/josm/plugins/OpeningHoursEditor/src/org/openstreetmap/josm/plugins/ohe/parser/OpeningTimeCompiler.jj
r22751 r30112 9 9 timespan ::= [ dayspanlist " " ] daytimespanlist 10 10 11 daytimespanlist ::= 11 daytimespanlist ::= daytimespan [ "," daytimespanlist ] 12 12 daytimespan ::= off | ( daytime ( openend | [ "-" daytime ]) ) 13 daytime ::= 13 daytime ::= (DIGIT DIGIT ":" DIGIT DIGIT ) 14 14 openend ::= PLUS 15 15 off ::= OFF 16 16 17 dayspanlist ::= 18 dayspan ::= 17 dayspanlist ::= dayspan [ "," dayspanlist ] 18 dayspan ::= WEEKDAY [ "-" WEEKDAY ] 19 19 */ 20 20 … … 77 77 { 78 78 if (time.size() == 0) { 79 80 81 82 83 84 85 79 ArrayList<DaySpan> daySpans = new ArrayList<DaySpan>(); 80 daySpans.add(new DaySpan(0,6)); 81 ArrayList<DaytimeSpan> timeSpans = new ArrayList<DaytimeSpan>(); 82 timeSpans.add(new DaytimeSpan(0, 24 * 60)); 83 time.add(new DateTime(daySpans, timeSpans)); 84 } 85 86 86 return time; 87 87 } … … 99 99 list.add(first); 100 100 if(second != null) 101 101 list.addAll(second); 102 102 return list; 103 103 } … … 128 128 list.add(first); 129 129 if(second != null) 130 130 list.addAll(second); 131 131 return list; 132 132 } … … 144 144 { 145 145 if (end < 0) 146 146 end = start; 147 147 else if(end < start) 148 148 throw new SyntaxException(null, usedTokens.lastElement().beginColumn - 1, usedTokens.lastElement().endColumn + 1); 149 149 150 150 return new DaytimeSpan(start, end); … … 167 167 168 168 if (hour > 24) 169 169 throw new SyntaxException(null, th1.beginColumn - 1, th0.endColumn + 1); 170 170 if (minute >= 60 || (hour == 24 && minute != 0)) 171 171 throw new SyntaxException(null, tm1.beginColumn - 1, tm0.endColumn + 1); 172 172 173 173 return hour * 60 + minute; … … 235 235 { 236 236 if(end < 0) 237 237 end = start; 238 238 else if(end < start) 239 239 throw new SyntaxException(null, usedTokens.lastElement().beginColumn - 1, usedTokens.lastElement().endColumn + 1); 240 240 241 241 return new DaySpan(start, end); … … 253 253 for (int i = 0; i < WEEKDAYS.length; ++i) 254 254 if (WEEKDAYS[i].equals(t.image)) 255 256 255 return i; 256 257 257 throw new SyntaxException(null, t.beginColumn - 1, t.endColumn + 1); 258 258 }
Note:
See TracChangeset
for help on using the changeset viewer.