1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
| <?xml version="1.0" encoding="UTF-8"?>
<project name="com.alticeo.jslibs" default="Build scripts" basedir=".">
<description>Builds, tests, and runs the project com.alticeo.jslibs.</description>
<property name="srcdir" value="${basedir}/web/src"/>
<property name="tooldir" value="${srcdir}/util"/>
<property name="appdir" value="${srcdir}/app"/>
<property name="distdir" value="${basedir}/web"/>
<property name="releasedir" value="${basedir}/web/release"/>
<property name="LOADERMID" value="app/run"/>
<property name="LOADERCONF" value="${appdir}/run.js"/>
<property name="PROFILE" value="${appdir}/app.profile.js"/>
<target name="Build" description="Build javascripts">
<echo message="srcdir = ${srcdir}"/>
<echo message="tooldir = ${tooldir}"/>
<echo message="appdir = ${appdir}"/>
<echo message="distdir = ${distdir}"/>
<java
classname="org.mozilla.javascript.tools.shell.Main"
dir="${tooldir}"
fork="true"
failonerror="true"
maxmemory="256m">
<arg line="${srcdir}/dojo/dojo.js"/>
<arg line="baseUrl=${srcdir}/dojo"/>
<arg line="load=build"/>
<arg line="--require "${LOADERCONF}""/>
<arg line="--profile "${PROFILE}""/>
<arg line="--releasedir "${distdir}""/>
<arg line="action=clean,release"/>
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement location="${tooldir}\shrinksafe\js.jar"/>
<pathelement location="${tooldir}\closureCompiler\compiler.jar"/>
<pathelement location="${tooldir}\shrinksafe\shrinksafe.jar"/>
</classpath>
</java>
<delete dir="${distdir}/dojox"/>
<delete dir="${distdir}/dojo"/>
<delete dir="${distdir}/dijit"/>
<mkdir dir="${distdir}"/>
<!-- Répertoire dojo -->
<mkdir dir="${distdir}/dojo"/>
<copy file="${releasedir}/dojo/dojo.js" todir="${distdir}/dojo/"/>
<copy todir="${distdir}/dojo/nls/">
<fileset dir="${releasedir}/dojo/nls/">
<include name="**/*.js"/>
</fileset>
</copy>
<!-- Les images et les css doivent être gargées-->
<copy todir="${distdir}/dojo/resources/">
<fileset dir="${releasedir}/dojo/resources/">
<include name="**/*.css"/>
<include name="**/*.png"/>
<include name="**/*.gif"/>
<exclude name="**/*.commented.css"/>
</fileset>
</copy>
<!-- Répertoire dijit -->
<mkdir dir="${distdir}/dijit"/>
<copy todir="${distdir}/dijit/themes/">
<!-- On ne copie que les themes et rien d'autre (tout a été internalisé dans dojo.js)-->
<fileset dir="${releasedir}/dijit/themes/">
<exclude name="**/*.commented.css"/>
<exclude name="**/*.psd"/>
</fileset>
</copy>
<!-- Répertoire dojox -->
<mkdir dir="${distdir}/dojox"/>
<!-- Copie des css et des images uniquement -->
<copy todir="${distdir}/dojox/">
<fileset dir="${releasedir}/dojox/">
<include name="**/*.html"/>
<include name="**/*.css"/>
<include name="**/*.png"/>
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<!-- <include name="**/uploader.swf"/> -->
<exclude name="**/*.commented.css"/>
</fileset>
</copy>
<!-- <delete dir="${releasedir}"/> -->
</target>
</project>
Et ça c'est mon profile :
/**
* This is a new Dojo 1.7 style build profile. Look at util/build/buildControlDefault.js if you want to explore the
* default Dojo build profile options.
*/
// This function is used to determine whether or not a resource should be tagged as copy-only. See the resourceTags
// property below for more information.
function copyOnly(mid) {
return mid in {
// There are no modules right now in dojo boilerplate that are copy-only. If you have some, though, just add
// them here like this:
// 'app/module': 1
};
}
var profile = {
// basePath is relative to the directory containing this profile file; in this case, it is being set to the
// src/ directory, which is the same place as the baseUrl directory in the loader configuration. (If you change
// this, you will also need to update run.js).
basePath: '..',
// This is the directory within the release directory where built packages will be placed. The release directory
// itself is defined by build.sh. You really probably should not use this; it is a legacy option from very old
// versions of Dojo (like, version 0.1). If you do use it, you will need to update build.sh, too.
// releaseName: '',
// Builds a new release.
action: 'release',
// Strips all comments from CSS files.
cssOptimize: 'comments',
// Excludes tests, demos, and original template files from being included in the built version.
mini: true,
// Uses Closure Compiler as the JavaScript minifier. This can also be set to "shrinksafe" to use ShrinkSafe.
// Note that you will probably get some errors with CC; these are generally safe to ignore, and will be
// fixed in a later version of Dojo. This defaults to "" (no compression) if not provided.
optimize: 'closure',
// Were building layers, so we need to set the minifier to use for those, too. This defaults to "shrinksafe" if
// it is not provided.
layerOptimize: 'closure',
// Strips all calls to console functions within the code. You can also set this to "warn" to strip everything
// but console.error, and any other truthy value to strip everything but console.warn and console.error.
stripConsole: 'all',
// The default selector engine is not included by default in a dojo.js build in order to make mobile builds
// smaller. We add it back here to avoid that extra HTTP request. There is also a "lite" selector available; if
// you use that, youll need to set selectorEngine in app/run.js too. (The "lite" engine is only suitable if you
// are not supporting IE7 and earlier.)
selectorEngine: 'acme',
// Builds can be split into multiple different JavaScript files called layers. This allows applications to
// defer loading large sections of code until they are actually required while still allowing multiple modules to
// be compiled into a single file.
layers: {
// This is the main loader module. It is a little special because it is treated like an AMD module even though
// it is actually just plain JavaScript. There is some extra magic in the build system specifically for this
// module ID.
'dojo/dojo': {
// In addition to the loader (dojo/dojo) and the loader configuration file (app/run), were also including
// the main application (app/main) and the dojo/i18n and dojo/domReady modules because they are one of the
// conditional dependencies in app/main (the other being app/Dialog) but we dont want to have to make
// extra HTTP requests for such tiny files.
include: [ 'dojo/dojo', 'dojo/i18n', 'dojo/domReady', 'dojo/data/ItemFileReadStore', 'dijit/form/ComboBox'],
// By default, the build system will try to include dojo/main in the built dojo/dojo layer, which adds a
// bunch of stuff we dont want or need. We want the initial script load to be as small and quick as
// possible, so we configure it as a custom, bootable base.
boot: true,
customBase: true
}
},
// Providing hints to the build system allows code to be conditionally removed on a more granular level than
// simple module dependencies can allow. This is especially useful for creating tiny mobile builds.
// Keep in mind that dead code removal only happens in minifiers that support it! Currently, ShrinkSafe does not
// support dead code removal; Closure Compiler and UglifyJS do.
staticHasFeatures: {
// The trace & log APIs are used for debugging the loader, so we dont need them in the build
'dojo-trace-api':0,
'dojo-log-api':0,
// This causes normally private loader data to be exposed for debugging, so we dont need that either
'dojo-publish-privates':0,
// Were fully async, so get rid of the legacy loader
'dojo-sync-loader':0,
// dojo-xhr-factory relies on dojo-sync-loader
'dojo-xhr-factory':0,
// We arent loading tests in production
'dojo-test-sniff':0
},
// Resource tags are functions that provide hints to the compiler about a given file. The first argument is the
// filename of the file, and the second argument is the module ID for the file.
resourceTags: {
// Files that contain test code.
test: function (filename, mid) {
return false;
},
// Files that should be copied as-is without being modified by the build system.
copyOnly: function (filename, mid) {
return copyOnly(mid);
},
// Files that are AMD modules.
amd: function (filename, mid) {
return !copyOnly(mid) && /\.js$/.test(filename);
},
// Files that should not be copied when the mini compiler flag is set to true.
miniExclude: function (filename, mid) {
return mid in {
'app/profile': 1
};
}
}
}; |
Partager