Ver Fonte

update option

ruki há 5 anos atrás
pai
commit
2dca12a2b6

+ 0 - 19
manual/conditions.md

@@ -9,7 +9,6 @@ Conditions are generally used to handle some special compilation platforms.
 | [is_host](#is_host)         | Is the current compilation host system?   | >= 2.1.4                    |
 | [is_mode](#is_mode)         | Is the current compilation mode?          | >= 2.0.1                    |
 | [is_kind](#is_kind)         | Is the current target kind?               | >= 2.0.1                    |
-| [is_option](#is_option)     | Is the given options enabled?             | >= 2.0.1 < 2.2.2 deprecated |
 | [is_config](#is_config)     | Is the given config values?               | >= 2.2.2                    |
 | [has_config](#has_config)   | Is the given configs enabled?             | >= 2.2.2                    |
 | [has_package](#has_package) | Is the given dependent package enabled?   | >= 2.2.3                    |
@@ -227,24 +226,6 @@ $ xmake f -k shared
 $ xmake
 ```
 
-### is_option
-
-#### Is the given options enabled
-
-<p class="tip">
-This interface has been deprecated after v2.2.2, please use [has_config](#has_config) instead.
-</p>
-
-You can use this api to check the custom option configuration command:`xmake f --xxxx=y`
-
-For example, we want to enable the custom option: `xmake f --demo=y` and check it from `xmake.lua`.
-
-```lua
-if is_option("demo") then
-    includes("src/demo")
-end
-```
-
 ### is_config
 
 #### Is the given config values?

+ 7 - 4
manual/configuration_option.md

@@ -129,7 +129,7 @@ option("small")
 option("test")
     add_deps("small")
     set_default(true)
-    on_check(function (option)
+    after_check(function (option)
         if option:dep("small"):enabled() then
             option:enable(false)
         end
@@ -138,6 +138,8 @@ option("test")
 
 After the detection of the dependent small option is completed, the state of the option of the test is controlled by judging the state of the small option.
 
+!> Since on_check will only be executed when the default value is not set, if the default value is set, the custom logic can be processed in the after_check phase.
+
 ### option:before_check
 
 Execute this script before option detection
@@ -162,7 +164,6 @@ This script overrides the built-in option detection logic.
 ```lua
 option("test")
     add_deps("small")
-    set_default(true)
     on_check(function (option)
         if option:dep("small"):enabled() then
             option:enable(false)
@@ -172,6 +173,8 @@ option("test")
 
 If the option that test depends on passes, disable the test option.
 
+!> Only when `set_default` is not set, will the `on_check` be executed for custom option check script.
+
 ### option:after_check
 
 Execute this script after option detection
@@ -191,7 +194,7 @@ option("test")
 
 #### Setting the list of option values
 
-For the graphical menu configuration of `xmake f --menu` only, a list of option values ​​is provided for quick selection by the user, for example:
+For the graphical menu configuration of `xmake f --menu` only, a list of option values is provided for quick selection by the user, for example:
 
 ```lua
 option("test")
@@ -228,7 +231,7 @@ option("test")
 | boolean    | Typically used as a parameter switch, value range: `true/false` | `xmake f --optionname=[y/n/yes/no/true/false]`  |
 | string     | can be any string, generally used for pattern judgment          | `xmake f --optionname=value`                    |
 
-If it is an option of the `boolean` value, it can be judged by [is_option](#is_option), and the option is enabled.
+If it is an option of the `boolean` value, it can be judged by [has_config](/manual/conditions?id=has_config), and the option is enabled.
 
 If it is an option of type `string`, it can be used directly in built-in variables, for example:
 

+ 0 - 16
mirror/manual/conditions.html

@@ -131,11 +131,6 @@
 <td>>= 2.0.1</td>
 </tr>
 <tr>
-<td><a href="#is_option">is_option</a></td>
-<td>Is the given options enabled?</td>
-<td>>= 2.0.1 < 2.2.2 deprecated</td>
-</tr>
-<tr>
 <td><a href="#is_config">is_config</a></td>
 <td>Is the given config values?</td>
 <td>>= 2.2.2</td>
@@ -311,17 +306,6 @@ $ xmake
 $ xmake f -k shared
 $ xmake
 </code></pre>
-<h3 id="is_option">is_option</h3>
-<h4 id="isthegivenoptionsenabled">Is the given options enabled</h4>
-<p><p class="tip"><br>This interface has been deprecated after v2.2.2, please use <a href="#has_config">has_config</a> instead.<br></p>
-
-</p>
-<p>You can use this api to check the custom option configuration command:<code>xmake f --xxxx=y</code></p>
-<p>For example, we want to enable the custom option: <code>xmake f --demo=y</code> and check it from <code>xmake.lua</code>.</p>
-<pre><code class="lang-lua">if is_option("demo") then
-    includes("src/demo")
-end
-</code></pre>
 <h3 id="is_config">is_config</h3>
 <h4 id="isthegivenconfigvalues">Is the given config values?</h4>
 <p>This interface is introduced from version 2.2.2 to determine whether the specified configuration is a given value.</p>

+ 5 - 4
mirror/manual/configuration_option.html

@@ -394,13 +394,14 @@ $ xmake
 option("test")
     add_deps("small")
     set_default(true)
-    on_check(function (option)
+    after_check(function (option)
         if option:dep("small"):enabled() then
             option:enable(false)
         end
     end)
 </code></pre>
 <p>After the detection of the dependent small option is completed, the state of the option of the test is controlled by judging the state of the small option.</p>
+<p>!> Since on_check will only be executed when the default value is not set, if the default value is set, the custom logic can be processed in the after_check phase.</p>
 <h3 id="optionbefore_check">option:before_check</h3>
 <p>Execute this script before option detection</p>
 <p>For example: before testing, find the package by <a href="#detect-find_package">find_package</a>, and add information such as <code>links</code>, <code>includedirs</code> and <code>linkdirs</code> to the option.<br>Then start the option detection, and then automatically link to the target after passing.</p>
@@ -415,7 +416,6 @@ option("test")
 <p>This script overrides the built-in option detection logic.</p>
 <pre><code class="lang-lua">option("test")
     add_deps("small")
-    set_default(true)
     on_check(function (option)
         if option:dep("small"):enabled() then
             option:enable(false)
@@ -423,6 +423,7 @@ option("test")
     end)
 </code></pre>
 <p>If the option that test depends on passes, disable the test option.</p>
+<p>!> Only when <code>set_default</code> is not set, will the <code>on_check</code> be executed for custom option check script.</p>
 <h3 id="optionafter_check">option:after_check</h3>
 <p>Execute this script after option detection</p>
 <p>After the option detection is complete, execute this script for some post-processing, or you can re-disable the option at this time:</p>
@@ -435,7 +436,7 @@ option("test")
 </code></pre>
 <h3 id="optionset_values">option:set_values</h3>
 <h4 id="settingthelistofoptionvalues">Setting the list of option values</h4>
-<p>For the graphical menu configuration of <code>xmake f --menu</code> only, a list of option values ​​is provided for quick selection by the user, for example:</p>
+<p>For the graphical menu configuration of <code>xmake f --menu</code> only, a list of option values is provided for quick selection by the user, for example:</p>
 <pre><code class="lang-lua">option("test")
     set_default("b")
     set_showmenu(true)
@@ -475,7 +476,7 @@ option("test")
 </tr>
 </tbody>
 </table>
-<p>If it is an option of the <code>boolean</code> value, it can be judged by <a href="#is_option">is_option</a>, and the option is enabled.</p>
+<p>If it is an option of the <code>boolean</code> value, it can be judged by <a href="/mirror/manual/conditions.html#has_config">has_config</a>, and the option is enabled.</p>
 <p>If it is an option of type <code>string</code>, it can be used directly in built-in variables, for example:</p>
 <pre><code class="lang-lua">-- define a path configuration option, using the temporary directory by default
 option("rootdir")

+ 0 - 17
mirror/zh-cn/manual/conditions.html

@@ -131,11 +131,6 @@
 <td>>= 2.0.1</td>
 </tr>
 <tr>
-<td><a href="#is_option">is_option</a></td>
-<td>判断选项是否启用</td>
-<td>>= 2.0.1 < 2.2.2 已废弃</td>
-</tr>
-<tr>
 <td><a href="#is_config">is_config</a></td>
 <td>判断指定配置是否为给定的值</td>
 <td>>= 2.2.2</td>
@@ -321,18 +316,6 @@ $ xmake
 $ xmake f -k shared
 $ xmake
 </code></pre>
-<h3 id="is_option">is_option</h3>
-<h4 id="">判断选项是否启用</h4>
-<p><p class="tip"><br>此接口在2.2.2版本之后已经弃用,请使用<a href="#has_config">has_config</a>来代替。<br></p>
-
-</p>
-<p>用于检测自定义的编译配置选型:<code>xmake f --xxxx=y</code></p>
-<p>如果某个自动检测选项、手动设置选项被启用,那么可以通过<code>is_option</code>接口来判断,例如:</p>
-<pre><code class="lang-lua">-- 如果手动启用了xmake f --demo=y 选项
-if is_option("demo") then
-    includes("src/demo")
-end
-</code></pre>
 <h3 id="is_config">is_config</h3>
 <h4 id="">判断指定配置是否为给定的值</h4>
 <p>此接口从2.2.2版本开始引入,用于判断指定配置是否为给定的值,可用于描述域。</p>

+ 5 - 7
mirror/zh-cn/manual/configuration_option.html

@@ -384,13 +384,14 @@ $ xmake
 option("test")
     add_deps("small")
     set_default(true)
-    on_check(function (option)
+    after_check(function (option)
         if option:dep("small"):enabled() then
             option:enable(false)
         end
     end)
 </code></pre>
 <p>当依赖的small选项检测完成后,通过判断small选项的状态,来控制test的选项状态。</p>
+<p>!> 由于 on_check 只有在没有设置 default 值的情况下才会被执行,因此如果设置了 default 值,那么可以在 after_check 阶段处理自定义逻辑。</p>
 <h3 id="optionbefore_check">option:before_check</h3>
 <h4 id="">选项检测之前执行此脚本</h4>
 <p>例如:在检测之前,通过<a href="#detect-find_package">find_package</a>来查找包,将<code>links</code>, <code>includedirs</code>和<code>linkdirs</code>等信息添加到option中去,<br>然后开始选项检测,通过后就会自动链接到target上。</p>
@@ -405,14 +406,11 @@ option("test")
 <p>此脚本会覆盖内置的选项检测逻辑。</p>
 <pre><code class="lang-lua">option("test")
     add_deps("small")
-    set_default(true)
     on_check(function (option)
-        if option:dep("small"):enabled() then
-            option:enable(false)
-        end
+        option:enable(true)
     end)
 </code></pre>
-<p>如果test依赖的选项通过,则禁用test选项。</p>
+<p>!> 仅仅在 <code>set_default</code> 没有被设置的情况下,才会执行 <code>on_check</code> 进行自定义的选项检测脚本。</p>
 <h3 id="optionafter_check">option:after_check</h3>
 <h4 id="">选项检测之后执行此脚本</h4>
 <p>在选项检测完成后,执行此脚本做一些后期处理,也可以在此时重新禁用选项:</p>
@@ -465,7 +463,7 @@ option("test")
 </tr>
 </tbody>
 </table>
-<p>如果是<code>boolean</code>值的选项,可以通过<a href="#is_option">is_option</a>来进行判断,选项是否被启用。</p>
+<p>如果是<code>boolean</code>值的选项,可以通过<a href="/mirror/zh-cn/manual/conditions.html#has_config">has_config</a>来进行判断,选项是否被启用。</p>
 <p>如果是<code>string</code>类型的选项,可以在内建变量中直接使用,例如:</p>
 <pre><code class="lang-lua">-- 定义一个路径配置选项,默认使用临时目录
 option("rootdir")

+ 76 - 76
sitemap.xml

@@ -12,382 +12,382 @@
 
 <url>
   <loc>https://xmake.io/mirror/guide/project_examples.html</loc>
-  <lastmod>2021-01-16T21:03:38+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/other_features.html</loc>
-  <lastmod>2021-01-16T21:03:39+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:15+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/quickstart.html</loc>
-  <lastmod>2021-01-16T21:03:39+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/faq.html</loc>
-  <lastmod>2021-01-16T21:03:39+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/configuration.html</loc>
-  <lastmod>2021-01-16T21:03:39+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/syntax_description.html</loc>
-  <lastmod>2021-01-16T21:03:39+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/installation.html</loc>
-  <lastmod>2021-01-16T21:03:39+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/plugin_development.html</loc>
-  <lastmod>2021-01-16T21:03:39+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/more_plugins.html</loc>
-  <lastmod>2021-01-16T21:03:40+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/builtin_plugins.html</loc>
-  <lastmod>2021-01-16T21:03:40+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/old/zh/plugins.html</loc>
-  <lastmod>2021-01-16T21:03:40+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/old/zh/manual.html</loc>
-  <lastmod>2021-01-16T21:03:40+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/old/plugins.html</loc>
-  <lastmod>2021-01-16T21:03:40+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/old/manual.html</loc>
-  <lastmod>2021-01-16T21:03:41+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/awesome.html</loc>
-  <lastmod>2021-01-16T21:03:41+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/technical_support.html</loc>
-  <lastmod>2021-01-16T21:03:41+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/changelog.html</loc>
-  <lastmod>2021-01-16T21:03:41+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/contact.html</loc>
-  <lastmod>2021-01-16T21:03:41+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/introduction.html</loc>
-  <lastmod>2021-01-16T21:03:41+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/sponsor.html</loc>
-  <lastmod>2021-01-16T21:03:42+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/index.html</loc>
-  <lastmod>2021-01-16T21:03:42+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/project_examples.html</loc>
-  <lastmod>2021-01-16T21:03:42+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/other_features.html</loc>
-  <lastmod>2021-01-16T21:03:42+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/quickstart.html</loc>
-  <lastmod>2021-01-16T21:03:42+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/faq.html</loc>
-  <lastmod>2021-01-16T21:03:42+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/configuration.html</loc>
-  <lastmod>2021-01-16T21:03:43+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/syntax_description.html</loc>
-  <lastmod>2021-01-16T21:03:43+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/installation.html</loc>
-  <lastmod>2021-01-16T21:03:43+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/plugin_development.html</loc>
-  <lastmod>2021-01-16T21:03:43+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/more_plugins.html</loc>
-  <lastmod>2021-01-16T21:03:43+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/builtin_plugins.html</loc>
-  <lastmod>2021-01-16T21:03:44+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/awesome.html</loc>
-  <lastmod>2021-01-16T21:03:44+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/technical_support.html</loc>
-  <lastmod>2021-01-16T21:03:44+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/changelog.html</loc>
-  <lastmod>2021-01-16T21:03:44+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/contact.html</loc>
-  <lastmod>2021-01-16T21:03:44+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/peripheral_items.html</loc>
-  <lastmod>2021-01-16T21:03:44+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/introduction.html</loc>
-  <lastmod>2021-01-16T21:03:45+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/sponsor.html</loc>
-  <lastmod>2021-01-16T21:03:45+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/course.html</loc>
-  <lastmod>2021-01-16T21:03:45+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/index.html</loc>
-  <lastmod>2021-01-16T21:03:45+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2021-01-16T21:03:45+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/specification.html</loc>
-  <lastmod>2021-01-16T21:03:46+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_variables.html</loc>
-  <lastmod>2021-01-16T21:03:46+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/conditions.html</loc>
-  <lastmod>2021-01-16T21:03:46+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_rule.html</loc>
-  <lastmod>2021-01-16T21:03:46+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/project_target.html</loc>
-  <lastmod>2021-01-16T21:03:46+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_modules.html</loc>
-  <lastmod>2021-01-16T21:03:46+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_toolchain.html</loc>
-  <lastmod>2021-01-16T21:03:47+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/plugin_task.html</loc>
-  <lastmod>2021-01-16T21:03:47+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_dependencies.html</loc>
-  <lastmod>2021-01-16T21:03:47+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/configuration_option.html</loc>
-  <lastmod>2021-01-16T21:03:47+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/extension_modules.html</loc>
-  <lastmod>2021-01-16T21:03:47+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/global_interfaces.html</loc>
-  <lastmod>2021-01-16T21:03:48+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/builtin_themes.html</loc>
-  <lastmod>2021-01-16T21:03:48+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/switch_theme.html</loc>
-  <lastmod>2021-01-16T21:03:48+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package.html</loc>
-  <lastmod>2021-01-16T21:03:48+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/system_package.html</loc>
-  <lastmod>2021-01-16T21:03:48+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/remote_package.html</loc>
-  <lastmod>2021-01-16T21:03:48+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2021-01-16T21:03:49+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/specification.html</loc>
-  <lastmod>2021-01-16T21:03:49+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_variables.html</loc>
-  <lastmod>2021-01-16T21:03:49+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/conditions.html</loc>
-  <lastmod>2021-01-16T21:03:49+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_rule.html</loc>
-  <lastmod>2021-01-16T21:03:49+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/project_target.html</loc>
-  <lastmod>2021-01-16T21:03:50+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_modules.html</loc>
-  <lastmod>2021-01-16T21:03:50+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_toolchain.html</loc>
-  <lastmod>2021-01-16T21:03:50+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/plugin_task.html</loc>
-  <lastmod>2021-01-16T21:03:50+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_dependencies.html</loc>
-  <lastmod>2021-01-16T21:03:50+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/configuration_option.html</loc>
-  <lastmod>2021-01-16T21:03:50+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/extension_modules.html</loc>
-  <lastmod>2021-01-16T21:03:51+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/global_interfaces.html</loc>
-  <lastmod>2021-01-16T21:03:51+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/builtin_themes.html</loc>
-  <lastmod>2021-01-16T21:03:51+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/switch_theme.html</loc>
-  <lastmod>2021-01-16T21:03:51+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package.html</loc>
-  <lastmod>2021-01-16T21:03:51+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/system_package.html</loc>
-  <lastmod>2021-01-16T21:03:52+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/remote_package.html</loc>
-  <lastmod>2021-01-16T21:03:52+08:00</lastmod>
+  <lastmod>2021-01-20T01:26:28+08:00</lastmod>
 </url>
 
 </urlset>

+ 0 - 20
zh-cn/manual/conditions.md

@@ -9,7 +9,6 @@
 | [is_host](#is_host)         | 判断当前主机环境操作系统      | >= 2.1.4                |
 | [is_mode](#is_mode)         | 判断当前编译模式              | >= 2.0.1                |
 | [is_kind](#is_kind)         | 判断当前编译类型              | >= 2.0.1                |
-| [is_option](#is_option)     | 判断选项是否启用              | >= 2.0.1 < 2.2.2 已废弃 |
 | [is_config](#is_config)     | 判断指定配置是否为给定的值    | >= 2.2.2                |
 | [has_config](#has_config)   | 判断配置是否启用或者存在      | >= 2.2.2                |
 | [has_package](#has_package) | 判断依赖包是否被启用或者存在  | >= 2.2.3                |
@@ -242,25 +241,6 @@ $ xmake f -k shared
 $ xmake
 ```
 
-### is_option
-
-#### 判断选项是否启用
-
-<p class="tip">
-此接口在2.2.2版本之后已经弃用,请使用[has_config](#has_config)来代替。
-</p>
-
-用于检测自定义的编译配置选型:`xmake f --xxxx=y`
-
-如果某个自动检测选项、手动设置选项被启用,那么可以通过`is_option`接口来判断,例如:
-
-```lua
--- 如果手动启用了xmake f --demo=y 选项
-if is_option("demo") then
-    includes("src/demo")
-end
-```
-
 ### is_config
 
 #### 判断指定配置是否为给定的值

+ 6 - 7
zh-cn/manual/configuration_option.md

@@ -127,7 +127,7 @@ option("small")
 option("test")
     add_deps("small")
     set_default(true)
-    on_check(function (option)
+    after_check(function (option)
         if option:dep("small"):enabled() then
             option:enable(false)
         end
@@ -136,6 +136,8 @@ option("test")
 
 当依赖的small选项检测完成后,通过判断small选项的状态,来控制test的选项状态。
 
+!> 由于 on_check 只有在没有设置 default 值的情况下才会被执行,因此如果设置了 default 值,那么可以在 after_check 阶段处理自定义逻辑。
+
 ### option:before_check
 
 #### 选项检测之前执行此脚本
@@ -160,15 +162,12 @@ option("zlib")
 ```lua
 option("test")
     add_deps("small")
-    set_default(true)
     on_check(function (option)
-        if option:dep("small"):enabled() then
-            option:enable(false)
-        end
+        option:enable(true)
     end)
 ```
 
-如果test依赖的选项通过,则禁用test选项
+!> 仅仅在 `set_default` 没有被设置的情况下,才会执行 `on_check` 进行自定义的选项检测脚本
 
 ### option:after_check
 
@@ -226,7 +225,7 @@ option("test")
 | boolean | 一般用作参数开关,值范围:`true/false` | `xmake f --optionname=[y/n/yes/no/true/false]` |
 | string  | 可以是任意字符串,一般用于模式判断     | `xmake f --optionname=value`                   |
 
-如果是`boolean`值的选项,可以通过[is_option](#is_option)来进行判断,选项是否被启用。
+如果是`boolean`值的选项,可以通过[has_config](/zh-cn/manual/conditions?id=has_config)来进行判断,选项是否被启用。
 
 如果是`string`类型的选项,可以在内建变量中直接使用,例如: