2
0
Эх сурвалжийг харах

dodola:兼容2021.1.3的Idea和Clion

littleheuer 4 жил өмнө
parent
commit
221e2f20bb
83 өөрчлөгдсөн 3210 нэмэгдсэн , 0 устгасан
  1. 129 0
      CONTRIBUTING.md
  2. 261 0
      LICENSE.md
  3. 103 0
      README.md
  4. 38 0
      build.gradle
  5. 1 0
      gradle.properties
  6. 5 0
      gradle/wrapper/gradle-wrapper.properties
  7. 185 0
      gradlew
  8. 89 0
      gradlew.bat
  9. BIN
      res/create_project.png
  10. BIN
      res/logo256.png
  11. BIN
      res/menu.png
  12. BIN
      res/output_panel.png
  13. BIN
      res/problem.gif
  14. BIN
      res/project_configuration.png
  15. BIN
      res/quickstart.gif
  16. BIN
      res/run_configuration.png
  17. 10 0
      settings.gradle
  18. 34 0
      src/main/kotlin/org/tboox/xmake/actions/BuildAction.kt
  19. 34 0
      src/main/kotlin/org/tboox/xmake/actions/CleanAction.kt
  20. 24 0
      src/main/kotlin/org/tboox/xmake/actions/CleanConfigurationAction.kt
  21. 22 0
      src/main/kotlin/org/tboox/xmake/actions/QuickStartAction.kt
  22. 34 0
      src/main/kotlin/org/tboox/xmake/actions/RebuildAction.kt
  23. 47 0
      src/main/kotlin/org/tboox/xmake/actions/RunAction.kt
  24. 14 0
      src/main/kotlin/org/tboox/xmake/icons/XMakeIconProvider.kt
  25. 22 0
      src/main/kotlin/org/tboox/xmake/icons/XMakeIcons.kt
  26. 6 0
      src/main/kotlin/org/tboox/xmake/project/XMakeConfigData.kt
  27. 69 0
      src/main/kotlin/org/tboox/xmake/project/XMakeDirectoryProjectGenerator.kt
  28. 64 0
      src/main/kotlin/org/tboox/xmake/project/XMakeModuleBuilder.kt
  29. 26 0
      src/main/kotlin/org/tboox/xmake/project/XMakeModuleConfigurationEditorProvider.kt
  30. 41 0
      src/main/kotlin/org/tboox/xmake/project/XMakeModuleType.kt
  31. 88 0
      src/main/kotlin/org/tboox/xmake/project/XMakeNewProjectPanel.kt
  32. 314 0
      src/main/kotlin/org/tboox/xmake/project/XMakeProjectConfigurable.kt
  33. 26 0
      src/main/kotlin/org/tboox/xmake/project/XMakeProjectGeneratorPeer.kt
  34. 7 0
      src/main/kotlin/org/tboox/xmake/project/XMakeProjectSettingsStep.kt
  35. 54 0
      src/main/kotlin/org/tboox/xmake/project/XMakeSdkSettingsStep.kt
  36. 67 0
      src/main/kotlin/org/tboox/xmake/project/XMakeSdkType.kt
  37. 50 0
      src/main/kotlin/org/tboox/xmake/project/XMakeToolWindowFactory.kt
  38. 62 0
      src/main/kotlin/org/tboox/xmake/project/XMakeToolWindowOutputPanel.kt
  39. 170 0
      src/main/kotlin/org/tboox/xmake/project/XMakeToolWindowProblemPanel.kt
  40. 73 0
      src/main/kotlin/org/tboox/xmake/run/XMakeProjectTasksRunner.kt
  41. 117 0
      src/main/kotlin/org/tboox/xmake/run/XMakeRunConfiguration.kt
  42. 98 0
      src/main/kotlin/org/tboox/xmake/run/XMakeRunConfigurationEditor.kt
  43. 35 0
      src/main/kotlin/org/tboox/xmake/run/XMakeRunConfigurationProducer.kt
  44. 46 0
      src/main/kotlin/org/tboox/xmake/run/XMakeRunConfigurationType.kt
  45. 21 0
      src/main/kotlin/org/tboox/xmake/run/XMakeRunner.kt
  46. 249 0
      src/main/kotlin/org/tboox/xmake/shared/XMakeConfiguration.kt
  47. 4 0
      src/main/kotlin/org/tboox/xmake/shared/XMakeProblem.kt
  48. 80 0
      src/main/kotlin/org/tboox/xmake/utils/ConsoleProcessHandler.kt
  49. 255 0
      src/main/kotlin/org/tboox/xmake/utils/SystemUtils.kt
  50. 4 0
      src/main/resources/META-INF/clion-only.xml
  51. 2 0
      src/main/resources/META-INF/idea-only.xml
  52. 130 0
      src/main/resources/META-INF/plugin.xml
  53. BIN
      src/main/resources/icons/build.png
  54. BIN
      src/main/resources/icons/[email protected]
  55. BIN
      src/main/resources/icons/build@2x_dark.png
  56. BIN
      src/main/resources/icons/build_dark.png
  57. BIN
      src/main/resources/icons/clean.png
  58. BIN
      src/main/resources/icons/[email protected]
  59. BIN
      src/main/resources/icons/cleanconf.png
  60. BIN
      src/main/resources/icons/[email protected]
  61. BIN
      src/main/resources/icons/debug.png
  62. BIN
      src/main/resources/icons/[email protected]
  63. BIN
      src/main/resources/icons/debug@2x_dark.png
  64. BIN
      src/main/resources/icons/debug_dark.png
  65. BIN
      src/main/resources/icons/error.png
  66. BIN
      src/main/resources/icons/[email protected]
  67. BIN
      src/main/resources/icons/quickstart.png
  68. BIN
      src/main/resources/icons/[email protected]
  69. BIN
      src/main/resources/icons/rebuild.png
  70. BIN
      src/main/resources/icons/[email protected]
  71. BIN
      src/main/resources/icons/rebuild@2x_dark.png
  72. BIN
      src/main/resources/icons/rebuild_dark.png
  73. BIN
      src/main/resources/icons/run.png
  74. BIN
      src/main/resources/icons/[email protected]
  75. BIN
      src/main/resources/icons/settings.png
  76. BIN
      src/main/resources/icons/[email protected]
  77. BIN
      src/main/resources/icons/settings@2x_dark.png
  78. BIN
      src/main/resources/icons/settings_dark.png
  79. BIN
      src/main/resources/icons/warning.png
  80. BIN
      src/main/resources/icons/[email protected]
  81. BIN
      src/main/resources/icons/xmake.png
  82. BIN
      src/main/resources/icons/[email protected]
  83. BIN
      src/main/resources/icons/xmake_13x13.png

+ 129 - 0
CONTRIBUTING.md

