Build flex library using mxmlc - apache-flex

I want to build a flex library project directly through the mxmlc compiler. My library has one .as file and it is under a package call com.test
package com.test { public class Main { public function Main(){...
I run the following command on the cmd
D:\4.11.0\bin\mxmlc D:\TestLibrary\src\com\test\Main.as
But it gives me the following error
Error: A file found in a source-path must have the same package structure '', as the definition's package, 'com.test'
If I remove the package definition from the script as follows, it works.
package { public class Main { ...
My question is why this happen and how to fix it?

You need to additionally tell the compiler the root of your sources:
mxmlc D:\TestLibrary\src\com\test\Main.as -source-path D:\TestLibrary\src\
by providing the "source-path" property you are telling the compiler where the root is and releative from that it now should know that com.test.Main is the relative path to your class.

Thanks Charisofer, Finally I could build the library project and make the swc file. This is the command I used. Hope it will help for others.
D:\4.11.0\bin\compc -source-path D:\TestLibrary\src -include-sources D:\TestLibrary\src\com\test\Main.as -debug=false -output D:\Auto_Release\main.swc
To build swf, need to use mxmlc
To build swc need to use compc

Related

Error when adding include folder cmake

I am creating new project using cmake to configure it. That project has dependency of library lib1, for example which is compiled separately.
Problem starts when I add include folder of the lib1 like this:
include_directories (../lib1/include)
When I launch make command it complains saying that
fatal error: 'QSharedData' file not found
#include < QSharedData >
QSharedData is included in one of the .h of lib1.
How can I fix this?
Thanks in advance
You should definitely follow Qt's cmake instructions (https://doc.qt.io/qt-5.10/cmake-manual.html) and use their cmake package, i.e.
find_package(Qt5Core)
...
The Qt cmake package takes care of determining and setting the needed include directories, etc.

Open XML in dnx5.0 / aspnext

I'm trying to build an app that uses OpenXML in a dnx/aspnet next environment.
I've added added the OpenXML dependency to my package.json
"dependencies": {
....
"DocumentFormat.OpenXml": "2.5.0"
}
However, when i try to run, i get this error:
The type 'Package' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=4.0.0.0
It seems OpenXML depends on WindowsBase. I'm fearful that this won't work in linux/mac environment, as I can't find a nuget package or a dependency by this name.
Is there a way to add this WindowsBase .dll to a unix dnx project? Is there another way to utilize OpenXML or another word document library in unix via dnx?
Thanks
It seems that mono has WindowsBase.dll.
Try adding a framework reference to it like in this example: https://github.com/aspnet/dnx/blob/7ac7929aa575e17b3c271e4a7a0c164418de0395/misc/XreTestApps/FrameworkReferences/project.json#L2 but use WindowBase instead of System.IO

How to define directory structure following packages in project's Scala build definitions?

There are two full build definition files in sbt project: Build.scala and Helpers.scala. They are located in project folder.
I'd like to put Helpers module into separate sub-folder project/utils. When I do import utils.Helpers in Build.scala it says:
not found: object utils
Is it possible to define directory structure that follows the packages in sbt full build definitions?
you should use project/src/main/scala/utils instead of project/utils
Sbt builds are recursive, which means that sbt build definition is built by sbt, applying the same rules as per normal project.
Unlike Java, Scala has no strict relation between the package and folder structure. Meaning you can place your sources wherever you like and it doesn't have to match package declaration. Scala will not complain.
Sbt knows where to search for folders by checking sourceDirectories setting key.
You can check it easily by executing show sourceDirectories. However this will show the sourceDirectories for your actual project. How you can check it for the build? Quite easily, execute reload plugins, this will take you to your build. Execute show sourceDirectories, and it should show you that it looks for sources in /project/src/main/scala, project/src/main/java and one more, which is managed sources (doesn't matter for our case). Now you can execute reload return to go back to your main project.
Given that you should be able to create an object let's say, named Helpers in project/src/main/scala/utils/Helpers.scala:
package utils
object Helpers {
def printFancy(name: String) = println(s">>$name<<")
}
And use it in your Build.scala:
import sbt._
import Keys._
import utils.Helpers._
object MyBuild extends Build {
val printProjectName = taskKey[Unit]("Prints fancy project name")
lazy val root = project.in(file(".")).settings(
printProjectName := printFancy(name.value)
)
}
You can test it by executing printProjectName.
> printProjectName
>>root<<
[success] Total time: 1 s, completed May 29, 2014 1:24:16 AM
I've stated earlier that sbt is recursive. This means, that if you want, you can use the same technique to configure the sbt build, as you use for configuring building of your own project.
If you don't want to keep your files under /project/src/main/scala, but just under /project/utils, you can do so by creating build.sbt in your project folder, with following content:
unmanagedSourceDirectories in Compile += baseDirectory.value / "utils"
Just as it is described in the documentation
Now even if you place your utils in project/utils sbt should be able to find it.

Is it possible to compile a flex project that uses Cairngorm with command line?

Has anyone tried to compile a flex project that uses Cairngorm with command line?
Ensure that the Cairngorm SWC is in your library path. For instance, if you have the SWC in a folder called "libs" that is relative to the current directory, you should include the following command line argument for mxmlc:
--library-path+="libs"
Notice the += in there. This means that "libs" is added to the current library path, which may already include other folders. The quotes are optional if you don't have spaces in your path.

Flex 3 ASDocs Library Issue

We've been attempting to compile ASDocs against a Flex 3 Library Project. Our problem is that ASDocs refuses to recognize any custom mxml component that is both created and used within the library.
For example, if we have a custom mxml AdvancedButton control in our library, and we attempt to use it in another mxml class within the library, ASDocs compiler errors out on the parent class file, with "Error: Type was not found or was not a compile-time constant: AdvancedButton".
An error also occurs if we try to extend our custom component. So if our library contains AdvancedButton that extends Button, and ExtraAdvancedButton that extends AdvancedButton, ASDocs will be "Unable to locate specified base class 'AdvancedButton for component class 'ExtraAdvancedButton'".
On the other hand, if AdvancedButton is referenced from an external library, we don't get errors.
This doesn't seem to be an issue if the files are .as, not .mxml. In our case, however, we have nested degrafa based components.
Ideas would be hugely appreciated.
I had the same problem recently. The trick for me was to add -source-path "src" to the asdoc compiler arguments.
Here is the asdoc command which worked for me:
c:\work\prg\Flex>"c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.3.0\bin\asdoc.exe" -doc-sources "src" -main-title "PRG documentation" -output "c:\work\prg\Flex\docs" -source-path "c:\work\XmlMappingAS3\src" -source-path "assets\css" -source-path "c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.3.0\frameworks\projects\framework\src" -source-path "c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.3.0\frameworks\projects\rpc\src" -external-library-path "c:\work\commonLibraries\Flex\as3commons-reflect-1.0.0.swc" -external-library-path "c:\work\commonLibraries\Flex\Cairngorm.swc" -external-library-path "c:\work\commonLibraries\Flex\spring-actionscript.swc" -external-library-path "c:\work\commonLibraries\Flex\xpath-as3-1.0.0.swc" -external-library-path "c:\work\commonLibraries\Flex\as3corelib.swc" -external-library-path "c:\work\commonLibraries\Flex\as3reflect.swc" -source-path "src"
Also, a great help would be to use the FlashDevelop ActionScript Documentation Generator (that is, in fact, what I used). If you install FlashDevelop on a Windows environment into "c:\Program Files\FlashDevelop", the Documentation Generator is located at "c:\Program Files\FlashDevelop\Tools\asdocgen\ASDocGen.exe".
Good luck!
I spent a good couple of hours trying to generate ASDocs for my Flex project and kept getting errors relating to not being able to find base class x/y/z. In the end I found it was because I wasn't telling ASDoc the location of the Flex SWC files:
(For me) C:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.4.0\frameworks\libs
Include this path in an additional -library-path argument and you should find it stops any errors about not finding base classes.
This sounds similar to the original problem described above which is missing links to where these custom components sit. Make sure the base directory is included which contains these custom component .as files
Are you using the -library-path parameter of asdoc?
But wait, u said u r not getting errors if its referenced from external library - so u r using the library path already, right?
Flex 3 ASDoc doesn't document mxml at all. So may be u shud get flex 4 sdk and try with the asdoc that comes with it.

Resources