44 Commits

Author SHA1 Message Date
3a600b1b3e chore: bump gradle to 8.14.3 2025-08-19 16:02:07 +08:00
7d45821628 chore: bump dependencies 2025-08-19 16:02:01 +08:00
3b86e41688 docs: update README 2025-06-24 16:21:09 +08:00
9fb17f195f chore: update project files 2025-06-24 16:21:00 +08:00
56ff6a109a chore: bump dependencies 2025-03-17 01:25:14 +08:00
99d7134a76 chore: bump gradle to 8.13 2025-03-17 01:25:10 +08:00
220c78c4e2 chore: update .editorconfig 2025-03-17 01:25:06 +08:00
ce4a6f3c75 chore: update .gitignore 2025-03-17 01:25:01 +08:00
76f2a5535f docs: update license 2025-01-13 10:45:46 +08:00
294913a9b1 chore: update project files 2025-01-13 10:45:41 +08:00
cd1eab47d7 chore: bump dependencies 2024-11-10 19:29:19 +08:00
8e4a4615ab chore: bump gradle to 8.10.2 2024-11-10 19:29:00 +08:00
3da032b3bb chore: update .editorconfig 2024-06-21 10:20:09 +08:00
4978774e39 chore: update project files 2024-06-21 10:20:04 +08:00
72c6d4c585 chore: bump dependencies 2024-06-20 12:57:43 +08:00
1f3ac5c392 chore: bump gradle to 8.7 2024-06-20 12:57:39 +08:00
018f6c305b chore: update .editorconfig 2024-06-20 12:57:33 +08:00
2afa45fd97 chore: bump dependencies 2024-02-20 10:37:45 +08:00
d3eeb338f6 chore: bump gradle to 8.6 2024-02-20 10:37:39 +08:00
cd110085bb chore: update .editorconfig 2024-01-13 21:32:13 +08:00
85ad3236c6 docs: update contacts 2024-01-02 03:29:57 +08:00
0a10d05e09 docs: update copyright date to 2024 for all existing files 2024-01-01 01:48:50 +08:00
e18d33f1a8 style: merge to new ktlint version & rules 2023-12-29 21:29:06 +08:00
a48d15df5d chore: add included properties for build 2023-12-29 21:17:58 +08:00
c5ef7af843 chore: specify project name in properties 2023-12-28 23:25:50 +08:00
b0c8b08b7d chore: update .gitignore 2023-12-28 22:26:44 +08:00
14ddd6978c chore: merge and update to java 21 2023-12-28 21:41:39 +08:00
fcdf0b9f89 chore: bump gradle to 8.5 2023-12-28 21:41:26 +08:00
189a1e2424 chore: merge to new maven publish way 2023-12-28 20:45:05 +08:00
be33fb489e chore: update project files 2023-12-28 20:29:19 +08:00
9ef63252d1 chore: bump dependencies 2023-12-28 20:29:09 +08:00
c90ac4e152 fix: project folder naming 2023-12-28 20:26:30 +08:00
2173620443 docs: use relative link 2023-12-11 02:20:58 +08:00
0eb24e7a44 chore: update project files 2023-12-11 02:20:42 +08:00
54af0cbf2d chore: bump dependency versions 2023-12-11 00:59:16 +08:00
95a24118cd docs: update promotion 2023-11-18 18:23:01 +08:00
0594a400b2 chore: bump "com.highcapable.sweetdependency" version to 1.0.4 2023-11-14 00:40:23 +08:00
88cffc01f7 chore: update project files 2023-11-14 00:40:21 +08:00
289f81cdd7 chore: bump "com.highcapable.sweetproperty" version to 1.0.5 2023-11-08 15:10:12 +08:00
d2005301db chore: bump dependencies 2023-11-04 03:59:36 +08:00
0885318a6e chore: bump plugin versions
- bump "com.highcapable.sweetdependency" version to 1.0.3
- bump "com.highcapable.sweetproperty" version to 1.0.4
2023-11-04 03:58:30 +08:00
5eda5077b9 refactor: replace not to ! 2023-11-04 03:11:43 +08:00
a8f07f0d6b docs: update promotion 2023-10-24 21:58:44 +08:00
f968560d8b refactor: rearrange code 2023-10-13 19:58:56 +08:00
32 changed files with 275 additions and 197 deletions

