Adding runtime-library-path to flex build configuration using ant mxmlc task - apache-flex

I'm trying to build a flex project, linking it to some RLSs. When setting up the project in Flex Builder, the corresponding "build configuration" (that I got by adding -dump-config to the compiler options) generates (among other things) a tag like this :
<runtime-shared-libraries>
<url>some-lib.swf</url>
<url>some-other-lib.swf</url>
</runtime-shared-libraries>
Now, I am trying to build the project using mxmlc ant task, but I can't seem to add any reference to a share-library. I thought something like this would have help, but it didin't:
<!-- Skipping attributes that I don't think are relevant ... -->
<mxmlc ....>
...
<runtime-shared-library-path>
<url rsl-url="some-lib.swf"></url>
<url rsl-url="some-other-lib.swf"></url>
</runtime-shared-library-path>
</mxmlc>
So what could I be missing here ?
Thanks

You will need to specify the path to the SWC of your custom libraries via the "path-element" attribute on the "runtime-shared-library-path" element and define the "rsl-url" in the "url" element which points to the SWF. Note that this is needed for each custom RSL individually.
To achieve this you'll need to unpack the SWC and extract the SWF from it so that the compiler can copy it to the output folder.
There is a comment on a post here that describes how to include the Mate framework as an RSL. I added the interesting part below.
First, you have to extract the SWF from the SWC file yourself.
<macrodef name="create-rsl">
<attribute name="rsl-dir" />
<attribute name="swc-dir" />
<attribute name="swc-name" />
<sequential>
<unzip src="#{swc-dir}/#{swc-name}.swc" dest="#{rsl-dir}" >
<patternset>
<include name="library.swf" />
</patternset>
</unzip>
<move file="#{rsl-dir}/library.swf" tofile="#{rsl-dir}/#{swc-name}.swf"/>
</sequential>
</macrodef>
<target name="extract-rsls">
<!-- Third parties RSLs -->
<create-rsl rsl-dir="${build.rsls.dir}" swc-dir="${lib.dir}" swc-name="mate" />
</target>
Then, you need to put this SWF file as a RSL:
<target name="compile">
<mxmlc file="${src.dir}/MyApplication.mxml" output="${build.dir}/MyApplication.swf" locale="${locale}" debug="false">
<!-- Flex default compile configuration -->
<load-config filename="${flex.frameworks.dir}/flex-config.xml" />
<!-- Main source path -->
<source-path path-element="${src.dir}" />
<runtime-shared-library-path path-element="${lib.dir}/mate.swc">
<url rsl-url="rsls/mate.swf" />
</runtime-shared-library-path>
</mxmlc>
</target>

I guess you are missing the path-element
<runtime-shared-library-path path-element="${FLEX_FRAMEWORK}/framework.swc">
<url rsl-url="framework_3.4.1.10084.swf"/>
<!--<url rsl-url="datavisualization_3.2.0.3958.swf"/>-->
</runtime-shared-library-path>

