Specifying a flex-config.xml with Maven / Flex Mojos - apache-flex

I have to port an existing project to Maven, and it includes a resource called "config.xml" that is copied to the deploy directory alongside the SWF and HTML, and loaded at run-time to locate a bunch of WSDLs.
Flex Mojos has taken it upon itself to assume that my xml file is a flex-config file with instructions for the compiler, which of course promptly gives up the ghost.
The question is: How do I specify a named config file for the compiler so that Maven stops this nonsense (as well as specifying my compile-time options)?

<configuration>
<configFile>path/to/yourConfigFile.xml</configFile>
</configuration>
https://docs.sonatype.org/display/FLEXMOJOS/compile-swf-mojo.html#compile-swf-mojo.html-configFile

Sorry for the archeology. If you want to hide only some warnings, you can add the following in your pom:
<configuration>
<!-- Maven is more strict than Flash Builder, so I'm hiding some warnings -->
<compilerWarnings>
<warn-no-constructor>false</warn-no-constructor>
</compilerWarnings>
</configuration>
From this documentation:
compilerWarnings
A list of warnings that should be enabled/disabled
Equivalent to -compiler.show-actionscript-warnings,
-compiler.show-binding-warnings,
-compiler.show-shadowed-device-font-warnings,
-compiler.show-unused-type-selector-warnings and -compiler.warn-*
Usage:
<compilerWarnings>
<show-actionscript-warnings>true</show-actionscript-warnings>
<warn-bad-nan-comparison>false</warn-bad-nan-comparison>
</compilerWarnings>

Related

JAWR generator using less to css not finding jawr_generator.css

I'm trying to get JAWR working with the generator configuration to convert less into CSS post compile but I keep getting errors when I try where it's trying to go to a jawr_generator.css file as this is supported (if I'm reading the documentation correctly) in newer versions but I'm getting a 404 doesn't exist.
I'm using maven, spring, and JAWR (project requirement, yes I know grunt and other things can do what we're doing but I need it using these technologies). I'm not wanting to do this at compile time with the Pom files either because we want hot swapping without using the less plugin for intelliJ.
From what I'm reading all you have to do is have JAWR set up, include the less4j in your maven config along with JAWR (JAWR is already functioning from a compile time configuration) and change the resource to .less at the directory you're pointing to, does anyone have any idea what I'm missing?
applicable parts of pom (version of JAWR is 1.7.0.1.1 if I'm not mistaken, it's just not defined in this POM explicitly):
...
<dependency>
<groupId>com.github.sommeri</groupId>
<artifactId>less4j</artifactId>
<version>1.17.2</version>
</dependency>
...
<plugin>
<groupId>org.lesscss</groupId>
<artifactId>lesscss-maven-plugin</artifactId>
<configuration>
<sourceDirectory>ourSourceDirectoryPath</sourceDirectory>
<outputDirectory>targetPath/ourDirectory
</outputDirectory>
<includes>
<include>otherFileCompiledAtCompile.less</include>
</includes>
</configuration>
</plugin>
jawr.properties:
# fileName (note I've ripped out this from our actual names to make this generic)
jawr.js.bundle.bundleName.id=/bundles/fileName.js
jawr.js.bundle.bundleName.mappings=/path/js/fileName.js,/path/otherFileName.js
jawr.css.bundle.bundleName.id=/bundles/fileName.css
jawr.css.bundle.bundleName.mappings=/path/css/lib/fileName.less
Anyone have any ideas as to what I'm missing here? I've changed all the files and paths somewhat just for sanitization of data, it works fine when I put it in the pom. However if I try and get the resources to dynamically compile less to css at runtime it's saying this in the web browser developer tools debugger console and not showing the css file as being loaded:
Failed to http://ourUrl.com/path/jawr_generator.css?generationConfigParam=%2fpath%2fcss%2flib%2ffileName.less
load resource: the server responded with a status of 404 (Not Found)
The jawr_generator.css isn't a file we use, it seems to be a part of JAWR itself and doesn't get compiled/exist. I'm assuming I'm missing a configuration or a property somewhere to enable this, anyone have any ideas? Thanks in advance for any help.
We've resolved this, there was an issue with one of the paths where it was placing the file in a different directory than it was in the original file structure. Fixing this resolved the issue. The anltr conflict was a red herring. Closing as resolved.

