Ant Builder for SASS in Zend Studio (Eclipse) "Is A Directory" Error - eclipse

The build script I am using:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="sass">
<target name="sass">
<apply dest="./sass" executable="sassy.bat">
<srcfile />
<targetfile />
<mapper from="*.scss" to="*.css" type="glob"/>
<fileset dir="./sass" includes="**/*.scss" />
</apply>
</target>
</project>
And it works great, with the condition that I have this external sassy.bat script on my %%PATH%%.
sass %1 %2
It compiles sass/*.scss files and puts the *.css in the same directory. However, if I don't use my sassy.bat and rather just use sass.bat it produces:
ruby.exe: Is a directory -- C:/project/sass (LoadError)
But in theory it should be running the same thing. Any idea what I'm doing wrong?

I ended up solving this problem recently. The first step is to ensure that the builder is set to use a "Separate JRE" (Zend Studio's). The second step was to update my buildfile to the following:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="sass">
<target name="sass">
<exec osfamily="windows" vmlauncher="false" executable="sass">
<arg value="--update" />
<arg value="scss/:css/" />
<arg value="--style=compressed" />
</exec>
</target>
</project>
The key was to set the vmlauncher attribute to false on Windows.

Related

How to build and deploy adapter with single ANT script Worklight 6.1

At 6.1 the ant jar was split into two jars: worklight-ant-builder.jar and worklight-ant-deployer.jar. I can run the build or the deploy tasks by themselves but I have to change the fileset. I want to run the build adapter and deploy adapter out of a single ant script.
I've tried a few ways to include both jars in the taskdef fileset:
include name="*.jar"
or
filename name="*.jar"
or
include name="worklight-ant-builder.jar"
include name="worklight-ant-deployer.jar"
Its almost like the tasks won't accept multiple jars. The build always works, but the deploy only when the deployer.jar is "include name="worklight-ant-deployer.jar" by itself.
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<fileset dir="${worklight.server.install.dir}/WorklightServer">
<include name="*.jar"/>
<!-- <filename name="*.jar"/> -->
<!-- <include name="worklight-ant-builder.jar"/> -->
<!-- <include name="worklight-ant-deployer.jar"/> -->
</fileset>
</classpath>
</taskdef>
I understand the multi-script answer but I think I shouldn't have to do that. This is my full script:
<?xml version="1.0" encoding="UTF-8"?>
<project name="BuildDeployAdapter" basedir="." default="help">
<property name="worklight.server.install.dir" value="C:/IBM/Worklight61/"/>
<property name="adapter-source-files-folder" value="C:/Worklight/workspaces/base61p/HelloWorklight/adapters/HTTPAdapter"/>
<property name="destination-folder" value="C:/Worklight/workspaces/base61p/HelloWorklight/binANT"/>
<property name="myAdapter.adapter" value="${destination-folder}/HTTPAdapter.adapter"/>
<property name="http.server.port.context" value="http://mydomain:9080/worklight"/>
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<fileset dir="${worklight.server.install.dir}/WorklightServer">
<include name="*.jar"/>
<!-- <filename name="*.jar"/> -->
<!-- <include name="worklight-ant-builder.jar"/> -->
<!-- <include name="worklight-ant-deployer.jar"/> -->
</fileset>
</classpath>
</taskdef>
<target name="buildAdapter">
<adapter-builder
folder="${adapter-source-files-folder}"
destinationfolder="${destination-folder}"/>
</target>
<target name="deployAdapter">
<adapter-deployer deployable="${myAdapter.adapter}"
worklightserverhost="${http.server.port.context}"
userName="username" password="password" />
</target>
</project>
Right now I have to switch the included jar for each task, when I want to use the masked include - either include name=".jar" or filename name=".jar". This seems to be a limititation on the specific task not accepting more than one jar. Am I off base here?
Given the information you provided, it seems that a solution could be to create a separate script that would invoke the build and deploy scripts in sequence, like this:
<project name="Adapter Stuff" default="do.all" basedir=".">
<target name="do.all">
<ant antfile="path/to/worklight-build-adapter.xml"
target="build-target" inheritall="false"/>
<ant antfile="path/to/worklight-deploy-adapter.xml"
target="deploy-target" inheritall="false"/>
</target>
</project>

Add Build Settings for xcodeuild in Ant Script

I want to run this working line of code in ant-script:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO -workspace \APPNAME.xcworkspace -scheme APPNAMETarget build
So far I have this:
<?xml version="1.0" encoding="utf-8"?>
<project name="APPNAME" default="debugbuild" basedir=".">
<target name="debugbuild">
<echo message="Building debug build of APPNAME" />
<exec executable="/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" os="Mac OS X">
<arg value="-workspace"/>
<arg value="APPNAME.xcworkspace"/>
<arg value="-scheme"/>
<arg value="APPNAMETarget"/>
<arg value="build"/>
</exec>
</target>
</project>
But I also need to add Build Settings (ARCHS="armv7 armv7s" ONLY_ACTIVE_ARCH=NO) but don't know how to add them in the script. I tried
<env key="ONLY_ACTIVE_ARCH" value="NO"/>
But it didn't work.
I found a solution. I just had to add them as arguments like the other but I had to get rid of the parenthesis which were fine in the command line. I hope it is helpful for other because I spend some time on this:
<?xml version="1.0" encoding="utf-8"?>
<project name="APPNAME" default="debugbuild" basedir=".">
<target name="debugbuild">
<echo message="Building debug build of APPNAME" />
<exec executable="/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" os="Mac OS X">
<arg value="-workspace"/>
<arg value="APPNAME.xcworkspace"/>
<arg value="-scheme"/>
<arg value="APPNAMETarget"/>
<arg value="build"/>
<arg value="ARCHS=armv7 armv7s"/>
<arg value="ONLY_ACTIVE_ARCH=NO"/>
</exec>
</target>
</project>

Prune old files in a directory with phing

This target works fine
<target name="cleanlogs">
<echo msg="clean log do nothing !!!!not ready!!!!" />
<fileset dir="/var/www/myapp/log" id="deleteLogs">
<include name="**/debug*.log" />
</fileset>
<delete>
<fileset refid="deleteLogs" />
</delete>
</target>
I want add something like
<date datetime="xxxxxx" when="before"/>
or
<date seconds="xxxxxx" when="before"/>
to delete only logs older than 5 days
How to build xxxxx in phing ??
<tstamp>
dont return "timestamp" :-/
Here is a proposition of solution
<?xml version="1.0" encoding="UTF-8"?>
<project name="Project" default="format" basedir=".">
<target name="format">
<tstamp>
<format property="DATE" pattern="%s" />
</tstamp>
<php expression="${DATE}-(3600*24*5)" returnProperty="NEWDATE"/>
<php expression="time()-(3600*24*5)" returnProperty="EVALUATEDTIME"/>
<echo>DATE = ${DATE}</echo>
<echo>NEWDATE = ${NEWDATE}</echo>
<echo>EVALUATEDTIME = ${EVALUATEDTIME}</echo>
</target>
</project>
Actually you can put anything in the eval and directly compute whatever you need.

