Skip to content

Commit

Permalink
Add module template (#87)
Browse files Browse the repository at this point in the history
**Background**

Add module template with help Geminio
See here for plugin build: hhru/android-multimodule-plugin#48

**Changes**

- Add template
  • Loading branch information
LionZXY authored Oct 29, 2021
1 parent dd810e3 commit 89fa73f
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 0 deletions.
51 changes: 51 additions & 0 deletions config/geminio/modules_templates/Blank Module/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
requiredParams:
name: Flipper Blank Module
description: Creates empty Gradle-module for general purposes

predefinedFeatures:
- enableModuleCreationParams:
defaultPackageNamePrefix: com.flipperdevices

widgets:
- booleanParameter:
id: needCompose
name: Add Compose dependencies?
help: Adds compose gradle plugin and compose deps
default: false

- booleanParameter:
id: isApi
name: Is API submodule?
help: If it is api module, we create only interface for instances
default: false

- booleanParameter:
id: shouldGenerateDI
name: Add di?
help: Adds Dagger and Anvil deps, and create di component
default: false

recipe:
- mkDirs:
- ${srcOut}

- instantiate:
from: root/gitignore.ftl
to: ${rootOut}/.gitignore

- instantiate:
from: root/build.gradle.kts.ftl
to: ${rootOut}/build.gradle.kts

- instantiate:
from: root/src/main/AndroidManifest.xml.ftl
to: ${manifestOut}/AndroidManifest.xml

- predicate:
validIf: ${shouldGenerateDI}
commands:
- mkDirs:
- ${srcOut}/di/
- instantiateAndOpen:
from: root/src/app_package/di/BlankComponent.kt.ftl
to: ${srcOut}/di/${__formattedModuleName}Component.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id("com.android.library")
id("kotlin-android")
<#if shouldGenerateDI>
id("com.squareup.anvil")
id("kotlin-kapt")
</#if>
}
apply<com.flipperdevices.gradle.ConfigurationPlugin>()
<#if needCompose>
apply<com.flipperdevices.gradle.ComposerPlugin>()
</#if>

dependencies {
implementation(project(":components:core"))

implementation(Libs.ANNOTATIONS)
implementation(Libs.APPCOMPAT)
<#if needCompose>

// Compose
implementation(Libs.COMPOSE_UI)
implementation(Libs.COMPOSE_TOOLING)
implementation(Libs.COMPOSE_FOUNDATION)
implementation(Libs.COMPOSE_MATERIAL)
</#if>
<#if shouldGenerateDI>

// Dagger deps
implementation(Libs.DAGGER)
kapt(Libs.DAGGER_COMPILER)
</#if>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package ${packageName}.di

import com.flipperdevices.core.di.AppGraph
import com.squareup.anvil.annotations.ContributesTo

@ContributesTo(AppGraph::class)
interface ${__formattedModuleName}Component {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest package="${packageName}" />
6 changes: 6 additions & 0 deletions geminio_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
templatesRootDirPath: /config/geminio/templates
modulesTemplatesRootDirPath: /config/geminio/modules_templates

groupsNames:
forNewGroup: Flipper Templates
forNewModulesGroup: Flipper Modules

0 comments on commit 89fa73f

Please sign in to comment.