how to minify sencha touch project using ant? - ant

I am working on sencha touch application. I tried to build as a native app using phonegap. but the touch library itself taking more than 10 MB. Is it possible to minify it using ant?

Sencha Cmd uses Ant under the hood to minify a "build" directory for your app - which you could then drop into PhoneGap.
In Touch 2.3, there's a whole guide on PhoneGap integration via Sencha Cmd.

I use HtmlCompressor for minify html with Ant before build. Part of my build.xml:
<target name="-pre-build">
<ant target="compress-html" />
</target>
<target name="compress-html">
<echo>Compressing html</echo>
<exec executable="java" dir="." failonerror="true">
<arg line="-jar ${user.home}/lib/htmlcompressor-1.5.3.jar --compress-js -r -m '*.html' -o assets/www/ assets/www/" />
</exec>
</target>

Related

Generating HTML report of testcases results in SoapUI

I have an testsuite of API testing in SOAP UI.
I want an HTML report of testcases results. I am using basic SOAP UI version. Give me a solution apart from SOAP UI Pro.
Yes, it is possible to generate Junit Style HTML reports using SoapUI Opensource Edition as well.
All you need to do is the execution of tests has to be done
use Apache-Ant software, more details on installing and configuring here
write build script
Here is the sample build script(build.xml):
Note that modify the SOAPUI_HOME(or define environment variable), soapui project file path, results directory path according to your environment.
<project basedir="." default="testreport" name="ant script for testing soapui project">
<property environment="env"/>
<property name="soapui.project" value="/app/demo-soapui-project.xml"/>
<property name="results.dir" value="/tmp/results"/>
<property name="reports.dir" value="${results.dir}/Reports"/>
<property name="html.dir" value="${reports.dir}/html"/>
<target name="execute.project">
<exec dir="${env.SOAPUI_HOME}" executable="testrunner.sh">
<arg line="-raj -f ${results.dir} ${soapui.project}" />
</exec>
</target>
<target name="testreport" depends="execute.project">
<mkdir dir="${reports.dir}"/>
<junitreport todir="${reports.dir}">
<fileset dir="${results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${html.dir}" />
</junitreport>
</target>
</project>
and execute following command (run soapui project and generate report):
ant
There is also simple way (i.e., every thing configured and readily available envrionment) if you are willing to use this docker image.
Short video also available there on how to.

How to avoid recompiling the same Eclipse plugin that is a dependency of several other plugins

I have several Eclipse projects, each of them is an RCP plugin. All of them has a dependency on another common project which is itself an RCP plugin.
I have been building each project in Ant like this:
<java jar="${eclipse.equinox.launcher.plugin}" fork="true" failonerror="true">
<arg value="-application"/>
<arg value="org.eclipse.ant.core.antRunner"/>
<arg value="-buildfile"/>
<arg value="${eclipse.pde.build.plugin}/scripts/productBuild/productBuild.xml"/>
<arg value="-Dbuilder=${build.directory.projectroot}"/>
</java>
However, with this the common project is rebuilt for each dependent project, which is quite slow and unnecessary. Is there a way to only build/compile the common project once and use the output?
I was able to do this by copying the already-built plugins into the dropins folder of the Eclipse Target. PDE detects these plugins upon building other products and doesn't rebuild them.

Zend Framework 2 Unit Tests on Jenkins not working

I have a zend framework 2 project and i am trying to set up my jenkins so that unit tests can be executed. Jenkins is running on ubuntu and i am developing under Windows 7 with PHPStorm.
build.xml
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true">
<arg value="${basedir}/module/Addressbook/test"/>
</exec>
</target>
Folder structure:
project
module
Addressbook
test
AddressbookTest
Controller
AddressbookControllerTest.php
Boostrap.php
phpunit.xml.dist
TestConfig.php
build.xml
Jenkins Output:
phpunit:
[exec] PHPUnit 3.7.13 by Sebastian Bergmann.
[exec]
[exec] PHP Fatal error: Class 'AddressbookTest\Bootstrap' not found in /var/lib/jenkins/workspace/Test/src/module/Addressbook/test/AddressbookTest/Controller/AddressbookControllerTest.php on line 28
PHPStorm on my local machine does this when running phpunit.xml.dist
D:\Zend\ZendServer\bin\php.exe -d auto_prepend_file=D:/Zend/Apache2/htdocs/demoshop/vendor/autoload.php C:\Users\ChristianB\AppData\Local\Temp\ide-phpunit.php --configuration D:/Zend/Apache2/htdocs/demoshop/module/Addressbook/test/phpunit.xml.dist
How can i use that for jenkins?
It looks like your include path isn't setup correctly, I wouldn't use exec directly with PHPUNIT when there's better options.
You should look into using PHING tasks with Jenkins, they work excellent together.
You then setup Jenking to trigger your PHING target to run the unit tests for you via the PHPUNIT task, an example phing target for PHPUNIT:
<target name="phpunit">
<phpunit bootstrap="${srcdir}/tests/bootstrap.php">
<formatter todir="${builddir}/reports" type="xml"/>
<batchtest>
<fileset dir="${srcdir}/tests">
<include name="**/*Test*.php"/>
<exclude name="**/Abstract*.php"/>
<exclude name="${srcdir}/vendor/**"/>
</fileset>
</batchtest>
</phpunit>
<!--
Generate a report from the XML data created..
note: error when using format="frames"
-->
<phpunitreport infile="${builddir}/reports/testsuites.xml"
format="noframes"
todir="${builddir}/reports/tests"
/>
</target>

Ant task to compile stylus file to normal css file?

I am trying to use stylus in a project, that is using ANT build.
I need to compile the stylus file to normal css before packaging the war.
is there a way to do it?
Note : I am not using node.js, it is a simple java web application
Here is a full example how to use it:
<property name="css.stylus" value="../folder/to/stylus/files"/>
<property name="cmd.node" value="C:\Program Files\nodejs\nodevars.bat"/>
<property name="cmd.stylus" value="C:\Program Files\nodejs\stylus.cmd"/>
<target name="css_compile" description="compile l'ensemble des CSS avec stylus">
<exec executable="${cmd.node}" />
<exec dir="${css.stylus}" executable="${cmd.stylus}" >
<arg value="myCSS.styl"/>
<arg value="-c"/>
<arg value="-o"/>
<arg value="..\cssFolder"/>
</exec>
</target>
This example (I used) transform myCSS.styl in a obfuscate CSS to /cssFolder
nodevars.bat is necessary for launching stylus.
stylus.cmd is stylus itself, because the path not working in ant. To know where is it, (it's in nodejs), you can type "path" in terminal, on Windows.
That's all!

PHP_CodeBrowser directory settings for more than one directory

I have project structure like:
application
tests
docs
library
Zend
My_Lib
I setup my JenkinsCLI to make PHP_Code_Sniffer analysis and so on application and library/My_Lib. And now I need setup PHP_CodeBrowser to browse applivation and library/My_Lib too. But only this two I dont want to setup PHP_CodeBrowser to browse all files in project.
Is it possible and any clue how to do it?
My PHP_CodeBrowser ant task.
<target name="phpcb"
description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg line="--log ${basedir}/build/logs
--source ${source}
--output ${basedir}/build/code-browser" />
</exec>
</target>
Thanks for replies.
From phpcb --help:
-s source, --source=source Path to the project source
code. . . .
Can be given multiple times
So try
<target name="phpcb"
description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg line="--log ${basedir}/build/logs
--source ${source}/application
--source ${source}/library/My_Lib
--output ${basedir}/build/code-browser" />
</exec>
</target>

Resources