123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677 |
- <?xml version="1.0" encoding="utf-8"?>
- <project name="ext" default=".help">
- <!--
- The build-impl.xml file imported here contains the guts of the build process. It is
- a great idea to read that file to understand how the process works, but it is best to
- limit your changes to this file.
- -->
- <script language="javascript">
- <![CDATA[
- var dir = project.getProperty("basedir"),
- cmdDir = project.getProperty("cmd.dir"),
- cmdLoaded = project.getReference("senchaloader");
-
- if (!cmdLoaded) {
- function echo(message, file) {
- var e = project.createTask("echo");
- e.setMessage(message);
- if (file) {
- e.setFile(file);
- }
- e.execute();
- };
- if (!cmdDir) {
-
- function exec(args) {
- var process = java.lang.Runtime.getRuntime().exec(args),
- input = new java.io.BufferedReader(new java.io.InputStreamReader(process.getInputStream())),
- headerFound = false,
- line;
- while (line = input.readLine()) {
- line = line + '';
- java.lang.System.out.println(line);
- if (line.indexOf("Sencha Cmd") > -1) {
- headerFound = true;
- }
- else if (headerFound && !cmdDir) {
- cmdDir = line;
- project.setProperty("cmd.dir", cmdDir);
- }
- }
- process.waitFor();
- return !!cmdDir;
- }
-
- if (!exec(["sencha", "which"])) {
- var tmpFile = "tmp.sh";
- echo("source ~/.bash_profile; sencha " + whichArgs.join(" "), tmpFile);
- exec(["/bin/sh", tmpFile]);
- new java.io.File(tmpFile)['delete']();
- }
- }
- }
-
- if (cmdDir && !project.getTargets().containsKey("init-cmd")) {
- var importTask = project.createTask("import");
- importTask.setOwningTarget(self.getOwningTarget());
- importTask.setLocation(self.getLocation());
- importTask.setFile(cmdDir + "/ant/build/package/build-impl.xml");
- importTask.execute();
- }
- ]]>
- </script>
- <!--
- The following targets can be provided to inject logic before and/or after key steps
- of the build process:
- The "init-local" target is used to initialize properties that may be personalized
- for the local machine.
- <target name="-before-init-local"/>
- <target name="-after-init-local"/>
- The "clean" target is used to clean build output from the build.dir.
- <target name="-before-clean"/>
- <target name="-after-clean"/>
- The general "init" target is used to initialize all other properties, including
- those provided by Sencha Cmd.
- <target name="-before-init"/>
- <target name="-after-init"/>
-
- The "build" target performs the call to Sencha Cmd to build the application.
- <target name="-before-build"/>
- <target name="-after-build"/>
- -->
- <target name="-before-init">
- <property name="pkg.excludes"
- value="all-licenses/**/*,
- examples/**/*,
- welcome/**/*,
- build/welcome/**/*,
- build/classic/**/*,
- build/modern/**/*,
- build/packages/**/*,
- build/index.html,
- release-notes-*,
- build/temp/**/*,
- build/examples/**/*,
- ext-all*.js,
- ext-debug.js,
- ext.js,
- ext-modern*.js,
- packages/*/test/**/*,
- test_internal/**/*,
- bootstrap*.js"/>
- <condition property="repo.dev.mode" value="true">
- <available file="${basedir}/../attic" type="dir"/>
- </condition>
- </target>
-
- <target name="-after-init" depends="apply-production-settings"/>
- <macrodef name="x-set-license">
- <attribute name="license" default="${ext.license.name}"/>
- <attribute name="version" default="${build.version}"/>
- <sequential>
- <replaceregexp replace="ext.license.name=@{license}"
- file="${basedir}/cmd/sencha.cfg" byline="true">
- <regexp pattern="ext.license.name=(.*)"/>
- </replaceregexp>
- <replaceregexp replace="$ext-version: '@{version}'"
- file="${package.dir}/classic/theme-base/sass/etc/all.scss">
- <regexp pattern="\$ext-version: '(.*)'"/>
- </replaceregexp>
- <replaceregexp replace="$ext-version: '@{version}'"
- file="${package.dir}/modern/theme-base/sass/etc/all.scss">
- <regexp pattern="\$ext-version: '(.*)'"/>
- </replaceregexp>
- <local name="watermark.setting"/>
- <condition property="watermark.beta.setting" value="$ext-beta: true !default;">
- <equals arg1="@{license}" arg2="beta"/>
- </condition>
- <property name="watermark.beta.setting" value="$ext-beta: false !default;"/>
- <condition property="watermark.setting" value="$ext-trial: true !default;">
- <equals arg1="@{license}" arg2="trial"/>
- </condition>
- <property name="watermark.setting" value="$ext-trial: false !default;"/>
- <replaceregexp replace="${watermark.setting}"
- file="${package.dir}/classic/theme-base/sass/etc/all.scss">
- <regexp pattern="\$ext-trial: (.*) !default;"/>
- </replaceregexp>
- <replaceregexp replace="${watermark.setting}"
- file="${package.dir}/modern/theme-base/sass/etc/all.scss">
- <regexp pattern="\$ext-trial: (.*) !default;"/>
- </replaceregexp>
- <replaceregexp replace="${watermark.beta.setting}"
- file="${package.dir}/classic/theme-base/sass/etc/all.scss">
- <regexp pattern="\$ext-beta: (.*) !default;"/>
- </replaceregexp>
- <replaceregexp replace="${watermark.beta.setting}"
- file="${package.dir}/modern/theme-base/sass/etc/all.scss">
- <regexp pattern="\$ext-beta: (.*) !default;"/>
- </replaceregexp>
- <if>
- <available file="${basedir}/all-licenses/@{license}" type="dir"/>
- <then>
- <copy todir="${basedir}/licenses" overwrite="true">
- <fileset dir="${basedir}/all-licenses/@{license}" includes="**/*"/>
- </copy>
- </then>
- </if>
- </sequential>
- </macrodef>
- <target name="beta" depends="init">
- <x-set-license license="beta"/>
- </target>
- <target name="commercial" depends="init">
- <x-set-license license="commercial"/>
- </target>
- <target name="gpl" depends="init">
- <x-set-license license="gpl"/>
- </target>
- <target name="trial" depends="init">
- <x-set-license license="trial"/>
- </target>
- <target name="dev" depends="init">
- <x-set-license license="dev"/>
- </target>
- <target name="init-version-properties" if="repo.dev.mode">
- <property name="build.number" value="12345"/>
- <property name="version.major" value="6"/>
- <property name="version.minor" value="0"/>
- <property name="version.patch" value="0"/>
- <property name="version.build" value="${build.number}"/>
- <property name="version.release" value="${version.major}.${version.minor}.${version.patch}"/>
- <property name="version.full" value="${version.release}.${version.build}"/>
- <property name="ext.version.number" value="${version.full}"/>
- <property name="ext.license.name" value="dev"/>
- </target>
- <target name="detect-git-hash" if="repo.dev.mode">
- <x-git-current-hash property="git.current.hash"/>
- </target>
- <target name="generate-version-properties"
- depends="detect-git-hash,init-version-properties"
- if="repo.dev.mode">
- <propertyfile file="${package.dir}/version.properties">
- <entry operation="="
- key="version.major"
- value="${version.major}"/>
- <entry operation="="
- key="version.minor"
- value="${version.minor}"/>
- <entry operation="="
- key="version.patch"
- value="${version.patch}"/>
- <entry operation="="
- key="version.build"
- value="${version.build}"/>
- <entry operation="="
- key="version.release"
- value="${version.release}"/>
- <entry operation="="
- key="version.full"
- value="${version.full}"/>
- <entry operation="="
- key="git.current.hash"
- value="${git.current.hash}"/>
- </propertyfile>
- </target>
- <target name="load-version-properties" depends="generate-version-properties">
- <property file="${package.dir}/version.properties"/>
- </target>
-
- <target name="set-build-production">
- <property name="build.production" value="1"/>
-
- <replace file="${basedir}/package.json"
- token=""local": true"
- value=""local": false"/>
- </target>
-
- <target name="apply-production-settings" if="build.production">
- <!--<x-property-file file="${package.dir}/.sencha/package/sencha.cfg">-->
- <!--<entry type="string" key="skip.examples" operation="=" value="1"/>-->
- <!--</x-property-file>-->
- </target>
- <target name="copy-license" depends="init,load-version-properties">
- <tstamp>
- <!-- sets DSTAMP=yyyyMMdd, TSTAMP=hhmm -->
- <format property="THIS_YEAR" pattern="yyyy"/>
- <format property="tstamp.datetime" pattern="yyyy-MM-dd HH:mm:ss"/>
- <format property="tstamp.pretty" pattern="MMMM d, yyyy"/>
- </tstamp>
- <property name="product.name" value="Ext JS ${package.version}"/>
- <!--
- Ext JS is distrubted under GPL and Commercial licenses as well as a Beta license.
- This target allows the package build to be leveraged while swapping out the files
- with license information.
- -->
- <condition property="ext.license"
- value="${package.dir}/../all-licenses/${ext.license.name}">
- <available file="${package.dir}/../all-licenses/${ext.license.name}" type="dir"/>
- </condition>
- <property name="ext.license" value="${package.licenses.dir}"/>
- <echo> loading file-header.txt </echo>
- <!-- Load the appropriate license file header -->
- <local name="file-header"/>
- <loadfile property="file-header" srcfile="${ext.license}/file-header.txt">
- <filterchain>
- <expandproperties/>
- </filterchain>
- </loadfile>
- <echo> expanding file-header.txt </echo>
- <copy file="${ext.license}/file-header.txt"
- tofile="${package.licenses.dir}/file-header.txt.final"
- overwrite="true">
- <filterchain>
- <expandproperties/>
- </filterchain>
- </copy>
- <rename src="${package.licenses.dir}/file-header.txt.final"
- dest="${package.licenses.dir}/file-header.txt"
- replace="true"/>
- <!--
- Create a JS/CSS compatible file with header inside a "/* */" block.
- -->
- <echo file="${package.licenses.dir}/file-header.js"
- message="/* ${file-header} */ "/>
- <fixcrlf file="${package.licenses.dir}/file-header.js"/>
- <!--
- Copy in the appropriate license.txt file
- -->
- <mkdir dir="${package.licenses.dir}"/>
- <copy file="${ext.license}/license.txt"
- tofile="${package.licenses.dir}/license.txt.final"
- overwrite="true">
- <filterchain>
- <expandproperties/>
- </filterchain>
- </copy>
- <rename src="${package.licenses.dir}/license.txt.final"
- dest="${package.licenses.dir}/license.txt"
- replace="true"/>
- <copy file="${package.licenses.dir}/license.txt"
- tofile="${package.dir}/license.txt" overwrite="true"/>
- <copy file="${package.licenses.dir}/license-include.txt"
- tofile="${package.dir}/license-include.txt" overwrite="true"
- failonerror="false"/>
- <!--
- Lay down the file header so we can append the rest from the compiler.
- -->
- <for list="ext,ext-all,ext-all-rtl,ext-modern,ext-modern-all"
- param="file">
- <sequential>
- <for list=".js,-debug.js" param="sfx">
- <sequential>
- <concat destfile="${build.dir}/@{file}@{sfx}.tmp" overwrite="true">
- <fileset file="${package.licenses.dir}/file-header.js"/>
- <fileset file="${build.dir}/@{file}@{sfx}"/>
- </concat>
- <delete>
- <fileset file="${build.dir}/@{file}@{sfx}"/>
- </delete>
- <move file="${build.dir}/@{file}@{sfx}.tmp" tofile="${build.dir}/@{file}@{sfx}"/>
- </sequential>
- </for>
- </sequential>
- </for>
- </target>
- <target name="bootstrap-classic" depends="init"
- description="Build Ext JS Bootstrap (Classic)">
- <x-echo>=========================================</x-echo>
- <x-echo>Building framework bootstrap (Classic)</x-echo>
- <x-echo>=========================================</x-echo>
- <x-sencha-command
- dir="${package.dir}/classic/classic"
- inheritall="false">
- ant
- bootstrap
- </x-sencha-command>
- </target>
-
- <target name="bootstrap-modern" depends="init"
- description="Build Ext JS Bootstrap (Modern)">
- <x-echo>=========================================</x-echo>
- <x-echo>Building framework bootstrap (Modern)</x-echo>
- <x-echo>=========================================</x-echo>
- <x-sencha-command
- dir="${package.dir}/modern/modern"
- inheritall="false">
- ant
- bootstrap
- </x-sencha-command>
- </target>
-
- <target name="bootstrap" depends="bootstrap-classic,bootstrap-modern"
- description="Build Ext JS Bootstrap"/>
-
- <target name="build-examples-index">
- <copy todir="${build.dir}/examples/" overwrite="true">
- <fileset dir="${basedir}/examples/">
- <include name="index.html"/>
- <include name="main.css"/>
- <include name="main.js"/>
- <include name="examples.js"/>
- </fileset>
- </copy>
- <copy todir="${build.dir}/examples/resources/" overwrite="true">
- <fileset dir="${basedir}/examples/resources/" includes="**/*"/>
- </copy>
- </target>
-
- <target name="build-non-app-examples">
- <for param="example">
- <dirset dir="${package.dir}/examples/classic" includes="*"/>
- <sequential>
- <if>
- <not>
- <available file="@{example}/app.json"/>
- </not>
- <then>
- <local name="example.name"/>
- <basename property="example.name" file="@{example}"/>
- <copy todir="${build.dir}/examples/classic/${example.name}" overwrite="true">
- <fileset dir="@{example}" includes="**/*"/>
- </copy>
- </then>
- </if>
- </sequential>
- </for>
- </target>
-
- <target name="prep-build-folder" depends="init,build-examples-index,build-non-app-examples">
- <copy todir="${build.dir}/welcome" overwrite="true">
- <fileset dir="${basedir}/welcome"/>
- </copy>
- <copy file="${basedir}/index.html"
- tofile="${build.dir}/index.html"
- overwrite="true"/>
- <replace file="${build.dir}/index.html"
- token="build/examples/classic/index.html"
- value="examples/classic/index.html"/>
- <replace file="${build.dir}/examples/classic/shared/include-ext.js"
- token="Ext.devMode = 2;"
- value="Ext.devMode = 0;"/>
- <replace file="${build.dir}/examples/classic/shared/include-ext.js"
- token="Ext.devMode = 1;"
- value="Ext.devMode = 0;"/>
- </target>
-
- <target name="-before-pkg" depends="init,copy-license">
- <if>
- <available file="${basedir}/release-notes.html"/>
- <then>
- <copy file="${basedir}/release-notes.html"
- tofile="${build.dir}/release-notes.html"
- overwrite="true"/>
- </then>
- </if>
- </target>
- <!--
- ******************************************************************
- Targets to easily run builds for specific items
- ******************************************************************
- -->
- <target name="build-classic"
- description="Build the Classic Theme (needed by unit tests)"
- depends="init">
- <x-sencha-command dir="${package.dir}/classic/theme-classic" inheritall="false">
- package
- build
- </x-sencha-command>
- </target>
- <target name="build-crisp"
- description="Build the Crisp Theme"
- depends="init">
- <x-sencha-command dir="${package.dir}/classic/theme-crisp" inheritall="false">
- package
- build
- </x-sencha-command>
- </target>
- <target name="build-gray"
- description="Build the Gray Theme"
- depends="init">
- <x-sencha-command dir="${package.dir}/classic/theme-gray" inheritall="false">
- package
- build
- </x-sencha-command>
- </target>
- <target name="build-neptune"
- description="Build the Neptune Theme"
- depends="init">
- <x-sencha-command dir="${package.dir}/classic/theme-neptune" inheritall="false">
- package
- build
- </x-sencha-command>
- </target>
- <target name="build-triton"
- description="Build the Triton Theme"
- depends="init">
- <x-sencha-command dir="${package.dir}/classic/theme-triton" inheritall="false">
- package
- build
- </x-sencha-command>
- </target>
- <target name="themes"
- description="Build all theme packages"
- depends="build-neptune,build-crisp,build-triton,build-classic,build-gray"/>
- <!--
- ******************************************************************
- Targets used to produce deployment builds
- ******************************************************************
- -->
- <target name="docs" depends="init" description="Builds docs for Ext JS and sub-packages">
- <mkdir dir="${package.build.dir}/docs"/>
- <exec executable="jsduck">
- <arg value="--output=${package.build.dir}/docs"/>
- <arg value="--config=${package.dir}/docs/config.json"/>
- </exec>
- </target>
- <!-- FIXME core should be the only package here, but we still have dependencies in the examples -->
- <property name="static.packages" value="core,amf,charts,soap"/>
- <target name="zip-impl" depends="init">
- <property name="staging.dir" value="${workspace.dir}/staging"/>
- <property name="display.version" value="${package.version}"/>
- <property name="folder.display.version" value="${display.version}"/>
- <property name="zip.display.version" value="${display.version}"/>
- <property name="ext.staging.dir" value="${staging.dir}/${package.name}-${folder.display.version}"/>
- <property name="ext.zip" value="${pkg.build.dir}/${package.name}-${zip.display.version}-${ext.license.name}.zip"/>
- <delete dir="${staging.dir}"/>
- <delete file="${ext.zip}"/>
-
- <mkdir dir="${ext.staging.dir}"/>
- <unzip src="${pkg.build.dir}/${pkg.file.name}" dest="${ext.staging.dir}"/>
- <copy todir="${ext.staging.dir}">
- <fileset dir="${package.dir}" includes="examples/**/*,build/examples/**/*"/>
- </copy>
- <copy todir="${ext.staging.dir}">
- <fileset dir="${package.dir}" includes="examples/**/*,build/examples/**/*"/>
- </copy>
- <if>
- <equals arg1="${repo.dev.mode}" arg2="true"/>
- <then>
- <copy todir="${ext.staging.dir}/.sencha/workspace">
- <fileset dir="${package.dir}/../deployment_workspace"
- includes="**/*"/>
- </copy>
- </then>
- </if>
- <copy todir="${ext.staging.dir}">
- <fileset dir="${package.dir}"
- includes="welcome/**/*,
- build/**/*,
- packages/core/test/specs*/**/*,
- packages/core/test/resources/**/*,
- packages/charts/test/specs*/**/*,
- classic/classic/test/*.*,
- classic/classic/test/resources/**/*,
- classic/classic/test/local/**/*,
- classic/classic/test/specs*/**/*,
- modern/modern/test/*.*,
- modern/modern/test/local/**/*,
- modern/modern/test/specs*/**/*"/>
- </copy>
- <delete dir="${ext.staging.dir}/build/temp"/>
- <delete dir="${ext.staging.dir}/build/ext"/>
- <replace file="${ext.staging.dir}/examples/classic/shared/include-ext.js"
- token="Ext.devMode = 2;"
- value="Ext.devMode = 1;"/>
- <zip destfile="${ext.zip}" basedir="${staging.dir}" level="9"/>
- </target>
- <target name="zip" depends="set-build-production,build,prep-build-folder,zip-impl"
- description="Build package and create distribution ZIP file">
- </target>
- <target name="sass-rebuild" depends="init" if="false">
- <x-process-sub-packages>
- <x-sub-build dir="@{pkg-dir}"
- target="sass"
- inherit-version="${build.subpkgs.inherit.version}"/>
- </x-process-sub-packages>
- <x-process-examples>
- <x-sencha-command dir="@{example-dir}" inheritall="false">
- app
- each
- ant
- sass
- </x-sencha-command>
- </x-process-examples>
- </target>
- <target name="quick-build" depends="init,js,prep-build-folder,pkg"/>
- <target name="zip-only" depends="quick-build,zip-impl">
- </target>
-
- <macrodef name="x-sandbox">
- <attribute name="file"/>
- <attribute name="outfile" default="@{file}"/>
- <attribute name="jsPrefix"/>
- <attribute name="cssPrefix"/>
- <sequential>
- <concat destfile="@{outfile}">
- <header trimleading="yes" filtering="no">
- (function(Ext) {
- Ext.sandboxName = '@{jsPrefix}';
- Ext.isSandboxed = true;
- Ext.buildSettings = { baseCSSPrefix: "@{cssPrefix}", scopeResetCSS: true };
- </header>
- <filelist files="@{file}"/>
- <footer trimleading="yes" filtering="no">
- })(this.@{jsPrefix} || (this.@{jsPrefix} = {}));
- </footer>
- </concat>
- </sequential>
- </macrodef>
-
- <target name="-after-build">
- <for list="ext-all,ext-all-rtl,ext-modern-all" param="file">
- <sequential>
- <for list=".js,-debug.js" param="sfx">
- <sequential>
- <x-sandbox file="${build.dir}/@{file}@{sfx}"
- outfile="${build.dir}/@{file}-sandbox@{sfx}"
- jsPrefix="Ext6"
- cssPrefix="x6-"/>
- </sequential>
- </for>
- </sequential>
- </for>
- </target>
- <!--
- ******************************************************************
- Targets for Test
- ******************************************************************
- -->
- <!--
- <target name="test-ext" depends="bootstrap,build-classic,test-run"/>
- <target name="test-all" depends="test-ext"/>
- <target name="coverage-run" depends="init">
- <x-sencha-command dir="${package.dir}">
- <![CDATA[
- config
- -prop
- cmd-test.specs.test-json=${package.dir}/test/specs/coverageTest.json
- -prop
- cmd-test.coverage.results.dir=${workspace.dir}/test/coverage-results
- then
- package
- test
- run
- ]]>
- </x-sencha-command>
- </target>
- <target name="coverage-report" depends="init">
- <x-shell dir="${workspace.dir}/test">
- node istanbul_report.js ${workspace.dir}/test/coverage-results ${workspace.dir}
- </x-shell>
- </target>
- <target name="coverage" depends="coverage-run,coverage-report"/>
- -->
- </project>
|