Archive for June, 2009

Android PMD ruleset

Posted: June 30, 2009 in AndCooper, Android, Java, Mobile
Tags: ,
T-Mobile's G1
Image by neo.wave via Flickr

Xavier Le Vourch   had made a post describing how to modify the PMD ruleset to be more Android specific. My AndCooper-modified-pmd with his ruleset enclosed(jar download). For AndCooper 0.2 the mdoified PMD will have some more rules specific to Android. You will refer to the ruleset as andcooper.xml in your pmd ant task and you need the ruleset in the jar hence the modified PMD jar download. Sorry for the delay in gettting this out.

Reblog this post [with Zemanta]
Advertisement

Fennec on Android

Posted: June 30, 2009 in Android, Java, Mobile
Tags: ,
TOKYO - JUNE 24:  A baby Fennec is seen at Sun...
Image by Getty Images via Daylife

A lot of talk has been about getting Fennec on Android since the Android NDK release.  First, my bias. I am in some talks  and or discussion about this with Mozilla . If I was to do it one would have to target webview functionality and work backwards to get Fennec on Android. it is not enough to have Fennec a 2nd class citizen on Android or SymnbianS60 for that matter it is a strategic blunder not to integrate Fennec with webview on both platforms.

Webview developers by having two browser engines competing on Android and SymbianS60 would get certain features faster such as Gears support and etc. I am unsure if Mozilla will respond to my counter-proposal as I was asked in May about discussing the Fennec Front end Engineering posiiton and felt at that time that unless Mozilla leads with webbview integration that it was a lost cause. I can state that if Mozilla says yes, the screen shots may come  a lot faster than anyone is aware of at this moment.

Hopefully, Mozilla says yes. They are my opinions and my opinions alone and should not be construed to to be coming from Mozilla or the Fennec project.

Reblog this post [with Zemanta]


This is what the obfuscation prepaation ANT script code looks like:

<property name="assets-css-obfuscated" value="${assets-folder}/css-obfuscated"></property>
<property name="assets-js-obfuscated" value="${assets-folder}/js-obfuscated"></property>
<property name="assets-js-libs-compressed" value="${assets-folder}/js-libs-compressed"></property>
<property name="project-assets-css-libs" value="${basedir}/project-assets/css-libs"></property>
<property name="project-assets-js-libs-compressed" value="${basedir}/project-assets/js-libs-compressed"></property>
<property name="project-assets-temp-concat" value="${basedir}/project-assets/temp-concat"></property>
 <!--  The assumption is that during testing/dev we want the non obfuscated js/css files to 
 be real but the obfuscated oen sot be empty and reverse that for the 
 production/release. Thus prep step prepares an obfuscated empty file
 concat of the js-libs and the css files.  we assume
 that we plaqce js-libs-compressed libs in the folder
 -->
 <!-- Concat js-libs-compressed into one js-libs-3rdparty file-->
 <concat destfile="${project-assets-temp-concat}/js-compressed-3rdparty.js" force="no">
 <fileset dir="${project-assets-js-libs-compressed}" includes="**/*.js"></fileset>
 </concat>
 <!-- Move js lib file to assets -->
 <copy file="${project-assets-temp-concat}/js-compressed-3rdparty.js" todir="${assets-js-libs-compressed}"></copy>
 <!-- Produce an empty css-obfuscated file and a js-obfuscated file only empty for testing/dev -->
<property name="css-obfuscated-file-name" value="css-obfuscated-file-name.css"></property>
<property name="js-obfuscated-file-name" value="js-obfuscated-file-name.js"></property>
 <concat destfile="${project-assets-temp-concat}/${css-obfuscated-file-name}" force="no">
 <fileset dir="${project-assets-temp-concat}" includes="${css-obfuscated-file-name}"></fileset>
 </concat>
 <copy file="${project-assets-temp-concat}/${css-obfuscated-file-name}" todir="${assets-css-obfuscated}"></copy>
 <concat destfile="${project-assets-temp-concat}/${js-obfuscated-file-name}" force="no">
 <fileset dir="${project-assets-temp-concat}" includes="${js-obfuscated-file-name}"></fileset>
 </concat>
 <copy file="${project-assets-temp-concat}/${js-obfuscated-file-name}" todir="${assets-js-obfuscated}"></copy>
 <delete includeemptydirs="true">
 <fileset dir="${project-assets-temp-concat}"></fileset>
 </delete>

Than during the release.produciton target before the apkbuilder task you make empty css-not-obfuscated.css and js-not-obfuscate.js files and thus your import wil always be:

import css-non-obfuscated.css

import css-bofuscated.css

import js-non-obfuscate.js