Where to specify --module flag in VS 2015?

I am using typescript 1.5 and VS 2015 RC with new ASP.NET 5 Project templates.
Typescript compiles fine however I am getting the following error on my exported classes:
cannot compile external modules unless the "-module" flag is provided
I want to silence this error however I am unable to specify any typescript options though VS 2015. I also tried tsconfig.json file however it seems it is not effective to just add this file. Perhaps there is an additional step I am missing. What can I do ?
Typically this setting is in the project properties on the TypeScript build tab in the project properties (for your current build configuration such as Debug or Release).
Since you are saying that the TypeScript build tab doesn't appear, you may not have a valid reference to the TypeScript "props" file in your project. Look for a line like this in your .csproj or similar file:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
If it doesn't exist, add it to your project and then fix up the path to be correct for your install of Visual Studio and TypeScript (just search for the "Microsoft.TypeScript.Default.props" file on your hard drive). When you reload the project, the TypeScript build properties tab should appear.
The other thing you need is a reference to the TypeScript "targets" file such as this:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
Note that a targets reference generally has to be as low as possible in your project - possibly even just before the </Project> tag.
Initialization of TypeScript in Visual Studio is dependent on the .props and .targets files existing so that could also be the issue.

Run the Qt application as administrator on Windows

Is there a way I can run the Qt application as an administrator? I have an auto-updater for my application. It needs administrator privileges to replace the files in Program Files folder and hence it requires administrator privileges.
Running your application with administrator privileges does not have a whole lot to do with Qt. There are two approaches.
The "simple" one is to manually set your application to run with administrator privileges. You can do so by right-clicking on the executable. Then on the "Compatibilty" tab, you can choose to "Run this application as an administrator" under "Privilege level".
However, if you automatically want to achieve the same, you will have to embed a manifest into your application. What you're looking for is to set the requestedExecutionLevel to requireAdministrator. A bit more information can be found on MSDN or in this Wikipedia entry on UAC.
For your application as built in Qt Creator, it means you will need to embed the manifest by including a reference to it in a Resource (.rc) file. This resource file can then be added to your .pro file by specifying RC_FILE = myapp.rc. An informative blog post on this very issue is this one, as well as this post on the QtCentre forum.
A very simple solution for this, if you're using MSVC toolkit, is to add the following into the project file:
QMAKE_LFLAGS_WINDOWS += "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\""
I am using Qt 5.12 msvc2017.
I've found this to be quite neat, as from what I see in generated Makefile, Qt is already adding some manifest related link flags, and this approach wouldn't interfere with already embedding manifest, as manually adding manifest from existing file.
Other manifest link options can be easily added. You can read the docs for VS compiler, and/or you can check what flags/options Visual Studio IDE has to offer in Project properties/Linker/Manifest File and then check Command Line section of the Linker to see how it adds them.
Not sure how would this be done in gcc or clang builds, it would probably require solutions provided by #H Aßdøµ, and #Bart.
From the article that referred to Mr #Bart:
Application Manifest
First, we have to prepare an application manifest file. This one below is for application that does not require administrator rights:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="2.0.2.0" processorArchitecture="X86" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Second, we need the MT.exe tool from the Microsoft Windows SDK to embed this XML in our executable. To do it use the following command:
mt.exe –manifest MyApp.exe.manifest -outputresource:MyApp.exe;1
Automatic Manifest Embedding
Manually executing the mt command after each compilation is a tedious task. What about convincing qmake to do it for us? After studying the docs it looks like the following line should do the trick:
win32 {
WINSDK_DIR = C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A
WIN_PWD = $$replace(PWD, /, \\)
OUT_PWD_WIN = $$replace(OUT_PWD, /, \\)
QMAKE_POST_LINK = "$$WINSDK_DIR/bin/x64/mt.exe -manifest $$quote($$WIN_PWD\\$$basename(TARGET).manifest) -outputresource:$$quote($$OUT_PWD_WIN\\${DESTDIR_TARGET};1)"
}
The above code will automatically execute the mt.exe program from WINSDK_DIR and embed a manifest file that is located in the project root directory and named after project's target (ie. MyApp.manifest). That's all to adding a manifest, now let's move on and specify the version information.
Orginal post: http://blog.strixcode.com/2010/08/embedding-application-manifest-and.html

