开发环境与工具: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
m (Adding interlang links (links to translated versions of this page in other languages) triggered by origin English page "Environment_and_development_tools" update.)
Tag: 2017 source edit
 
(5 intermediate revisions by 2 users not shown)
Line 10: Line 10:
{{TemplateDocDevZh}}
{{TemplateDocDevZh}}


Every integrated development environment can be used.
您可以使用任何开发环境。但是,这里有一份高度推荐使用的工具清单,因为它们提供了较好的完整性、开发质量和开发效率。Dolibarr的大多数核心开发人员都在使用它们。请注意,所有这些解决方案都是免费和开源的。
However, this is a list of tools highly recommanded to use. They are all famous and a good help as they are featurful and of high quality. They are used by most main Dolibarr developers. Above all, they are all free and Opensource.


=[[File:Eclipsephp.jpg]] For every developer=
=[[File:Eclipsephp.jpg]] 适用于每个开发者=


These are the recommended tools but any tool compliant with PHP, MySQL and Web standards can be used.
这是推荐的基本开发环境,但任何符合Web、PHP和MySQL标准的工具都可以做到这一点。


==An AMP server==
==一个 AMP 服务器==


*AMP means Apache + MariaDB + PHP
*AMP 表示 Apache + MariaDB + PHP


For Linux: These 3 products are available in almost all Linux distributions by default.
Linux平台:默认情况下,这3个产品在所有发行版中都可用。


