Skip to content

Commit

Permalink
Fix resolution of project/extension/bin template files, add support f…
Browse files Browse the repository at this point in the history
…or certificate values (--certificate-path="", etc) from command-line
  • Loading branch information
jgranick committed May 13, 2013
1 parent fee36a1 commit 4e7e20d
Show file tree
Hide file tree
Showing 25 changed files with 251 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<extension>

<template path="" />
<template path="templates" />

</extension>
4 changes: 2 additions & 2 deletions project/Keystore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Keystore {
public var path:String;
public var type:String;

public function new (path:String, password:String = null, alias:String = null, aliasPassword:String = null) {
public function new (path:String = null, password:String = null, alias:String = null, aliasPassword:String = null) {

this.path = path;
this.password = password;
Expand All @@ -28,7 +28,7 @@ class Keystore {

if (keystore != null) {

if (keystore.path != "") path = keystore.path;
if (keystore.path != null && keystore.path != "") path = keystore.path;
if (keystore.password != null) path = keystore.password;
if (keystore.alias != null) path = keystore.alias;
if (keystore.aliasPassword != null) path = keystore.aliasPassword;
Expand Down
2 changes: 1 addition & 1 deletion project/NMEProject.hx
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class NMEProject {

} else {

ObjectHelper.copyUniqueFields (project.certificate, certificate, null);
certificate.merge (project.certificate);

}

Expand Down
10 changes: 5 additions & 5 deletions src/CommandLineTools.hx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class CommandLineTools {
}

PathHelper.mkdir (title);
FileHelper.recursiveCopyTemplate ([ nme + "/templates/default" ], "project", title, context);
FileHelper.recursiveCopyTemplate ([ PathHelper.getHaxelib (new Haxelib ("pazu-tools")) + "/templates" ], "project", title, context);

if (FileSystem.exists (title + "/Project.hxproj")) {

Expand Down Expand Up @@ -244,7 +244,7 @@ class CommandLineTools {
context.extensionUpperCase = extension.toUpperCase ();

PathHelper.mkdir (title);
FileHelper.recursiveCopyTemplate ([ nme + "/templates/default" ], "extension", title, context);
FileHelper.recursiveCopyTemplate ([ PathHelper.getHaxelib (new Haxelib ("pazu-tools")) + "/templates" ], "extension", title, context);

if (FileSystem.exists (title + "/Extension.hx")) {

Expand Down Expand Up @@ -881,9 +881,9 @@ class CommandLineTools {
}

if (field == "template" && attribute == "path") {

project.templatePaths.push (projectDefines.get (key));

} else {

if (Reflect.hasField (project, field)) {
Expand Down Expand Up @@ -1140,7 +1140,7 @@ class CommandLineTools {

if (overrides.certificate == null) {

overrides.certificate = new Keystore ("");
overrides.certificate = new Keystore ();

}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions templates/extension/Extension.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package;

#if cpp
import cpp.Lib;
#elseif neko
import neko.Lib;
#end


class ::className:: {


public static function sampleMethod (inputValue:Int):Int {

return ::extensionLowerCase::_sample_method(inputValue);

}


private static var ::extensionLowerCase::_sample_method = Lib.load ("::file::", "::extensionLowerCase::_sample_method", 1);


}
5 changes: 5 additions & 0 deletions templates/extension/haxelib.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<project name="::extension::" url="" license="MIT">
<user name=""/>
<description></description>
<version name="1.0.0"></version>
</project>
6 changes: 6 additions & 0 deletions templates/extension/include.nmml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<project>

<ndll name="::file::" />

</project>
46 changes: 46 additions & 0 deletions templates/extension/project/Build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<xml>

<include name="${HXCPP}/build-tool/BuildCommon.xml"/>

<set name="mobile" value="1" if="iphone"/>
<set name="mobile" value="1" if="android"/>
<set name="mobile" value="1" if="blackberry"/>
<set name="mobile" value="1" if="webos"/>

<files id="common">

<compilerflag value="-Iinclude"/>

<file name="common/ExternalInterface.cpp"/>
<file name="common/::file::.cpp"/>

</files>

<set name="name_prefix" value="lib" if="iphone"/>
<set name="IOS_ARCH" value="-v7" if="HXCPP_ARMV7"/>
<set name="name_extra" value=".iphoneos${IOS_ARCH}" if="iphoneos"/>
<set name="name_extra" value=".iphonesim" if="iphonesim"/>
<set name="name_extra" value="-x86" if="simulator" unless="iphonesim" />
<set name="tool" value="exe" unless="iphone"/>
<set name="tool" value="static" if="iphone"/>
<set name="ndll-tool" value="dll" unless="iphone"/>
<set name="ndll-tool" value="static" if="iphone"/>
<set name="SLIBEXT" value=".lib" if="windows"/>
<set name="SLIBEXT" value=".a" unless="windows"/>
<set name="SLIBEXT" value=".so" if="webos"/>

<target id="NDLL" output="${name_prefix}::file::${debug_extra}${name_extra}" tool="linker" toolid="${ndll-tool}">

<outdir name="../ndll/${BINDIR}"/>
<ext value=".ndll" unless="mobile"/>
<files id="common"/>

</target>

<target id="default">

<target id="NDLL"/>

</target>

</xml>
14 changes: 14 additions & 0 deletions templates/extension/project/common/Extension.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "Utils.h"


namespace ::extensionLowerCase:: {


int SampleMethod(int inputValue) {

return inputValue * 100;

}


}
33 changes: 33 additions & 0 deletions templates/extension/project/common/ExternalInterface.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef STATIC_LINK
#define IMPLEMENT_API
#endif

#if defined(HX_WINDOWS) || defined(HX_MACOS) || defined(HX_LINUX)
#define NEKO_COMPATIBLE
#endif


#include <hx/CFFI.h>
#include "Utils.h"


using namespace ::extensionLowerCase::;



static value ::extensionLowerCase::_sample_method (value inputValue) {

int returnValue = SampleMethod(val_int(inputValue));
return alloc_int(returnValue);

}
DEFINE_PRIM (::extensionLowerCase::_sample_method, 1);



extern "C" void ::extensionLowerCase::_main () {}
DEFINE_ENTRY_POINT (::extensionLowerCase::_main);



extern "C" int ::extensionLowerCase::_register_prims () { return 0; }
14 changes: 14 additions & 0 deletions templates/extension/project/include/Utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef ::extensionUpperCase::_H
#define ::extensionUpperCase::_H


namespace ::extensionLowerCase:: {


int SampleMethod(int inputValue);


}


#endif
17 changes: 17 additions & 0 deletions templates/project/Assets/nme.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions templates/project/Project.hxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<project version="2">
<!-- Output SWF options -->
<output>
<movie outputType="Application" />
<movie input="" />
<movie path="project.nmml" />
<movie fps="30" />
<movie width="800" />
<movie height="600" />
<movie version="3" />
<movie minorVersion="0" />
<movie platform="NME" />
<movie background="#FFFFFF" />
</output>
<!-- Other classes to be compiled into your SWF -->
<classpaths>
<class path="Source" />
</classpaths>
<!-- Build options -->
<build>
<option directives="" />
<option flashStrict="False" />
<option mainClass="::packageName::" />
<option enabledebug="False" />
<option additional="" />
</build>
<!-- haxelib libraries -->
<haxelib>
<library name="nme" />
<library name="actuate" />
</haxelib>
<!-- Class files to compile (other referenced classes will automatically be included) -->
<compileTargets>
<!-- example: <compile path="..." /> -->
</compileTargets>
<!-- Assets to embed into the output SWF -->
<library>
<!-- example: <asset path="..." id="..." update="..." glyphs="..." mode="..." place="..." sharepoint="..." /> -->
</library>
<!-- Paths to exclude from the Project Explorer tree -->
<hiddenPaths>
<!-- example: <hidden path="..." /> -->
</hiddenPaths>
<!-- Executed before build -->
<preBuildCommand />
<!-- Executed after build -->
<postBuildCommand alwaysRun="False" />
<!-- Other project options -->
<options>
<option showHiddenPaths="False" />
<option testMovie="Custom" />
<option testMovieCommand="" />
</options>
<!-- Plugin storage -->
<storage />
</project>
13 changes: 13 additions & 0 deletions templates/project/Source/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import flash.display.Sprite;

class Main extends Sprite {

public function new () {

super ();



}

}
14 changes: 14 additions & 0 deletions templates/project/project.nmml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<project>

<meta title="::title::" package="::packageName::" version="::version::" company="::company::" />
<app main="Main" path="Export" file="::file::" />

<source path="Source" />

<haxelib name="pazu" />

<assets path="Assets" rename="assets" exclude="nme.svg" />
<icon path="Assets/nme.svg" />

</project>

0 comments on commit 4e7e20d

Please sign in to comment.