Files
Gropify/zh-cn/guide/home.html
github-actions[bot] b6e2fda7eb Deploy to GitHub pages
2025-11-15 17:19:55 +00:00

45 lines
26 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="VuePress 2.0.0-rc.0">
<style>
:root {
--c-bg: #fff;
}
html.dark {
--c-bg: #22272e;
}
html, body {
background-color: var(--c-bg);
}
</style>
<script>
const userMode = localStorage.getItem('vuepress-color-scheme');
const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
document.documentElement.classList.toggle('dark', true);
}
</script>
<link rel="icon" href="/Gropify/images/logo.svg"><title>介绍 | Gropify</title><meta name="description" content="一个类型安全且现代化的 Gradle 属性插件">
<link rel="preload" href="/Gropify/assets/style-ZvMm2Cad.css" as="style"><link rel="stylesheet" href="/Gropify/assets/style-ZvMm2Cad.css">
<link rel="modulepreload" href="/Gropify/assets/app-aH6YcK-Q.js"><link rel="modulepreload" href="/Gropify/assets/home.html-9eiAlurd.js"><link rel="modulepreload" href="/Gropify/assets/home.html-no62ZQLF.js">
<link rel="prefetch" href="/Gropify/assets/index.html-zPqCtEf7.js" as="script"><link rel="prefetch" href="/Gropify/assets/index.html-J5Mpt7Vl.js" as="script"><link rel="prefetch" href="/Gropify/assets/index.html-7LpniZrm.js" as="script"><link rel="prefetch" href="/Gropify/assets/home.html-TFY4cEol.js" as="script"><link rel="prefetch" href="/Gropify/assets/quick-start.html-7AxcUCW_.js" as="script"><link rel="prefetch" href="/Gropify/assets/about.html-h4rdh_fS.js" as="script"><link rel="prefetch" href="/Gropify/assets/changelog.html-OIxI57Wq.js" as="script"><link rel="prefetch" href="/Gropify/assets/contacts.html-fepWrcVL.js" as="script"><link rel="prefetch" href="/Gropify/assets/future.html-mEvcxp6P.js" as="script"><link rel="prefetch" href="/Gropify/assets/about.html-6Xw5XEhi.js" as="script"><link rel="prefetch" href="/Gropify/assets/changelog.html-xI7_Sq17.js" as="script"><link rel="prefetch" href="/Gropify/assets/contacts.html-oiF8uxsH.js" as="script"><link rel="prefetch" href="/Gropify/assets/future.html-LX8OEuCN.js" as="script"><link rel="prefetch" href="/Gropify/assets/quick-start.html-wQnE0x98.js" as="script"><link rel="prefetch" href="/Gropify/assets/404.html-6Yl8cQE3.js" as="script"><link rel="prefetch" href="/Gropify/assets/index.html-7DNoxpGZ.js" as="script"><link rel="prefetch" href="/Gropify/assets/index.html-H28pjygm.js" as="script"><link rel="prefetch" href="/Gropify/assets/index.html-WpXt5Cz7.js" as="script"><link rel="prefetch" href="/Gropify/assets/home.html-2op2IBCZ.js" as="script"><link rel="prefetch" href="/Gropify/assets/quick-start.html-f_E-gIx7.js" as="script"><link rel="prefetch" href="/Gropify/assets/about.html-jqvjl3Ob.js" as="script"><link rel="prefetch" href="/Gropify/assets/changelog.html-HK_jZl0_.js" as="script"><link rel="prefetch" href="/Gropify/assets/contacts.html-umJCUAv2.js" as="script"><link rel="prefetch" href="/Gropify/assets/future.html-T9ih0RxQ.js" as="script"><link rel="prefetch" href="/Gropify/assets/about.html-AyhWm9Wa.js" as="script"><link rel="prefetch" href="/Gropify/assets/changelog.html-dsukWq08.js" as="script"><link rel="prefetch" href="/Gropify/assets/contacts.html-mhfINZEn.js" as="script"><link rel="prefetch" href="/Gropify/assets/future.html-UrATvnbP.js" as="script"><link rel="prefetch" href="/Gropify/assets/quick-start.html-umL0lxu-.js" as="script"><link rel="prefetch" href="/Gropify/assets/404.html-UdYhvg0G.js" as="script">
</head>
<body>
<div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/Gropify/zh-cn/" class=""><img class="logo" src="/Gropify/images/logo.svg" alt="Gropify"><span class="site-name can-hide">Gropify</span></a></span><div class="navbar-items-wrapper" style=""><!--[--><!--]--><nav class="navbar-items can-hide"><!--[--><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="导航"><span class="title">导航</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="导航"><span class="title">导航</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>入门</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a aria-current="page" href="/Gropify/zh-cn/guide/home.html" class="router-link-active router-link-exact-active router-link-active" aria-label="介绍"><!--[--><!--]--> 介绍 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/guide/quick-start.html" class="" aria-label="快速开始"><!--[--><!--]--> 快速开始 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>关于</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/changelog.html" class="" aria-label="更新日志"><!--[--><!--]--> 更新日志 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/future.html" class="" aria-label="展望未来"><!--[--><!--]--> 展望未来 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/contacts.html" class="" aria-label="联系我们"><!--[--><!--]--> 联系我们 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/about.html" class="" aria-label="关于此文档"><!--[--><!--]--> 关于此文档 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul></div></div><div class="navbar-item"><a href="/Gropify/zh-cn/about/contacts" class="" aria-label="联系我们"><!--[--><!--]--> 联系我们 <!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">简体中文 (CN)</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">简体中文 (CN)</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a href="/Gropify/en/guide/home.html" class="" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a aria-current="page" href="/Gropify/zh-cn/guide/home.html" class="router-link-active router-link-exact-active router-link-active" aria-label="简体中文"><!--[--><!--]--> 简体中文 <!--[--><!--]--></a></li><!--]--></ul></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/HighCapable/Gropify" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口中打开</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-color-mode-button" title="切换颜色模式"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><form class="search-box" role="search"><input type="search" placeholder="搜索" autocomplete="off" spellcheck="false" value><!----></form></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-items"><!--[--><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="导航"><span class="title">导航</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="导航"><span class="title">导航</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>入门</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a aria-current="page" href="/Gropify/zh-cn/guide/home.html" class="router-link-active router-link-exact-active router-link-active" aria-label="介绍"><!--[--><!--]--> 介绍 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/guide/quick-start.html" class="" aria-label="快速开始"><!--[--><!--]--> 快速开始 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><li class="navbar-dropdown-item"><!--[--><h4 class="navbar-dropdown-subtitle"><span>关于</span></h4><ul class="navbar-dropdown-subitem-wrapper"><!--[--><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/changelog.html" class="" aria-label="更新日志"><!--[--><!--]--> 更新日志 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/future.html" class="" aria-label="展望未来"><!--[--><!--]--> 展望未来 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/contacts.html" class="" aria-label="联系我们"><!--[--><!--]--> 联系我们 <!--[--><!--]--></a></li><li class="navbar-dropdown-subitem"><a href="/Gropify/zh-cn/about/about.html" class="" aria-label="关于此文档"><!--[--><!--]--> 关于此文档 <!--[--><!--]--></a></li><!--]--></ul><!--]--></li><!--]--></ul></div></div><div class="navbar-item"><a href="/Gropify/zh-cn/about/contacts" class="" aria-label="联系我们"><!--[--><!--]--> 联系我们 <!--[--><!--]--></a></div><div class="navbar-item"><div class="navbar-dropdown-wrapper"><button class="navbar-dropdown-title" type="button" aria-label="Select language"><span class="title">简体中文 (CN)</span><span class="arrow down"></span></button><button class="navbar-dropdown-title-mobile" type="button" aria-label="Select language"><span class="title">简体中文 (CN)</span><span class="right arrow"></span></button><ul style="display:none;" class="navbar-dropdown"><!--[--><li class="navbar-dropdown-item"><a href="/Gropify/en/guide/home.html" class="" aria-label="English"><!--[--><!--]--> English <!--[--><!--]--></a></li><li class="navbar-dropdown-item"><a aria-current="page" href="/Gropify/zh-cn/guide/home.html" class="router-link-active router-link-exact-active router-link-active" aria-label="简体中文"><!--[--><!--]--> 简体中文 <!--[--><!--]--></a></li><!--]--></ul></div></div><div class="navbar-item"><a class="external-link" href="https://github.com/HighCapable/Gropify" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口中打开</span></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-items"><!--[--><li><p tabindex="0" class="sidebar-item sidebar-heading active collapsible">入门 <span class="down arrow"></span></p><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/Gropify/zh-cn/guide/home.html" class="router-link-active router-link-exact-active router-link-active sidebar-item active" aria-label="介绍"><!--[--><!--]--> 介绍 <!--[--><!--]--></a><ul style="" class="sidebar-item-children"><!--[--><li><a aria-current="page" href="/Gropify/zh-cn/guide/home.html#背景" class="router-link-active router-link-exact-active sidebar-item" aria-label="背景"><!--[--><!--]--> 背景 <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/Gropify/zh-cn/guide/home.html#用途" class="router-link-active router-link-exact-active sidebar-item" aria-label="用途"><!--[--><!--]--> 用途 <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/Gropify/zh-cn/guide/home.html#语言要求" class="router-link-active router-link-exact-active sidebar-item" aria-label="语言要求"><!--[--><!--]--> 语言要求 <!--[--><!--]--></a><!----></li><li><a aria-current="page" href="/Gropify/zh-cn/guide/home.html#功能贡献" class="router-link-active router-link-exact-active sidebar-item" aria-label="功能贡献"><!--[--><!--]--> 功能贡献 <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><a href="/Gropify/zh-cn/guide/quick-start.html" class="sidebar-item" aria-label="快速开始"><!--[--><!--]--> 快速开始 <!--[--><!--]--></a><!----></li><!--]--></ul></li><li><p tabindex="0" class="sidebar-item sidebar-heading collapsible">关于 <span class="right arrow"></span></p><ul style="display:none;" class="sidebar-item-children"><!--[--><li><a href="/Gropify/zh-cn/about/changelog.html" class="sidebar-item" aria-label="更新日志"><!--[--><!--]--> 更新日志 <!--[--><!--]--></a><!----></li><li><a href="/Gropify/zh-cn/about/future.html" class="sidebar-item" aria-label="展望未来"><!--[--><!--]--> 展望未来 <!--[--><!--]--></a><!----></li><li><a href="/Gropify/zh-cn/about/contacts.html" class="sidebar-item" aria-label="联系我们"><!--[--><!--]--> 联系我们 <!--[--><!--]--></a><!----></li><li><a href="/Gropify/zh-cn/about/about.html" class="sidebar-item" aria-label="关于此文档"><!--[--><!--]--> 关于此文档 <!--[--><!--]--></a><!----></li><!--]--></ul></li><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><!--]--><div><h1 id="介绍" tabindex="-1"><a class="header-anchor" href="#介绍" aria-hidden="true">#</a> 介绍</h1><blockquote><p><code>Gropify</code> 是一个类型安全且现代化的 Gradle 属性插件。</p></blockquote><h2 id="背景" tabindex="-1"><a class="header-anchor" href="#背景" aria-hidden="true">#</a> 背景</h2><p>这是一个为 Gradle 构建脚本设计的插件,旨在将类似 <code>gradle.properties</code> 文件中的属性以类型安全的方式引入到构建脚本中,从而避免硬编码字符串可能带来的问题。</p><p>项目图标由 <a href="https://github.com/Lagrio" target="_blank" rel="noopener noreferrer">MaiTungTM<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口中打开</span></span></a> 设计,名称取自 <strong>G</strong>radleP<strong>ropify</strong>,意为针对 Gradle 属性的插件。</p><p>它是基于 <a href="https://github.com/HighCapable/SweetProperty" target="_blank" rel="noopener noreferrer">SweetProperty<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口中打开</span></span></a> 重构的全新项目,借鉴了以往的设计方案,使得其在原有基础上更加完善和易用。</p><p><code>Gropify</code> 的配置方案与 <code>SweetProperty</code> 类似,如果你正在使用 <code>SweetProperty</code>,你可以考虑将其迁移到 <code>Gropify</code></p><h2 id="用途" tabindex="-1"><a class="header-anchor" href="#用途" aria-hidden="true">#</a> 用途</h2><p><code>Gropify</code> 主要针对 Kotlin DSL 构建脚本设计Groovy 语言可以直接将 <code>gradle.properties</code> 文件中的属性作为变量使用,但是你也可以通过 <code>Gropify</code> 来实现类型安全的属性访问。</p><p><code>Gropify</code> 同时支持将类似 <code>gradle.properties</code> 文件中的属性以类型安全的方式生成到 Kotlin、Java、Android 项目的源码中以供应用程序运行时使用,功能类似 Android 的 <code>BuildConfig</code> 中的 <code>buildConfigField</code> 功能。</p><p>假设我们有以下 <code>gradle.properties</code> 文件。</p><blockquote><p>示例如下</p></blockquote><div class="language-properties line-numbers-mode" data-ext="properties"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">project.app.name</span><span style="color:#ADBAC7;">=Gropify-Demo</span></span>
<span class="line"><span style="color:#F47067;">project.app.version</span><span style="color:#ADBAC7;">=1.0.0</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><p>这是 <code>Gropify</code> 自动生成的代码调用示例。</p><blockquote><p>构建脚本 (Kotlin DSL、Groovy DSL)</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> appName </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> gropify.project.app.name</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> appVersion </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> gropify.project.app.version</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><div class="language-groovy line-numbers-mode" data-ext="groovy"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">def</span><span style="color:#F69D50;"> appName </span><span style="color:#F47067;">=</span><span style="color:#F69D50;"> gropify</span><span style="color:#F47067;">.</span><span style="color:#F69D50;">project</span><span style="color:#F47067;">.</span><span style="color:#F69D50;">app</span><span style="color:#F47067;">.</span><span style="color:#F69D50;">name</span></span>
<span class="line"><span style="color:#F47067;">def</span><span style="color:#F69D50;"> appVersion </span><span style="color:#F47067;">=</span><span style="color:#F69D50;"> gropify</span><span style="color:#F47067;">.</span><span style="color:#F69D50;">project</span><span style="color:#F47067;">.</span><span style="color:#F69D50;">app</span><span style="color:#F47067;">.</span><span style="color:#F69D50;">version</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><blockquote><p>源代码 (Kotlin、Java)</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> appName </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> MyAppProperties.PROJECT_APP_NAME</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> appVersion </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> MyAppProperties.PROJECT_APP_VERSION</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><div class="language-java line-numbers-mode" data-ext="java"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">var</span><span style="color:#F69D50;"> </span><span style="color:#ADBAC7;">appName</span><span style="color:#F69D50;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> MyAppProperties.PROJECT_APP_NAME;</span></span>
<span class="line"><span style="color:#F47067;">var</span><span style="color:#F69D50;"> </span><span style="color:#ADBAC7;">appVersion</span><span style="color:#F69D50;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> MyAppProperties.PROJECT_APP_VERSION;</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><p><code>Gropify</code> 同样支持 Kotlin Multiplatform 项目,你可以在 <code>commonMain</code> 源集中使用生成的属性类。</p><h2 id="语言要求" tabindex="-1"><a class="header-anchor" href="#语言要求" aria-hidden="true">#</a> 语言要求</h2><p>推荐使用 Kotlin DSL 来配置项目的构建脚本Groovy 语言同样受支持,但在纯 Groovy 项目中部分配置语法可能存在兼容性问题。</p><p>在 Groovy DSL 中使用此插件发生的任何问题,我们都将不再负责排查和修复,并且在后期版本可能会完全不再支持 Groovy DSL。</p><h2 id="功能贡献" tabindex="-1"><a class="header-anchor" href="#功能贡献" aria-hidden="true">#</a> 功能贡献</h2><p>本项目的维护离不开各位开发者的支持和贡献,目前这个项目处于初期阶段,可能依然存在一些问题或者缺少你需要的功能, 如果可能,欢迎提交 PR 为此项目贡献你认为需要的功能或前往 <a href="https://github.com/HighCapable/Gropify/issues" target="_blank" rel="noopener noreferrer">GitHub Issues<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口中打开</span></span></a> 向我们提出建议。</p></div><!--[--><!--]--></div><footer class="page-meta"><div class="meta-item edit-link"><a class="external-link meta-item-label" href="https://github.com/HighCapable/Gropify/edit/main/docs-source/src/zh-cn/guide/home.md" rel="noopener noreferrer" target="_blank" aria-label="在 GitHub 上编辑此页"><!--[--><!--]--> 在 GitHub 上编辑此页 <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">在新窗口中打开</span></span><!--[--><!--]--></a></div><div class="meta-item last-updated"><span class="meta-item-label">上次更新: </span><!----></div><div class="meta-item contributors"><span class="meta-item-label">贡献者: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: qzmmcn@163.com">fankesyooni</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><!----><span class="next"><a href="/Gropify/zh-cn/guide/quick-start.html" class="" aria-label="快速开始"><!--[--><!--]--> 快速开始 <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
<script type="module" src="/Gropify/assets/app-aH6YcK-Q.js" defer></script>
</body>
</html>