You may find this xsl useful. You can call it from ant and generate your RSL entries from you .actionScriptProperties file. I hope this helps everyone going through RSL hell!!! See here:
<mxmlc output="${{dist.dir}}/${{inputMXML}}.swf"
file="${{src.dir}}/${{inputMXML}}.mxml"
locale="${{compiler.locale}}"
use-network="${{compiler.use-network}}"
debug="false"
optimize="true"
incremental="false">
<load-config filename="${{FLEX_HOME}}/frameworks/flex-config.xml"/>
<source-path path-element="${{src.dir}}"/>
<!-- Project RSLs -->
<xsl:for-each select="//libraryPath/libraryPathEntry">
<xsl:if test="#linkType = '1'">
<compiler.library-path>
<!-- substring before last '/' -->
<xsl:attribute name="dir">
<xsl:call-template name="substring-before-last">
<xsl:with-param name="list" select="#path" />
<xsl:with-param name="delimiter" select="'/'" />
</xsl:call-template>
</xsl:attribute>
<xsl:attribute name="append">true</xsl:attribute>
<xsl:element name="include">
<xsl:attribute name="name">
<!-- substring after last '/' -->
<xsl:call-template name="substring-after-last">
<xsl:with-param name="string" select="#path" />
<xsl:with-param name="delimiter" select="'/'" />
</xsl:call-template>
</xsl:attribute>
</xsl:element>
</compiler.library-path>
</xsl:if>
</xsl:for-each>
<!-- Framework RSLs. Note: Order is important. Also note: swz comes
first. This is the signed version of the library which once
downloaded can be used cross-domain, possibly saving bandwidth -->
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/textLayout.swc">
<url rsl-url="textLayout_2.0.0.232.swz"/>
<url rsl-url="textLayout_2.0.0.232.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/framework.swc">
<url rsl-url="framework_4.6.0.23201.swz"/>
<url rsl-url="framework_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/osmf.swc">
<url rsl-url="osmf_1.0.0.16316.swz"/>
<url rsl-url="osmf_1.0.0.16316.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/charts.swc">
<url rsl-url="charts_4.6.0.23201.swz"/>
<url rsl-url="charts_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/rpc.swc">
<url rsl-url="rpc_4.6.0.23201.swz"/>
<url rsl-url="rpc_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/mx/mx.swc">
<url rsl-url="mx_4.6.0.23201.swz"/>
<url rsl-url="mx_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/spark.swc">
<url rsl-url="spark_4.6.0.23201.swz"/>
<url rsl-url="spark_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/advancedgrids.swc">
<url rsl-url="advancedgrids_4.6.0.23201.swz"/>
<url rsl-url="advancedgrids_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/sparkskins.swc">
<url rsl-url="sparkskins_4.6.0.23201.swz"/>
<url rsl-url="sparkskins_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<runtime-shared-library-path path-element="${{FLEX_HOME}}/frameworks/libs/spark_dmv.swc">
<url rsl-url="spark_dmv_4.6.0.23201.swz"/>
<url rsl-url="spark_dmv_4.6.0.23201.swf"/>
</runtime-shared-library-path>
<!-- Project RSLs -->
<!-- Flex Ant Task Shortcoming. -->
<xsl:for-each select="//libraryPath/libraryPathEntry">
<xsl:if test="#linkType = '4'">
<runtime-shared-library-path>
<xsl:attribute name="path-element">
<xsl:value-of select="#path" />
</xsl:attribute>
<xsl:element name="url">
<xsl:attribute name="rsl-url">
<xsl:value-of select="crossDomainRsls/crossDomainRslEntry/#rslUrl" />
</xsl:attribute>
</xsl:element>
</runtime-shared-library-path>
</xsl:if>
</xsl:for-each>
</mxmlc>

Related

How to loop macrodef in Ant script?

Currently, I am writing an Ant Script that removes the signatures of signed Jar files.
Removing the signature for a single jar file was successful using the script below.
<project name="unsign">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="ant-lib/ant-contrib-0.6.jar" />
<property name="jarPath" location="C:\Users\Administrator\Desktop\tempDir" />
<property name="resultPath" location="C:\Users\Administrator\Desktop\tempDir-result" />
<target name="unsignJar">
<unsignjar jarFile="${jarPath}/com.google.guava_15.0.0.v201403281430.jar" />
</target>
<macrodef name="unsignjar" description="Unsign a jar file">
<attribute name="jarfile" description="Jar file to unsign " />
<sequential>
<copy toFile="#{jarFile}_MANIFEST.tmp">
<resources>
<zipentry zipfile="#{jarFile}" name="META-INF/MANIFEST.MF" />
</resources>
</copy>
<replaceregexp file="#{jarFile}_MANIFEST.tmp" match="\nName:(.+?)\nSH" replace="SH" flags="gis" byline="false" />
<replaceregexp file="#{jarFile}_MANIFEST.tmp" match="SHA(.*)" replace="" flags="gis" byline="false" />
<jar jarfile="#{jarFile}.tmp" manifest="#{jarFile}_MANIFEST.tmp">
<zipfileset src="#{jarFile}">
<include name="**" />
<exclude name="META-INF/*.SF" />
<exclude name="META-INF/*.DSA" />
<exclude name="META-INF/*.RSA" />
</zipfileset>
</jar>
<!-- Removing the temporary manifest -->
<delete file="#{jarFile}_MANIFEST.tmp" />
<!-- Swapping the original Jar file with the temporary one -->
<move file="#{jarFile}.tmp" tofile="#{jarFile}" overwrite="true" />
</sequential>
</macrodef>
</project>

Execution failed for task ':app:processDebugGoogleServices'. when run ionic cordova build android

When I run a command "ionic cordova build android", i have error like this:
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'ammar_5d767'
I have already try this steps however still not working.
here is my config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="ammar-5d767" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Doc.in</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
.
.
.
<allow-intent href="market:*" />
.
.
.
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
.
.
.
</platform>
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^3.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-firebase" spec="2.0.5" />
<engine name="android" spec="7.1.4" />
</widget>
i found some solutions but still not working.
Your Googleservice.json file is missing from the project folder which can be found in firebase console.