@@ -0,0 +1,129 @@
+# Contributing
+
+If you discover issues, have ideas for improvements or new features, or
+want to contribute a new module, please report them to the
+[issue tracker][1] of the repository or submit a pull request. Please,
+try to follow these guidelines when you do so.
+
+## Issue reporting
+
+* Check that the issue has not already been reported.
+* Check that the issue has not already been fixed in the latest code
+  (a.k.a. `master`).
+* Be clear, concise and precise in your description of the problem.
+* Open an issue with a descriptive title and a summary in grammatically correct,
+  complete sentences.
+* Include any relevant code to the issue summary.
+
+## Pull requests
+
+* Use a topic branch to easily amend a pull request later, if necessary.
+* Write good commit messages.
+* Use the same coding conventions as the rest of the project.
+* Ensure your edited codes with four spaces instead of TAB.
+* Please commit code to `dev` branch and we will merge into `master` branch in feature
+
+## Financial contributions
+
+We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/xmake).
+Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
+
+## Credits
+
+### Backers
+
+Thank you to all our backers! [[Become a backer](https://opencollective.com/xmake#backer)]
+
+<a href="https://opencollective.com/xmake#backers" target="_blank"><img src="https://opencollective.com/xmake/backers.svg?width=890"></a>
+
+### Sponsors
+
+Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/xmake#sponsor))
+
+<a href="https://opencollective.com/xmake/sponsor/0/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/0/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/1/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/1/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/2/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/2/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/3/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/3/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/4/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/4/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/5/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/5/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/6/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/6/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/7/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/7/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/8/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/8/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/9/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/9/avatar.svg"></a>
+
+# 贡献代码
+
+如果你发现一些问题,或者想新增或者改进某些新特性,或者想贡献一个新的模块
+那么你可以在[issues][1]上提交反馈,或者发起一个提交代码的请求(pull request).
+
+## 问题反馈
+
+* 确认这个问题没有被反馈过
+* 确认这个问题最近还没有被修复,请先检查下 `master` 的最新提交
+* 请清晰详细地描述你的问题
+* 如果发现某些代码存在问题,请在issue上引用相关代码
+
+## 安装环境
+
+#### 安装cnpm
+
+```console
+$ npm install -g cnpm --registry=https://registry.npm.taobao.org
+```
+
+#### 创建空工程
+
+```console
+$ cnpm install -g yo generator-code
+$ yo code
+```
+
+#### 创建发布者
+
+```console
+$ cnpm install -g vsce
+$ vsce create-publisher (publisher name)
+$ vsce login (publisher name)
+```
+
+#### 构建发布
+
+```console
+$ vsce package
+$ vsce publish [version]
+```
+
+## 提交代码
+
+* 请先更新你的本地分支到最新,再进行提交代码请求,确保没有合并冲突
+* 编写友好可读的提交信息
+* 请使用余工程代码相同的代码规范
+* 确保提交的代码缩进是四个空格,而不是tab
+* 请提交代码到`dev`分支,如果通过,我们会在特定时间合并到`master`分支上
+* 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述
+
+[1]: https://github.com/xmake-io/xmake-vscode/issues
+
+## 支持项目
+
+xmake项目属于个人开源项目,它的发展需要您的帮助,如果您愿意支持xmake项目的开发,欢迎为其捐赠,支持它的发展。 🙏 [[支持此项目](https://opencollective.com/xmake#backer)]
+
+<a href="https://opencollective.com/xmake#backers" target="_blank"><img src="https://opencollective.com/xmake/backers.svg?width=890"></a>
+
+## 赞助项目
+
+通过赞助支持此项目,您的logo和网站链接将显示在这里。[[赞助此项目](https://opencollective.com/xmake#sponsor)]
+
+<a href="https://opencollective.com/xmake/sponsor/0/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/0/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/1/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/1/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/2/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/2/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/3/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/3/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/4/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/4/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/5/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/5/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/6/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/6/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/7/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/7/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/8/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/8/avatar.svg"></a>
+<a href="https://opencollective.com/xmake/sponsor/9/website" target="_blank"><img src="https://opencollective.com/xmake/sponsor/9/avatar.svg"></a>
+
+
+

+ 261 - 0
LICENSE.md

@@ -0,0 +1,261 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright 2016-2017 TBOOX Open Source Group
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+-------------------------------------------------------------------------------
+## SUBCOMPONENTS
+
+The XMake project contains subcomponents with separate copyright
+notices and license terms. Your use of the source code for the these
+subcomponents is subject to the terms and conditions of the following
+licenses.
+
+#### LuaJIT license
+
+===============================================================================
+LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
+
+Copyright (C) 2005-2014 Mike Pall. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+[ MIT license: http://www.opensource.org/licenses/mit-license.php ]
+
+===============================================================================
+[ LuaJIT includes code from Lua 5.1/5.2, which has this license statement: ]
+
+Copyright (C) 1994-2012 Lua.org, PUC-Rio.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+

+ 103 - 0
README.md

@@ -0,0 +1,103 @@
+<div align="center">
+  <a href="http://xmake.io">
+    <img width="200" heigth="200" src="https://github.com/xmake-io/xmake-idea/raw/master/res/logo256.png">
+  </a>  
+
+  <h1>xmake-idea</h1>
+
+  <div>
+    <a href="https://plugins.jetbrains.com/plugin/10156-xmake">
+      <img src="https://img.shields.io/jetbrains/plugin/v/10156-xmake.svg?style=flat-square" alt="Version" />
+    </a>
+    <a href="https://plugins.jetbrains.com/plugin/10156-xmake">
+      <img src="https://img.shields.io/jetbrains/plugin/d/10156-xmake.svg?style=flat-square" alt="Downloads" />
+    </a>
+    <a href="https://github.com/xmake-io/xmake-idea/blob/master/LICENSE.md">
+      <img src="https://img.shields.io/github/license/tboox/xmake-idea.svg?colorB=f48041&style=flat-square" alt="license" />
+    </a>
+  </div>
+  <div>
+    <a href="https://github.com/xmake-io/xmake-idea/blob/master/LICENSE.md">
+      <img src="https://img.shields.io/github/license/tboox/xmake-idea.svg?colorB=f48041&style=flat-square" alt="license" />
+    </a>
+    <a href="https://www.reddit.com/r/tboox/">
+      <img src="https://img.shields.io/badge/chat-on%20reddit-ff3f34.svg?style=flat-square" alt="Reddit" />
+    </a>
+    <a href="https://gitter.im/tboox/tboox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge">
+      <img src="https://img.shields.io/gitter/room/tboox/tboox.svg?style=flat-square&colorB=96c312" alt="Gitter" />
+    </a>
+    <a href="https://t.me/tbooxorg">
+      <img src="https://img.shields.io/badge/chat-on%20telegram-blue.svg?style=flat-square" alt="Telegram" />
+    </a>
+    <a href="https://jq.qq.com/?_wv=1027&k=5hpwWFv">
+      <img src="https://img.shields.io/badge/chat-on%20QQ-ff69b4.svg?style=flat-square" alt="QQ" />
+    </a>
+    <a href="http://xmake.io/pages/donation.html#donate">
+      <img src="https://img.shields.io/badge/donate-us-orange.svg?style=flat-square" alt="Donate" />
+    </a>
+  </div>
+
+  <p>A XMake integration in IntelliJ IDEA</p>
+</div>
+
+## Introduction 
+
+A XMake integration in IntelliJ IDEA. 
+
+It is deeply integrated with [xmake](https://github.com/xmake-io/xmake) and Intellij-IDEA to provide a convenient and fast cross-platform c/c++ development and building.
+
+And It also support other Intellij-based platform, like Clion, Android Studio and etc.
+
+You need install [xmake](https://github.com/xmake-io/xmake) first and a project with `xmake.lua`.
+
+Please see [xmake-github](https://github.com/xmake-io/xmake) and [website](http://xmake.io) if you want to known more about xmake.
+
+## Features
+
+* Quickstart
+* Create project
+* Project configuration
+* Run configuration
+* Menu tools
+* Tool windows
+* Build and run
+* Parse errors and goto file
+ 
+## Quickstart
+
+<div align="center">
+<img src="https://raw.githubusercontent.com/tboox/xmake-idea/master/res/quickstart.gif" width="80%" />
+</div>
+
+## Parse errors and goto file
+ 
+<div align="center">
+<img src="https://raw.githubusercontent.com/tboox/xmake-idea/master/res/problem.gif" width="80%" />
+</div>
+
+## Tool windows
+
+#### Output panel
+
+<img src="https://raw.githubusercontent.com/tboox/xmake-idea/master/res/output_panel.png" width="100%" />
+ 
+## Create project
+
+<img src="https://raw.githubusercontent.com/tboox/xmake-idea/master/res/create_project.png" width="100%" />
+
+## Project configuration
+
+<img src="https://raw.githubusercontent.com/tboox/xmake-idea/master/res/project_configuration.png" width="100%" />
+
+## Run configuration
+
+<img src="https://raw.githubusercontent.com/tboox/xmake-idea/master/res/run_configuration.png" width="100%" />
+
+## Menu tools
+
+<div align="center">
+<img src="https://raw.githubusercontent.com/tboox/xmake-idea/master/res/menu.png" width="80%" />
+</div>
+ 
+
+  

+ 38 - 0
build.gradle

@@ -0,0 +1,38 @@
+plugins {
+    id 'java'
+    id 'org.jetbrains.intellij' version '0.7.3'
+    id 'org.jetbrains.kotlin.jvm' version '1.5.10'
+}
+apply plugin: 'org.jetbrains.intellij'
+apply plugin: 'idea'
+
+group 'org.example'
+version '1.0-SNAPSHOT'
+
+repositories {
+    mavenCentral()
+    maven {
+        url "https://oss.sonatype.org/content/repositories/snapshots/"
+    }
+}
+
+dependencies {
+    implementation "org.jetbrains.kotlin:kotlin-stdlib"
+    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
+    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
+}
+
+// See https://github.com/JetBrains/gradle-intellij-plugin/
+intellij {
+
+//    version = 'LATEST-EAP-SNAPSHOT'
+    ///////clion 配置////////
+        type 'CL'
+        version = 'CL-2021.1.2'
+        downloadSources false
+    plugins = ["com.intellij.cidr.base", "com.intellij.clion"]
+}
+
+test {
+    useJUnitPlatform()
+}

+ 1 - 0
gradle.properties

@@ -0,0 +1 @@
+kotlin.code.style=official

+ 5 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists

+ 185 - 0
gradlew

@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=`expr $i + 1`
+    done
+    case $i in
+        0) set -- ;;
+        1) set -- "$args0" ;;
+        2) set -- "$args0" "$args1" ;;
+        3) set -- "$args0" "$args1" "$args2" ;;
+        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"

+ 89 - 0
gradlew.bat

@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

BIN
res/create_project.png


BIN
res/logo256.png


BIN
res/menu.png


BIN
res/output_panel.png


BIN
res/problem.gif


BIN
res/project_configuration.png


BIN
res/quickstart.gif


BIN
res/run_configuration.png


+ 10 - 0
settings.gradle

@@ -0,0 +1,10 @@
+
+pluginManagement {
+    repositories {
+        maven {
+            url 'https://oss.sonatype.org/content/repositories/snapshots/'
+        }
+        gradlePluginPortal()
+    }
+}
+rootProject.name = 'xmake-idea'

+ 34 - 0
src/main/kotlin/org/tboox/xmake/actions/BuildAction.kt

@@ -0,0 +1,34 @@
+package org.tboox.xmake.actions
+
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.utils.SystemUtils
+import org.tboox.xmake.shared.xmakeConfiguration
+
+class BuildAction : AnAction() {
+
+    override fun actionPerformed(e: AnActionEvent) {
+
+        // the project
+        val project = e.project ?: return
+
+        // clear console first
+        project.xmakeConsoleView.clear()
+
+        // configure and build it
+        val xmakeConfiguration = project.xmakeConfiguration
+        if (xmakeConfiguration.changed) {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.configurationCommandLine).addProcessListener(object: ProcessAdapter() {
+                override fun processTerminated(e: ProcessEvent) {
+                    SystemUtils.runvInConsole(project, xmakeConfiguration.buildCommandLine, false, true, true)
+                }
+            })
+            xmakeConfiguration.changed = false
+        } else {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.buildCommandLine, true, true, true)
+        }
+    }
+}

+ 34 - 0
src/main/kotlin/org/tboox/xmake/actions/CleanAction.kt

@@ -0,0 +1,34 @@
+package org.tboox.xmake.actions
+
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.utils.SystemUtils
+import org.tboox.xmake.shared.xmakeConfiguration
+
+class CleanAction : AnAction() {
+
+    override fun actionPerformed(e: AnActionEvent) {
+
+        // the project
+        val project = e.project ?: return
+
+        // clear console first
+        project.xmakeConsoleView.clear()
+
+        // configure and clean it
+        val xmakeConfiguration = project.xmakeConfiguration
+        if (xmakeConfiguration.changed) {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.configurationCommandLine).addProcessListener(object: ProcessAdapter() {
+                override fun processTerminated(e: ProcessEvent) {
+                    SystemUtils.runvInConsole(project, xmakeConfiguration.cleanCommandLine, false, false, true)
+                }
+            })
+            xmakeConfiguration.changed = false
+        } else {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.cleanCommandLine, true, false, true)
+        }
+    }
+}

+ 24 - 0
src/main/kotlin/org/tboox/xmake/actions/CleanConfigurationAction.kt

@@ -0,0 +1,24 @@
+package org.tboox.xmake.actions
+
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.utils.SystemUtils
+import org.tboox.xmake.shared.xmakeConfiguration
+
+class CleanConfigurationAction : AnAction() {
+
+    override fun actionPerformed(e: AnActionEvent) {
+
+        // the project
+        val project = e.project ?: return
+
+        // clear console first
+        project.xmakeConsoleView.clear()
+
+        // clear configure
+        val xmakeConfiguration = project.xmakeConfiguration
+        SystemUtils.runvInConsole(project, xmakeConfiguration.cleanConfigurationCommandLine, true, false, true)
+        xmakeConfiguration.changed = false
+    }
+}

+ 22 - 0
src/main/kotlin/org/tboox/xmake/actions/QuickStartAction.kt

@@ -0,0 +1,22 @@
+package org.tboox.xmake.actions
+
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.utils.SystemUtils
+import org.tboox.xmake.shared.xmakeConfiguration
+
+class QuickStartAction : AnAction() {
+
+    override fun actionPerformed(e: AnActionEvent) {
+
+        // the project
+        val project = e.project ?: return
+
+        // clear console first
+        project.xmakeConsoleView.clear()
+
+        // quick start
+        SystemUtils.runvInConsole(project, project.xmakeConfiguration.quickStartCommandLine, true, false, true)
+    }
+}

+ 34 - 0
src/main/kotlin/org/tboox/xmake/actions/RebuildAction.kt

@@ -0,0 +1,34 @@
+package org.tboox.xmake.actions
+
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.utils.SystemUtils
+import org.tboox.xmake.shared.xmakeConfiguration
+
+class RebuildAction : AnAction() {
+
+    override fun actionPerformed(e: AnActionEvent) {
+
+        // the project
+        val project = e.project ?: return
+
+        // clear console first
+        project.xmakeConsoleView.clear()
+
+        // configure and rebuild it
+        val xmakeConfiguration = project.xmakeConfiguration
+        if (xmakeConfiguration.changed) {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.configurationCommandLine).addProcessListener(object: ProcessAdapter() {
+                override fun processTerminated(e: ProcessEvent) {
+                    SystemUtils.runvInConsole(project, xmakeConfiguration.rebuildCommandLine, false, true, true)
+                }
+            })
+            xmakeConfiguration.changed = false
+        } else {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.rebuildCommandLine, true, true, true)
+        }
+    }
+}

+ 47 - 0
src/main/kotlin/org/tboox/xmake/actions/RunAction.kt

@@ -0,0 +1,47 @@
+package org.tboox.xmake.actions
+
+import com.intellij.execution.RunManager
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.execution.ui.ConsoleViewContentType
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.run.XMakeRunConfiguration
+import org.tboox.xmake.utils.SystemUtils
+import org.tboox.xmake.shared.xmakeConfiguration
+
+class RunAction : AnAction() {
+
+    override fun actionPerformed(e: AnActionEvent) {
+
+        // the project
+        val project = e.project ?: return
+
+        // get selected run configuration
+        val runConfiguration = RunManager.getInstance(project).selectedConfiguration?.configuration
+        if (runConfiguration is XMakeRunConfiguration) {
+
+            // clear console first
+            project.xmakeConsoleView.clear()
+
+            // configure and run it
+            val xmakeConfiguration = project.xmakeConfiguration
+            if (xmakeConfiguration.changed) {
+                SystemUtils.runvInConsole(project, xmakeConfiguration.configurationCommandLine).addProcessListener(object: ProcessAdapter() {
+                    override fun processTerminated(e: ProcessEvent) {
+                        SystemUtils.runvInConsole(project, runConfiguration.runCommandLine, false, true, true)
+                    }
+                })
+                xmakeConfiguration.changed = false
+            } else {
+                SystemUtils.runvInConsole(project, runConfiguration.runCommandLine, true, true, true)
+            }
+
+        } else {
+
+            // show tips
+            project.xmakeConsoleView.print("Please select a xmake run configuration first!\n", ConsoleViewContentType.ERROR_OUTPUT)
+        }
+    }
+}

+ 14 - 0
src/main/kotlin/org/tboox/xmake/icons/XMakeIconProvider.kt

@@ -0,0 +1,14 @@
+package org.tboox.xmake.icons
+
+import com.intellij.ide.IconProvider
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.psi.PsiElement
+import javax.swing.Icon
+
+class XMakeIconProvider : IconProvider() {
+
+    override fun getIcon(element: PsiElement, flags: Int): Icon? = when {
+        element.containingFile?.name == "xmake.lua" -> XMakeIcons.FILE
+        else -> null
+    }
+}

+ 22 - 0
src/main/kotlin/org/tboox/xmake/icons/XMakeIcons.kt

@@ -0,0 +1,22 @@
+package org.tboox.xmake.icons
+
+import com.intellij.openapi.util.IconLoader
+import javax.swing.Icon
+
+object XMakeIcons {
+
+    // logo icon
+    val XMAKE = load("/icons/xmake.png")
+
+    // file icon
+    val FILE = load("/icons/xmake.png")
+
+    // error icon
+    val ERROR = load("/icons/error.png")
+
+    // warning icon
+    val WARNING = load("/icons/warning.png")
+
+    private fun load(path: String): Icon = IconLoader.getIcon(path, XMakeIcons::class.java)
+
+}