Jenkins with JSLint and Violations plugin

I currently configured a jenkins server that validates my project on javascript errors with JSlint ( with ant). Now i want to show all the errors with the violation plugin. I can generate an xml with all the errors. But it doesn't show this in the graph.
This is my build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<taskdef name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="jslint/jslint4java-2.0.2.jar" />
<property name="reports.dir" value="reports" />
<target name="clean" description="Removes output files created by other targets.">
<delete dir="${reports.dir}" failonerror="true" />
</target>
<target name="jslint" depends="clean">
<mkdir dir="reports" />
<jslint options="white,undef,plusplus,newcap,vars,indent=4">
<predef>jQuery, setTimeout, history, window, document</predef>
<formatter type="xml" destfile="jslint_results.xml"/>
<fileset dir="" includes="**/*.js" excludes="lib/*.js" />
</jslint>
</target>
This is my violations setting:
The pattern is relative to your workspace. So if your report 'lives' in <WORKSPACE>/reports the pattern should be reports/jslint_results.xml or **/jslint_results.xml

Ant buildfile does not contain a javac task

I have build.xml file and I want to create Java project from Existing Ant Buildfile. But I have an error: Specified buildfile does not contain a javac task
My file has simple structure:
<project>
<target ...>
</target>
...
</project>
Provide javac to your build.xml as below:
<javac srcdir="src" destdir="bin" />
As Puneet Pandey pointed out, this error occurs when your build.xml file is lacking a <javac> XML element.
The <javac> XML element in the build.xml file (referred to as javac task) tells the compiler or IDE (Eclipse in this case) where the source Java files are for compiling. Once you know that it should be quite clear why Eclipse can't import your build.xml without a <javac> XML element.
In case you are not sure where to stick the <javac> tag I'll add a slightly fuller example. You will need to navigate to your build.xml and edit it so that it contains the <javac> line in the appropriate section inside the <project> tag.
<project ...>
<javac srcdir="src" destdir="bin" />
<target ...>
</target>
...
</project>
You need something like this,
<target name="compile">
<javac destdir="build/classes" srcdir="src" includeantruntime="false">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="war" depends="compile">
<war destfile="build/${name}.war" webxml="WebContent/WEB-INF/web.xml">
<fileset dir="WebContent" casesensitive="no">
</fileset>
<lib dir="WebContent/WEB-INF/lib"/>
<classes dir="build/classes">
</classes>
</war>
</target>