How to generate XML for Menu using Dataset and display menu and menu items

I need to generate a menu based on the values in the table/ dataset. The table contains data similar to the Image data below. The main menu contains 4 values, Products, Applications, Documents, Support. Each menu has its menu items.
Below is the sitemaster code for the master page:
<asp:Menu ID="Menu1" runat="server" DataSourceID="XmlDataSource1" BackColor="#0072c5"
CssClass="Menu" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="12px"
ForeColor="#F7F6F3" Width="100%" StaticSubMenuIndent="10px" Orientation="Horizontal"
StaticDisplayLevels="2">
<DataBindings>
<asp:MenuItemBinding DataMember="MenuItem" NavigateUrlField="NavigateUrl" TextField="Text" ToolTipField="ToolTip" />
</DataBindings>
</asp:Menu>
<asp:XmlDataSource ID="XmlDataSource1" TransformFile="~/Default2.xslt" XPath="MenuItems/MenuItem"runat="server"></asp:XmlDataSource>
I generated XML as below.
<Menus ProductName="Acapella Admin">
<Menu MenuID="1" Text="Products">
<MenuItem MenuID="1" Text="ProductInfo" URL="ProductInfo.aspx"/>
<MenuItem MenuID="2" Text="Product Features" URL="ProductFeatures.aspx"/>
<MenuItem MenuID="3" Text="Products Details" URL="ProductDetails.aspx" />
</Menu>
<Menu MenuID="1" Text="Applications">
<MenuItem MenuID="1" Text="MobileApps" URL="MobileApps.aspx"/>
<MenuItem MenuID="2" Text="Web Applications" URL="WebApplications.aspx"/>
<MenuItem MenuID="3" Text="Portal" URL="Portal.aspx" />
</Menu>
<Menu MenuID="2" Text="Document">
<MenuItem MenuID="4" Text="Tutorial" URL="Tutorial.aspx" />
</Menu>
<Menu MenuID="4" Text="Support">
<MenuItem MenuID="5" Text="FAQs" URL="FAQs.aspx" />
<MenuItem MenuID="6" Text="Contact us" URL="ContactUS.aspx" />
</Menu>
</Menus>
And my XSLT stylesheet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<!-- Replace root node name Menus with MenuItems
and call MenuListing for its children-->
<xsl:template match="/Menus">
<MenuItems>
<xsl:call-template name="MenuListing" />
</MenuItems>
</xsl:template>
<!-- Allow for recursive child nodeprocessing -->
<xsl:template name="MenuListing">
<xsl:apply-templates select="Menu" />
</xsl:template>
<xsl:template match="Menu">
<MenuItem>
<!-- Convert Menu child elements to MenuItem attributes -->
<xsl:attribute name="Text">
<xsl:value-of select="Text"/>
</xsl:attribute>
<xsl:attribute name="ToolTip">
<xsl:value-of select="Description"/>
</xsl:attribute>
<xsl:attribute name="NavigateUrl">
<xsl:text>?Sel=</xsl:text>
<xsl:value-of select="Text"/>
</xsl:attribute>
<!-- Recursively call MenuListing forchild menu nodes -->
<xsl:if test="count(Menu) >0">
<xsl:call-template name="MenuListing" />
</xsl:if>
</MenuItem>
</xsl:template>
</xsl:stylesheet>
Help me in generating XML And binding it to the menu with XmlDataSource.
There were some issues with the xlst file:
While transforming the "Menu"s, children were not copied.
Transformed "Menu" attribute "NavigateUrl" should be like other
MenuItem and it is "URL".
Transformed "Menu" attributes were wrong e.g. <xsl:value-of
select="Text"/> should be <xsl:value-of select="#Text"/>.
Here's the xlst file that worked for me:
<xsl:template match="node()|#*">
<xsl:copy>
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:template>
<!-- Replace root node name Menus with MenuItems
and call MenuListing for its children-->
<xsl:template match="Menus">
<MenuItems>
<xsl:call-template name="MenuListing" />
</MenuItems>
</xsl:template>
<!-- Allow for recursive child nodeprocessing -->
<xsl:template name="MenuListing">
<xsl:apply-templates select="Menu" />
</xsl:template>
<xsl:template match="Menu">
<MenuItem>
<!-- Convert Menu child elements to MenuItem attributes -->
<xsl:attribute name="Text">
<xsl:value-of select="#Text"/>
</xsl:attribute>
<xsl:attribute name="ToolTip">
<xsl:value-of select="#Description"/>
</xsl:attribute>
<xsl:attribute name="URL">
<xsl:text>?Sel=</xsl:text>
<xsl:value-of select="#Text"/>
</xsl:attribute>
<xsl:apply-templates />
<!-- Recursively call MenuListing forchild menu nodes -->
<xsl:if test="count(Menu) >0">
<xsl:call-template name="MenuListing" />
</xsl:if>
</MenuItem>
</xsl:template>
</xsl:stylesheet>
And this is the markup I have used:
<asp:Menu ID="Menu1" runat="server" DataSourceID="XmlDataSource1" BackColor="#0072c5"
CssClass="Menu" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="12px"
ForeColor="#F7F6F3" Width="100%" StaticSubMenuIndent="10px" Orientation="Horizontal"
StaticDisplayLevels="1">
<DataBindings>
<asp:MenuItemBinding DataMember="MenuItem" NavigateUrlField="URL" TextField="Text"/>
</DataBindings>
</asp:Menu>
<asp:XmlDataSource ID="XmlDataSource1" DataFile="~/Default1.xml" TransformFile="~/Default2.xslt" XPath="MenuItems/MenuItem" runat="server"></asp:XmlDataSource>
I would suggest to use online xslt transformer to check the transformed xml. I found this one very helpful.

