Skip to content

Commit

Permalink
add new currentDir params (#84)
Browse files Browse the repository at this point in the history
- Add new parameters for Geminio's recipes and FTL templates
  • Loading branch information
user32338 committed Apr 21, 2023
1 parent 0baf716 commit 8fe351e
Show file tree
Hide file tree
Showing 70 changed files with 533 additions and 335 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Список плагинов в репозитории

- [hh-carnival](/plugins/hh-carnival) - плагин для быстрого создания нового feature-модуля, который также добавляет ещё немного полезных вещеё
- [hh-carnival](/plugins/hh-carnival) - плагин для быстрого создания нового feature-модуля, который также добавляет ещё немного полезных вещей
- [hh-garcon](/plugins/hh-garcon) - плагин для быстрого создания Page Object-ов из XML-вёрстки
- [hh-geminio](/plugins/hh-geminio) - плагин, добавляющий возможность создавать свои шаблоны кода на основе FreeMarker-а

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ configure<IntelliJPluginExtension> {
plugins.set(currentVersion.pluginsNames)
}

@Suppress("UnstableApiUsage")
tasks.getByName<IntelliJInstrumentCodeTask>("instrumentCode") {
val currentVersion = Libs.chosenIdeaVersion
if (currentVersion is ExternalLibrariesExtension.Product.LocalIde) {
Expand Down
8 changes: 6 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ plugins {

staticAnalysis {
detekt {
configPath = files(project.rootDir.resolve("build-logic/static-analysis-convention/rules/detekt/detekt-config.yaml"))
baselinePath = file(project.rootDir.resolve("build-logic/static-analysis-convention/rules/detekt/detekt-baseline.xml"))
configPath = files(
project.rootDir.resolve("build-logic/static-analysis-convention/rules/detekt/detekt-config.yaml")
)
baselinePath = file(
project.rootDir.resolve("build-logic/static-analysis-convention/rules/detekt/detekt-baseline.xml")
)
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kotlin.code.style=official
systemProp.gradleIntellijPluginVersion=1.12.0
systemProp.gradleChangelogPluginVersion=1.3.1
systemProp.kotlinVersion=1.8.0
systemProp.detektVersion=1.21.0
systemProp.detektVersion=1.22.0

systemProp.androidStudioPath=/Applications/Android Studio.app/Contents
systemProp.androidStudioCompilerVersion=221.6008.13
Expand Down
7 changes: 6 additions & 1 deletion infra/scripts/build_all_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ readonly repoUrl=$(prop "${PROPERTY_PLUGINS_REPO_URL}" "${PLUGINS_PROPERTIES_FIL

logMessage "Build all plugins..."

bash gradlew clean buildAllPlugins collectUpdatePluginsXmlTask --customRepositoryUrl="${repoUrl}"
bash gradlew \
clean \
buildAllPlugins \
collectUpdatePluginsXmlTask \
--customRepositoryUrl="${repoUrl}" \
--no-configuration-cache

logMessage "Successfully build all plugins"
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,24 @@ data class GenerateFragmentViewModelNames(
companion object {

fun from(featurePrefix: String, packageName: String): GenerateFragmentViewModelNames {
val (modelsPackageName, mviFeaturePackageName, mviFeatureElementPackageName) = if (packageName.isNotBlank()) {
val splitted = packageName.split(".")
val previous = if (splitted.isNotEmpty()) {
packageName.removeSuffix(".${splitted.last()}")
val (modelsPackageName, mviFeaturePackageName, mviFeatureElementPackageName) =
if (packageName.isNotBlank()) {
val splitted = packageName.split(".")
val previous = if (splitted.isNotEmpty()) {
packageName.removeSuffix(".${splitted.last()}")
} else {
packageName
}

Triple(
"$packageName.model.",
"$previous.feature.",
"$previous.feature.element."
)
} else {
packageName
Triple(String.EMPTY, String.EMPTY, String.EMPTY)
}

Triple(
"$packageName.model.",
"$previous.feature.",
"$previous.feature.element."
)
} else {
Triple(String.EMPTY, String.EMPTY, String.EMPTY)
}

val viewModelClassName = "${featurePrefix}ViewModel"
val singleEventClassName = "${featurePrefix}Event"
val uiStateClassName = "${featurePrefix}UiState"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class PluginConfigEditor(
initialJiraHostName != jiraHostNameTextField.text ||
initialJiraUsername != jiraUsernameTextField.text ||
initialJiraPassword != jiraPasswordTextField.text ||
initialJiraDevelopmentTeam != JiraDevelopmentTeam.fromLabel(jiraDevelopmentTeamComboBoxModel.selected.orEmpty())
initialJiraDevelopmentTeam != JiraDevelopmentTeam.fromLabel(
jiraDevelopmentTeamComboBoxModel.selected.orEmpty()
)
}

fun applyNewConfiguration(project: Project, pluginConfig: PluginConfig) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ru.hh.android.plugin.core.model.enums


private const val ANDROID_WIDGET_PKG = "android.widget"
private const val ANDROIDX_APPCOMPAT_WIDGET_PKG = "androidx.appcompat.widget"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum class JiraDevelopmentTeam(

companion object {

fun fromLabel(label: String): JiraDevelopmentTeam = values().firstOrNull { it.comboBoxLabel == label } ?: MOBILE_CORE
fun fromLabel(label: String): JiraDevelopmentTeam = values().firstOrNull { it.comboBoxLabel == label }
?: MOBILE_CORE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ fun PsiDirectory.findSubdirectoryByPackageName(moduleName: String, packageName:
for (item in directoriesNames) {
result = result.findSubdirectory(item)
?: throw CopyModuleActionException(
"Can't find main package directory in copying module. Please, check AndroidManifest.xml in \"${moduleName}\" module and make sure that main package name is \"${packageName}\""
"""Can't find main package directory in copying module.
|Please, check AndroidManifest.xml in \"$moduleName\"
|module and make sure that main package name is \"$packageName\"""
.trimMargin()
)
}
return result
Expand Down
74 changes: 65 additions & 9 deletions plugins/hh-geminio/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,158 @@
# Geminio

## [1.4.2]

### Added

- New `currentDirPackageName` parameter in FTL - add package name from selected folder in specified module.
- New `currentDirOut` parameter in recipes - path to selected directory that launched Geminio's action.
- Improvements for docs.

## [1.4.1]

### Added

- Support `ksp` dependency configuration in Geminio's recipes.

## [1.4.0]

### Added
- Support for Android Studio Electric Eel | 2022.1.1

- Support for Android Studio Electric Eel | 2022.1.1

## [1.3.0]

### Added

- Support for Android Studio Dolphin | 2021.3.1 (thanks to @IlyaGulya)
- Added "Enable debug mode" checkbox in settings
- Optional Gradle sync after creating files from templates

### Fixed

- Fixed some problems on Android Studio Chipmunk Patch 2 | 2021.2.1
- Fixed too many templates rescan

## [1.2.0]

### Added

- Sync dialog after creating templates
- Display templates folders with recipes only
- Ability to rescan templates folders without restarting
- `help` filed for all widgets not required
- Multi-window support with different projects

### Fixed

- Fixed duplication templates items after reopen project
- Fixed 'addGradlePlugin' and other modification commands in files

## [1.1.11]

### Added

- Support for Android Studio Chipmunk | 2021.2.1

## [1.1.10]

### Added
- Ability to change predefined package name for modules templates through
`enableModuleCreationParams.defaultPackageNamePrefix` property in `recipe.xml`.

- Ability to change predefined package name for modules templates through
`enableModuleCreationParams.defaultPackageNamePrefix` property in `recipe.xml`.

## [1.1.9]

### Added

- Support for Android Studio Bumblebee | 2021.1.1

## [1.1.8]

### Fixed

- Fixed duplication of projects in dependencies after recipe execution

## [1.1.7]

### Added

- Support for Android Studio Arctic Fox | 2020.3.1

## [1.1.6]

### Added

- Support for Android Studio 4.2

### Changed
- **Breaking change**!!! In Android Studio 4.2 `underlinesToCamelCase` function was removed,
so we renamed `underlinesToCamelCase` modifier in templates into `underscoreToCamelCase`.


- **Breaking change**!!! In Android Studio 4.2 `underlinesToCamelCase` function was removed,
so we renamed `underlinesToCamelCase` modifier in templates into `underscoreToCamelCase`.

### Fixed
- Don't generate actions if there is no Geminio config

- Don't generate actions if there is no Geminio config

## [1.1.5]

### Fixed

- Fixed adding dependencies into build.gradle / build.gradle.kts files

## [1.1.4]

### Added

- [Gradle Changelog Plugin](https://github.com/JetBrains/gradle-changelog-plugin) integration.

### Changed
- Now we configure plugin modules with [gradle convention plugins](https://docs.gradle.org/current/samples/sample_convention_plugins.html);

- Now we configure plugin modules
with [gradle convention plugins](https://docs.gradle.org/current/samples/sample_convention_plugins.html);
- Upgrade Gradle Wrapper to `7.0`;
BuildGradleModificationService.kt

## [1.1.3]

### Changed

- Remove `'Choose module'` step from modules actions.

## [1.1.2]

### Changed

- Moved templates actions to the top of `'New'` action group.

### Fixed

- Made `'help'` parameter optional in widgets section.

## [1.1.1]

### Fixed

- Fix bug with duplicated project service.

## [1.1.0]

### Added

- Support for modules creation;
- A lot of validation messages for recipes to help you properly create new recipes;
- New command for recipe: `mkDirs` for creating directories structure;
- Predefined variables in `recipe` section: `{manifestOut}` and `{rootOut}`.

## [1.0.1]

### Added
- Add new command for recipe: `addDependencies` for adding dependencies into build.gradle file;

- Add new command for recipe: `addDependencies` for adding dependencies into build.gradle file;
- New hardcoded parameter in FTL-files: `applicationPackage` - it is package name from AndroidManifest.xml file.

## [1.0.0]

### Added

- Initial project release.
12 changes: 6 additions & 6 deletions plugins/hh-geminio/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Geminio

![Geminio](/plugins/hh-geminio/img/Geminio.png)
![Geminio](./img/Geminio.png)

<!-- Plugin description -->
**Geminio** -- Android Studio Plugin for generating code from templates.
Expand All @@ -21,8 +21,8 @@

## Содержание

- [Как работает плагин](/plugins/hh-geminio/docs/ru/HOW_IT_WORKS.md)
- [Конфигурация плагина](/plugins/hh-geminio/docs/ru/PLUGIN_CONFIG.md)
- [Выражения](/plugins/hh-geminio/docs/ru/EXPRESSIONS.md)
- [Устройство "рецепта"](/plugins/hh-geminio/docs/ru/RECIPE_CONTENT.md)
- [Шаблоны модулей](/plugins/hh-geminio/docs/ru/MODULES_TEMPLATES.md)
- [Как работает плагин](./docs/ru/HOW_IT_WORKS.md)
- [Конфигурация плагина](./docs/ru/PLUGIN_CONFIG.md)
- [Выражения](./docs/ru/EXPRESSIONS.md)
- [Устройство "рецепта"](./docs/ru/RECIPE_CONTENT.md)
- [Шаблоны модулей](./docs/ru/MODULES_TEMPLATES.md)
22 changes: 13 additions & 9 deletions plugins/hh-geminio/README_EN.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# Geminio
# Geminio

![Geminio](/plugins/hh-geminio/img/Geminio.png)
![Geminio](./img/Geminio.png)

Android Studio's plugin for generating code from FreeMarker templates

## Why?

Android Studio 4.1 has [disabled support for custom FreeMarker templates](https://issuetracker.google.com/issues/154531807). Previously, you could create custom templates, put them into a specific folder, and then the Android Studio should use your templates as 'Other'-templates.
Android Studio 4.1
has [disabled support for custom FreeMarker templates](https://issuetracker.google.com/issues/154531807). Previously,
you could create custom templates, put them into a specific folder, and then the Android Studio should use your
templates as 'Other'-templates.

Starting from Android Studio 4.1 you can add custom templates only from IDEA plugins. We at hh.ru are not satisfied with this and we want to add and update templates independently from plugins.
Starting from Android Studio 4.1 you can add custom templates only from IDEA plugins. We at hh.ru are not satisfied with
this and we want to add and update templates independently from plugins.

That's what Geminio is for.

## MoC (Map of contents)

- [How the plugins works](/plugins/hh-geminio/docs/en/HOW_IT_WORKS.md)
- [Plugin's configuration](/plugins/hh-geminio/docs/en/PLUGIN_CONFIG.md)
- [Expressions](/plugins/hh-geminio/docs/en/EXPRESSIONS.md)
- [`recipe.yaml` content](/plugins/hh-geminio/docs/en/RECIPE_CONTENT.md)
- [Modules templates](/plugins/hh-geminio/docs/en/MODULES_TEMPLATES.md)
- [How the plugins works](./docs/en/HOW_IT_WORKS.md)
- [Plugin's configuration](./docs/en/PLUGIN_CONFIG.md)
- [Expressions](./docs/en/EXPRESSIONS.md)
- [`recipe.yaml` content](./docs/en/RECIPE_CONTENT.md)
- [Modules templates](./docs/en/MODULES_TEMPLATES.md)
Loading

0 comments on commit 8fe351e

Please sign in to comment.