For Windows: Install [https://www.wampserver.com/WampServer] (MariaDB SQL database, Apache and PHP in an all-in-one package) or a comparable system environment (like XAMPP).
Windows平台: 安装 [https://www.wampserver.com/WampServer] (基于MariaDB SQL database、Apache和PHP的组合软件包) 。这个WAMP服务器提供了MariaDB+Apache+PHP三个组件,只需单击一下即可变更其中任何一个组件的版本。


The WAMP server offers MariaDB+Apache+PHP, with the option to change the version of any component with a simple click.
==浏览器 (Chrome / Firefox) + 插件==
 
==Webbrowser (Chrome / Firefox) + plugins==


*Chrome + plugins
*Chrome + plugins
Line 34: Line 31:


*Firefox + plugins:  
*Firefox + plugins:  
**HTML Validator
**User Agent Switcher to simulate usage of smartphones
**Cert Viewer Plus if you plan to make tests with HTTPS
**QuickProxy if you want to switch quickly on proxy tools (WebScarab)


You can download this on web site https://www.firefox.com  
You can download this on web site https://www.firefox.com  
Line 43: Line 36:
or the new Firefox Developer Edition:  https://www.mozilla.org/de/firefox/developer/
or the new Firefox Developer Edition:  https://www.mozilla.org/de/firefox/developer/


==SquirrelSQL or DBeaver==
==访问数据库的工具(SquirrelSQL 或 DBeaver)==


*SquirrelSQL or DBeaver for database administration.
*SquirrelSQL or DBeaver for database administration.
Line 49: Line 42:
Go on official web site of this product to download them.
Go on official web site of this product to download them.


==Eclipse and plugins==
==IDE(Eclipse、VSCode)和插件==
===Install Eclipse===
===Eclipse===
====Install Eclipse====
We recommend to use an Eclipse version provided on eclipse.org. For example: {{DownloadEclipse}}
We recommend to use an Eclipse version provided on eclipse.org. For example: {{DownloadEclipse}}


Line 58: Line 52:
{{EclipseStandardSetup}}
{{EclipseStandardSetup}}


===Install plugin Eclipse for PHP: PDT.===
====Install plugin Eclipse for PHP: PDT.====
If you installed Eclipse version and PDT is not included, all you have to do is using process Help -> Install new software -> Add -> Archive to add module:
If you installed Eclipse version and PDT is not included, all you have to do is using process Help -> Install new software -> Add -> Archive to add module:


Line 65: Line 59:
Once installed, you must also setup PDT into Eclipse as explained into chapter [[Environment_and_development_tools_-_Optionnal_components#From_Eclipse]]
Once installed, you must also setup PDT into Eclipse as explained into chapter [[Environment_and_development_tools_-_Optionnal_components#From_Eclipse]]


===Setup Eclipse to get sources===
====Setup Eclipse to get sources====
Once Eclipse is installed, you can connect to GIT repository to get last development version.
Once Eclipse is installed, you can connect to GIT repository to get last development version.


For this see page [[FAQ Get,update GIT project sources]].
For this see page [[FAQ Get,update GIT project sources]].


== Git Hooks ==
===VSCode===
{{DownloadVSCode}}
 
==Git 钩子==
 
===安裝預提交 git hook===
您可以使用 git hooks 檢查您提交的文件的語法,並在發生錯誤時取消(或更好地自動修復)提交。


=== Install Pre-commit git hook ===
此文件中提供了安裝此類預提交掛鉤的說明:
You can use git hooks to check the syntax of the file you commit and cancel the commit if something is wrong. You need '''phpcs''' command line tool for this (sudo apt-get -y install php-codesniffer). If you have '''phpcbf''' installed, you can also fix the files automatically. This is how to:


Go to '''/dev/setup/git/hooks''' of your local repository, copy the file '''pre-commit''' into your '''.git/hooks''' folder of the local git repository and make it executable.
https://github.com/Dolibarr/dolibarr/tree/develop/dev/setup/pre-commit


Next, you need to edit pre-commit file in .git/hooks to modify the DIRPHPCS variable to set the path of your phpcs and phpcbf tool (you can keep it empty if tools are available into your PATH).
此類掛鉤在命令列上使用時可以工作,但在使用通用 IDE 提交時也可以工作(它已通過 Eclipse 和 VSC 進行了驗證)。


Such hooks will work when using on command line but may also work when committing using your common IDE (it has been validated with Eclipse and VSC).
安裝後,該掛鉤將在您下一次提交時啟動以重新格式化您的程式碼,因此您的程式碼將始終符合編碼語法規則。如果每個人都啟用此鉤子,則每個人都將使用相同的編碼語法規則,因此強烈建議您盡可能啟用它。如果語法有問題,提交將立即取消。如果它可以自動修復,在安裝預提交掛鉤期間安裝的 phpcbf 將修復它,因此您只需再次嘗試提交即可驗證它。


Once installed, the hook will start on your next commit to re-format your code, so your code will always match the coding syntax rules. If everybody enable this hook, everybody will use the same coding syntax rule, so it is highly recommended to enable it if you can. If something is wrong in the syntax, the commit will be immediately canceled. If it can be fixed automatically, phpcbf will fix it so you just have to try the commit a second time to have it validated.
=[[File:Computer.png]]  可选组件=
您还可以安装可选组件以获得更多技术支持。请参阅:[[Environment and development tools - Optionnal components|开发环境与工具 - 可选组件]] 。


=[[File:Computer.png]]  Optional=
[[Category:开发]]
There are a lot of more components you can install to get more technologies support:
[[Environment and development tools - Optionnal components]]

Latest revision as of 09:45, 2 April 2025


您可以使用任何开发环境。但是,这里有一份高度推荐使用的工具清单,因为它们提供了较好的完整性、开发质量和开发效率。Dolibarr的大多数核心开发人员都在使用它们。请注意,所有这些解决方案都是免费和开源的。

Eclipsephp.jpg 适用于每个开发者

这是推荐的基本开发环境,但任何符合Web、PHP和MySQL标准的工具都可以做到这一点。

一个 AMP 服务器

  • AMP 表示 Apache + MariaDB + PHP

Linux平台:默认情况下,这3个产品在所有发行版中都可用。

Windows平台: 安装 [1] (基于MariaDB SQL database、Apache和PHP的组合软件包) 。这个WAMP服务器提供了MariaDB+Apache+PHP三个组件,只需单击一下即可变更其中任何一个组件的版本。

浏览器 (Chrome / Firefox) + 插件

  • Chrome + plugins

You can download Chrome from https://www.chrome.com

  • Firefox + plugins:

You can download this on web site https://www.firefox.com

or the new Firefox Developer Edition: https://www.mozilla.org/de/firefox/developer/

访问数据库的工具(SquirrelSQL 或 DBeaver)

  • SquirrelSQL or DBeaver for database administration.

Go on official web site of this product to download them.

IDE(Eclipse、VSCode)和插件

Eclipse

Install Eclipse

We recommend to use an Eclipse version provided on eclipse.org. For example: https://eclipse.org/pdt/

Also any version available on Eclipse web site is possible.

Once Eclipse is installed, it is recommanded to setup following parameters:

  • Window - Preferences - General - Workspace - Text file encoding -> UTF8
  • Window - Preferences - General - Workspace - New text file line delimiter -> Unix
  • Window - Preferences - General - Compare/Patch - Ignore white spaces -> Yes
  • Window - Preferences - General - Editor - Text editors - Tab delimiter length -> 4
  • Window - Preferences - General - Editor - Text editors - Insert spaces for tab -> No
  • Window - Preferences - General - Editor - File Association -> Add *.lang associated to "Text Editor"
  • Note: You can also disable Windows - Preferences - Java - Editor - Content Assist - Auto Activation

And if PDT is installed (see later):

  • Window - Preferences - PHP - Code Style - Formatter - Tab policy -> Tab
  • Window - Preferences - PHP - Code Style - Formatter - Default indentation for wrapped line -> 1
  • Window - Preferences - PHP - Code Style - Formatter - Default indentation for array initializer -> 0
  • Window - Preferences - PHP - Editor - Typing - Uncheck "When Pasting Adjust Indentation" (keeping this option checked create corruption of text files by adding bad end of line characters)
  • Window - Preferences - PHP - Code Style - Formatter - Use the profile provided into dev/setup/eclipse/PSR-12 [built-in].xml as Eclipse syntax formatter.
  • Note: You can also disable Windows - Preferences - PHP - Editor - Content Assist - Auto Activation

Install plugin Eclipse for PHP: PDT.

If you installed Eclipse version and PDT is not included, all you have to do is using process Help -> Install new software -> Add -> Archive to add module:

https://download.eclipse.org/releases/xxx - xxx = version

Or from the GUI of any Eclipse =>Install New Software =>Work With Kepler => Wait until list display =>General Purpose Tools Check PHP development tools (PDT)=>Install

Once installed, you must also setup PDT into Eclipse as explained into chapter Environment_and_development_tools_-_Optionnal_components#From_Eclipse

Setup Eclipse to get sources

Once Eclipse is installed, you can connect to GIT repository to get last development version.

For this see page FAQ Get,update GIT project sources.

VSCode

Voir les instructions d'installation de l'éditeur.

Git 钩子

安裝預提交 git hook

您可以使用 git hooks 檢查您提交的文件的語法,並在發生錯誤時取消(或更好地自動修復)提交。

此文件中提供了安裝此類預提交掛鉤的說明:

https://github.com/Dolibarr/dolibarr/tree/develop/dev/setup/pre-commit

此類掛鉤在命令列上使用時可以工作,但在使用通用 IDE 提交時也可以工作(它已通過 Eclipse 和 VSC 進行了驗證)。

安裝後,該掛鉤將在您下一次提交時啟動以重新格式化您的程式碼,因此您的程式碼將始終符合編碼語法規則。如果每個人都啟用此鉤子,則每個人都將使用相同的編碼語法規則,因此強烈建議您盡可能啟用它。如果語法有問題,提交將立即取消。如果它可以自動修復,在安裝預提交掛鉤期間安裝的 phpcbf 將修復它,因此您只需再次嘗試提交即可驗證它。

Computer.png 可选组件

您还可以安装可选组件以获得更多技术支持。请参阅:开发环境与工具 - 可选组件 。