Error when saving document of custom type in Alfresco Share

I got this exception when trying to save a new document of custom type:
org.alfresco.service.cmr.repository.MalformedNodeRefException: 06010026 Invalid node ref - does not contain forward slash: {node.nodeRef}
Here is how the definition of the custom type looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="ht:channelmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Imports are required to allow references to definitions in other models
-->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>
<!-- Introduction of new namespaces defined by this model -->
<namespaces>
<namespace uri="http://www.someco.com/model/content/1.0" prefix="ht" />
</namespaces>
<types>
<!-- Here comes my type -->
<type name="ht:doc">
<title>Custom Document</title>
<parent>cm:content</parent>
<mandatory-aspects>
<aspect>cm:generalclassifiable</aspect>
</mandatory-aspects>
</type>
</types>
<aspects>
<aspect name="ht:channel">
<title>Content Channel</title>
<properties>
<property name="ht:isWeb">
<type>d:boolean</type>
</property>
</properties>
</aspect>
</aspects>
</model>
and here is how I set the forms for displaying the creation of a new document of my custom type (inside share-config-custom.xml)
<alfresco-config>
<config evaluator="string-compare" condition="DocumentLibrary">
<create-content>
<content id="plain-text" mimetype="text/plain" label="Prompt" itemid="ht:doc" />
</create-content>
<aspects>
<visible>
<aspect name="ht:channel" />
</visible>
<addable>
</addable>
<removeable>
</removeable>
</aspects>
<types>
<type name="cm:content">
<subtype name="ht:doc" />
</type>
</types>
</config>
<config evaluator="model-type" condition="ht:doc">
<forms>
<form>
<field-visibility>
<show id="cm:title" force="true" />
<show id="ht:isWeb" force="true" />
</field-visibility>
<appearance>
<field id="cm:title">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
</alfresco-config>
Is it something wrong with the formatting or am I missing some fields in the type definition?
Thanks
Found the solution on the dedicated Alfresco forum.
Here it is:
<content id="myContent" label="Prompt" type="pagelink" index="1" >
<param name="page">create-content?destination={nodeRef}&itemId=ht:doc&mimeType=text/html</param>
</content>

loading jars during splash screen

I have a main application which is referencing to 4-5 external jar files. So while compiling the project netbeans ide(javafx application) takes long time. Therefore I want to design a splash screen and which will be displayed till all jars gets loaded.
My JNLP file is
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="Black.jnlp">
<information>
<title>Black</title>
<vendor>RATTAN</vendor>
<description>Sample JavaFX 2.0 application.</description>
<offline-allowed/>
</information>
<resources>
<jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="Black.jar" size="3393158" download="eager" />
<jar href="lib/commons-io-1.3.2.jar" size="95655" download="eager" />
<jar href="lib/commons-lang-2.0.jar" size="179420" download="eager" />
<jar href="lib/newlink.jar" size="6160" download="eager" />
<jar href="lib/scribe-1.3.0.jar" size="74543" download="eager" />
</resources>
<security>
<all-permissions/>
</security>
<applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="Black" >
<param name="requiredFXVersion" value="2.2+"/>
</applet-desc>
<jfx:javafx-desc width="800" height="600" main-class="test.Test" name="Black" />
<update check="always"/>
</jnlp>
Use preloaders module from JavaFx
here is complete tutorial:
http://docs.oracle.com/javafx/2/deployment/preloaders.htm
Good luck,'.

Resources