+ 6 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeConfigData.kt

@@ -0,0 +1,6 @@
+package org.tboox.xmake.project
+
+data class XMakeConfigData(
+    val languagesModel: String,
+    val kindsModel: String
+)

+ 69 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeDirectoryProjectGenerator.kt

@@ -0,0 +1,69 @@
+package org.tboox.xmake.project
+
+import com.intellij.facet.ui.ValidationResult
+import com.intellij.ide.util.projectWizard.AbstractNewProjectStep
+import com.intellij.ide.util.projectWizard.CustomStepProjectGenerator
+import com.intellij.openapi.module.Module
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.util.io.FileUtil
+import com.intellij.openapi.vfs.LocalFileSystem
+import com.intellij.openapi.vfs.VirtualFile
+import com.intellij.openapi.wm.impl.welcomeScreen.AbstractActionWithPanel
+import com.intellij.platform.DirectoryProjectGenerator
+import com.intellij.platform.DirectoryProjectGeneratorBase
+import com.intellij.platform.ProjectGeneratorPeer
+import org.tboox.xmake.icons.XMakeIcons
+import org.tboox.xmake.utils.SystemUtils
+import java.io.File
+import javax.swing.Icon
+
+
+class XMakeDirectoryProjectGenerator : DirectoryProjectGeneratorBase<XMakeConfigData>(),
+    CustomStepProjectGenerator<XMakeConfigData> {
+
+    private var peer: XMakeProjectGeneratorPeer? = null
+
+    override fun getName(): String = "XMake"
+    override fun getLogo(): Icon = XMakeIcons.XMAKE
+    override fun createPeer(): ProjectGeneratorPeer<XMakeConfigData> = XMakeProjectGeneratorPeer().also { peer = it }
+
+    override fun validate(baseDirPath: String): ValidationResult {
+        val crateName = File(baseDirPath).nameWithoutExtension
+        return ValidationResult.OK
+    }
+
+    override fun generateProject(project: Project, baseDir: VirtualFile, data: XMakeConfigData, module: Module) {
+        //TODO:
+        // get content entry path
+        val contentEntryPath = baseDir.canonicalPath ?: return
+        val t =listOf(
+            SystemUtils.xmakeProgram,
+            "create",
+            "-P",
+            contentEntryPath,
+            "-l",
+            data.languagesModel,
+            "-t",
+            data.kindsModel
+        ).joinToString(separator = " ")
+
+        // create empty project
+        SystemUtils.Runv(
+            listOf(
+                SystemUtils.xmakeProgram,
+                "create",
+                "-P",
+                contentEntryPath,
+                "-l",
+                data.languagesModel,
+                "-t",
+                data.kindsModel
+            )
+        )
+    }
+
+    override fun createStep(
+        projectGenerator: DirectoryProjectGenerator<XMakeConfigData>,
+        callback: AbstractNewProjectStep.AbstractCallback<XMakeConfigData>
+    ): AbstractActionWithPanel = XMakeProjectSettingsStep(projectGenerator)
+}

+ 64 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeModuleBuilder.kt

@@ -0,0 +1,64 @@
+package org.tboox.xmake.project
+
+import XMakeSdkSettingsStep
+import com.intellij.ide.util.projectWizard.*
+import com.intellij.openapi.Disposable
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.module.ModuleType
+import com.intellij.openapi.projectRoots.SdkTypeId
+import com.intellij.openapi.roots.ModifiableRootModel
+import com.intellij.openapi.util.Disposer
+import com.intellij.openapi.util.io.FileUtil
+import com.intellij.openapi.vfs.LocalFileSystem
+import org.tboox.xmake.utils.SystemUtils
+
+import javax.swing.DefaultComboBoxModel
+
+class XMakeModuleBuilder : ModuleBuilder() {
+    var configurationData: XMakeConfigData? = null
+
+
+    override fun isSuitableSdkType(sdkType: SdkTypeId?): Boolean = true
+
+
+    override fun setupRootModel(rootModel: ModifiableRootModel) {
+
+        // get content entry path
+        val contentEntryPath = contentEntryPath ?: return
+
+        // get content entry
+        val contentEntry = doAddContentEntry(rootModel) ?: return
+
+        // add source root
+        val sourceRoot =
+            LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(contentEntryPath))!!
+        contentEntry.addSourceFolder(sourceRoot, false)
+
+        // create empty project
+        SystemUtils.Runv(
+            listOf(
+                SystemUtils.xmakeProgram,
+                "create",
+                "-P",
+                contentEntryPath,
+                "-l",
+                configurationData?.languagesModel.toString(),
+                "-t",
+                configurationData?.kindsModel.toString()
+            )
+        )
+    }
+
+    override fun getModuleType(): ModuleType<*> {
+        return XMakeModuleType.instance
+    }
+
+    override fun getCustomOptionsStep(context: WizardContext, parentDisposable: Disposable): ModuleWizardStep =
+        XMakeSdkSettingsStep(context).apply {
+            Disposer.register(parentDisposable, this::disposeUIResources)
+        }
+
+    companion object {
+        private val Log = Logger.getInstance(XMakeModuleBuilder::class.java.getName())
+    }
+}

+ 26 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeModuleConfigurationEditorProvider.kt

@@ -0,0 +1,26 @@
+package org.tboox.xmake.project
+
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.module.ModuleConfigurationEditor
+//import com.intellij.openapi.roots.ui.configuration.DefaultModuleConfigurationEditorFactory
+import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationEditorProvider
+import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState
+
+class XMakeModuleConfigurationEditorProvider : ModuleConfigurationEditorProvider {
+
+    override fun createEditors(moduleConfigurationState: ModuleConfigurationState): Array<ModuleConfigurationEditor> {
+
+        var editors = arrayOf<ModuleConfigurationEditor>()
+//        val factory = DefaultModuleConfigurationEditorFactory.getInstance()
+
+        /*
+        editors += factory.createModuleContentRootsEditor(moduleConfigurationState)
+        editors += factory.createClasspathEditor(moduleConfigurationState)
+        */
+        return editors
+    }
+
+    companion object {
+        private val Log = Logger.getInstance(XMakeModuleConfigurationEditorProvider::class.java.getName())
+    }
+}

+ 41 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeModuleType.kt

@@ -0,0 +1,41 @@
+package org.tboox.xmake.project
+
+import com.intellij.openapi.module.ModuleType
+import com.intellij.openapi.module.ModuleTypeManager
+import org.jetbrains.jps.model.module.JpsModuleSourceRootType
+import org.tboox.xmake.icons.XMakeIcons
+
+import javax.swing.*
+
+class XMakeModuleType : ModuleType<XMakeModuleBuilder>(MODULE_TYPE) {
+
+    override fun createModuleBuilder(): XMakeModuleBuilder {
+        return XMakeModuleBuilder()
+    }
+
+    override fun getName(): String {
+        return "XMake"
+    }
+
+    override fun getDescription(): String {
+        return "XMake Module"
+    }
+
+    override fun getNodeIcon(b: Boolean): Icon {
+        return XMakeIcons.XMAKE
+    }
+
+    override fun isMarkInnerSupportedFor(type: JpsModuleSourceRootType<*>?): Boolean {
+        return true
+    }
+
+    companion object {
+
+        // the module type name
+        private val MODULE_TYPE = "XMake.Module"
+
+        // the instance
+        val instance: XMakeModuleType
+            get() = ModuleTypeManager.getInstance().findByID(MODULE_TYPE) as XMakeModuleType
+    }
+}

+ 88 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeNewProjectPanel.kt

@@ -0,0 +1,88 @@
+package org.tboox.xmake.project
+
+import com.intellij.openapi.Disposable
+import com.intellij.openapi.project.ProjectManager
+import com.intellij.openapi.roots.ui.configuration.SdkComboBox
+import com.intellij.openapi.roots.ui.configuration.SdkComboBoxModel
+import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel
+import com.intellij.openapi.ui.ComboBox
+import com.intellij.ui.layout.LayoutBuilder
+import java.awt.BorderLayout
+import javax.swing.DefaultComboBoxModel
+import javax.swing.JComponent
+import javax.swing.JPanel
+
+class XMakeNewProjectPanel : Disposable {
+
+    // the module kinds
+    private val kindsModel = DefaultComboBoxModel<String>().apply {
+        addElement("Console")
+        addElement("Static Library")
+        addElement("Shared Library")
+    }
+
+    // the module languages
+    private val languagesModel = DefaultComboBoxModel<String>().apply {
+        addElement("C")
+        addElement("C++")
+        addElement("Rust")
+        addElement("Dlang")
+        addElement("Go")
+        addElement("Swift")
+        addElement("Objc")
+        addElement("Objc++")
+    }
+
+    // the module kinds
+    private val kindsComboBox = ComboBox(kindsModel)
+
+    // the module languages
+    private val languagesComboBox = ComboBox(languagesModel)
+
+    val data: XMakeConfigData
+        get() = XMakeConfigData(
+            languagesModel.selectedItem.toString().toLowerCase(),
+            template
+        )
+
+    // get template
+    private val template: String
+        get() = when (kindsModel.selectedItem.toString()) {
+            "Console" -> "console"
+            "Static Library" -> "static"
+            "Shared Library" -> "shared"
+            else -> "console"
+        }
+
+
+    fun attachTo(layout: LayoutBuilder) = with(layout) {
+        row("XMake SDK:") {
+            val project = ProjectManager.getInstance().defaultProject
+            val sdkModel = ProjectSdksModel()
+            sdkModel.addSdk(XMakeSdkType.instance, XMakeSdkType.instance.suggestHomePath()!!, null);
+            val myJdkComboBox = SdkComboBox(SdkComboBoxModel.createSdkComboBoxModel(project, sdkModel))
+            wrapComponent(myJdkComboBox)(growX, pushX)
+        }
+        row("Module Language:") {
+            wrapComponent(languagesComboBox)(growX, pushX)
+        }
+        row("Module Type:") {
+            wrapComponent(kindsComboBox)(growX, pushX)
+        }
+
+        update()
+    }
+
+    private fun wrapComponent(component: JComponent): JComponent =
+        JPanel(BorderLayout()).apply {
+            add(component, BorderLayout.NORTH)
+        }
+
+    fun update() {
+
+    }
+
+    override fun dispose() {
+    }
+
+}

+ 314 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeProjectConfigurable.kt