View File

@@ -10,6 +10,24 @@ ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_function_signature_body_expression_wrapping = multiline
ktlint_standard_string-template-indent = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_if-else-wrapping = disabled
ktlint_standard_if-else-bracing = disabled
ktlint_standard_statement-wrapping = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_no-empty-file = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_function-naming = disabled
ktlint_standard_chain-method-continuation = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_condition-wrapping = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_no-trailing-spaces = disabled
ktlint_standard_multiline-loop = disabled
ij_continuation_indent_size = 2
indent_size = 4
indent_style = space

132
.gitignore vendored
View File

@@ -1,42 +1,110 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
## Fully .gtignore for IntelliJ, Android Studio and Gradle based Java projects
## References:
## - https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
## - https://github.com/android/platform-samples/blob/main/.gitignore
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
.idea/.name
.idea/artifacts
.idea/compiler.xml
.idea/libraries/
*.iws
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
.idea/modules
.idea/caches
.idea/material_theme**
.idea/other.xml
*.iml
*.ipr
# Kotlin
.kotlin
# Misc
.idea/misc.xml
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
# mpeltonen/sbt-idea plugin
.idea_modules/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
# JIRA plugin
atlassian-ide-plugin.xml
### VS Code ###
.vscode/
# Cursive Clojure plugin
.idea/replstate.xml
### Mac OS ###
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# Android studio 3.1+ additional
.idea/deployment*.xml
.idea/assetWizardSettings.xml
.idea/androidTestResultsUserPreferences.xml
# Android projects
**/local.properties
/captures
.externalNativeBuild
.cxx
# Gradle projects
.gradle
build/
# Mkdocs temporary serving folder
docs-gen
site
*.bak
.idea/appInsightsSettings.xml
# Mac OS
.DS_Store

10
.idea/.gitignore generated vendored
View File

@@ -1,10 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
/gradle.xml
/misc.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
.idea/AndroidProjectSystem.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

View File

@@ -1,6 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="CheckImageSize" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true" editorAttributes="INFO_ATTRIBUTES" />
<inspection_tool class="ReplaceUntilWithRangeUntil" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">

2
.idea/kotlinc.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.10" />
<option name="version" value="2.2.10" />
</component>
</project>

7
.idea/ktlint-plugin.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtLint plugin">
<ktlintMode>MANUAL</ktlintMode>
<formatOnSave>false</formatOnSave>
</component>
</project>

View File