Why does Flexmojos produce a different size swf to mxmlc?

I am compiling a very simple app, Main.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Label
text="Flex"/>
</s:Application>
With mxmlc (SDK 4.0.0.14159):
mxmlc
-context-root=a
-services=.\src\main\webapp\WEB-INF\flex\services-config.xml
src\main\flex\Main.mxml
-output src\main\webapp\Main.swf
And also with Flexmojos 3.9 & 4.0-RC2, using SDK 4.0.0.14159:
<configuration>
<output>src/main/webapp/Main.swf</output>
<services>src/main/webapp/WEB-INF/flex/services-config.xml</services>
<contextRoot>a</contextRoot>
</configuration>
The output from both builds creates a valid swf file that works as expected, yet the swf file from mxmlc is much smaller than the Flexmojos version:
mxmlc Main.swf 43k
flexmojos Main.swf 367k
This is quite worrying because I am developing in Eclipse (which uses mxmlc) yet my master build script (which uses flexmojos) is producing a totally different file.
Can anyone tell me why this is, and how to rectify it?
Thanks
It seems, that compilation with flexmojos includes flex framework classes in output swf. And compilation with mxmlc in your case uses framework swfs as RSL.
MXMLC will be pulling in the flex-config.xml from the Flex SDK install that specifies the default linkage (mostly RSL) for the Flex runtime - meaning a smaller SWF file.
I'm not familiar with how Flexmojos work, so you'll need to learn how to set up the equivalent arguments. It may be possible to tell Flexmojos to use the same default config XML file.
I implemented a Flex build using Gradle and we have different file sizes even though we're supposed to be using the same compiler and the same settings as in Flash Builder (Eclipse) - though the difference is very small and our dependencies are linked as expected.

DotNetNuke module development with webservices

I need to deploy a webservice as part of a DotNetNuke 4.x module that I'm creating - but am not sure how I can do that and know that it'll always stay in the same place. How can I add an asmx file to my module project, and when I create my .DNN file specify where the webservice will end up? I want to reference the webservice from inside the ascx file in the module using the "~/webservices/webservice.asmx" format.
Does DotNetNuke have a way to specify in the .DNN file where the webservices will end up on the site? And if so, will I still be able to reference them with root anchored tags like ~/myservice.asmx?
You can include the ASMX file by including a element in the <files> section:
<files>
<file>
<name>YourWebService.asmx</name>
<path></path>
</file>
</files>
Generally, you don't need to specify a path.
Alternatively, you can include a Resources.zip file with your package which will include any files other than those that DNN needs to process during installation (e.g. Assemblies and SqlDataProvider files).
The benefit of this is maintainability. Using Resources.zip will keep you from having to edit the manifest file over and over...
The contents of the zip file will simply be unpacked into the root module directory (e.g. /DesktopModules/YourModule/*). If there is a file structure within your zip file it will be maintained.
You'll want to add TheNameOfYourFile.zip To your manifest file under the element.
[snip]
<folder>
<name>Your Module</name>
<friendlyname>Your Module</friendlyname>
<foldername>YourModule</foldername>
<modulename>YourModule</modulename>
<description>A module for DotNetNuke websites.</description>
<version>01.00.00</version>
<resourcefile>Resources.zip</resourcefile>
<businesscontrollerclass></businesscontrollerclass>
<modules>
<module>
[/snip]
As for referencing it in your module - I suggest using:
<%=ResolveUrl("~/DesktopModules/YourModule/Services.asmx")%>

Resources