@@ -0,0 +1,314 @@
+package org.tboox.xmake.project
+
+import com.intellij.execution.ExecutionBundle
+import com.intellij.execution.configuration.EnvironmentVariablesComponent
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
+import com.intellij.openapi.options.Configurable
+import com.intellij.openapi.options.ConfigurationException
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.ui.ComboBox
+import com.intellij.openapi.ui.LabeledComponent
+import com.intellij.openapi.ui.TextFieldWithBrowseButton
+import com.intellij.ui.RawCommandLineEditor
+import com.intellij.ui.components.CheckBox
+import com.intellij.ui.components.Label
+import com.intellij.ui.components.JBLabel
+import com.intellij.ui.layout.CCFlags
+import com.intellij.ui.layout.LayoutBuilder
+import com.intellij.ui.layout.Row
+import com.intellij.ui.layout.panel
+import org.tboox.xmake.shared.XMakeConfiguration
+import org.tboox.xmake.shared.xmakeConfiguration
+import java.awt.Dimension
+import java.nio.file.Path
+import java.nio.file.Paths
+import javax.swing.JComponent
+import javax.swing.JList
+import javax.swing.JPanel
+import javax.swing.JLabel
+import javax.swing.JTextField
+import javax.swing.JTextArea
+import javax.swing.DefaultComboBoxModel
+import javax.swing.event.ListDataEvent
+import javax.swing.event.ListDataListener
+import java.awt.event.KeyEvent
+import java.awt.event.KeyListener
+import java.awt.event.ItemEvent
+import java.awt.event.ItemListener
+
+class XMakeProjectConfigurable(
+        private val project: Project
+) : Configurable, Configurable.NoScroll {
+
+    // the xmake configuration
+    val xmakeConfiguration = project.xmakeConfiguration
+
+    // the platforms ui
+    private val platformsModel = DefaultComboBoxModel<String>()
+    private val platformsComboBox = ComboBox<String>(platformsModel)
+
+    // the architectures ui
+    private val architecturesModel = DefaultComboBoxModel<String>()
+    private val architecturesComboBox = ComboBox<String>(architecturesModel)
+
+    // the modes ui
+    private val modesModel = DefaultComboBoxModel<String>()
+    private val modesComboBox = ComboBox<String>(modesModel)
+
+    // the additional configuration
+    private val additionalConfiguration = RawCommandLineEditor()
+
+    // the configuration command text
+    private val configurationCommandText = JTextArea(10, 10)
+
+    // the working directory
+    private val workingDirectory = run {
+        val textField = TextFieldWithBrowseButton().apply {
+            val fileChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor().apply {
+                title = ExecutionBundle.message("select.working.directory.message")
+            }
+            addBrowseFolderListener(null, null, null, fileChooser)
+        }
+        LabeledComponent.create(textField, ExecutionBundle.message("run.configuration.working.directory.label"))
+    }
+
+    // the android NDK directory
+    private val androidNDKDirectory = run {
+        val textField = TextFieldWithBrowseButton().apply {
+            val fileChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor().apply {
+                title = ExecutionBundle.message("select.working.directory.message")
+            }
+            addBrowseFolderListener(null, null, null, fileChooser)
+        }
+        LabeledComponent.create(textField, ExecutionBundle.message("run.configuration.working.directory.label"))
+    }
+
+    // the build output directory
+    private val buildOutputDirectory = run {
+        val textField = TextFieldWithBrowseButton().apply {
+            val fileChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor().apply {
+                title = ExecutionBundle.message("select.working.directory.message")
+            }
+            addBrowseFolderListener(null, null, null, fileChooser)
+        }
+        LabeledComponent.create(textField, ExecutionBundle.message("run.configuration.working.directory.label"))
+    }
+
+    // verbose output
+    private val verboseOutput = CheckBox("Show verbose output", true)
+
+    override fun createComponent(): JComponent = panel {
+
+        labeledRow("Platform:", platformsComboBox) {
+            platformsComboBox()
+        }
+
+        labeledRow("Architecture:", architecturesComboBox) {
+            architecturesComboBox()
+        }
+
+        labeledRow("Mode:", modesComboBox) {
+            modesComboBox()
+        }
+
+        labeledRow("Additional configuration:", additionalConfiguration) {
+            additionalConfiguration.apply {
+                dialogCaption = "Additional configuration"
+                makeWide()
+            }()
+        }
+
+        row { verboseOutput() }
+
+        row(workingDirectory.label) {
+            workingDirectory.apply { makeWide() }()
+        }
+
+        row(buildOutputDirectory.label) {
+            buildOutputDirectory.apply { makeWide() }()
+        }
+        buildOutputDirectory.label.text = "Build directory: "
+
+        row(androidNDKDirectory.label) {
+            androidNDKDirectory.apply { makeWide() }()
+        }
+        androidNDKDirectory.label.text = "Android NDK directory: "
+
+        row {
+            configurationCommandText()
+        }
+        configurationCommandText.setEditable(false)
+
+        platformsModel.addListDataListener(object: ListDataListener {
+            override fun contentsChanged(e: ListDataEvent) {
+                architecturesModel.removeAllElements()
+                for (architecture in XMakeConfiguration.getArchitecturesByPlatform(platformsModel.selectedItem.toString())) {
+                    architecturesModel.addElement(architecture)
+                }
+                configurationCommandText.text = previewConfigurationCommand
+            }
+            override fun intervalAdded(e: ListDataEvent) {
+            }
+            override fun intervalRemoved(e: ListDataEvent) {
+            }
+        })
+
+        architecturesModel.addListDataListener(object: ListDataListener {
+            override fun contentsChanged(e: ListDataEvent) {
+                configurationCommandText.text = previewConfigurationCommand
+            }
+            override fun intervalAdded(e: ListDataEvent) {
+            }
+            override fun intervalRemoved(e: ListDataEvent) {
+            }
+        })
+
+        modesModel.addListDataListener(object: ListDataListener {
+            override fun contentsChanged(e: ListDataEvent) {
+                configurationCommandText.text = previewConfigurationCommand
+            }
+            override fun intervalAdded(e: ListDataEvent) {
+            }
+            override fun intervalRemoved(e: ListDataEvent) {
+            }
+        })
+
+        additionalConfiguration.textField.addKeyListener(object: KeyListener {
+            override fun keyPressed(keyEvent: KeyEvent) {
+                configurationCommandText.text = previewConfigurationCommand
+            }
+            override fun keyReleased(keyEvent: KeyEvent) {
+                configurationCommandText.text = previewConfigurationCommand
+            }
+            override fun keyTyped(keyEvent: KeyEvent) {
+                configurationCommandText.text = previewConfigurationCommand
+            }
+        })
+
+        verboseOutput.addItemListener(object: ItemListener {
+            override fun itemStateChanged(e: ItemEvent) {
+                configurationCommandText.text = previewConfigurationCommand
+            }
+        })
+    }
+
+    override fun disposeUIResources() {
+    }
+
+    override fun reset() {
+
+        // reset platforms
+        platformsModel.removeAllElements()
+        for (platform in xmakeConfiguration.platforms) {
+            platformsModel.addElement(platform)
+        }
+        platformsModel.selectedItem = xmakeConfiguration.data.currentPlatform
+
+        // reset architectures
+        architecturesModel.removeAllElements()
+        for (architecture in xmakeConfiguration.architectures) {
+            architecturesModel.addElement(architecture)
+        }
+        architecturesModel.selectedItem = xmakeConfiguration.data.currentArchitecture
+
+        // reset modes
+        modesModel.removeAllElements()
+        for (mode in xmakeConfiguration.modes) {
+            modesModel.addElement(mode)
+        }
+        modesModel.selectedItem = xmakeConfiguration.data.currentMode
+
+        // reset additional configuration
+        additionalConfiguration.text = xmakeConfiguration.data.additionalConfiguration
+
+        // reset working directory
+        workingDirectory.component.text = xmakeConfiguration.data.workingDirectory
+
+        // reset build output directory
+        buildOutputDirectory.component.text = xmakeConfiguration.data.buildOutputDirectory
+
+        // reset android ndk directory
+        androidNDKDirectory.component.text = xmakeConfiguration.data.androidNDKDirectory
+
+        // reset verbose output
+        verboseOutput.isSelected = xmakeConfiguration.data.verboseOutput
+
+        // reset configuration command text
+        configurationCommandText.text = previewConfigurationCommand
+    }
+
+    @Throws(ConfigurationException::class)
+    override fun apply() {
+
+        xmakeConfiguration.data.currentPlatform         = platformsModel.selectedItem.toString()
+        xmakeConfiguration.data.currentArchitecture     = architecturesModel.selectedItem.toString()
+        xmakeConfiguration.data.currentMode             = modesModel.selectedItem.toString()
+        xmakeConfiguration.data.additionalConfiguration = additionalConfiguration.text
+        xmakeConfiguration.data.workingDirectory        = workingDirectory.component.text
+        xmakeConfiguration.data.buildOutputDirectory    = buildOutputDirectory.component.text
+        xmakeConfiguration.data.androidNDKDirectory     = androidNDKDirectory.component.text
+        xmakeConfiguration.data.verboseOutput           = verboseOutput.isSelected
+    }
+
+    override fun isModified(): Boolean {
+
+        if (xmakeConfiguration.data.currentPlatform != platformsModel.selectedItem.toString() ||
+            xmakeConfiguration.data.currentArchitecture != architecturesModel.selectedItem.toString() ||
+            xmakeConfiguration.data.currentMode != modesModel.selectedItem.toString() ||
+            xmakeConfiguration.data.additionalConfiguration != additionalConfiguration.text ||
+            xmakeConfiguration.data.workingDirectory != workingDirectory.component.text ||
+            xmakeConfiguration.data.buildOutputDirectory != buildOutputDirectory.component.text ||
+            xmakeConfiguration.data.androidNDKDirectory != androidNDKDirectory.component.text ||
+            xmakeConfiguration.data.verboseOutput != verboseOutput.isSelected) {
+            xmakeConfiguration.changed = true
+            return true
+        }
+        return false
+    }
+
+    override fun getDisplayName(): String = "XMake"
+    override fun getHelpTopic(): String? = null
+
+    private fun JPanel.makeWide() {
+        preferredSize = Dimension(1000, height)
+    }
+
+    private fun LayoutBuilder.labeledRow(labelText: String, component: JComponent, init: Row.() -> Unit) {
+        val label = Label(labelText)
+        label.labelFor = component
+        row(label) { init() }
+    }
+
+    private val previewConfigurationCommand: String
+        get() {
+            var cmd = "xmake f"
+            var platformItem = platformsModel.selectedItem
+            if (platformItem != null) {
+                cmd += " -p ${platformItem.toString()}"
+            }
+            if (architecturesModel.selectedItem != null) {
+                cmd += " -a ${architecturesModel.selectedItem?.toString()}"
+            }
+            if (modesModel.selectedItem != null) {
+                cmd += " -m ${modesModel.selectedItem?.toString()}"
+            }
+            if (platformItem?.toString() == "android" && androidNDKDirectory.component.text != "") {
+                cmd += " --ndk=\"${androidNDKDirectory.component.text}\""
+            }
+            if (buildOutputDirectory.component.text != "") {
+                cmd += " -o \"${buildOutputDirectory.component.text}\""
+            }
+            if (verboseOutput.isSelected) {
+                cmd += " -v"
+            }
+            cmd += " ${additionalConfiguration.text}"
+            return cmd
+        }
+
+    companion object {
+
+        // get log
+        private val Log = Logger.getInstance(XMakeProjectConfigurable::class.java.getName())
+    }
+}

+ 26 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeProjectGeneratorPeer.kt

@@ -0,0 +1,26 @@
+package org.tboox.xmake.project
+
+import com.intellij.openapi.options.ConfigurationException
+import com.intellij.openapi.ui.TextFieldWithBrowseButton
+import com.intellij.openapi.ui.ValidationInfo
+import com.intellij.platform.GeneratorPeerImpl
+import com.intellij.ui.layout.panel
+import javax.swing.JComponent
+
+class XMakeProjectGeneratorPeer : GeneratorPeerImpl<XMakeConfigData>() {
+
+    private val newProjectPanel = XMakeNewProjectPanel()
+    private var checkValid: Runnable? = null
+
+    override fun getSettings(): XMakeConfigData = newProjectPanel.data
+
+    override fun getComponent(myLocationField: TextFieldWithBrowseButton, checkValid: Runnable): JComponent {
+        this.checkValid = checkValid
+        return super.getComponent(myLocationField, checkValid)
+    }
+
+    override fun getComponent(): JComponent = panel {
+        newProjectPanel.attachTo(this)
+    }
+
+}

+ 7 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeProjectSettingsStep.kt

@@ -0,0 +1,7 @@
+package org.tboox.xmake.project
+import com.intellij.ide.util.projectWizard.AbstractNewProjectStep
+import com.intellij.ide.util.projectWizard.ProjectSettingsStepBase
+import com.intellij.platform.DirectoryProjectGenerator
+
+open class XMakeProjectSettingsStep(generator: DirectoryProjectGenerator<XMakeConfigData>)
+    : ProjectSettingsStepBase<XMakeConfigData>(generator, AbstractNewProjectStep.AbstractCallback())

+ 54 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeSdkSettingsStep.kt

@@ -0,0 +1,54 @@
+import com.intellij.ide.util.projectWizard.ModuleBuilder
+import com.intellij.ide.util.projectWizard.ModuleWizardStep
+import com.intellij.ide.util.projectWizard.WizardContext
+import com.intellij.openapi.module.Module
+import com.intellij.openapi.project.ProjectManager
+import com.intellij.openapi.roots.ModifiableRootModel
+import com.intellij.openapi.roots.ui.configuration.SdkComboBox
+import com.intellij.openapi.roots.ui.configuration.SdkComboBoxModel
+import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel
+import com.intellij.ui.layout.panel
+import org.jetbrains.annotations.Nullable
+import org.tboox.xmake.project.XMakeSdkType
+import java.awt.BorderLayout
+import javax.swing.JComponent
+import javax.swing.JLabel
+import javax.swing.JPanel
+import com.intellij.openapi.ui.ComboBox
+import com.intellij.openapi.util.Disposer
+import org.tboox.xmake.project.XMakeModuleBuilder
+import org.tboox.xmake.project.XMakeNewProjectPanel
+
+
+class XMakeSdkSettingsStep(
+    private val context: WizardContext,
+    private val configurationUpdaterConsumer: ((ModuleBuilder.ModuleConfigurationUpdater) -> Unit)? = null
+) : ModuleWizardStep() {
+
+    private val newProjectPanel = XMakeNewProjectPanel()
+
+    override fun getComponent(): JComponent = panel {
+        newProjectPanel.attachTo(this)
+    }
+
+    override fun disposeUIResources() = Disposer.dispose(newProjectPanel)
+
+    override fun updateDataModel() {
+        val data = newProjectPanel.data
+
+        val projectBuilder = context.projectBuilder
+        if (projectBuilder is XMakeModuleBuilder) {
+            projectBuilder.configurationData = data
+            projectBuilder.addModuleConfigurationUpdater(ConfigurationUpdater)
+        } else {
+            configurationUpdaterConsumer?.invoke(ConfigurationUpdater)
+        }
+    }
+
+    private object ConfigurationUpdater : ModuleBuilder.ModuleConfigurationUpdater() {
+
+        override fun update(module: Module, rootModel: ModifiableRootModel) {
+            //TODO:数据联动
+        }
+    }
+}

