mirror of
https://github.com/HighCapable/Gropify.git
synced 2025-12-11 15:53:54 +08:00
docs: update quick-start
This commit is contained in:
@@ -443,6 +443,12 @@ android {
|
|||||||
// - Note: If you disable this option, please make sure that there are no other projects
|
// - Note: If you disable this option, please make sure that there are no other projects
|
||||||
// that also use or not only Gropify to generate code to avoid conflicts.
|
// that also use or not only Gropify to generate code to avoid conflicts.
|
||||||
isIsolationEnabled = true
|
isIsolationEnabled = true
|
||||||
|
|
||||||
|
// Whether to use manifest placeholders' generation.
|
||||||
|
//
|
||||||
|
// Disabled by default, when enabled will synchronize the properties' key-values
|
||||||
|
// to the `manifestPlaceholders` in the `android` configuration method block.
|
||||||
|
manifestPlaceholders = false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -638,6 +644,7 @@ In Android projects, many repetitive and fixed properties usually need to be con
|
|||||||
|
|
||||||
```properties
|
```properties
|
||||||
project.namespace=com.highcapable.gropifydemo
|
project.namespace=com.highcapable.gropifydemo
|
||||||
|
project.appName=Gropify Demo
|
||||||
project.compileSdk=36
|
project.compileSdk=36
|
||||||
project.targetSdk=36
|
project.targetSdk=36
|
||||||
project.minSdk=26
|
project.minSdk=26
|
||||||
@@ -661,6 +668,24 @@ android {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When you set `manifestPlaceholders = true`, Gropify will automatically synchronize these properties' key-values to `manifestPlaceholders` in the android configuration method block.
|
||||||
|
|
||||||
|
You can then use these placeholders directly in `AndroidManifest.xml`.
|
||||||
|
|
||||||
|
> The following example
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:label="${project.appName}"
|
||||||
|
android:icon="@mipmap/ic_launcher">
|
||||||
|
|
||||||
|
...
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
|
```
|
||||||
|
|
||||||
You no longer need to use `buildConfigField` to add code to `BuildConfig`. With the property key-value code generated by `Gropify`, you can manage your project more flexibly.
|
You no longer need to use `buildConfigField` to add code to `BuildConfig`. With the property key-value code generated by `Gropify`, you can manage your project more flexibly.
|
||||||
|
|
||||||
You can also use interpolation `${...}` in property key-values to reference each other's content, but recursive references are not allowed.
|
You can also use interpolation `${...}` in property key-values to reference each other's content, but recursive references are not allowed.
|
||||||
|
|||||||
@@ -418,6 +418,11 @@ android {
|
|||||||
// - 注意: 如果你禁用此选项,请确保没有其他同样使用或不仅使用
|
// - 注意: 如果你禁用此选项,请确保没有其他同样使用或不仅使用
|
||||||
// Gropify 生成代码的项目,以避免冲突
|
// Gropify 生成代码的项目,以避免冲突
|
||||||
isIsolationEnabled = true
|
isIsolationEnabled = true
|
||||||
|
|
||||||
|
// 是否使用清单占位符的生成。
|
||||||
|
//
|
||||||
|
// 默认禁用,启用后将同步属性的键值到 `android` 配置方法块中的 `manifestPlaceholders`
|
||||||
|
manifestPlaceholders = false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -605,6 +610,7 @@ var version = GropifyDemoProperties.PROJECT_VERSION;
|
|||||||
|
|
||||||
```properties
|
```properties
|
||||||
project.namespace=com.highcapable.gropifydemo
|
project.namespace=com.highcapable.gropifydemo
|
||||||
|
project.appName=Gropify Demo
|
||||||
project.compileSdk=36
|
project.compileSdk=36
|
||||||
project.targetSdk=36
|
project.targetSdk=36
|
||||||
project.minSdk=26
|
project.minSdk=26
|
||||||
@@ -628,6 +634,24 @@ android {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
当你设置了 `manifestPlaceholders = true` 时,`Gropify` 将自动将这些属性键值同步到 `android` 配置方法块中的 `manifestPlaceholders`。
|
||||||
|
|
||||||
|
此时你可以直接在 `AndroidManifest.xml` 中使用这些占位符。
|
||||||
|
|
||||||
|
> 示例如下
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:label="${project.appName}"
|
||||||
|
android:icon="@mipmap/ic_launcher">
|
||||||
|
|
||||||
|
...
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
|
```
|
||||||
|
|
||||||
你可以无需再使用 `buildConfigField` 向 `BuildConfig` 添加代码,有了 `Gropify` 生成的属性键值代码,你可以更加灵活地管理你的项目。
|
你可以无需再使用 `buildConfigField` 向 `BuildConfig` 添加代码,有了 `Gropify` 生成的属性键值代码,你可以更加灵活地管理你的项目。
|
||||||
|
|
||||||
你还可以在属性键值中使用插值 `${...}` 互相引用其中的内容,但不允许递归引用。
|
你还可以在属性键值中使用插值 `${...}` 互相引用其中的内容,但不允许递归引用。
|
||||||
|
|||||||
Reference in New Issue
Block a user