I am trying to hide the console when running the Haxe application.
I am using FlashDevelop to compile Haxe into hxcpp, and this is my project.xml
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- metadata, make sure 'package' is at least 3 segments (ie. com.mycompany.myproject) -->
<meta title="haxeGame" package="haxeGame" version="1.0.0" company="xiggie" />
<!-- output -->
<app main="Main" file="haxeGame" path="bin" />
<window width="800" height="480" fps="60" background="0x000000" orientation="landscape" resizable="false" borderless="true" />
<window vsync="true" antialiasing="6" />
<!-- classpath, haxe libs -->
<classpath name="src" />
<haxelib name="openfl" />
<haxelib name="actuate" />
<!-- assets -->
<icon path="assets/texture.jpg" />
<assets path="assets" rename="assets" />
<!-- optimize output
<haxeflag name="-dce full" /> -->
<!-- Windows app: hide console -->
<setenv name="no_console" value="1" />
<flag value="subsystem:windows" />
</project>
I have tried all of these:
<haxeflag name="-D no_console" />
<haxedef name="no_console" />
<setenv name="no_console" value="1" />
Is it actually possible to remove the console from the release app?
The console should be hidden by default. To make it appear one needs to add
<setenv name="SHOW_CONSOLE" />
However, when using mingw instead of msvc as compiler, the toolchain configuration that comes with hxcpp currently does not pass the flag to the linker that avoids the creation of a console window.
To work around this, search for the mingw-toolchain.xml in your haxe installation and add the -mwindows flag to the linker configuration.
I created a pull request for this https://github.com/HaxeFoundation/hxcpp/pull/286
Related
We're using Cruise Control v1.8.5. We have next scenario:
checkout source code from git repository
run some scripts to build project (e.g. npm install && cordova clean, cordova build, also minify some css files, compile typescript ...)
Now we want to add label on successfull build. Therefore I found that cruisecontrol has labeller option, so I added:
<cb:define name="Mylabeller">
<labeller type="defaultlabeller">
<initialBuildLabel>1</initialBuildLabel>
<labelFormat>0</labelFormat>
<incrementOnFailure>true</incrementOnFailure>
<labelPrefixFile>X:\BuildFiles\myProject\version.txt</labelPrefixFile>
<labelPrefixFileSearchPattern>\d\.\d\.\d\.</labelPrefixFileSearchPattern>
</labeller>
</cb:define>
But the problem is that, this is done before source code is retrieved (git) from repository. I read version from my project and then CruiseControl with regex reads version and outputs something like: 1.0.3.buildNumber.
How to set/update label prefix version after retrieving source code from repository. It reads old one, before checkout. I also read about dynamic variables, can they be somehow set or something?
Appending project's xml:
<cb:scope ProjDirName="myProject">
<project name="myProject" queue="Daily" queuePriority="30">
<workingDirectory>D:\BuildFiles\$(ProjDirName)\Working</workingDirectory>
<artifactDirectory>D:\BuildFiles\$(ProjDirName)\Artifacts</artifactDirectory>
<cb:sourcecontrol module="Modul1" TagOnSuccess="false" Branch="$(BranchDevelop)" />
<tasks>
<cb:NpmInstall />
<cb:Build />
</tasks>
<cb:Mylabeller />
<cb:commonall />
</project>
</cb:scope>
Figured that CruiseControl sets next build version when project build is started and before project's xml is read (checkout, tasks, ...).
CruiseControl project build log:
<parameters>
<parameter name="$CCNetArtifactDirectory" value="D:\BuildFiles\MyProject\Artifacts" />
<parameter name="$CCNetBuildCondition" value="ForceBuild" />
<parameter name="$CCNetBuildDate" value="2016-01-25" />
<parameter name="$CCNetBuildId" value="9d8234720e7342a3aa636aacc120eb13" />
<parameter name="$CCNetBuildTime" value="13:49:42" />
<parameter name="$CCNetFailureTasks" value="System.Collections.ArrayList" />
<parameter name="$CCNetFailureUsers" value="System.Collections.ArrayList" />
<parameter name="$CCNetIntegrationStatus" value="Unknown" />
<parameter name="$CCNetLabel" value="1.0.88" />
<parameter name="$CCNetLastIntegrationStatus" value="Failure" />
<parameter name="$CCNetListenerFile" value="D:\BuildFiles\MyProject\Artifacts\MyProject_ListenFile.xml" />
<parameter name="$CCNetModifyingUsers" value="System.Collections.ArrayList" />
<parameter name="$CCNetNumericLabel" value="88" />
<parameter name="$CCNetProject" value="MyProject" />
<parameter name="$CCNetProjectUrl" value="http://BUILDer/ccnet" />
<parameter name="$CCNetRequestSource" value="machineName1" />
<parameter name="$CCNetUser" value="user1" />
<parameter name="$CCNetWorkingDirectory" value="D:\BuildFiles\MyProject\Working" />
<parameter name="$LastChangeNumber" value="96ece86d55f83c8eb129cbfeb01724a3d37bb18a" />
Also I makes sense that Continuous Integration dictates application version e.g. major.minor.build instead that each commit dictates version.
Solution:
<cb:scope ProjDirName="myProject">
<project name="myProject" queue="Daily" queuePriority="30">
<workingDirectory>D:\BuildFiles\$(ProjDirName)\Working</workingDirectory>
<artifactDirectory>D:\BuildFiles\$(ProjDirName)\Artifacts</artifactDirectory>
<cb:sourceControlMyProject Branch="develop"/>
<cb:dailytrigger />
<tasks>
<cb:NpmInstall />
<cb:BuildRelease />
<cb:PublishAfter />
</tasks>
<publishers>
<cb:commonpublish/>
</publishers>
<cb:MyLabeller LabelPrefix="1.0." /> <!-- version is fixed -->
<cb:commonall />
</project>
</cb:scope>
And labeller:
<cb:define name="MyLabeller">
<labeller type="defaultlabeller">
<initialBuildLabel>1</initialBuildLabel>
<prefix>$(LabelPrefix)</prefix>
<incrementOnFailure>true</incrementOnFailure>
<labelFormat>0</labelFormat>
</labeller>
</cb:define>
Currently this setup is ok. In case we'll be developing version 1.1 upper setup must be changed. Main point was to get versioning working e.g. 1.0. + cruiseControl_next_build_number.
I'm doing this exact example from the phonegap docs.
<!DOCTYPE HTML>
<html>
<head>
<title>getPreferredLanguage Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
function checkLanguage() {
navigator.globalization.getPreferredLanguage(
function (language) {alert('language: ' + language.value + '\n');},
function () {alert('Error getting language\n');}
);
}
</script>
</head>
<body>
<button onclick="checkLanguage()">Click for language</button>
</body>
</html>
When I click the button I want it to return the language I'm using on my phone.
It works good if I run it through the PhoneGap app, while connected to the local server on my computer (phonegap serve) however it won't work after making the .apk and installing it on my phone. What am I missing?
edit: here's the config.xml
http://pastebin.com/t6fx3jRD
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.helloworld" version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0">
<name>hi bi</name>
<description>
sample stuff
</description>
<author email="support#phonegap.com" href="http://phonegap.com">
PhoneGap Team
</author>
<content src="index.html" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<preference name="phonegap-version" value="3.3.0" />
<preference name="permissions" value="none" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="android-installLocation" value="auto" />
<icon src="icon.png" />
</widget>
I don't see any obvious problems, but there are five things that should be resolved.
you need to post your config.xml to this forum. If you delete that pastebin file, others will not be able to benefit from this. (If we can get it to work.)
you are using the generic file, which is not a bad thing, except the large file makes it more difficult to spot a problem.
you did NOT use <preference name="phonegap-version" value="X.X.X" />, which is not required. But since you do not, then by default you get the latest version (the bleeding edge) of the phonegap. (This might get you leading edge bugs which would be difficult to debug -- without asking for lots of help.)
Since you are using the latest version of Phonegap, and not 3.3.0, then you should reference leading edge - which does not have an full example.
Since you did NOT say what your target platform is, then perhaps you should look at the Bug List
Lastly, you might consider using an earlier version, say <preference name="phonegap-version" value="3.3.0" />, and try you build again. Oh and RTFM.
Best of Luck, Jesse
I want to copy files over to a server but before i do this i would like to include the latest msi file that i generate.
I noticed that the ItemGroup and Item have a Condition attribute but i do not know how to utilize this to include the latest file.
So far this is my setup:
<Target Name="AfterBuild">
<ItemGroup>
<Installers Include="\\SERVERNAME\BuildOutput\ProductStream\**\Installers\Customer\Installer.msi"/>
</ItemGroup>
<Message Text="FirstItem: %(Installers.Filename)" />
<Message Text="FirstItem: %(Installers.FullPath)" />
The output of this are two files:
e.g
\\Servername\BuildOutput\ProductStream\Installers\ProductStreamV2.1.1202.1402\Installer.msi
\\Servername\BuildOutput\ProductStream\Installers\ProductStreamV2.1.1405.1301\Installer.msi
I want to include the 2.1.1405.1301 build in the Item as this is the latest one.
I would appreciate if someone would assist me because i cannot find how to go about doing this from the MSDN blogs.
Thanks,
You could use a custom task for this purpose. It allows you to filter items any way you want. Here I used regular expressions to select the latest installer:
<Target Name="AfterBuild">
<ItemGroup>
<Installers Include="**\Installer.msi"/>
</ItemGroup>
<SelectLatestInstaller Installers="#(Installers)">
<Output TaskParameter="LatestInstaller" ItemName="LatestInstaller" />
</SelectLatestInstaller>
<Message Text="%(LatestInstaller.FullPath)" />
</Target>
<UsingTask TaskName="SelectLatestInstaller"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Installers ParameterType="System.String[]" Required="true" />
<LatestInstaller ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Linq" />
<Using Namespace="System" />
<Using Namespace="System.Linq" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
LatestInstaller = Installers
.OrderByDescending(f => Regex.Match(f, #"\\ProductStreamV(?<version>(\d+.){0,3}\d+)\\").Groups["version"].Value)
.FirstOrDefault();
]]>
</Code>
</Task>
</UsingTask>
I'm trying to Minify Javascript and CSS using AjaxMin when I deploy using a Web Deploy Publish Profile. Here is what I have in the project file:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\AjaxMin.tasks" />
<PropertyGroup>
<ResGenDependsOn>
MinifyJavascriptAndCss;
$(ResGenDependsOn);
</ResGenDependsOn>
</PropertyGroup>
<Target Name="MinifyJavascriptAndCss"
Condition=" '$(ConfigurationName)'=='Release' ">
<ItemGroup>
<JS Include="$(_PackageTempDir)\**\*.js"
Exclude="$(_PackageTempDir)\**\*.min.js;Scripts\*.js" />
</ItemGroup>
<ItemGroup>
<CSS
Include="$(_PackageTempDir)\**\*.css"
Exclude="$(_PackageTempDir)\**\*.min.css" />
</ItemGroup>
<Message Text="Compressing JavaScript and CSS files into $(_PackageTempDir)"
Importance="high" />
<AjaxMin JsSourceFiles="#(JS)" JsSourceExtensionPattern="\.js$"
JsTargetExtension=".min.js" CssSourceFiles="#(CSS)"
CssSourceExtensionPattern="\.css$" CssTargetExtension=".min.css" />
</Target>
If I watch the output directory I can see that the files are minified as the min.* files appear, but when the package file is deployed, they are not included.
How do I force the minified files to be included in the publish package?
It worked for me in VS2010, but does nothing with VS2012...
<!-- Use AjaxMinifier from Libs folder in this project -->
<UsingTask TaskName="AjaxMin" AssemblyFile="$(MSBuildProjectLocation)Libs\AjaxMinTask.dll" />
<!-- This target will run after publish web in Release mode -->
<Target Name="MinifyJavaScriptAndCSS" AfterTargets="CopyAllFilesToSingleFolderForPackage" Condition="'$(Configuration)'=='Release'">
<ItemGroup>
<!-- Every .js file (exclude *.min.js and *.vsdoc.js files) -->
<JS Include="$(_PackageTempDir)\**\*.js" Exclude="$(_PackageTempDir)\**\*.min.js;$(_PackageTempDir)\**\*vsdoc.js" />
<!-- Every .css file (exclude *.min.css files) -->
<CSS Include="$(_PackageTempDir)\**\*.css" Exclude="$(_PackageTempDir)\**\*.min.css" />
</ItemGroup>
<!-- Log in output build window -->
<AjaxMin JsKnownGlobalNames="jQuery,$" JsSourceFiles="#(JS)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".js" CssSourceFiles="#(CSS)" CssSourceExtensionPattern="\.css$" CssTargetExtension=".css" />
<!-- Log in output build window -->
<Message Text="[pcv] $(MSBuildProjectName) -> Minified: #(JS)" Importance="high" />
<Message Text="[pcv] $(MSBuildProjectName) -> Minified: #(CSS)" Importance="high" />
</Target>
I faced the same problem and successfully resolved it. There is one easy way to do this task.
Set the Build Action of original CSS/JS files to None and set the Build Action of minify files to Content. Now when you build the project then only minified css/java script files will come.
I'm using VS2012, and this worked for me
<!--<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\AjaxMin.targets" />-->
<UsingTask TaskName="AjaxMin" AssemblyFile="$(MSBuildProjectDirectory)\..\packages\AjaxMin.5.14.5506.26202\tools\net40\AjaxMinTask.dll" />
<Target Name="MinifyJsAndCss" AfterTargets="CopyAllFilesToSingleFolderForPackage" >
<ItemGroup>
<JS Include="$(_PackageTempDir)\App_Scripts\**\*.js" Exclude="$(_PackageTempDir)\**\*.min.js" />
<CSS Include="$(_PackageTempDir)\**\*.css" Exclude="$(_PackageTempDir)\**\*.min.css" />
</ItemGroup>
<Message Text="Compressing JavaScript and CSS files...(to edit this feature, unload the project, right click it ->edit -> search for 'AjaxMin' bottom of the xml)" Importance="high" />
<AjaxMin JsSourceFiles="#(JS)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".js" CssSourceFiles="#(CSS)" CssSourceExtensionPattern="\.css$" CssTargetExtension=".min.css" />
</Target>
In the following phing xml, inside the "skel" target I check if the app is configured, if it's not then I call the configure target and then apply the config to several files.
The problem is that property db.host is not set after the phingcall, even though it is set after the propertyprompt.
What am I missing?
<!-- base configuration -->
<property name="paths.config" value="config" />
<property name="paths.config.file" value="${paths.config}/environment.ini" />
<available file="${paths.config.file}" property="configured" />
<target name="configure">
<if>
<equals arg1="${configured}" arg2="true" />
<then>
<echo message="Reconfigure ..." />
</then>
<else>
<echo message="Configure ..." />
</else>
</if>
<propertyprompt propertyName="db.host" defaultValue="localhost" promptText="Mysql Server Host" />
</target>
<target name="skel">
<echo msg="Skel files..." />
<if>
<equals arg1="${configured}" arg2="${configured}" />
<then>
<echo message="Missing config file ..." />
<phingcall target="configure" />
</then>
</if>
<echo message="${db.host}" />
<copy todir="config">
<mapper type="glob" from="*.skel" to="*"/>
<filterchain>
<expandproperties />
</filterchain>
<fileset dir="config">
<include name="*.skel" />
</fileset>
</copy>
</target>
I think the phingcall will create a new environment internally. When the configure target is done, this environment is out of scope.
This means it is not possible to use a separate configure target as you are suggesting.
The only solution might be to make the configure target create a configuration file which is used by the other targets.
Properties set inside of targets are scoped to those targets and are not accessible outside their parent targets.
From the documentation for PropertyTask:
Important note about scope: when the <property> tag is called inside a <phingcall> tag, any properties are set in a new local scope. Thus, any properties or other variables set inside that scope will cease to exist (or revert to their previous value) once the parent <phingcall> tag completes.