+ 67 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeSdkType.kt

@@ -0,0 +1,67 @@
+package org.tboox.xmake.project
+
+import com.intellij.openapi.application.PathManager
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.projectRoots.SdkType
+import com.intellij.openapi.projectRoots.SdkAdditionalData
+import com.intellij.openapi.projectRoots.SdkModificator
+import com.intellij.openapi.projectRoots.SdkModel
+import com.intellij.openapi.projectRoots.AdditionalDataConfigurable
+import com.intellij.openapi.projectRoots.Sdk
+import org.tboox.xmake.icons.XMakeIcons
+import org.jdom.Element
+import org.tboox.xmake.utils.SystemUtils
+import java.io.File
+import javax.swing.Icon
+
+class XMakeSdkType : SdkType("XMake SDK") {
+
+    override fun suggestHomePath(): String? {
+        val program = SystemUtils.xmakeProgram
+        if (program == "") {
+            return null
+        }
+        return program
+    }
+
+    override fun isValidSdkHome(s: String): Boolean {
+        return true
+    }
+
+    override fun suggestSdkName(currentSdkName: String?, sdkHome: String): String {
+        return "XMake"
+    }
+
+    override fun getVersionString(sdk: Sdk): String? {
+        return SystemUtils.xmakeVersion
+    }
+
+    override fun createAdditionalDataConfigurable(sdkModel: SdkModel, sdkModificator: SdkModificator): AdditionalDataConfigurable? {
+        return null
+    }
+
+    override fun getPresentableName(): String {
+        return "XMake SDK"
+    }
+
+    override fun saveAdditionalData(sdkAdditionalData: SdkAdditionalData, element: Element) {
+    }
+
+    override fun getIcon(): Icon {
+        return XMakeIcons.FILE
+    }
+
+    override fun getIconForAddAction(): Icon {
+        return XMakeIcons.FILE
+    }
+
+    companion object {
+
+        // the log
+        private val Log = Logger.getInstance(XMakeSdkType::class.java.getName())
+
+        // the instance
+        val instance: XMakeSdkType
+            get() = SdkType.findInstance(XMakeSdkType::class.java)
+    }
+}

+ 50 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeToolWindowFactory.kt

@@ -0,0 +1,50 @@
+package org.tboox.xmake.project
+
+import com.intellij.execution.ui.ConsoleView
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.wm.ToolWindow
+import com.intellij.openapi.wm.ToolWindowFactory
+import com.intellij.openapi.wm.ToolWindowManager
+import com.intellij.ui.content.ContentFactory
+import org.tboox.xmake.shared.XMakeProblem
+
+class XMakeToolWindowFactory : ToolWindowFactory {
+    override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
+
+        // add output tab/panel
+        val toolwindowOutputPanel = XMakeToolWindowOutputPanel(project)
+        val outputTab = ContentFactory.SERVICE.getInstance().createContent(toolwindowOutputPanel, "Output", false)
+        toolWindow.contentManager.addContent(outputTab)
+
+        // add problem tab/panel
+        val toolwindowProblemPanel = XMakeToolWindowProblemPanel(project)
+        val problemTab = ContentFactory.SERVICE.getInstance().createContent(toolwindowProblemPanel, "Problem", false)
+        toolWindow.contentManager.addContent(problemTab)
+
+        // show the output panel by default
+        toolWindow.contentManager.setSelectedContent(outputTab)
+    }
+}
+
+// the xmake tool windows
+val Project.xmakeToolWindow: ToolWindow?
+    get() = ToolWindowManager.getInstance(this).getToolWindow("XMake")
+
+// the xmake output panel
+val Project.xmakeOutputPanel: XMakeToolWindowOutputPanel
+    get() = this.xmakeToolWindow?.contentManager?.getContent(0)?.component as XMakeToolWindowOutputPanel
+
+// the xmake problem panel
+val Project.xmakeProblemPanel: XMakeToolWindowProblemPanel
+    get() = this.xmakeToolWindow?.contentManager?.getContent(1)?.component as XMakeToolWindowProblemPanel
+
+// the xmake console view
+val Project.xmakeConsoleView: ConsoleView
+    get() = this.xmakeOutputPanel.consoleView
+
+// the xmake problem list
+var Project.xmakeProblemList: List<XMakeProblem>
+    get() = this.xmakeProblemPanel.problems
+    set(value) {
+        this.xmakeProblemPanel.problems = value
+    }

+ 62 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeToolWindowOutputPanel.kt

@@ -0,0 +1,62 @@
+package org.tboox.xmake.project
+
+import com.intellij.execution.filters.TextConsoleBuilderFactory
+import com.intellij.execution.ui.ConsoleView
+import com.intellij.execution.ui.ConsoleViewContentType
+import com.intellij.openapi.actionSystem.ActionManager
+import com.intellij.openapi.actionSystem.ActionToolbar
+import com.intellij.openapi.actionSystem.DefaultActionGroup
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.ui.SimpleToolWindowPanel
+import javax.swing.JEditorPane
+import javax.swing.JList
+import javax.swing.JPanel
+import javax.swing.ListSelectionModel
+
+class XMakeToolWindowOutputPanel(project: Project) : SimpleToolWindowPanel(false) {
+
+    // the project
+    val project = project
+
+    // the toolbar
+    val toolbar: ActionToolbar = run {
+        val actionManager = ActionManager.getInstance()
+        actionManager.createActionToolbar(
+            "XMake Toolbar",
+            actionManager.getAction("XMake.Menu") as DefaultActionGroup,
+            false
+        )
+    }
+
+    // the console view
+    val consoleView: ConsoleView = run {
+        val builder = TextConsoleBuilderFactory.getInstance().createBuilder(project)
+        builder.setViewer(true)
+        builder.console
+    }
+
+    init {
+
+        // init toolbar
+        setToolbar(toolbar.component)
+        toolbar.setTargetComponent(this)
+
+        // init content
+        setContent(consoleView.component)
+    }
+
+    // show panel
+    fun showPanel() {
+        val contentManager = project.xmakeToolWindow?.contentManager
+        contentManager?.setSelectedContent(contentManager.getContent(0)!!)
+    }
+
+    override fun getData(dataId: String): Any? {
+        return super.getData(dataId)
+    }
+
+    companion object {
+        private val Log = Logger.getInstance(XMakeToolWindowOutputPanel::class.java.getName())
+    }
+}

+ 170 - 0
src/main/kotlin/org/tboox/xmake/project/XMakeToolWindowProblemPanel.kt

@@ -0,0 +1,170 @@
+package org.tboox.xmake.project
+
+import com.intellij.openapi.actionSystem.ActionManager
+import com.intellij.openapi.actionSystem.ActionToolbar
+import com.intellij.openapi.actionSystem.DefaultActionGroup
+import com.intellij.openapi.application.ApplicationManager
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.ui.SimpleToolWindowPanel
+import com.intellij.ui.ColoredListCellRenderer
+import com.intellij.ui.JBColor
+import com.intellij.ui.SimpleTextAttributes
+import com.intellij.ui.components.JBList
+import com.intellij.ui.layout.CCFlags
+import com.intellij.ui.layout.panel
+import org.tboox.xmake.icons.XMakeIcons
+import org.tboox.xmake.shared.XMakeProblem
+import java.awt.Font
+import java.awt.event.MouseEvent
+import java.awt.event.MouseAdapter
+import javax.swing.JEditorPane
+import javax.swing.JScrollPane
+import javax.swing.JList
+import javax.swing.JPanel
+import java.io.File
+import javax.swing.ListSelectionModel
+import com.intellij.openapi.fileEditor.OpenFileDescriptor
+import com.intellij.openapi.vfs.LocalFileSystem
+import org.tboox.xmake.shared.xmakeConfiguration
+import com.intellij.openapi.fileEditor.FileEditorManager
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.editor.markup.EffectType
+import com.intellij.openapi.editor.markup.TextAttributes
+
+
+class XMakeToolWindowProblemPanel(project: Project) : SimpleToolWindowPanel(false) {
+
+    // the problems
+    private var _problems: List<XMakeProblem> = emptyList()
+    var problems: List<XMakeProblem>
+        get() = _problems
+        set(value) {
+            check(ApplicationManager.getApplication().isDispatchThread)
+            _problems = value
+            problemList.setListData(problems.toTypedArray())
+        }
+
+    // the toolbar
+    val toolbar: ActionToolbar = run {
+        val actionManager = ActionManager.getInstance()
+        actionManager.createActionToolbar("XMake Toolbar", actionManager.getAction("XMake.Menu") as DefaultActionGroup, false)
+    }
+
+    // the problem list
+    private val problemList = JBList<XMakeProblem>(emptyList()).apply {
+        emptyText.text = "There are no compiling problems to display."
+        selectionMode = ListSelectionModel.SINGLE_SELECTION
+        cellRenderer = object : ColoredListCellRenderer<XMakeProblem>() {
+            override fun customizeCellRenderer(list: JList<out XMakeProblem>, value: XMakeProblem, index: Int, selected: Boolean, hasFocus: Boolean) {
+
+                // get file path
+                var file = value.file
+                if (file === null) {
+                    return
+                }
+
+                // init icon
+                if (value.kind == "warning") {
+                    icon = XMakeIcons.WARNING
+                } else if (value.kind == "error") {
+                    icon = XMakeIcons.ERROR
+                } else {
+                    icon = XMakeIcons.WARNING
+                }
+
+                // init tips
+                toolTipText = value.message ?: ""
+
+                // append text
+                append("${file}(${value.line ?: "0"}): ${value.message ?: ""}", SimpleTextAttributes.REGULAR_ATTRIBUTES)
+            }
+        }
+    }
+
+    // the problem pane
+    val problemPane = JScrollPane(problemList).apply {
+        border = null
+    }
+
+    // the content
+    val content = panel {
+        row {
+            problemPane(CCFlags.push, CCFlags.grow)
+        }
+    }
+
+    init {
+
+        // init toolbar
+        setToolbar(toolbar.component)
+        toolbar.setTargetComponent(this)
+
+        // init content
+        setContent(content)
+
+        // init double click listener
+        problemList.addMouseListener(object: MouseAdapter() {
+            override fun mouseClicked(e: MouseEvent) {
+                if (e.getClickCount() == 1 || e.getClickCount() == 2) {
+
+                    // get the clicked problem
+                    val index   = problemList.locationToIndex(e.getPoint())
+                    if (index < problems.size && problems[index].file !== null) {
+
+                        // get file path
+                        val problem     = problems[index]
+                        var filename    = problem.file
+                        if (File(filename).exists()) {
+                            filename = File(filename).getAbsolutePath()
+                        } else {
+                            filename = File(project.xmakeConfiguration.data.workingDirectory, filename).getAbsolutePath()
+                        }
+
+                        // open this file
+                        val file = LocalFileSystem.getInstance().findFileByPath(filename)
+                        if (file !== null) {
+
+                            // goto file:line
+                            val descriptor = OpenFileDescriptor(project, file, problem.line?.toInt() ?: 0, problem.column?.toInt() ?: 0)
+                            descriptor.navigate(true)
+
+                            // highlight line
+                            val editor = FileEditorManager.getInstance(project).selectedTextEditor
+                            if (editor !== null) {
+
+                                if (e.getClickCount() == 2 && editor.markupModel.allHighlighters.size > 0) {
+                                    editor.markupModel.removeAllHighlighters()
+                                    return
+                                }
+
+                                // get line offset
+                                var line = problem.line?.toInt() ?: 0
+                                if (line > 0) line -= 1
+
+                                // init box color
+                                var boxcolor = JBColor.GRAY
+                                if (problem.kind == "warning") {
+                                    boxcolor = JBColor.YELLOW
+                                } else if (problem.kind == "error") {
+                                    boxcolor = JBColor.RED
+                                }
+
+                                // draw box
+                                editor.markupModel.addLineHighlighter(line, -1, TextAttributes(null, null, boxcolor, EffectType.BOXED, Font.PLAIN))
+                            }
+                        }
+                    }
+                }
+            }
+        })
+    }
+
+    override fun getData(dataId: String): Any? {
+        return super.getData(dataId)
+    }
+
+    companion object {
+        private val Log = Logger.getInstance(XMakeToolWindowProblemPanel::class.java.getName())
+    }
+}

