diff --git a/samples/Javascript/Shared b/samples/Javascript/Shared
index 7f2eb3cb30..999fabb306 160000
--- a/samples/Javascript/Shared
+++ b/samples/Javascript/Shared
@@ -1 +1 @@
-Subproject commit 7f2eb3cb30e548f0253b1d851b9930dd2cde7296
+Subproject commit 999fabb306cddffd0c043ee1cff6e8627ac0df24
diff --git a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp
index ab228a448e..5c82c478a1 100644
--- a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp
+++ b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp
@@ -46,8 +46,11 @@ bool AppDelegate::applicationDidFinishLaunching()
CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
+#ifdef JS_OBFUSCATED
+ ScriptingCore::getInstance()->runScript("game.js");
+#else
ScriptingCore::getInstance()->runScript("tests-boot-jsb.js");
-
+#endif
return true;
}
diff --git a/samples/Javascript/TestJavascript/game.js.REMOVED.git-id b/samples/Javascript/TestJavascript/game.js.REMOVED.git-id
new file mode 100644
index 0000000000..989e347537
--- /dev/null
+++ b/samples/Javascript/TestJavascript/game.js.REMOVED.git-id
@@ -0,0 +1 @@
+e1f03e3925993f54e478def7760c0c849140f5d3
\ No newline at end of file
diff --git a/samples/Javascript/TestJavascript/obfuscate.xml b/samples/Javascript/TestJavascript/obfuscate.xml
new file mode 100644
index 0000000000..3be4846e46
--- /dev/null
+++ b/samples/Javascript/TestJavascript/obfuscate.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id
index 9b1c9cf749..5fc75e26b9 100644
--- a/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id
+++ b/samples/Javascript/TestJavascript/proj.ios/TestJavascript.xcodeproj/project.pbxproj.REMOVED.git-id
@@ -1 +1 @@
-8b69641f7f7438303572b802404917dced43feab
\ No newline at end of file
+0b29dbaef87c1e7f69eea235667a2e278bec0062
\ No newline at end of file
diff --git a/scripting/javascript/bindings/js/jsb.js b/scripting/javascript/bindings/js/jsb.js
index 79bc0c8e5b..524e0dc53b 100644
--- a/scripting/javascript/bindings/js/jsb.js
+++ b/scripting/javascript/bindings/js/jsb.js
@@ -3,9 +3,12 @@
//
// DO NOT ALTER THE ORDER
+require('jsb_cocos2d_constants.js');
require('jsb_cocos2d.js');
require('jsb_cocos2d_extension.js');
+require('jsb_chipmunk_constants.js');
require('jsb_chipmunk.js');
+require('jsb_opengl_constants.js');
require('jsb_opengl.js');
require('jsb_cocosbuilder.js');
require('jsb_sys.js');
diff --git a/scripting/javascript/bindings/js/jsb_chipmunk.js b/scripting/javascript/bindings/js/jsb_chipmunk.js
index be1537f204..ba8613f4c1 100644
--- a/scripting/javascript/bindings/js/jsb_chipmunk.js
+++ b/scripting/javascript/bindings/js/jsb_chipmunk.js
@@ -2,8 +2,6 @@
// Chipmunk defines
//
-require('jsb_chipmunk_constants.js');
-
var cp = cp || {};
cp.v = cc.p;
diff --git a/scripting/javascript/bindings/js/jsb_cocos2d.js b/scripting/javascript/bindings/js/jsb_cocos2d.js
index 0de077de52..32e718ff0c 100644
--- a/scripting/javascript/bindings/js/jsb_cocos2d.js
+++ b/scripting/javascript/bindings/js/jsb_cocos2d.js
@@ -2,8 +2,6 @@
// cocos2d constants
//
-require('jsb_cocos2d_constants.js');
-
var cc = cc || {};
cc.DIRECTOR_PROJECTION_2D = 0;
@@ -383,8 +381,8 @@ cc.associateWithNative = function( jsobj, superclass_or_instance ) {
try {
// Used when subclassing using the "extend" method
- var native = new superclass_or_instance();
- __associateObjWithNative( jsobj, native );
+ var nativeObj = new superclass_or_instance();
+ __associateObjWithNative( jsobj, nativeObj );
} catch(err) {
// Used when subclassing using the goog.inherits method
__associateObjWithNative( jsobj, superclass_or_instance );
diff --git a/scripting/javascript/bindings/obfuscate/obfuscate_exclude_chipmunk.js b/scripting/javascript/bindings/obfuscate/obfuscate_exclude_chipmunk.js
new file mode 100644
index 0000000000..159c9493c3
--- /dev/null
+++ b/scripting/javascript/bindings/obfuscate/obfuscate_exclude_chipmunk.js
@@ -0,0 +1,602 @@
+/**
+ * @fileoverview Java Script Builtins for windows properties.
+ *
+ * @externs
+ */
+
+/**
+ * @see https://cocos2d-x.org
+ */
+
+/**
+ * for chipmunk api
+ * @type {string}
+ */
+var cp = function(){};
+
+CSSProperties.prototype.cp;
+CSSProperties.prototype.momentForCircle;
+CSSProperties.prototype.areaForCircle;
+CSSProperties.prototype.momentForSegment;
+CSSProperties.prototype.areaForSegment;
+CSSProperties.prototype.momentForPoly;
+CSSProperties.prototype.areaForPoly;
+CSSProperties.prototype.centroidForPoly;
+CSSProperties.prototype.recenterPoly;
+CSSProperties.prototype.momentForBox;
+CSSProperties.prototype.momentForBox2;
+CSSProperties.prototype.clamp01;
+CSSProperties.prototype.fclamp01;
+CSSProperties.prototype.Vect;
+CSSProperties.prototype.add;
+CSSProperties.prototype.sub;
+CSSProperties.prototype.neg;
+CSSProperties.prototype.mult;
+CSSProperties.prototype.project;
+CSSProperties.prototype.rotate;
+CSSProperties.prototype.v;
+CSSProperties.prototype.dot;
+CSSProperties.prototype.len;
+CSSProperties.prototype.eql;
+CSSProperties.prototype.cross;
+CSSProperties.prototype.perp;
+CSSProperties.prototype.pvrperp;
+CSSProperties.prototype.unrotate;
+CSSProperties.prototype.lengthsq;
+CSSProperties.prototype.lerp;
+CSSProperties.prototype.normalize;
+CSSProperties.prototype.normalize_safe;
+CSSProperties.prototype.clamp;
+CSSProperties.prototype.lerpconst;
+CSSProperties.prototype.dist;
+CSSProperties.prototype.distsq;
+CSSProperties.prototype.near;
+CSSProperties.prototype.slerp;
+CSSProperties.prototype.slerpconst;
+CSSProperties.prototype.forangle;
+CSSProperties.prototype.toangle;
+CSSProperties.prototype.str;
+CSSProperties.prototype.vzero;
+CSSProperties.prototype.x;
+CSSProperties.prototype.y;
+CSSProperties.prototype.BB;
+CSSProperties.prototype.bb;
+CSSProperties.prototype.NO_GROUP;
+CSSProperties.prototype.ALL_LAYERS;
+CSSProperties.prototype.resetShapeIdCounter;
+CSSProperties.prototype.Shape;
+CSSProperties.prototype.setElasticity;
+CSSProperties.prototype.setFriction;
+CSSProperties.prototype.setLayers;
+CSSProperties.prototype.setSensor;
+CSSProperties.prototype.setCollisionType;
+CSSProperties.prototype.getBody;
+CSSProperties.prototype.active;
+CSSProperties.prototype.setBody;
+CSSProperties.prototype.cacheBB;
+CSSProperties.prototype.update;
+CSSProperties.prototype.getBB;
+CSSProperties.prototype.CircleShape;
+CSSProperties.prototype.cacheData;
+CSSProperties.prototype.pointQuery;
+CSSProperties.prototype.segmentQuery;
+CSSProperties.prototype.collisionCode;
+CSSProperties.prototype.collisionTable;
+CSSProperties.prototype.SegmentShape;
+CSSProperties.prototype.setNeighbors;
+CSSProperties.prototype.setEndpoints;
+CSSProperties.prototype.PolyShape;
+CSSProperties.prototype.setVerts;
+CSSProperties.prototype.transformVerts;
+CSSProperties.prototype.transformAxes;
+CSSProperties.prototype.getNumVerts;
+CSSProperties.prototype.getVert;
+CSSProperties.prototype.valueOnAxis;
+CSSProperties.prototype.containsVert;
+CSSProperties.prototype.containsVertPartial;
+CSSProperties.prototype.BoxShape;
+CSSProperties.prototype.BoxShape2;
+CSSProperties.prototype.Body;
+CSSProperties.prototype.sanityCheck;
+CSSProperties.prototype.getPos;
+CSSProperties.prototype.getVel;
+CSSProperties.prototype.getAngVel;
+CSSProperties.prototype.isSleeping;
+CSSProperties.prototype.isStatic;
+CSSProperties.prototype.isRogue;
+CSSProperties.prototype.setMass;
+CSSProperties.prototype.setMoment;
+CSSProperties.prototype.addShape;
+CSSProperties.prototype.removeShape;
+CSSProperties.prototype.removeConstraint;
+CSSProperties.prototype.setPos;
+CSSProperties.prototype.setVel;
+CSSProperties.prototype.setAngVel;
+CSSProperties.prototype.setAngleInternal;
+CSSProperties.prototype.setAngle;
+CSSProperties.prototype.velocity_func;
+CSSProperties.prototype.position_func;
+CSSProperties.prototype.resetForces;
+CSSProperties.prototype.applyForce;
+CSSProperties.prototype.applyImpulse;
+CSSProperties.prototype.getVelAtPoint;
+CSSProperties.prototype.getVelAtWorldPoint;
+CSSProperties.prototype.getVelAtLocalPoint;
+CSSProperties.prototype.eachShape;
+CSSProperties.prototype.eachConstraint;
+CSSProperties.prototype.eachArbiter;
+CSSProperties.prototype.local2World;
+CSSProperties.prototype.world2Local;
+CSSProperties.prototype.kineticEnergy;
+CSSProperties.prototype.activate;
+CSSProperties.prototype.activateStatic;
+CSSProperties.prototype.pushArbiter;
+CSSProperties.prototype.sleep;
+CSSProperties.prototype.sleepWithGroup;
+CSSProperties.prototype.StaticBody;
+CSSProperties.prototype.SpatialIndex;
+CSSProperties.prototype.collideStatic;
+CSSProperties.prototype.BBTree;
+CSSProperties.prototype.getStamp;
+CSSProperties.prototype.incrementStamp;
+CSSProperties.prototype.insert;
+CSSProperties.prototype.remove;
+CSSProperties.prototype.contains;
+CSSProperties.prototype.reindexQuery;
+CSSProperties.prototype.reindex;
+CSSProperties.prototype.reindexObject;
+CSSProperties.prototype.query;
+CSSProperties.prototype.count;
+CSSProperties.prototype.each;
+CSSProperties.prototype.optimize;
+CSSProperties.prototype.log;
+CSSProperties.prototype.CollisionHandler;
+CSSProperties.prototype.begin;
+CSSProperties.prototype.preSolve;
+CSSProperties.prototype.postSolve;
+CSSProperties.prototype.separate;
+CSSProperties.prototype.collideShapes;
+CSSProperties.prototype.Space;
+CSSProperties.prototype.getCurrentTimeStep;
+CSSProperties.prototype.isLocked;
+CSSProperties.prototype.addCollisionHandler;
+CSSProperties.prototype.removeCollisionHandler;
+CSSProperties.prototype.setDefaultCollisionHandler;
+CSSProperties.prototype.lookupHandler;
+CSSProperties.prototype.addStaticShape;
+CSSProperties.prototype.addBody;
+CSSProperties.prototype.addConstraint;
+CSSProperties.prototype.filterArbiters;
+CSSProperties.prototype.removeStaticShape;
+CSSProperties.prototype.removeBody;
+CSSProperties.prototype.containsShape;
+CSSProperties.prototype.containsBody;
+CSSProperties.prototype.containsConstraint;
+CSSProperties.prototype.uncacheArbiter;
+CSSProperties.prototype.eachBody;
+CSSProperties.prototype.reindexStatic;
+CSSProperties.prototype.reindexShape;
+CSSProperties.prototype.reindexShapesForBody;
+CSSProperties.prototype.useSpatialHash;
+CSSProperties.prototype.activateBody;
+CSSProperties.prototype.deactivateBody;
+CSSProperties.prototype.processComponents;
+CSSProperties.prototype.activateShapesTouchingShape;
+CSSProperties.prototype.pointQueryFirst;
+CSSProperties.prototype.segmentQueryFirst;
+CSSProperties.prototype.bbQuery;
+CSSProperties.prototype.shapeQuery;
+CSSProperties.prototype.addPostStepCallback;
+CSSProperties.prototype.runPostStepCallbacks;
+CSSProperties.prototype.lock;
+CSSProperties.prototype.unlock;
+CSSProperties.prototype.makeCollideShapes;
+CSSProperties.prototype.arbiterSetFilter;
+CSSProperties.prototype.step;
+CSSProperties.prototype.Constraint;
+CSSProperties.prototype.activateBodies;
+CSSProperties.prototype.preStep;
+CSSProperties.prototype.applyCachedImpulse;
+CSSProperties.prototype.getImpulse;
+CSSProperties.prototype.next;
+CSSProperties.prototype.PinJoint;
+CSSProperties.prototype.SlideJoint;
+CSSProperties.prototype.PivotJoint;
+CSSProperties.prototype.GrooveJoint;
+CSSProperties.prototype.grooveConstrain;
+CSSProperties.prototype.setGrooveA;
+CSSProperties.prototype.setGrooveB;
+CSSProperties.prototype.DampedSpring;
+CSSProperties.prototype.DampedRotarySpring;
+CSSProperties.prototype.RotaryLimitJoint;
+CSSProperties.prototype.RatchetJoint;
+CSSProperties.prototype.GearJoint;
+CSSProperties.prototype.setRatio;
+CSSProperties.prototype.SimpleMotor;
+CSSProperties.prototype.Base;
+CSSProperties.prototype._v;
+CSSProperties.prototype.vadd;
+CSSProperties.prototype.getHandle;
+CSSProperties.prototype.getGravity;
+CSSProperties.prototype.getIterations;
+CSSProperties.prototype.getDamping;
+CSSProperties.prototype.getStaticBody;
+CSSProperties.prototype.getIdleSpeedThreshold;
+CSSProperties.prototype.getSleepTimeThreshold;
+CSSProperties.prototype.getCollisionSlop;
+CSSProperties.prototype.getCollisionBias;
+CSSProperties.prototype.getCollisionPersistence;
+CSSProperties.prototype.getEnableContactGraph;
+CSSProperties.prototype.getAngle;
+CSSProperties.prototype.getAngVel;
+CSSProperties.prototype.getPos;
+CSSProperties.prototype.getVel;
+CSSProperties.prototype.getMoment;
+CSSProperties.prototype.getBody;
+CSSProperties.prototype.getGroup;
+CSSProperties.prototype.getCollisionType;
+CSSProperties.prototype.getMaxForce;
+CSSProperties.prototype.getAnchr1;
+CSSProperties.prototype.getAnchr2;
+CSSProperties.prototype.setHandle;
+CSSProperties.prototype._setSpace;
+CSSProperties.prototype._setCPBody;
+CSSProperties.prototype.setGravity;
+CSSProperties.prototype.setIterations;
+CSSProperties.prototype.setDamping;
+CSSProperties.prototype.setStaticBody;
+CSSProperties.prototype.setIdleSpeedThreshold;
+CSSProperties.prototype.setSleepTimeThreshold;
+CSSProperties.prototype.setCollisionSlop;
+CSSProperties.prototype.setCollisionBias;
+CSSProperties.prototype.setCollisionPersistence;
+CSSProperties.prototype.setEnableContactGraph;
+CSSProperties.prototype.setAngle;
+CSSProperties.prototype.setAngVel;
+CSSProperties.prototype.setPos;
+CSSProperties.prototype.setVel;
+CSSProperties.prototype.setMoment;
+CSSProperties.prototype.setBody;
+CSSProperties.prototype.setGroup;
+CSSProperties.prototype.setCollisionType;
+CSSProperties.prototype.setMaxForce;
+CSSProperties.prototype.setAnchr1;
+CSSProperties.prototype.setAnchr2;
+CSSProperties.prototype.vclamp;
+CSSProperties.prototype.vcross;
+CSSProperties.prototype.vdist;
+CSSProperties.prototype.vdistsq;
+CSSProperties.prototype.vdot;
+CSSProperties.prototype.veql;
+CSSProperties.prototype.vforangle;
+CSSProperties.prototype.vlength;
+CSSProperties.prototype.vlengthsq;
+CSSProperties.prototype.vlerp;
+CSSProperties.prototype.vlerpconst;
+CSSProperties.prototype.vmult;
+CSSProperties.prototype.vnear;
+CSSProperties.prototype.vneg;
+CSSProperties.prototype.vnormalize;
+CSSProperties.prototype.vnormalize_safe;
+CSSProperties.prototype.vperp;
+CSSProperties.prototype.vproject;
+CSSProperties.prototype.vrotate;
+CSSProperties.prototype.vrperp;
+CSSProperties.prototype.vslerp;
+CSSProperties.prototype.vslerpconst;
+CSSProperties.prototype.vsub;
+CSSProperties.prototype.vtoangle;
+CSSProperties.prototype.vunrotate;
+CSSProperties.prototype.l;
+CSSProperties.prototype.b;
+CSSProperties.prototype.t;
+CSSProperties.prototype.r;
+CSSProperties.prototype.a;
+CSSProperties.prototype.w;
+CSSProperties.prototype.p;
+CSSProperties.prototype.i;
+CSSProperties.prototype.handle;
+CSSProperties.prototype.gravity;
+CSSProperties.prototype.iterations;
+CSSProperties.prototype.damping;
+CSSProperties.prototype.staticBody;
+CSSProperties.prototype.idleSpeedThreshold;
+CSSProperties.prototype.sleepTimeThreshold;
+CSSProperties.prototype.collisionSlop;
+CSSProperties.prototype.collisionBias;
+CSSProperties.prototype.collisionPersistence;
+CSSProperties.prototype.enableContactGraph;
+CSSProperties.prototype.group;
+CSSProperties.prototype.collision_type;
+CSSProperties.prototype.maxForce;
+CSSProperties.prototype.anchr1;
+CSSProperties.prototype.anchr2;
+CSSProperties.prototype.collisionBegin;
+CSSProperties.prototype.collisionPre;
+CSSProperties.prototype.collisionPost;
+CSSProperties.prototype.collisionSeparate;
+CSSProperties.prototype.createPhysicsSprite;
+CSSProperties.prototype.Arbiter;
+CSSProperties.prototype.spaceAddCollisionHandler;
+CSSProperties.prototype.spaceRemoveCollisionHandler;
+CSSProperties.prototype.arbiterGetBodies;
+CSSProperties.prototype.arbiterGetShapes;
+CSSProperties.prototype.bodyGetUserData;
+CSSProperties.prototype.bodySetUserData;
+CSSProperties.prototype.getBodies;
+CSSProperties.prototype.getShapes;
+CSSProperties.prototype.getUserData;
+CSSProperties.prototype.setUserData;
+CSSProperties.prototype.arbiterGetCount;
+CSSProperties.prototype.arbiterGetDepth;
+CSSProperties.prototype.arbiterGetElasticity;
+CSSProperties.prototype.arbiterGetFriction;
+CSSProperties.prototype.arbiterGetNormal;
+CSSProperties.prototype.arbiterGetPoint;
+CSSProperties.prototype.arbiterGetSurfaceVelocity;
+CSSProperties.prototype.arbiterIgnore;
+CSSProperties.prototype.arbiterIsFirstContact;
+CSSProperties.prototype.arbiterSetElasticity;
+CSSProperties.prototype.arbiterSetFriction;
+CSSProperties.prototype.arbiterSetSurfaceVelocity;
+CSSProperties.prototype.arbiterTotalImpulse;
+CSSProperties.prototype.arbiterTotalImpulseWithFriction;
+CSSProperties.prototype.arbiterTotalKE;
+CSSProperties.prototype.areaForCircle;
+CSSProperties.prototype.areaForSegment;
+CSSProperties.prototype.bBArea;
+CSSProperties.prototype.bBClampVect;
+CSSProperties.prototype.bBContainsBB;
+CSSProperties.prototype.bBContainsVect;
+CSSProperties.prototype.bBExpand;
+CSSProperties.prototype.bBIntersects;
+CSSProperties.prototype.bBIntersectsSegment;
+CSSProperties.prototype.bBMerge;
+CSSProperties.prototype.bBMergedArea;
+CSSProperties.prototype.bBNew;
+CSSProperties.prototype.bBNewForCircle;
+CSSProperties.prototype.bBSegmentQuery;
+CSSProperties.prototype.bBWrapVect;
+CSSProperties.prototype.bodyActivate;
+CSSProperties.prototype.bodyActivateStatic;
+CSSProperties.prototype.bodyApplyForce;
+CSSProperties.prototype.bodyApplyImpulse;
+CSSProperties.prototype.bodyDestroy;
+CSSProperties.prototype.bodyFree;
+CSSProperties.prototype.bodyGetAngVel;
+CSSProperties.prototype.bodyGetAngVelLimit;
+CSSProperties.prototype.bodyGetAngle;
+CSSProperties.prototype.bodyGetForce;
+CSSProperties.prototype.bodyGetMass;
+CSSProperties.prototype.bodyGetMoment;
+CSSProperties.prototype.bodyGetPos;
+CSSProperties.prototype.bodyGetRot;
+CSSProperties.prototype.bodyGetSpace;
+CSSProperties.prototype.bodyGetTorque;
+CSSProperties.prototype.bodyGetVel;
+CSSProperties.prototype.bodyGetVelAtLocalPoint;
+CSSProperties.prototype.bodyGetVelAtWorldPoint;
+CSSProperties.prototype.bodyGetVelLimit;
+CSSProperties.prototype.bodyInit;
+CSSProperties.prototype.bodyInitStatic;
+CSSProperties.prototype.bodyIsRogue;
+CSSProperties.prototype.bodyIsSleeping;
+CSSProperties.prototype.bodyIsStatic;
+CSSProperties.prototype.bodyKineticEnergy;
+CSSProperties.prototype.bodyLocal2World;
+CSSProperties.prototype.bodyNew;
+CSSProperties.prototype.bodyNewStatic;
+CSSProperties.prototype.bodyResetForces;
+CSSProperties.prototype.bodySetAngVel;
+CSSProperties.prototype.bodySetAngVelLimit;
+CSSProperties.prototype.bodySetAngle;
+CSSProperties.prototype.bodySetForce;
+CSSProperties.prototype.bodySetMass;
+CSSProperties.prototype.bodySetMoment;
+CSSProperties.prototype.bodySetPos;
+CSSProperties.prototype.bodySetTorque;
+CSSProperties.prototype.bodySetVel;
+CSSProperties.prototype.bodySetVelLimit;
+CSSProperties.prototype.bodySleep;
+CSSProperties.prototype.bodySleepWithGroup;
+CSSProperties.prototype.bodyUpdatePosition;
+CSSProperties.prototype.bodyUpdateVelocity;
+CSSProperties.prototype.bodyWorld2Local;
+CSSProperties.prototype.boxShapeNew;
+CSSProperties.prototype.boxShapeNew2;
+CSSProperties.prototype.circleShapeGetOffset;
+CSSProperties.prototype.circleShapeGetRadius;
+CSSProperties.prototype.circleShapeNew;
+CSSProperties.prototype.constraintActivateBodies;
+CSSProperties.prototype.constraintDestroy;
+CSSProperties.prototype.constraintFree;
+CSSProperties.prototype.constraintGetA;
+CSSProperties.prototype.constraintGetB;
+CSSProperties.prototype.constraintGetErrorBias;
+CSSProperties.prototype.constraintGetImpulse;
+CSSProperties.prototype.constraintGetMaxBias;
+CSSProperties.prototype.constraintGetMaxForce;
+CSSProperties.prototype.constraintGetSpace;
+CSSProperties.prototype.constraintSetErrorBias;
+CSSProperties.prototype.constraintSetMaxBias;
+CSSProperties.prototype.constraintSetMaxForce;
+CSSProperties.prototype.dampedRotarySpringGetDamping;
+CSSProperties.prototype.dampedRotarySpringGetRestAngle;
+CSSProperties.prototype.dampedRotarySpringGetStiffness;
+CSSProperties.prototype.dampedRotarySpringNew;
+CSSProperties.prototype.dampedRotarySpringSetDamping;
+CSSProperties.prototype.dampedRotarySpringSetRestAngle;
+CSSProperties.prototype.dampedRotarySpringSetStiffness;
+CSSProperties.prototype.dampedSpringGetAnchr1;
+CSSProperties.prototype.dampedSpringGetAnchr2;
+CSSProperties.prototype.dampedSpringGetDamping;
+CSSProperties.prototype.dampedSpringGetRestLength;
+CSSProperties.prototype.dampedSpringGetStiffness;
+CSSProperties.prototype.dampedSpringNew;
+CSSProperties.prototype.dampedSpringSetAnchr1;
+CSSProperties.prototype.dampedSpringSetAnchr2;
+CSSProperties.prototype.dampedSpringSetDamping;
+CSSProperties.prototype.dampedSpringSetRestLength;
+CSSProperties.prototype.dampedSpringSetStiffness;
+CSSProperties.prototype.gearJointGetPhase;
+CSSProperties.prototype.gearJointGetRatio;
+CSSProperties.prototype.gearJointNew;
+CSSProperties.prototype.gearJointSetPhase;
+CSSProperties.prototype.gearJointSetRatio;
+CSSProperties.prototype.grooveJointGetAnchr2;
+CSSProperties.prototype.grooveJointGetGrooveA;
+CSSProperties.prototype.grooveJointGetGrooveB;
+CSSProperties.prototype.grooveJointNew;
+CSSProperties.prototype.grooveJointSetAnchr2;
+CSSProperties.prototype.grooveJointSetGrooveA;
+CSSProperties.prototype.grooveJointSetGrooveB;
+CSSProperties.prototype.initChipmunk;
+CSSProperties.prototype.momentForBox;
+CSSProperties.prototype.momentForBox2;
+CSSProperties.prototype.momentForCircle;
+CSSProperties.prototype.momentForSegment;
+CSSProperties.prototype.pinJointGetAnchr1;
+CSSProperties.prototype.pinJointGetAnchr2;
+CSSProperties.prototype.pinJointGetDist;
+CSSProperties.prototype.pinJointNew;
+CSSProperties.prototype.pinJointSetAnchr1;
+CSSProperties.prototype.pinJointSetAnchr2;
+CSSProperties.prototype.pinJointSetDist;
+CSSProperties.prototype.pivotJointGetAnchr1;
+CSSProperties.prototype.pivotJointGetAnchr2;
+CSSProperties.prototype.pivotJointNew;
+CSSProperties.prototype.pivotJointNew2;
+CSSProperties.prototype.pivotJointSetAnchr1;
+CSSProperties.prototype.pivotJointSetAnchr2;
+CSSProperties.prototype.polyShapeGetNumVerts;
+CSSProperties.prototype.polyShapeGetVert;
+CSSProperties.prototype.ratchetJointGetAngle;
+CSSProperties.prototype.ratchetJointGetPhase;
+CSSProperties.prototype.ratchetJointGetRatchet;
+CSSProperties.prototype.ratchetJointNew;
+CSSProperties.prototype.ratchetJointSetAngle;
+CSSProperties.prototype.ratchetJointSetPhase;
+CSSProperties.prototype.ratchetJointSetRatchet;
+CSSProperties.prototype.resetShapeIdCounter;
+CSSProperties.prototype.rotaryLimitJointGetMax;
+CSSProperties.prototype.rotaryLimitJointGetMin;
+CSSProperties.prototype.rotaryLimitJointNew;
+CSSProperties.prototype.rotaryLimitJointSetMax;
+CSSProperties.prototype.rotaryLimitJointSetMin;
+CSSProperties.prototype.segmentShapeGetA;
+CSSProperties.prototype.segmentShapeGetB;
+CSSProperties.prototype.segmentShapeGetNormal;
+CSSProperties.prototype.segmentShapeGetRadius;
+CSSProperties.prototype.segmentShapeNew;
+CSSProperties.prototype.segmentShapeSetNeighbors;
+CSSProperties.prototype.shapeCacheBB;
+CSSProperties.prototype.shapeDestroy;
+CSSProperties.prototype.shapeFree;
+CSSProperties.prototype.shapeGetBB;
+CSSProperties.prototype.shapeGetBody;
+CSSProperties.prototype.shapeGetCollisionType;
+CSSProperties.prototype.shapeGetElasticity;
+CSSProperties.prototype.shapeGetFriction;
+CSSProperties.prototype.shapeGetGroup;
+CSSProperties.prototype.shapeGetLayers;
+CSSProperties.prototype.shapeGetSensor;
+CSSProperties.prototype.shapeGetSurfaceVelocity;
+CSSProperties.prototype.shapePointQuery;
+CSSProperties.prototype.shapeSetBody;
+CSSProperties.prototype.shapeSetCollisionType;
+CSSProperties.prototype.shapeSetElasticity;
+CSSProperties.prototype.shapeSetFriction;
+CSSProperties.prototype.shapeSetGroup;
+CSSProperties.prototype.shapeSetLayers;
+CSSProperties.prototype.shapeSetSensor;
+CSSProperties.prototype.shapeSetSurfaceVelocity;
+CSSProperties.prototype.shapeUpdate;
+CSSProperties.prototype.simpleMotorGetRate;
+CSSProperties.prototype.simpleMotorNew;
+CSSProperties.prototype.simpleMotorSetRate;
+CSSProperties.prototype.slideJointGetAnchr1;
+CSSProperties.prototype.slideJointGetAnchr2;
+CSSProperties.prototype.slideJointGetMax;
+CSSProperties.prototype.slideJointGetMin;
+CSSProperties.prototype.slideJointNew;
+CSSProperties.prototype.slideJointSetAnchr1;
+CSSProperties.prototype.slideJointSetAnchr2;
+CSSProperties.prototype.slideJointSetMax;
+CSSProperties.prototype.slideJointSetMin;
+CSSProperties.prototype.spaceActivateShapesTouchingShape;
+CSSProperties.prototype.spaceAddBody;
+CSSProperties.prototype.spaceAddConstraint;
+CSSProperties.prototype.spaceAddShape;
+CSSProperties.prototype.spaceAddStaticShape;
+CSSProperties.prototype.spaceContainsBody;
+CSSProperties.prototype.spaceContainsConstraint;
+CSSProperties.prototype.spaceContainsShape;
+CSSProperties.prototype.spaceDestroy;
+CSSProperties.prototype.spaceFree;
+CSSProperties.prototype.spaceGetCollisionBias;
+CSSProperties.prototype.spaceGetCollisionPersistence;
+CSSProperties.prototype.spaceGetCollisionSlop;
+CSSProperties.prototype.spaceGetCurrentTimeStep;
+CSSProperties.prototype.spaceGetDamping;
+CSSProperties.prototype.spaceGetEnableContactGraph;
+CSSProperties.prototype.spaceGetGravity;
+CSSProperties.prototype.spaceGetIdleSpeedThreshold;
+CSSProperties.prototype.spaceGetIterations;
+CSSProperties.prototype.spaceGetSleepTimeThreshold;
+CSSProperties.prototype.spaceGetStaticBody;
+CSSProperties.prototype.spaceInit;
+CSSProperties.prototype.spaceIsLocked;
+CSSProperties.prototype.spaceNew;
+CSSProperties.prototype.spacePointQueryFirst;
+CSSProperties.prototype.spaceReindexShape;
+CSSProperties.prototype.spaceReindexShapesForBody;
+CSSProperties.prototype.spaceReindexStatic;
+CSSProperties.prototype.spaceRemoveBody;
+CSSProperties.prototype.spaceRemoveConstraint;
+CSSProperties.prototype.spaceRemoveShape;
+CSSProperties.prototype.spaceRemoveStaticShape;
+CSSProperties.prototype.spaceSetCollisionBias;
+CSSProperties.prototype.spaceSetCollisionPersistence;
+CSSProperties.prototype.spaceSetCollisionSlop;
+CSSProperties.prototype.spaceSetDamping;
+CSSProperties.prototype.spaceSetEnableContactGraph;
+CSSProperties.prototype.spaceSetGravity;
+CSSProperties.prototype.spaceSetIdleSpeedThreshold;
+CSSProperties.prototype.spaceSetIterations;
+CSSProperties.prototype.spaceSetSleepTimeThreshold;
+CSSProperties.prototype.spaceStep;
+CSSProperties.prototype.spaceUseSpatialHash;
+CSSProperties.prototype.fabs;
+CSSProperties.prototype.fclamp;
+CSSProperties.prototype.fclamp01;
+CSSProperties.prototype.flerp;
+CSSProperties.prototype.shapeGetSpace;
+CSSProperties.prototype.flerpconst;
+CSSProperties.prototype.fmax;
+CSSProperties.prototype.fmin;
+CSSProperties.prototype.vadd;
+CSSProperties.prototype.vclamp;
+CSSProperties.prototype.vcross;
+CSSProperties.prototype.vdist;
+CSSProperties.prototype.vdistsq;
+CSSProperties.prototype.vdot;
+CSSProperties.prototype.veql;
+CSSProperties.prototype.vforangle;
+CSSProperties.prototype.vlength;
+CSSProperties.prototype.vlengthsq;
+CSSProperties.prototype.vlerp;
+CSSProperties.prototype.vlerpconst;
+CSSProperties.prototype.vmult;
+CSSProperties.prototype.vnear;
+CSSProperties.prototype.vneg;
+CSSProperties.prototype.vnormalize;
+CSSProperties.prototype.vnormalize_safe;
+CSSProperties.prototype.vperp;
+CSSProperties.prototype.vproject;
+CSSProperties.prototype.vrotate;
+CSSProperties.prototype.vrperp;
+CSSProperties.prototype.vslerp;
+CSSProperties.prototype.vslerpconst;
+CSSProperties.prototype.vsub;
+CSSProperties.prototype.vtoangle;
+CSSProperties.prototype.vunrotate;
\ No newline at end of file
diff --git a/scripting/javascript/bindings/obfuscate/obfuscate_exclude_cocos2d.js.REMOVED.git-id b/scripting/javascript/bindings/obfuscate/obfuscate_exclude_cocos2d.js.REMOVED.git-id
new file mode 100644
index 0000000000..1f98f8f036
--- /dev/null
+++ b/scripting/javascript/bindings/obfuscate/obfuscate_exclude_cocos2d.js.REMOVED.git-id
@@ -0,0 +1 @@
+f92eb40bc776570519509464d3f3ba6e9d93d3a9
\ No newline at end of file
diff --git a/tools/closure-compiler/compiler.jar.REMOVED.git-id b/tools/closure-compiler/compiler.jar.REMOVED.git-id
new file mode 100644
index 0000000000..bfeec63cdd
--- /dev/null
+++ b/tools/closure-compiler/compiler.jar.REMOVED.git-id
@@ -0,0 +1 @@
+3042ba36341406a67cfcb561c1c8cc08022c8485
\ No newline at end of file
diff --git a/tools/closure-compiler/obfuscate.py b/tools/closure-compiler/obfuscate.py
new file mode 100755
index 0000000000..dcbe2b1b90
--- /dev/null
+++ b/tools/closure-compiler/obfuscate.py
@@ -0,0 +1,125 @@
+#!/usr/bin/python
+# create_project.py
+# Create cross-platform cocos2d-x project
+# Copyright (c) 2012 cocos2d-x.org
+# Author: WangZhe
+
+# define global variables
+context = {
+ "input" : "undefined",
+ "output" : "undefined",
+ "cocos2d" : "undefined",
+}
+
+# begin
+import sys
+import os, os.path
+
+def dumpUsage():
+ print "Usage: generate-config.py -input INPUT_PATH -output OUTPUT_PATH -cocos2d COCOS2D_ROOT_PATH"
+ print "Options:"
+ print " -intput INPUT_PATH The path to javscript files directory"
+ print " -output OUTPUT_PATH The path to the obfuscated javascript file"
+ print " -cocos2d COCOS2D_ROOT_PATH The root path of cocos2d-x, e.g. /workspace/cocos2d-x"
+ print ""
+
+def checkParams():
+ # generate our internal params
+ context["script_path"] = os.getcwd() + "/"
+
+ if len(sys.argv) < 4:
+ dumpUsage()
+ sys.exit()
+
+ # fine params
+ for i in range(1, len(sys.argv)):
+ if "-input" == sys.argv[i]:
+ context["input"] = sys.argv[i+1]
+ elif "-output" == sys.argv[i]:
+ context["output"] = os.getcwd() + "/" + sys.argv[i+1]
+ elif "-cocos2d" == sys.argv[i]:
+ context["cocos2d"] = sys.argv[i+1]
+
+ # pinrt error log our required paramters are not ready
+ raise_error = False
+ if context["input"] == "undefined":
+ print "Invalid -input parameter"
+ raise_error = True
+ if context["output"] == "undefined":
+ print "Invalid -output parameter"
+ raise_error = True
+ if context["cocos2d"] == "undefined":
+ print "Invalid -cocos2d parameter"
+ raise_error = True
+ if raise_error != False:
+ sys.exit()
+# end of checkParams
+
+class FileInfo:
+ def __init__(self, filename, filepath):
+ self.filename = filename
+ self.filepath = filepath
+
+def getFiles(currentDir):
+ files = {
+ "js" : [],
+ "other" : [],
+ }
+ for root, dirs, file_list in os.walk(currentDir): # Walk directory tree
+ for f in file_list:
+ if f.find(".js") != -1:
+ files["js"].append(FileInfo(f, root))
+ else:
+ files["other"].append(FileInfo(f, root))
+ return files
+# end of getInfos
+
+def prepareConfigs():
+ config = {
+ "path_to_compiler": "undefiend",
+ "path_to_excludes": "undefined",
+ "path_to_sources": "undefined",
+ "sources": [],
+ }
+
+ config["path_to_compiler"] = context["cocos2d"] + "/tools/closure-compiler/compiler.jar"
+ config["path_to_excludes"] = context["cocos2d"] + "/scripting/javascript/bindings/obfuscate"
+ config["path_to_sources"] = "./" # don't use context["input"] here
+ config["path_to_output"] = context["output"] + "main.js"
+ config["js_files"] = ""
+
+ files = getFiles( context["input"] )
+
+ for item in files["js"]:
+ config["js_files"] += "" + "\n\t\t\t\t"
+
+ return config
+# end of prepareConfigs
+
+def generateXmlForCompiler():
+ print "preparing configs..."
+ config = prepareConfigs()
+ print "generating obfuscate.xml for google closure compiler"
+ f1 = open(context["cocos2d"] + "tools/closure-compiler/template.xml", "rb")
+ tmp = f1.read()
+ f1.close()
+ from string import Template
+ s = Template(tmp)
+ content = s.substitute( PATH_TO_COMPILER = config["path_to_compiler"],
+ PATH_TO_EXCLUDES = config["path_to_excludes"],
+ PATH_TO_OUTPUT = config["path_to_output"],
+ PATH_TO_SOURCES = config["path_to_sources"],
+ JS_FILES = config["js_files"] )
+
+ f2 = open(context["output"] + "obfuscate.xml", "wb")
+ f2.write(content)
+ f2.close()
+# end of generateXmlForCompiler
+
+# main
+checkParams()
+generateXmlForCompiler()
+print "running ant to generate obfuscated main.js"
+os.popen("ant -buildfile obfuscate.xml")
+print "done!"
+
diff --git a/tools/closure-compiler/template.xml b/tools/closure-compiler/template.xml
new file mode 100644
index 0000000000..28b4cd3a84
--- /dev/null
+++ b/tools/closure-compiler/template.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $JS_FILES
+
+
+
+
\ No newline at end of file