import js-0obfuscated.js

import js-compressed-3rdparty.js

Notice that you will always have the import js 3rdparty compressed lib.  Because if you import an empty css or js file nothing happens it will always work right for both testing and production release because of the switching of which one is the empty file. Is not that a cool trick? And you never have to go through the html and change the damn imports every time.  Sure I could have threw together an ANT build script like everyone else but I thought it might be valuable to actually have an Android Build script that supports WebVuiew application development.

Is this trick used in the PhoneGap or QuickConnect or Rhomobile build scripts? Suprisingly, no in fact. This is the quality that needs  to go into a WebView application development book. However, I can not develop the book unless I have side Android App Development contracts. Now, some more details to finish than AndCooper Build Tool 0.1 release.

Reblog this post [with Zemanta]
T-Mobile G1 Google Android
Image by netzkobold via Flickr

Part of the difficulty in using WebView has to do with the build, test, release process. Let me explain. You are importing or linking the importing of css and js to different locations depending upon whether you are testing or producing files for release. Obviously importing both the non shrinked version along with the shrinked version could also cause problems.

But. what if your importing both non-obfuscated and obfuscated to do this:

Testing:

non-obfuscated

-real css file

-real js file

obfuscated

-concat dummy empty css file

-concat dummy js empty file

Than, now here is the magic for the production release you reverse it in that the operational files are the obfuscated ones with the other original files being concated to empty files, importing a concated empty files does nothing(perfect!). Now, all that extra changing of imports and copying files and etc eliminated! Why? Because the step to change the concated empty files from non-obfuscated to obfuscated occurs during the lines right before the apkbuilder ANT task in the release.produciton target.  Than always name the css-library as css-library.css and the js libraries as the concat file of js-library.js. It will look weird that you have a pair of imports for css and js but hey no more other extra steps, who cares what it looks like when it saves some steps!

Now here is what I do not understand. The amount of time saved in the development process in developing Mobile RIAs that deploy on Android is significant when usin gthis new AndCooper build process tool so why the ‘long-face’ among several Android parties to the point of me not even answering Android employment inquires because of the non-listening about these important areas? Should I have to hide from Android Employment inqiuries if I am creating such time saving development tools?

Okay, sorry for the rant. The non OHA members have been extremely helpful and the comments have been used in making AndCooper better. And let us not forget all the helpful and overworked  Google Engineers who answered by questions this spring about SDK tools as the AndCooper project idea was being formed. The upcoming videos tonight are another reports video and possibly a video showing the tiddlywiki document system in AndCooper.

The whole reason why I built Android applications including those using WebView bare for several months was to understand what part of that process had to  change to make it accessible to more developers  both in saving time within that development process and etc. My model of how things should not be, was the PhoneGap mess. that is nothing against the contributors to PheonGap but no-one is really acting as architect and it shows up in the way the phoneGap is organized and how that impacts development time of those who are new to Mobile RIA development and those that are not.

Reblog this post [with Zemanta]

Those of you using WebView fully as a mobile RIA or as a way to embed application help html files you have probably been searching for a way to obfuscate and shrink the files. Not just js, but also css as well. You can drive the YUI-compressor library through the javaFlight ant task. It is the last bit I needed integrated into the AndCooper Android Application Build tool.

Reblog this post [with Zemanta]

StartUp HeartAche

Posted: June 25, 2009 in Android, StartUp

Here is a set of reasons why AndCooper Build Tool, extensions to  MetaWidget to support AndroSQL, and etc have been delayed on getting released. I do not know how to go about describing this.

Mobilebytes is not entirey founded as a one person founder startup.  It somewhat has a cofounder in training. Right now the situaiton is still very delicate so I will keeep his name not mentioned at this time. This co-founder in training that I was grooming for co-foundership tried to committ suicide. To say its been a few tough wweks, is somewhat an understatement.  I can tell you that the co-founder-in-training is out of the hospital, but as you might know there is a significant amount of work ahead.

The whole idea of me interviewing with Motorola in early June 2009 and depending upon  statements that yes I would  get a phone call back on the telecommute Android project was to bank that contract money to support bringing this co-founder-in-training into the startup full-time and to ‘rescue’ that co-founder-in-training from a very bad family situation.

So some things will get released this weekend, sorry for the  delays.

Android Hero

Posted: June 24, 2009 in Android, Mobile
Tags: ,

Details of Android Hero(HTC), via TechCrunch.

Full customized UI and full flash support, coming this summer.

JDepend Task for Android

Posted: June 24, 2009 in AndCooper, Android, Java, Mobile
Tags:

There is somewhat a trick to get JDepend ot wokr for an Andorid Application build:


<!-- To load jdepend.properties in taskdef for jdepend -->
 <taskdef  classpathref= "reporttools.classpath" resource= "${jdependConfigFile}" />

Notice, you have to declare the path to where your jdepend.properties file is located. Once, that is done your task looks like:


<target name="jdepend.reports"  >
 <jdepend
 fork="true"
 outputfile="${inreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml"
 format="xml"
 classpathref="reporttools.classpath"
 >
 <sourcespath>
<pathelement location="src"/>
 </sourcespath>

 <classespath>
<path refid="classes.dir.path"/>

 </classespath>
 </jdepend>
 <xslt basedir="${inreports-folder}" destdir="${outreports-folder}"
 includes="${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml" 
 style="${jdepend.home}/andcooper.jdepend.xsl" >
<param name="project" expression="${project}"/>
<param name="today" expression="${today}"/>

 </xslt>
 <xslt basedir="${inreports-folder}"
 destdir="${inreports-folder}"
 includes="${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml"
 extension=".dot"
 style="${jdepend.home}/jdepend2dot.xsl"/>
 <!-- need to define a path to Graphiz/dot path -->
 <apply executable="${graphviz-location}"
 dest="${outreports-folder}"
 parallel="false"
 output="${logs}/$(project.name}.${DSTAMP}.${TSTAMP}.dot-output.log"   >
 <arg value="-Tpng"/>
 <arg value="-o"/>
 <targetfile/>
 <srcfile/>
 <fileset dir="${inreports-folder}" includes="*.dot"/>
 <mapper type="glob" from="*.dot" to="*.png"/>
 </apply>
 <copy file="${inreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml" tofile="${ciserver-jdepend-folder}/input/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.xml"/>

 <copy file="${outreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.html" tofile="${ciserver-jdepend-folder}/output/jdepend.html"/>
 <copy file="${outreports-folder}/${project.name}.${DSTAMP}.${TSTAMP}.jdepend.png" tofile="${ciserver-jdepend-folder}/output/jdepend.png"/>
 <emit message="jdepend report generated and transformed to html"/>
 </target>

Nice and simple.

SignJar Target

Posted: June 24, 2009 in AndCooper, Android, Java, Mobile
Tags: , ,
T-Mobile G1 Google Android
Image by netzkobold via Flickr

While I polish the AndCooper release and directions, I will publish some ANT atrget example specific to Android.  How about a signjar task? SignJar:


<target name="signapk-pubkey" depends="release.production" description="signs the app to be published">
 <mkdir dir="${dist-folder}/${TSTAMP}${DSTAMP}"/>
 <signjar destDir="${dist-folder}/${TSTAMP}${DSTAMP}"
 alias="${keystore-alias}" keystore="${android-keystore-location}"
 storepass="${storepass}"
 preservelastmodified="true"
 Jar="${out-folder}/${ant.project.name}.apk" />

 </target>

The release.production target is just the apkbuilder task and you have set to signed not true so that the apk does not get signed witht the debug key. Remember, we do not have a clear standard way of indicating Android application  versions so I name the dist folder by date/time in preparation to indicate the version in some other ways. You may chose to do something very different.

Reblog this post [with Zemanta]


The Andr0id Java Application Build tool called AndCooper is being released tonight as 0.1 Alpha. Included with this release is a modifid PMD.jar with a very alpha PMD ruleset for Andorid that goes beyond the PMD Android ruleset. No matter what Continuous Integration server you may be running its just simple drop the stuff in and run although you may not get CI-integrated dashboard view yet.

No matter what IDE you might be using you can point or setup a JavaBuilder to point to this set of build scripts and it will auto-generate the code analysis reports every time the project workspace is built by the JavaBuilder of your IDE. Templates for items such as Java.Header, package-summary.html, package-info.java, and etc can be found at root for easy access for new users. Also, included tiddlywiki templates for taking notes and GTD note taking. Also, I have kept the tool IDE agnostic in nature.

Report-wise you can set reports to have your company logo and UML diagrams are included with javadocs. Jdepend reprots also have diagrams in png form when you define the Graphviz Home path.

At this time the build scripts recognize SDKs up to the Android SDK version 3.0 with slight support for OEM add-on APIs so that those jars get added properly to classpaths and etc.

At this time I would like to thank everyone who commented thus far as I did use those comments to refactor the build tool to come up with the 0.1 alpha version.  Hopefully, as we go forward into releases such as 0.2 and 0.3 that will encourage more comments that can be used to refacor AndCooper into better implementations and hopefully at some point maybe even comments from OHA members at some point.

Reblog this post [with Zemanta]