+ 73 - 0
src/main/kotlin/org/tboox/xmake/run/XMakeProjectTasksRunner.kt

@@ -0,0 +1,73 @@
+package org.tboox.xmake.run
+
+import com.intellij.execution.*
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.execution.runners.ExecutionEnvironment
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.project.Project
+import com.intellij.task.*
+import com.intellij.task.ExecuteRunConfigurationTask
+import org.jetbrains.concurrency.AsyncPromise
+import org.jetbrains.concurrency.Promise
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.utils.SystemUtils
+import org.tboox.xmake.shared.xmakeConfiguration
+
+class XMakeProjectTasksRunner : ProjectTaskRunner() {
+
+    override fun run(
+        project: Project,
+        context: ProjectTaskContext,
+        callback: ProjectTaskNotification?,
+        tasks: MutableCollection<out ProjectTask>
+    ) {
+        // clear console first
+        project.xmakeConsoleView.clear()
+
+        // configure and build it
+        val xmakeConfiguration = project.xmakeConfiguration
+        if (xmakeConfiguration.changed) {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.configurationCommandLine)
+                .addProcessListener(object : ProcessAdapter() {
+                    override fun processTerminated(e: ProcessEvent) {
+                        SystemUtils.runvInConsole(project, xmakeConfiguration.buildCommandLine, false, true, true)
+                    }
+                })
+            xmakeConfiguration.changed = false
+        } else {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.buildCommandLine, true, true, true)
+        }
+    }
+
+    override fun canRun(projectTask: ProjectTask): Boolean {
+
+        // hook 'Build Project/Module F9' => build
+        if (projectTask is ModuleBuildTask) {
+            return true
+        }
+
+
+        // run configuration?
+        if (projectTask is ExecuteRunConfigurationTask) {
+            val runProfile = projectTask.runProfile
+            if (runProfile is XMakeRunConfiguration) {
+                return true
+            }
+        }
+
+        return false
+    }
+
+    override fun createExecutionEnvironment(
+        project: Project,
+        task: ExecuteRunConfigurationTask,
+        executor: Executor?
+    ): ExecutionEnvironment? = null
+
+    companion object {
+
+        // get log
+        private val Log = Logger.getInstance(XMakeProjectTasksRunner::class.java.getName())
+    }
+}

+ 117 - 0
src/main/kotlin/org/tboox/xmake/run/XMakeRunConfiguration.kt

@@ -0,0 +1,117 @@
+package org.tboox.xmake.run
+
+import com.intellij.execution.Executor
+import com.intellij.execution.configuration.EnvironmentVariablesData
+import com.intellij.execution.configurations.*
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.execution.runners.ExecutionEnvironment
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.options.SettingsEditor
+import com.intellij.openapi.project.Project
+import org.jdom.Element
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.shared.xmakeConfiguration
+import org.tboox.xmake.utils.SystemUtils
+
+class XMakeRunConfiguration(
+    project: Project, name: String, factory: ConfigurationFactory
+) : LocatableConfigurationBase<RunProfileState>(project, factory, name),
+    RunConfigurationWithSuppressedDefaultDebugAction {
+
+    // the run target
+    var runTarget: String = "default"
+
+    // the run arguments
+    var runArguments: String = ""
+
+    // the run environment
+    var runEnvironment: EnvironmentVariablesData = EnvironmentVariablesData.DEFAULT
+
+    // the run command line
+    val runCommandLine: GeneralCommandLine
+        get() {
+
+            // make parameters
+            val parameters = mutableListOf("run")
+            if (runTarget == "all") {
+                parameters.add("-a")
+            } else if (runTarget != "" && runTarget != "default") {
+                parameters.add(runTarget)
+            }
+            if (runArguments != "") {
+                runArguments.split(" ").forEach {
+                    parameters.add(it)
+                }
+            }
+
+            // make command line
+            return project.xmakeConfiguration.makeCommandLine(parameters, runEnvironment)
+        }
+
+    // save configuration
+    override fun writeExternal(element: Element) {
+        super.writeExternal(element)
+        element.writeString("runTarget", runTarget)
+        element.writeString("runArguments", runArguments)
+        runEnvironment.writeExternal(element)
+    }
+
+    // load configuration
+    override fun readExternal(element: Element) {
+        super.readExternal(element)
+        runTarget = element.readString("runTarget") ?: "default"
+        runArguments = element.readString("runArguments") ?: ""
+        runEnvironment = EnvironmentVariablesData.readExternal(element)
+    }
+
+    override fun checkConfiguration() {
+    }
+
+    override fun getConfigurationEditor(): SettingsEditor<out RunConfiguration> = XMakeRunConfigurationEditor(project)
+
+    override fun getState(executor: Executor, environment: ExecutionEnvironment): RunProfileState? {
+
+        // clear console first
+        project.xmakeConsoleView.clear()
+
+        // configure and run it
+        val xmakeConfiguration = project.xmakeConfiguration
+        if (xmakeConfiguration.changed) {
+            SystemUtils.runvInConsole(project, xmakeConfiguration.configurationCommandLine)
+                .addProcessListener(object : ProcessAdapter() {
+                    override fun processTerminated(e: ProcessEvent) {
+                        SystemUtils.runvInConsole(project, runCommandLine, false, true, true)
+                    }
+                })
+            xmakeConfiguration.changed = false
+        } else {
+            SystemUtils.runvInConsole(project, runCommandLine, true, true, true)
+        }
+
+        // does not use builtin run console panel
+        return null
+    }
+
+    companion object {
+        private val Log = Logger.getInstance(XMakeRunConfiguration::class.java.getName())
+    }
+}
+
+
+private fun Element.writeString(name: String, value: String) {
+    val opt = org.jdom.Element("option")
+    opt.setAttribute("name", name)
+    opt.setAttribute("value", value)
+    addContent(opt)
+}
+
+private fun Element.readString(name: String): String? =
+    children.find { it.name == "option" && it.getAttributeValue("name") == name }?.getAttributeValue("value")
+
+
+private fun Element.writeBool(name: String, value: Boolean) {
+    writeString(name, value.toString())
+}
+
+private fun Element.readBool(name: String) = readString(name)?.toBoolean()

+ 98 - 0
src/main/kotlin/org/tboox/xmake/run/XMakeRunConfigurationEditor.kt

@@ -0,0 +1,98 @@
+package org.tboox.xmake.run
+
+import com.intellij.execution.ExecutionBundle
+import com.intellij.execution.configuration.EnvironmentVariablesComponent
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
+import com.intellij.openapi.options.SettingsEditor
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.ui.ComboBox
+import com.intellij.openapi.ui.LabeledComponent
+import com.intellij.openapi.ui.TextFieldWithBrowseButton
+import com.intellij.ui.RawCommandLineEditor
+import com.intellij.ui.components.CheckBox
+import com.intellij.ui.layout.*
+import com.intellij.ui.components.Label
+import org.tboox.xmake.shared.XMakeConfiguration
+import org.tboox.xmake.shared.xmakeConfiguration
+import java.awt.Dimension
+import java.nio.file.Path
+import java.nio.file.Paths
+import javax.swing.JComponent
+import javax.swing.JList
+import javax.swing.JPanel
+import javax.swing.JTextField
+import javax.swing.DefaultComboBoxModel
+
+class XMakeRunConfigurationEditor(private val project: Project) : SettingsEditor<XMakeRunConfiguration>() {
+
+    // the xmake configuration
+    val xmakeConfiguration = project.xmakeConfiguration
+
+    // the targets ui
+    private val targetsModel = DefaultComboBoxModel<String>()
+    private val targetsComboBox = ComboBox<String>(targetsModel)
+
+    // the run arguments
+    private val runArguments = RawCommandLineEditor()
+
+    // the environment variables
+    private val environmentVariables = EnvironmentVariablesComponent()
+
+    // reset editor from configuration
+    override fun resetEditorFrom(configuration: XMakeRunConfiguration) {
+
+        // reset targets
+        targetsModel.removeAllElements()
+        for (target in xmakeConfiguration.targets) {
+            targetsModel.addElement(target)
+        }
+        targetsModel.selectedItem = configuration.runTarget
+
+        // reset run arguments
+        runArguments.text = configuration.runArguments
+
+        // reset environment variables
+        environmentVariables.envData = configuration.runEnvironment
+    }
+
+    // apply editor to configuration
+    override fun applyEditorTo(configuration: XMakeRunConfiguration) {
+
+        configuration.runTarget         = targetsModel.selectedItem.toString()
+        configuration.runArguments      = runArguments.text
+        configuration.runEnvironment    = environmentVariables.envData
+    }
+
+    // create editor
+    override fun createEditor(): JComponent = panel {
+
+        labeledRow("Default target:", targetsComboBox) {
+            targetsComboBox(CCFlags.push)
+        }
+
+        labeledRow("Run arguments:", runArguments) {
+            runArguments.apply {
+                dialogCaption = "Run arguments"
+                makeWide()
+            }()
+        }
+        row(environmentVariables.label) { environmentVariables.apply { makeWide() }() }
+    }
+
+    private fun JPanel.makeWide() {
+        preferredSize = Dimension(1000, height)
+    }
+
+    private fun LayoutBuilder.labeledRow(labelText: String, component: JComponent, init: Row.() -> Unit) {
+        val label = Label(labelText)
+        label.labelFor = component
+        row(label) { init() }
+    }
+
+    companion object {
+
+        // get log
+        private val Log = Logger.getInstance(XMakeRunConfigurationEditor::class.java.getName())
+    }
+}

+ 35 - 0
src/main/kotlin/org/tboox/xmake/run/XMakeRunConfigurationProducer.kt

@@ -0,0 +1,35 @@
+package org.tboox.xmake.run
+
+import com.intellij.execution.actions.ConfigurationContext
+import com.intellij.execution.actions.RunConfigurationProducer
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.util.Ref
+import com.intellij.psi.PsiElement
+
+class XMakeRunConfigurationProducer : RunConfigurationProducer<XMakeRunConfiguration>(XMakeRunConfigurationType()) {
+
+    override fun isConfigurationFromContext(
+            configuration: XMakeRunConfiguration,
+            context: ConfigurationContext
+    ): Boolean {
+
+        Log.info("isConfigurationFromContext")
+        return false
+    }
+
+    override fun setupConfigurationFromContext(
+            configuration: XMakeRunConfiguration,
+            context: ConfigurationContext,
+            sourceElement: Ref<PsiElement>
+    ): Boolean {
+
+        Log.info("setupConfigurationFromContext")
+        return true
+    }
+
+    companion object {
+
+        // get log
+        private val Log = Logger.getInstance(XMakeRunConfigurationProducer::class.java.getName())
+    }
+}

+ 46 - 0
src/main/kotlin/org/tboox/xmake/run/XMakeRunConfigurationType.kt

@@ -0,0 +1,46 @@
+package org.tboox.xmake.run
+
+import com.intellij.execution.BeforeRunTask
+import com.intellij.execution.configurations.ConfigurationFactory
+import com.intellij.execution.configurations.ConfigurationTypeBase
+import com.intellij.execution.configurations.RunConfiguration
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.util.Key
+import org.tboox.xmake.icons.XMakeIcons
+
+class XMakeRunConfigurationType : ConfigurationTypeBase(
+    "XMakeRunConfiguration",
+    "XMake",
+    "XMake run command configuration",
+    XMakeIcons.XMAKE
+) {
+    init {
+        addFactory(object : ConfigurationFactory(this) {
+            override fun createTemplateConfiguration(project: Project): RunConfiguration =
+                XMakeRunConfiguration(project, "XMake", this)
+
+            override fun configureBeforeRunTaskDefaults(
+                providerID: Key<out BeforeRunTask<BeforeRunTask<*>>>,
+                task: BeforeRunTask<out BeforeRunTask<*>>
+            ) {
+
+//                if (providerID == CompileStepBeforeRun.ID) {
+//                    // We don't use jps, so we don't need to execute `Make` task
+//                    // before run configuration is executed
+//                    task.isEnabled = false
+//                }
+            }
+
+            override fun isConfigurationSingletonByDefault(): Boolean = true
+        })
+    }
+
+    val factory: ConfigurationFactory get() = configurationFactories.single()
+
+    companion object {
+
+        // get log
+        private val Log = Logger.getInstance(XMakeRunConfigurationType::class.java.getName())
+    }
+}

+ 21 - 0
src/main/kotlin/org/tboox/xmake/run/XMakeRunner.kt

