BindCmd.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include <Atomic/Core/Context.h>
  2. #include <Atomic/Core/StringUtils.h>
  3. #include <Atomic/IO/Log.h>
  4. #include <Atomic/IO/File.h>
  5. #include "../ToolSystem.h"
  6. #include "../ToolEnvironment.h"
  7. #include "../JSBind/JSBind.h"
  8. #include "BindCmd.h"
  9. namespace ToolCore
  10. {
  11. BindCmd::BindCmd(Context* context) : Command(context)
  12. {
  13. }
  14. BindCmd::~BindCmd()
  15. {
  16. }
  17. bool BindCmd::Parse(const Vector<String>& arguments, unsigned startIndex, String& errorMsg)
  18. {
  19. String argument = arguments[startIndex].ToLower();
  20. String value = startIndex + 1 < arguments.Size() ? arguments[startIndex + 1] : String::EMPTY;
  21. if (argument != "bind")
  22. {
  23. errorMsg = "Unable to parse bind command";
  24. return false;
  25. }
  26. return true;
  27. }
  28. void BindCmd::Run()
  29. {
  30. ToolEnvironment* env = GetSubsystem<ToolEnvironment>();
  31. bindPlatform_ = "MACOSX";
  32. sourceRootFolder_ = env->GetRootSourceDir();
  33. packageFolder_ = "Source/AtomicJS/Packages/ToolCore/";
  34. SharedPtr<JSBind> jsbind(new JSBind(context_));
  35. context_->RegisterSubsystem(jsbind);
  36. LOGINFOF("Generating JS Bindings");
  37. jsbind->GenerateBindings(sourceRootFolder_, packageFolder_, bindPlatform_);
  38. Finished();
  39. }
  40. }