Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gradleup/auto-manifest
Generates AndroidManifest.xml in simple libraries so that you don't have to
https://github.com/gradleup/auto-manifest
android android-library androidmanifest gradle gradle-plugin
Last synced: about 6 hours ago
JSON representation
Generates AndroidManifest.xml in simple libraries so that you don't have to
- Host: GitHub
- URL: https://github.com/gradleup/auto-manifest
- Owner: GradleUp
- License: apache-2.0
- Created: 2020-05-16T15:07:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-14T13:53:27.000Z (3 months ago)
- Last Synced: 2024-11-14T14:42:05.914Z (3 months ago)
- Topics: android, android-library, androidmanifest, gradle, gradle-plugin
- Language: Kotlin
- Homepage:
- Size: 170 KB
- Stars: 87
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# This project is archived
With Android Gradle Plugin namespaces ([doc](https://developer.android.com/build/configure-app-module#set-namespace)), most of the functionality provided by this plugin is now natively supported and we do not plan to support this plugin anymore.
----
Auto Manifest ![CI](https://github.com/GradleUp/auto-manifest/workflows/CI/badge.svg)
=============`AndroidManifest.xml` file is crucial to define Android specific properties like `minSdkVersion`, `uses-permission` etc.
Unfortunately, `package` property must be defined in `AndroidManifest.xml` and mandatory for `BuildConfig` and `R
` class generation. In most of my Gradle modules, `AndroidManifest.xml` is just 1 line:
```xml```
Here comes AutoManifest Gradle Plugin to rescue 🚀
- This is not meant for full replacement for AndroidManifest.xml file. It is useful for those 1-liner manifests where you don't have any `Activity/Service` or permission defined.
- It is easy to integrate into current projects. If manifest file is present, it will be no-op.
- You can add it per module or to the root `build.gradle`. If applied to root, it will even auto generate package names based on module paths.Configuration
-------------[ ![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/gradleup/auto/manifest/com.gradleup.auto.manifest.gradle.plugin/maven-metadata.xml.svg?label=Gradle%20Plugins%20Portal) ](https://plugins.gradle.org/plugin/com.gradleup.auto.manifest)
Add the plugin in your `build.gradle` file (preferably in root one)
Kotlin
```kotlin
plugins {
id("com.gradleup.auto.manifest") version ""
}autoManifest {
// Mandatory packageName
packageName.set("com.company.example")// OPTIONAL //
// Applies recursively to sub-modules so you don't have to
// Sub-module package names will be auto generated by using their relative path
// Default: true
applyRecursively.set(true)
// OPTIONAL //
// Using dashes `-` is pretty common in module names. But they are not allowed within Java package names.
// When this flag is enabled, they will be replaced by a dot. By default, they will be replaced with an underscore.
// Default: false
replaceDashesWithDot.set(true)
//
// Disables auto manifest generation per module (aka subproject)
//
// When [applyRecursively] is enabled, if you face any issues on a certain module with custom
// setup, you can use this to disable for that module.
// Example in a module:
//
// plugins {
// id("com.android.library")
// id("auto-manifest")
// }
// autoManifest.disable()
//
disable()
}
```Groovy
```kotlin
plugins {
id 'com.gradleup.auto.manifest' version ''
}autoManifest {
// Mandatory packageName
packageName = 'com.company.example'// OPTIONAL //
// Applies recursively to sub-modules so you don't have to
// Sub-module package names will be auto generated by using their relative path
// Default: true
applyRecursively = true
// OPTIONAL //
// Using dashes `-` is pretty common in module names. But they are not allowed within Java package names.
// When this flag is enabled, they will be replaced by a dot. By default, they will be replaced with an underscore.
// Default: false
replaceDashesWithDot = true
//
// Disables auto manifest generation per module (aka subproject)
//
// When [applyRecursively] is enabled, if you face any issues on a certain module with custom
// setup, you can use this to disable for that module.
// Example in a module:
//
// plugins {
// id("com.android.library")
// id("auto-manifest")
// }
// autoManifest.disable()
//
disable()
}
```Ta-da 🎉 Now just put your Java/Kotlin files and don't worry about the rest.
Nested Modules
--------------To make it easy for you `applyRecursively` is enabled by default. This will automatically generate
`AndroidManifest.xml` for you in all modules recursively. You have 2 options to override:- If you need more info like permissions, Activity definitions, you can continue to have your
`AndroidManifest.xml` and recursive generation will be skipped for that module.
- If you need to override, you can apply the plugin again in a nested Gradle module and provide a
custom packageNamePerformance
------------ This project uses Gradle's [Lazy Task Configuration APIs][lazy] and do not cause eager task creation in AGP.
- It generates the `AndroidManifest.xml` file lazily. That means "zero" impact on Gradle configuration times.
- It supports build cache so that the files are generated only once and re-used across builds.Sample App
----------Checkout the sample app with multi-modules where only the Application module defines `AndroidManifest.xml` - available
[here][sample]In Action
---------Here is the first integration into one of my apps: https://github.com/tasomaniac/OpenLinkWith/commit/5b4029e922c33816fde67400e6c1ac40e015c9b9
Plugin is added in couple of lines and many `AndroidManifest.xml` files are removed. 🎉
[lazy]: https://docs.gradle.org/current/userguide/task_configuration_avoidance.html
[sample]: https://github.com/GradleUp/auto-manifest/tree/master/sample