@@ -0,0 +1,21 @@
+package org.tboox.xmake.run;
+
+import com.intellij.execution.configurations.RunProfile
+import com.intellij.execution.executors.DefaultRunExecutor
+import com.intellij.execution.runners.DefaultProgramRunner
+import com.intellij.openapi.diagnostic.Logger
+
+class XMakeRunner : DefaultProgramRunner() {
+
+    override fun canRun(executorId: String, profile: RunProfile): Boolean {
+        return executorId == DefaultRunExecutor.EXECUTOR_ID && profile is XMakeRunConfiguration
+    }
+
+    override fun getRunnerId(): String = "XMakeRunner"
+
+    companion object {
+
+        // get log
+        private val Log = Logger.getInstance(XMakeRunner::class.java.getName())
+    }
+}

+ 249 - 0
src/main/kotlin/org/tboox/xmake/shared/XMakeConfiguration.kt

@@ -0,0 +1,249 @@
+package org.tboox.xmake.shared
+
+import com.intellij.execution.configuration.EnvironmentVariablesData
+import com.intellij.execution.configurations.GeneralCommandLine
+import com.intellij.openapi.components.PersistentStateComponent
+import com.intellij.openapi.components.State
+import com.intellij.openapi.components.ProjectComponent
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.project.Project
+import org.tboox.xmake.utils.SystemUtils
+
+@State(name = "XMakeProjectSettings")
+class XMakeConfiguration(project: Project) : PersistentStateComponent<XMakeConfiguration.State>, ProjectComponent {
+
+    // the project
+    val project = project
+
+    // the platforms
+    val platforms = arrayOf("macosx", "linux", "windows", "android", "iphoneos", "watchos", "mingw")
+
+    // the architectures
+    val architectures: Array<String>
+        get() = getArchitecturesByPlatform(data.currentPlatform)
+
+    // the modes
+    val modes = arrayOf("release", "debug")
+
+    // the build command line
+    val buildCommandLine: GeneralCommandLine
+        get() {
+
+            // make parameters
+            val parameters = mutableListOf<String>()
+            if (data.verboseOutput) {
+                parameters.add("-v")
+            } else {
+                parameters.add("-w")
+            }
+
+            // make command line
+            return makeCommandLine(parameters)
+        }
+
+    // the rebuild command line
+    val rebuildCommandLine: GeneralCommandLine
+        get() {
+
+            // make parameters
+            val parameters = mutableListOf<String>("-r")
+            if (data.verboseOutput) {
+                parameters.add("-v")
+            } else {
+                parameters.add("-w")
+            }
+
+            // make command line
+            return makeCommandLine(parameters)
+        }
+
+    // the clean command line
+    val cleanCommandLine: GeneralCommandLine
+        get() {
+
+            // make parameters
+            val parameters = mutableListOf<String>("c")
+            if (data.verboseOutput) {
+                parameters.add("-v")
+            }
+
+            // make command line
+            return makeCommandLine(parameters)
+        }
+
+    // the clean configuration command line
+    val cleanConfigurationCommandLine: GeneralCommandLine
+        get() {
+
+            // make parameters
+            val parameters = mutableListOf<String>("f", "-c")
+            if (data.verboseOutput) {
+                parameters.add("-v")
+            }
+            if (data.buildOutputDirectory != "") {
+                parameters.add("-o")
+                parameters.add(data.buildOutputDirectory)
+            }
+
+            // make command line
+            return makeCommandLine(parameters)
+        }
+
+    // the configuration command line
+    val configurationCommandLine: GeneralCommandLine
+        get() {
+
+            // make parameters
+            val parameters = mutableListOf<String>("f", "-p", data.currentPlatform, "-a", data.currentArchitecture, "-m", data.currentMode)
+            if (data.currentPlatform == "android" && data.androidNDKDirectory != "") {
+                parameters.add("--ndk=\"${data.androidNDKDirectory}\"")
+            }
+            if (data.verboseOutput) {
+                parameters.add("-v")
+            }
+            if (data.buildOutputDirectory != "") {
+                parameters.add("-o")
+                parameters.add(data.buildOutputDirectory)
+            }
+
+            // make command line
+            return makeCommandLine(parameters)
+        }
+
+    // the quick start command line
+    val quickStartCommandLine: GeneralCommandLine
+        get() {
+
+            // make parameters
+            val parameters = mutableListOf<String>("f", "-y")
+            if (data.verboseOutput) {
+                parameters.add("-v")
+            }
+
+            // make command line
+            return makeCommandLine(parameters)
+        }
+
+    // the targets
+    val targets: Array<String>
+        get() {
+
+            // make targets
+            var targets = arrayOf("default", "all")
+            val results = SystemUtils.ioRunv(listOf(SystemUtils.xmakeProgram, "l", "-c", "import(\"core.project.config\"); import(\"core.project.project\"); config.load(); for name, _ in pairs((project.targets())) do print(name) end"), data.workingDirectory)
+            results.split("\n").forEach {
+                if (it.trim() != "") {
+                    targets += it
+                }
+            }
+            return targets
+        }
+
+    // configuration is changed?
+    var changed = true
+
+    // the state data
+    var _data: State = State()
+    var data: State
+        get() = _data
+        set(value) {
+            val newState = State(
+                    currentPlatform = value.currentPlatform,
+                    currentArchitecture = value.currentArchitecture,
+                    currentMode = value.currentMode,
+                    workingDirectory = value.workingDirectory,
+                    androidNDKDirectory = value.androidNDKDirectory,
+                    buildOutputDirectory = value.buildOutputDirectory,
+                    verboseOutput = value.verboseOutput,
+                    additionalConfiguration = value.additionalConfiguration
+            )
+            if (_data != newState) {
+                _data = newState
+                changed = true
+            }
+        }
+
+    // make command line
+    fun makeCommandLine(parameters: List<String>, environmentVariables: EnvironmentVariablesData = EnvironmentVariablesData.DEFAULT): GeneralCommandLine {
+
+        // make command
+        return GeneralCommandLine(SystemUtils.xmakeProgram)
+                .withParameters(parameters)
+                .withCharset(Charsets.UTF_8)
+                .withWorkDirectory(data.workingDirectory)
+                .withEnvironment(environmentVariables.envs)
+                .withRedirectErrorStream(true)
+    }
+
+    data class State (
+        var currentPlatform: String = SystemUtils.platform(),
+        var currentArchitecture: String = "",
+        var currentMode: String = "release",
+        var workingDirectory: String = "",
+        var androidNDKDirectory: String = "",
+        var buildOutputDirectory: String = "",
+        var verboseOutput: Boolean = false,
+        var additionalConfiguration: String = ""
+
+    )
+
+    // ensure state
+    fun ensureState() {
+        if (data.workingDirectory == "") {
+            data.workingDirectory = project.basePath.toString()
+        }
+        if (data.currentArchitecture == "" && architectures.isNotEmpty()) {
+            data.currentArchitecture = architectures[0]
+        }
+    }
+
+    // get and save state to file
+    override fun getState(): State {
+        return data
+    }
+
+    // load state from file
+    override fun loadState(state: State) {
+        data = state
+        ensureState()
+    }
+
+    override fun initComponent() {
+        ensureState()
+    }
+
+    override fun disposeComponent() {
+    }
+
+    override fun getComponentName(): String {
+        return "XMakeConfiguration"
+    }
+
+    override fun projectOpened() {
+        ensureState()
+    }
+
+    override fun projectClosed() {
+    }
+
+    companion object {
+
+        // get architectures by platform
+        fun getArchitecturesByPlatform(platform: String) = when (platform) {
+            "macosx", "linux", "mingw" -> arrayOf("x86_64", "i386")
+            "windows" -> arrayOf("x86", "x64")
+            "iphoneos" -> arrayOf("arm64", "armv7", "armv7s", "x86_64", "i386")
+            "watchos" -> arrayOf("armv7s", "i386")
+            "android" -> arrayOf("armv7-a", "armv5te", "armv6", "armv8-a", "arm64-v8a")
+            else -> arrayOf()
+        }
+
+        // get log
+        private val Log = Logger.getInstance(XMakeConfiguration::class.java.getName())
+    }
+}
+
+val Project.xmakeConfiguration: XMakeConfiguration
+    get() = this.getComponent(XMakeConfiguration::class.java)
+            ?: error("Failed to get XMakeConfiguration for $this")
+

+ 4 - 0
src/main/kotlin/org/tboox/xmake/shared/XMakeProblem.kt

@@ -0,0 +1,4 @@
+package org.tboox.xmake.shared
+
+class XMakeProblem (val file: String? = null, val line: String? = "0", val column: String? = "0", val kind: String? = "error", val message: String? = "") {
+}

+ 80 - 0
src/main/kotlin/org/tboox/xmake/utils/ConsoleProcessHandler.kt

@@ -0,0 +1,80 @@
+package org.tboox.xmake.utils
+
+import com.intellij.execution.process.*
+import com.intellij.execution.ui.ConsoleView
+import com.intellij.execution.ui.ConsoleViewContentType
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.util.Key
+import com.intellij.execution.configurations.GeneralCommandLine
+import java.io.IOException
+import java.io.OutputStreamWriter
+
+class ConsoleProcessHandler(
+    private val consoleView: ConsoleView,
+    commandLine: GeneralCommandLine,
+    showExitCode: Boolean = false
+) : KillableColoredProcessHandler(commandLine) {
+
+    // the output content
+    var outputContent = ""
+
+    // initialize
+    init {
+
+        // shows exit code upon termination
+        if (showExitCode) {
+            ProcessTerminatedListener.attach(this)
+        }
+    }
+
+    override fun coloredTextAvailable(textOriginal: String, attributes: Key<*>) {
+        append(textOriginal, attributes)
+    }
+
+    // append info to the console view
+    private fun append(s: String, k: Key<*>) {
+        this.consoleView.print(s, ConsoleViewContentType.getConsoleViewType(k))
+        outputContent += s
+    }
+
+    // append input info to the console view
+    fun input(s: String) {
+        try {
+            processInputWriter.append(s)
+        } catch (ex: IOException) {
+            Log.error(ex)
+        }
+    }
+
+    // append input info and flush it
+    fun inputWithFlush(s: String) {
+        try {
+            processInputWriter.append(s)
+            processInputWriter.flush()
+        } catch (ex: IOException) {
+            Log.error(ex)
+        }
+    }
+
+    var _outputStreamWriter: OutputStreamWriter? = null
+    private val processInputWriter: OutputStreamWriter
+        get() {
+            if (_outputStreamWriter == null) {
+                _outputStreamWriter = OutputStreamWriter(processInput)
+            }
+            return _outputStreamWriter ?: OutputStreamWriter(processInput)
+        }
+
+    // flush io
+    fun flush() {
+        try {
+            processInputWriter.flush()
+        } catch (ex: IOException) {
+            Log.error(ex)
+        }
+    }
+
+    companion object {
+        private val Log = Logger.getInstance(ConsoleProcessHandler::class.java.getName())
+    }
+}

+ 255 - 0
src/main/kotlin/org/tboox/xmake/utils/SystemUtils.kt