@@ -1,15 +1,21 @@
# Flexi Locale
[![GitHub license](https://img.shields.io/github/license/BetterAndroid/FlexiLocale?color=blue)](https://github.com/BetterAndroid/FlexiLocale/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/BetterAndroid/FlexiLocale?display_name=release&logo=github&color=green)](https://github.com/BetterAndroid/FlexiLocale/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram)](https://t.me/BetterAndroid)
[![Telegram](https://img.shields.io/badge/discussion%20dev-Telegram-blue.svg?logo=telegram)](https://t.me/HighCapable_Dev)
[![GitHub license](https://img.shields.io/github/license/BetterAndroid/FlexiLocale?color=blue&style=flat-square)](https://github.com/BetterAndroid/FlexiLocale/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/BetterAndroid/FlexiLocale?display_name=release&logo=github&color=green&style=flat-square)](https://github.com/BetterAndroid/FlexiLocale/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/BetterAndroid)
[![Telegram](https://img.shields.io/badge/discussion%20dev-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/HighCapable_Dev)
[![QQ](https://img.shields.io/badge/discussion%20dev-QQ-blue.svg?logo=tencent-qq&logoColor=red&style=flat-square)](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
<img src="https://github.com/BetterAndroid/FlexiLocale/blob/master/img-src/icon.png?raw=true" width = "100" height = "100" alt="LOGO"/>
<img src="img-src/icon.png" width = "100" height = "100" alt="LOGO"/>
一个自动为 Android 项目生成国际化字符串调用的 Gradle 插件。
[English](https://github.com/BetterAndroid/FlexiLocale/blob/master/README.md) | 简体中文
[English](README.md) | 简体中文
| <img src="https://github.com/BetterAndroid/.github/blob/main/img-src/logo.png?raw=true" width = "30" height = "30" alt="LOGO"/> | [BetterAndroid](https://github.com/BetterAndroid) |
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
这个项目属于上述组织,**点击上方链接关注这个组织**,发现更多好项目。
## 这是什么
@@ -57,19 +63,22 @@ var appName = locale.getAppName();
## 开始使用
- [点击这里](https://github.com/BetterAndroid/FlexiLocale/blob/master/docs/guide-zh-CN.md) 查看使用文档
- [点击这里](docs/guide-zh-CN.md) 查看使用文档
## 更新日志
- [点击这里](https://github.com/BetterAndroid/FlexiLocale/blob/master/docs/changelog-zh-CN.md) 查看历史更新日志
- [点击这里](docs/changelog-zh-CN.md) 查看历史更新日志
## 项目推广
如果你正在寻找一个可以自动管理 Gradle 项目依赖的 Gradle 插件,你可以了解一下 [SweetDependency](https://github.com/HighCapable/SweetDependency) 项目。
如果你正在寻找一个可以自动生成属性键值的 Gradle 插件,你可以了解一下 [SweetProperty](https://github.com/HighCapable/SweetProperty) 项目。
本项目同样使用了 **SweetDependency****SweetProperty**
<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<h2>嘿,还请君留步!👋</h2>
<h3>这里有 Android 开发工具、UI 设计、Gradle 插件、Xposed 模块和实用软件等相关项目。</h3>
<h3>如果下方的项目能为你提供帮助,不妨为我点个 star 吧!</h3>
<h3>所有项目免费、开源,遵循对应开源许可协议。</h3>
<h1><a href="https://github.com/fankes/fankes/blob/main/project-promote/README-zh-CN.md">→ 查看更多关于我的项目,请点击这里 ←</a></h1>
</div>
## Star History
@@ -82,7 +91,7 @@ var appName = locale.getAppName();
```
Apache License Version 2.0
Copyright (C) 2019-2023 HighCapable
Copyright (C) 2019 HighCapable
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -97,4 +106,4 @@ See the License for the specific language governing permissions and
limitations under the License.
```
版权所有 © 2019-2023 HighCapable
版权所有 © 2019 HighCapable

View File

@@ -1,15 +1,21 @@
# Flexi Locale
[![GitHub license](https://img.shields.io/github/license/BetterAndroid/FlexiLocale?color=blue)](https://github.com/BetterAndroid/FlexiLocale/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/BetterAndroid/FlexiLocale?display_name=release&logo=github&color=green)](https://github.com/BetterAndroid/FlexiLocale/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram)](https://t.me/BetterAndroid)
[![Telegram](https://img.shields.io/badge/discussion%20dev-Telegram-blue.svg?logo=telegram)](https://t.me/HighCapable_Dev)
[![GitHub license](https://img.shields.io/github/license/BetterAndroid/FlexiLocale?color=blue&style=flat-square)](https://github.com/BetterAndroid/FlexiLocale/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/BetterAndroid/FlexiLocale?display_name=release&logo=github&color=green&style=flat-square)](https://github.com/BetterAndroid/FlexiLocale/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/BetterAndroid)
[![Telegram](https://img.shields.io/badge/discussion%20dev-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/HighCapable_Dev)
[![QQ](https://img.shields.io/badge/discussion%20dev-QQ-blue.svg?logo=tencent-qq&logoColor=red&style=flat-square)](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
<img src="https://github.com/BetterAndroid/FlexiLocale/blob/master/img-src/icon.png?raw=true" width = "100" height = "100" alt="LOGO"/>
<img src="img-src/icon.png" width = "100" height = "100" alt="LOGO"/>
An easy generation Android i18ns string call Gradle plugin.
English | [简体中文](https://github.com/BetterAndroid/FlexiLocale/blob/master/README-zh-CN.md)
English | [简体中文](README-zh-CN.md)
| <img src="https://github.com/BetterAndroid/.github/blob/main/img-src/logo.png?raw=true" width = "30" height = "30" alt="LOGO"/> | [BetterAndroid](https://github.com/BetterAndroid) |
|---------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
This project belongs to the above-mentioned organization, **click the link above to follow this organization** and discover more good projects.
## What's this
@@ -60,21 +66,22 @@ Some functions may be incompatible, support will be gradually dropped in the fut
## Get Started
- [Click here](https://github.com/BetterAndroid/FlexiLocale/blob/master/docs/guide.md) to view the documentation
- [Click here](docs/guide.md) to view the documentation
## Changelog
- [Click here](https://github.com/BetterAndroid/FlexiLocale/blob/master/docs/changelog.md) to view the historical changelog
- [Click here](docs/changelog.md) to view the historical changelog
## Promotion
If you are looking for a Gradle plugin that can automatically manage Gradle project dependencies,
you can check out the [SweetDependency](https://github.com/HighCapable/SweetDependency) project.
If you are looking for a Gradle plugin that can automatically generate properties key-values,
you can check out the [SweetProperty](https://github.com/HighCapable/SweetProperty) project.
This project also uses **SweetDependency** and **SweetProperty**.
<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<h2>Hey, please stay! 👋</h2>
<h3>Here are related projects such as Android development tools, UI design, Gradle plugins, Xposed Modules and practical software. </h3>
<h3>If the project below can help you, please give me a star! </h3>
<h3>All projects are free, open source, and follow the corresponding open source license agreement. </h3>
<h1><a href="https://github.com/fankes/fankes/blob/main/project-promote/README.md">→ To see more about my projects, please click here ←</a></h1>
</div>
## Star History
@@ -87,7 +94,7 @@ This project also uses **SweetDependency** and **SweetProperty**.
```
Apache License Version 2.0
Copyright (C) 2019-2023 HighCapable
Copyright (C) 2019 HighCapable
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -102,4 +109,4 @@ See the License for the specific language governing permissions and
limitations under the License.
```
Copyright © 2019-2023 HighCapable
Copyright © 2019 HighCapable

View File

@@ -1,16 +1,4 @@
plugins {
autowire(libs.plugins.kotlin.jvm) apply false
}
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
autowire(libs.plugins.maven.publish) apply false
}

View File

@@ -1,2 +0,0 @@
.gradle
/build

View File

@@ -1,66 +0,0 @@
plugins {
`kotlin-dsl`
autowire(libs.plugins.kotlin.jvm)
autowire(libs.plugins.maven.publish)
}
allprojects {
group = property.project.groupName
version = property.project.version
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
}
kotlin {
jvmToolchain(17)
sourceSets.all { languageSettings { languageVersion = "2.0" } }
}
dependencies {
compileOnly(com.android.library.com.android.library.gradle.plugin)
compileOnly(org.jetbrains.kotlin.kotlin.gradle.plugin)
implementation(com.squareup.kotlinpoet)
}
gradlePlugin {
plugins {
create(property.project.moduleName) {
id = property.project.groupName
implementationClass = property.gradle.plugin.implementationClass
}
}
}
mavenPublishing {
coordinates(property.project.groupName, property.project.moduleName, property.project.version)
pom {
name = property.project.name
description = property.project.description
url = property.project.url
licenses {
license {
name = property.project.licence.name
url = property.project.licence.url
distribution = property.project.licence.url
}
}
developers {
developer {
id = property.project.developer.id
name = property.project.developer.name
email = property.project.developer.email
}
}
scm {
url = property.maven.publish.scm.url
connection = property.maven.publish.scm.connection
developerConnection = property.maven.publish.scm.developerConnection
}
}
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.S01)
signAllPublications()
}

View File

@@ -0,0 +1,41 @@
plugins {
`kotlin-dsl`
autowire(libs.plugins.kotlin.jvm)
autowire(libs.plugins.maven.publish)
}
group = property.project.groupName
version = property.project.version
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
withSourcesJar()
}
kotlin {
jvmToolchain(21)
sourceSets.all { languageSettings { languageVersion = "2.0" } }
compilerOptions {
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
dependencies {
compileOnly(com.android.library.com.android.library.gradle.plugin)
compileOnly(org.jetbrains.kotlin.kotlin.gradle.plugin)
implementation(com.squareup.kotlinpoet)
}
gradlePlugin {
plugins {
create(property.project.moduleName) {
id = property.project.groupName
implementationClass = property.gradle.plugin.implementationClass
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0
@@ -37,7 +37,7 @@ import org.gradle.api.plugins.ExtensionAware
*/
internal fun ExtensionAware.getOrCreate(name: String, clazz: Class<*>, vararg args: Any?) = name.toSafeExtName().let { sName ->
runCatching { extensions.create(sName, clazz, *args).asExtension() }.getOrElse {
if ((it is IllegalArgumentException && it.message?.startsWith("Cannot add extension with name") == true).not()) throw it
if (!(it is IllegalArgumentException && it.message?.startsWith("Cannot add extension with name") == true)) throw it
runCatching { extensions.getByName(sName).asExtension() }.getOrNull() ?: FError.make("Create or get extension failed with name \"$sName\"")
}
}
@@ -50,7 +50,7 @@ internal fun ExtensionAware.getOrCreate(name: String, clazz: Class<*>, vararg ar
*/
internal inline fun <reified T> ExtensionAware.getOrCreate(name: String, vararg args: Any?) = name.toSafeExtName().let { sName ->
runCatching { extensions.create(sName, T::class.java, *args) as T }.getOrElse {
if ((it is IllegalArgumentException && it.message?.startsWith("Cannot add extension with name") == true).not()) throw it
if (!(it is IllegalArgumentException && it.message?.startsWith("Cannot add extension with name") == true)) throw it
runCatching { extensions.getByName(sName) as? T? }.getOrNull() ?: FError.make("Create or get extension failed with name \"$sName\"")
}
}

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0
@@ -91,13 +91,13 @@ open class FlexiLocaleConfigureExtension internal constructor() {
internal fun build(project: Project): IFlexiLocaleConfigs {
/** 检查合法包名 */
fun String.checkingValidPackageName() {
if (isNotBlank() && matches("^[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z_][a-zA-Z0-9_]*)*$".toRegex()).not())
if (isNotBlank() && !matches("^[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z_][a-zA-Z0-9_]*)*$".toRegex()))
FError.make("Invalid package name \"$this\"")
}
/** 检查合法类名 */
fun String.checkingValidClassName() {
if (isNotBlank() && matches("^[a-zA-Z][a-zA-Z0-9_]*$".toRegex()).not())
if (isNotBlank() && !matches("^[a-zA-Z][a-zA-Z0-9_]*$".toRegex()))
FError.make("Invalid class name \"$this\"")
}
packageName.checkingValidPackageName()

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0
@@ -86,7 +86,7 @@ internal object LocaleAnalysisHelper {
*/
internal fun start(project: Project, configs: IFlexiLocaleConfigs) {
this.configs = configs
if (configs.isEnable.not()) return
if (!configs.isEnable) return
checkingConfigsModified(project, configs)
initializePlugins(project)
val lastMappedStrings: LocaleStringMap = mutableMapOf()
@@ -106,7 +106,7 @@ internal object LocaleAnalysisHelper {
}
}.clear()
val isFileModified = mappedStrings != lastMappedStrings
if (isFileModified.not() && isConfigsModified.not()) return
if (!isFileModified && !isConfigsModified) return
mappedStrings.clear()
mappedStrings.putAll(lastMappedStrings)
lastMappedStrings.clear()
@@ -139,7 +139,6 @@ internal object LocaleAnalysisHelper {
extension.applicationVariants.forEach { variant ->
variant.updateResDirectories()
}; extension.updateSourceDirs()
extension.sourceSets.configureEach { kotlin.srcDir(configs.generateDirPath) }
}
}
project.plugins.withId(LIBRARY_PLUGIN_NAME) {
@@ -173,7 +172,7 @@ internal object LocaleAnalysisHelper {
val valuesDirs: LocaleFileMap = mutableMapOf()
forEach {
it.listFiles()?.filter { dir -> dir.name.startsWith("values") }?.forEach eachDir@{ valuesDir ->
if (valuesDir.exists().not() || valuesDir.isDirectory.not()) return@eachDir
if (!valuesDir.exists() || !valuesDir.isDirectory) return@eachDir
val langName = if (valuesDir.name == "values") "default" else valuesDir.name.split("s-").getOrNull(1) ?: return@eachDir
if (valuesDirs[langName] == null) valuesDirs[langName] = mutableSetOf()
valuesDirs[langName]?.add(valuesDir)

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,6 +1,6 @@
/*
* FlexiLocale - An easy generation Android i18ns string call Gradle plugin.
* Copyright (C) 2019-2023 HighCapable
* Copyright (C) 2019 HighCapable
* https://github.com/BetterAndroid/FlexiLocale
*
* Apache License Version 2.0

View File

@@ -1,19 +1,27 @@
# Project Configuration
project.name=FlexiLocale
project.description=An easy generation Android i18ns string call Gradle plugin.
project.url=https://github.com/BetterAndroid/FlexiLocale
project.groupName=com.highcapable.flexilocale
project.moduleName=flexi-locale
project.version=1.0.1
project.licence.name=Apache License 2.0
project.licence.url=https://github.com/BetterAndroid/FlexiLocale/blob/master/LICENSE
project.developer.id="0"
project.developer.name=fankes
project.developer.email=qzmmcn@163.com
# Gradle Plugin Configuration
gradle.plugin.moduleName=${project.groupName}.gradle.plugin
gradle.plugin.implementationClass=${project.groupName}.plugin.FlexiLocalePlugin
# Maven Publish Configuration
maven.publish.scm.connection=scm:git:git://github.com/BetterAndroid/FlexiLocale.git
maven.publish.scm.developerConnection=scm:git:ssh://github.com/BetterAndroid/FlexiLocale.git
maven.publish.scm.url=https://github.com/BetterAndroid/FlexiLocale
SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true
# Maven POM Configuration
POM_NAME=FlexiLocale
POM_ARTIFACT_ID=flexi-locale
POM_DESCRIPTION=An easy generation Android i18ns string call Gradle plugin.
POM_URL=https://github.com/BetterAndroid/FlexiLocale
POM_LICENSE_NAME=Apache License 2.0
POM_LICENSE_URL=https://github.com/BetterAndroid/FlexiLocale/blob/master/LICENSE
POM_LICENSE_DIST=repo
POM_SCM_URL=https://github.com/BetterAndroid/FlexiLocale
POM_SCM_CONNECTION=scm:git:git://github.com/BetterAndroid/FlexiLocale.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com/BetterAndroid/FlexiLocale.git
POM_DEVELOPER_ID=0
POM_DEVELOPER_NAME=fankes
POM_DEVELOPER_EMAIL=qzmmcn@163.com
POM_DEVELOPER_URL=https://github.com/fankes

View File

@@ -11,18 +11,18 @@ repositories:
plugins:
org.jetbrains.kotlin.jvm:
alias: kotlin-jvm
version: 1.9.10
version: 2.2.10
com.vanniktech.maven.publish:
alias: maven-publish
version: 0.25.3
version: 0.34.0
libraries:
com.android.library:
com.android.library.gradle.plugin:
version: 8.1.2
version: 8.12.1
org.jetbrains.kotlin:
kotlin-gradle-plugin:
version: 1.9.10
version: 2.2.10
com.squareup:
kotlinpoet:
version: 1.14.2
version: 2.2.0

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -6,8 +6,8 @@ pluginManagement {
}
}
plugins {
id("com.highcapable.sweetdependency") version "1.0.2"
id("com.highcapable.sweetproperty") version "1.0.3"
id("com.highcapable.sweetdependency") version "1.0.4"
id("com.highcapable.sweetproperty") version "1.0.8"
}
sweetDependency {
isEnableVerboseMode = false
@@ -16,10 +16,14 @@ sweetProperty {
global {
sourcesCode {
className = rootProject.name
includeKeys(
"^project\\..*\$".toRegex(),
"^gradle\\..*\$".toRegex()
)
isEnableRestrictedAccess = true
}
}
rootProject { all { isEnable = false } }
}
rootProject.name = "FlexiLocale"
include(":flexilocal-gradle-plugin")
include(":flexilocale-gradle-plugin")