@@ -0,0 +1,255 @@
+package org.tboox.xmake.utils
+
+import com.intellij.execution.configurations.GeneralCommandLine
+import com.intellij.execution.process.ProcessAdapter
+import com.intellij.execution.process.ProcessEvent
+import com.intellij.execution.process.ProcessHandler
+import com.intellij.openapi.application.ApplicationManager
+import com.intellij.openapi.util.SystemInfo
+import com.intellij.openapi.diagnostic.Logger
+import com.intellij.openapi.project.Project
+import org.tboox.xmake.project.xmakeConsoleView
+import org.tboox.xmake.project.xmakeOutputPanel
+import org.tboox.xmake.project.xmakeProblemList
+import org.tboox.xmake.project.xmakeToolWindow
+import org.tboox.xmake.shared.XMakeProblem
+import java.io.BufferedReader
+import java.io.IOException
+import java.io.InputStreamReader
+import java.io.File
+import java.util.regex.Pattern
+
+import java.nio.charset.Charset
+
+object SystemUtils {
+
+    // the log
+    private val Log = Logger.getInstance(SystemUtils::class.java.getName())
+
+    // the xmake program
+    private var _xmakeProgram:String = ""
+    var xmakeProgram:String
+        get() {
+
+            // cached? return it directly
+            if (_xmakeProgram != "") {
+                return _xmakeProgram
+            }
+
+            // for windows? return xmake directly
+            if (SystemInfo.isWindows) {
+                _xmakeProgram = "xmake"
+                return _xmakeProgram
+            }
+
+            // attempt to get xmake program
+            val programs = arrayOf("xmake", (System.getenv("HOME") ?: "") + "/.local/bin/xmake", "/usr/local/bin/xmake", "/usr/bin/xmake")
+            for (program in programs) {
+                if (program == "xmake" || File(program).exists()) {
+
+                    try {
+
+                        // init process builder
+                        val processBuilder = ProcessBuilder(listOf(program, "--version"))
+
+                        // run process
+                        val process = processBuilder.start()
+
+                        // wait for process
+                        if (process.waitFor() == 0) {
+                            _xmakeProgram = program
+                            break
+                        }
+
+                    } catch (e: IOException) {
+                        e.printStackTrace()
+                    }
+                }
+            }
+
+            // ok?
+            return _xmakeProgram
+        }
+        set(value) { _xmakeProgram = value }
+
+    // the xmake version
+    private var _xmakeVersion:String = ""
+    var xmakeVersion:String
+        get() {
+            if (_xmakeVersion == "") {
+                val result = ioRunv(listOf(xmakeProgram, "--version")).split(',')
+                if (result.size > 0) {
+                    _xmakeVersion = result[0]
+                }
+            }
+            return _xmakeVersion
+        }
+        set(value) { _xmakeVersion = value }
+
+    // get platform
+    fun platform(): String = when {
+        SystemInfo.isWindows -> "windows"
+        SystemInfo.isMac -> "macosx"
+        else -> "linux"
+    }
+
+    // run command with arguments
+    fun Runv(argv: List<String>, workingDirectory: String? = null): Int {
+
+        var code = -1
+        try {
+
+            // init process builder
+            val processBuilder = ProcessBuilder(argv)
+
+            // init working directory
+            if (workingDirectory !== null) {
+                processBuilder.directory(File(workingDirectory))
+            }
+
+            // run process
+            val process = processBuilder.start()
+
+            // wait for process
+            code = process.waitFor()
+
+        } catch (e: IOException) {
+            e.printStackTrace()
+        } finally {
+        }
+
+        // ok?
+        return code
+    }
+
+    // run command with arguments and return output
+    fun ioRunv(argv: List<String>, workingDirectory: String? = null): String {
+
+        var result = ""
+        var bufferReader: BufferedReader? = null
+        try {
+
+            // init process builder
+            val processBuilder = ProcessBuilder(argv)
+
+            // init working directory
+            if (workingDirectory !== null) {
+                processBuilder.directory(File(workingDirectory))
+            }
+
+            // disable color for xmake
+            processBuilder.environment().put("COLORTERM", "nocolor")
+
+            // run process
+            val process = processBuilder.start()
+
+            // get input buffer reader
+            bufferReader = BufferedReader(InputStreamReader(process.getInputStream()))
+
+            // get io output
+            var line: String? = bufferReader.readLine()
+            while (line != null) {
+                result += line + "\n"
+                line = bufferReader.readLine()
+            }
+
+            // wait for process
+            if (process.waitFor() != 0)
+                result = ""
+
+        } catch (e: IOException) {
+            e.printStackTrace()
+        } finally {
+
+            if (bufferReader != null) {
+                try {
+                    bufferReader.close()
+                } catch (e: Exception) {
+                    e.printStackTrace()
+                }
+
+            }
+        }
+
+        // ok?
+        return result
+    }
+
+    // parse problems for the given line
+    private fun parseProblem(info: String): XMakeProblem? {
+
+        if (SystemInfo.isWindows) {
+
+            // gbk => utf8
+            val info_utf8 = String(info.toByteArray(), charset("UTF-8"))
+
+            // parse problem info
+            val pattern = Pattern.compile("(.*?)\\(([0-9]*)\\): (.*?) .*?: (.*)")
+            val matcher = pattern.matcher(info_utf8)
+            if (matcher.find()) {
+                val file = matcher.group(1)
+                val line = matcher.group(2)
+                val kind = matcher.group(3)
+                val message = matcher.group(4)
+                return XMakeProblem(file, line, "0", kind, message)
+            }
+
+        } else {
+
+            // parse problem info
+            val pattern = Pattern.compile("^(error: )?(.*?):([0-9]*):([0-9]*): (.*?): (.*)\$")
+            val matcher = pattern.matcher(info)
+            if (matcher.find()) {
+                val file = matcher.group(2)
+                val line = matcher.group(3)
+                val column = matcher.group(4)
+                val kind = matcher.group(5)
+                val message = matcher.group(6)
+                return XMakeProblem(file, line, column, kind, message)
+            }
+        }
+        return null
+    }
+
+    // run process in console
+    fun runvInConsole(project: Project, commandLine: GeneralCommandLine, showConsole: Boolean = true, showProblem: Boolean = false, showExitCode: Boolean = false): ProcessHandler {
+
+        // create handler
+        val handler = ConsoleProcessHandler(project.xmakeConsoleView, commandLine, showExitCode)
+
+        // show console?
+        if (showConsole) {
+
+            // show tool window first
+            project.xmakeToolWindow?.show {
+                project.xmakeOutputPanel.showPanel()
+            }
+        }
+
+        // show problem?
+        if (showProblem) {
+            handler.addProcessListener(object : ProcessAdapter() {
+
+                override fun processTerminated(e: ProcessEvent) {
+                    val content = handler.outputContent
+                    ApplicationManager.getApplication().invokeLater {
+                        val problems = mutableListOf<XMakeProblem>()
+                        content.split('\n').forEach {
+                            val problem = parseProblem(it.trim())
+                            if (problem !== null) {
+                                problems.add(problem)
+                            }
+                        }
+                        project.xmakeProblemList = problems
+                    }
+                }
+            })
+        }
+
+        // start process
+        handler.startNotify()
+
+        // failed
+        return handler
+    }
+}

+ 4 - 0
src/main/resources/META-INF/clion-only.xml

@@ -0,0 +1,4 @@
+<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude" allow-bundled-update="true">
+    <depends>com.intellij.cidr.base</depends>
+    <depends>com.intellij.clion</depends>
+</idea-plugin>

+ 2 - 0
src/main/resources/META-INF/idea-only.xml

@@ -0,0 +1,2 @@
+<idea-plugin>
+</idea-plugin>

+ 130 - 0
src/main/resources/META-INF/plugin.xml

@@ -0,0 +1,130 @@
+<!-- plugin-docs: https://www.jetbrains.org/intellij/sdk/docs/basics.html -->
+<idea-plugin>
+    <id>org.tboox.xmake</id>
+    <name>XMake</name>
+    <version>1.0.5</version>
+    <vendor email="[email protected]" url="http://www.tboox.org">tboox.org</vendor>
+
+    <description><![CDATA[
+    A XMake integration plugin in Intellij Platform<br>
+    <p><a href="https://github.com/xmake-io/xmake-idea">Source Code</a> | <a href="https://gitter.im/tboox/tboox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge">Gitter</a> | <a href="http://xmake.io/pages/donation.html#donate">Donate</a> | <a href="http://xmake.io">XMake Homepage</a></p>
+    Features:
+    <ul>
+        <li>xmake</li>
+        <ul>
+            <li>C/C++/Objc/Swift/Rust/Dlang/Golang ... support</li>
+            <li>Cross-platform support</li>
+            <li>Lua syntax</li>
+            <li><a href="https://github.com/xmake-io/xmake">More features and info about xmake</a></li>
+        </ul>
+        <li>Quickstart</li>
+        <li>Create project</li>
+        <li>Project configuration</li>
+        <li>Run configuration</li>
+        <li>Menu tools</li>
+        <li>Tool windows</li>
+        <li>Build and run</li>
+        <li>Goto error and waring problems</li>
+    </ul>
+    <p>中国朋友可以加QQ群交流及反馈BUG: 343118190</p>
+    ]]></description>
+
+    <change-notes><![CDATA[
+    <strong>1.0.5</strong>
+    <ul>
+        <li>[FIX]: Fix conflict issues with java</li>
+    </ul>
+    <strong>1.0.4</strong>
+    <ul>
+        <li>[NEW]: Modify rebuild icon</li>
+    </ul>
+    <strong>1.0.3</strong>
+    <ul>
+        <li>[NEW]: Improve exit code</li>
+    </ul>
+    <strong>1.0.2</strong>
+    <ul>
+        <li>[NEW]: Create project (c/c++/rust/go/dlang/swift/objc)</li>
+    </ul>
+    <strong>1.0.1</strong>
+    <ul>
+        <li>[NEW]: Quickstart</li>
+        <li>[NEW]: Project configuration</li>
+        <li>[NEW]: Run configuration</li>
+        <li>[NEW]: Menu tools</li>
+        <li>[NEW]: Tool windows</li>
+        <li>[NEW]: Build and run</li>
+        <li>[NEW]: Goto error and waring problems</li>
+    </ul>
+    ]]>
+    </change-notes>
+
+    <!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
+    <idea-version since-build="201.0"/>
+
+    <!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
+         on how to target different products -->
+    <!--    <depends>com.intellij.modules.java</depends>-->
+    <depends>com.intellij.modules.lang</depends>
+    <depends>com.intellij.modules.platform</depends>
+    <depends optional="true" config-file="clion-only.xml">com.intellij.modules.clion</depends>
+
+    <extensions defaultExtensionNs="com.intellij">
+
+        <!-- icons -->
+        <iconProvider implementation="org.tboox.xmake.icons.XMakeIconProvider"/>
+
+        <!-- module configurations -->
+        <!-- clion not support -->
+        <sdkType implementation="org.tboox.xmake.project.XMakeSdkType"/>
+        <moduleType id="XMake.Module" implementationClass="org.tboox.xmake.project.XMakeModuleType"/>
+        <moduleBuilder builderClass="org.tboox.xmake.project.XMakeModuleBuilder"/>
+
+        <directoryProjectGenerator implementation="org.tboox.xmake.project.XMakeDirectoryProjectGenerator"/>
+
+        <!-- project configurations -->
+        <projectConfigurable instance="org.tboox.xmake.project.XMakeProjectConfigurable" displayName="XMake"
+                             groupId="language"/>
+        <toolWindow id="XMake" anchor="bottom" factoryClass="org.tboox.xmake.project.XMakeToolWindowFactory"
+                    icon="/icons/xmake_13x13.png"/>
+
+        <!-- run configurations -->
+        <programRunner implementation="org.tboox.xmake.run.XMakeRunner"/>
+        <configurationType implementation="org.tboox.xmake.run.XMakeRunConfigurationType"/>
+        <runConfigurationProducer implementation="org.tboox.xmake.run.XMakeRunConfigurationProducer"/>
+
+    </extensions>
+
+    <!--
+    group id
+         http://keithlea.com/idea-actions/
+         https://github.com/centic9/IntelliJ-Action-IDs
+    -->
+    <actions>
+        <group id="XMake.Menu" text="XMake" description="XMake Menu">
+            <add-to-group group-id="MainMenu" anchor="after" relative-to-action="RunMenu"/>
+            <action id="XMake.Run" class="org.tboox.xmake.actions.RunAction" text="Run Target" icon="/icons/run.png"
+                    description="Run the current target."/>
+            <action id="XMake.Build" class="org.tboox.xmake.actions.BuildAction" text="Build Project"
+                    icon="/icons/build.png" description="Build the current project."/>
+            <action id="XMake.Rebuild" class="org.tboox.xmake.actions.RebuildAction" text="Rebuild Project"
+                    icon="/icons/rebuild.png" description="Rebuild the current project."/>
+            <action id="XMake.Clean" class="org.tboox.xmake.actions.CleanAction" text="Clean Project"
+                    icon="/icons/clean.png" description="Clean target and object files."/>
+            <separator/>
+            <reference id="editRunConfigurations"/>
+            <action id="XMake.CleanConfiguration" class="org.tboox.xmake.actions.CleanConfigurationAction"
+                    text="Clean Configuration" icon="/icons/cleanconf.png"
+                    description="Clean the current configuration."/>
+            <separator/>
+            <action id="XMake.QuickStart" class="org.tboox.xmake.actions.QuickStartAction" text="Quick Start"
+                    icon="/icons/quickstart.png" description="Quick start a new project."/>
+        </group>
+    </actions>
+
+    <project-components>
+        <component>
+            <implementation-class>org.tboox.xmake.shared.XMakeConfiguration</implementation-class>
+        </component>
+    </project-components>
+</idea-plugin>

BIN
src/main/resources/icons/build.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/build@2x_dark.png


BIN
src/main/resources/icons/build_dark.png


BIN
src/main/resources/icons/clean.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/cleanconf.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/debug.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/debug@2x_dark.png


BIN
src/main/resources/icons/debug_dark.png


BIN
src/main/resources/icons/error.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/quickstart.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/rebuild.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/rebuild@2x_dark.png


BIN
src/main/resources/icons/rebuild_dark.png


BIN
src/main/resources/icons/run.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/settings.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/settings@2x_dark.png


BIN
src/main/resources/icons/settings_dark.png


BIN
src/main/resources/icons/warning.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/xmake.png


BIN
src/main/resources/icons/[email protected]


BIN
src/main/resources/icons/xmake_13x13.png