92 Commits

Author SHA1 Message Date
16f8422424 chore: bump gradle to 8.14.3 2025-08-19 14:05:40 +08:00
df85b8b8eb chore: bump dependencies 2025-08-19 14:05:35 +08:00
b4b3511c16 refactor: some tweaks in GradleProjectFactory 2025-08-19 14:05:26 +08:00
040f619413 docs: mark a fixme when support gradle 9.0.0 after in LibraryDependencyWrapper 2025-08-19 14:05:11 +08:00
46786f765b refactor: change update checking url in PluginUpdateHelper 2025-08-19 13:26:59 +08:00
47055fd724 docs: update README 2025-06-24 15:35:41 +08:00
1292f727dc chore: update project files 2025-06-24 15:33:50 +08:00
bfb97905cc chore: bump dependencies 2025-03-17 01:15:32 +08:00
fd44cdff0f chore: bump gradle to 8.13 2025-03-17 01:15:29 +08:00
cd984201dc chore: update project files 2025-03-17 01:15:24 +08:00
967e24889d chore: update .gitignore 2025-03-17 01:15:20 +08:00
12ff773c54 chore: update .editorconfig 2025-03-17 01:15:12 +08:00
5b353269ab docs: update license 2025-01-13 10:39:04 +08:00
a317610884 chore: update project files 2025-01-13 10:39:00 +08:00
36cc89a0ea chore: bump dependencies 2024-11-10 19:36:10 +08:00
38a93760b7 chore: bump gradle to 8.10.2 2024-11-10 19:36:07 +08:00
2cbf00e997 chore: update .editorconfig 2024-06-21 10:19:30 +08:00
b93bca20dd chore: update project files 2024-06-21 10:19:26 +08:00
2c58843942 chore: bump dependencies 2024-06-20 13:02:56 +08:00
e24fe8d9cb chore: bump gradle to 8.7 2024-06-20 13:02:53 +08:00
7635ded918 chore: update .editorconfig 2024-06-20 13:02:48 +08:00
8528873fad fix: wrong gradle version check in SweetDependencyExtensionImpl 2024-02-20 10:27:58 +08:00
e6286d4fd0 chore: bump dependencies 2024-02-20 10:07:44 +08:00
eb5aeb4449 chore: bump gradle to 8.6 2024-02-20 10:07:37 +08:00
258f559a9c chore: update .editorconfig 2024-01-13 21:33:17 +08:00
69da68e1e2 docs: update contacts 2024-01-02 03:31:56 +08:00
6cc079bcb1 docs: update copyright date to 2024 for all existing files 2024-01-01 01:46:00 +08:00
005c1b173f chore: update project files 2024-01-01 01:45:57 +08:00
982e574e35 style: merge to new ktlint version & rules 2023-12-29 21:29:45 +08:00
4452afa408 chore: add included properties for build 2023-12-29 21:17:53 +08:00
4e01ddacc3 chore: specify project name in properties 2023-12-28 23:27:45 +08:00
0ea6807231 chore: update .gitignore 2023-12-28 22:29:05 +08:00
6834ea84da chore: merge and update to java 21 2023-12-28 21:30:22 +08:00
72d6263eaf chore: bump gradle to 8.5 2023-12-28 21:30:04 +08:00
47a59ae8c7 chore: merge to new maven publish way 2023-12-28 21:02:01 +08:00
c6d6de94d6 chore: update project files 2023-12-28 20:56:47 +08:00
a0279171d2 chore: bump dependencies 2023-12-28 20:56:43 +08:00
e5229e8cb0 docs: use relative link 2023-12-11 02:25:24 +08:00
bce37d80bf chore: update project files 2023-12-11 02:25:22 +08:00
12713006a5 feat: add dependency versions 2023-12-11 01:02:37 +08:00
845cc2c6d7 docs: update README-zh-CN 2023-12-11 01:01:32 +08:00
c525a720f2 docs: update promotion 2023-11-18 18:19:12 +08:00
10e3915197 Bump version to 1.0.4 2023-11-14 00:32:47 +08:00
70aa40a5b1 docs: update guide 2023-11-14 00:22:52 +08:00
86e06bab69 feat: add dependencies autowire debug info 2023-11-14 00:22:46 +08:00
f0331ffee7 feat: update runtime debug info 2023-11-13 23:15:02 +08:00
6ff5801cb7 docs: update guide 2023-11-13 22:52:15 +08:00
d697a59c26 feat: add enable or disable dependencyResolutionManagement function 2023-11-13 22:52:07 +08:00
d896554421 chore: bump "com.highcapable.sweetproperty" version to 1.0.5 2023-11-08 15:06:07 +08:00
68dfdbf648 chore: update samples 2023-11-04 03:00:35 +08:00
2f47d72904 Bump version to 1.0.3 2023-11-04 02:19:14 +08:00
9b1b1050cf chore: update project files 2023-11-04 02:18:52 +08:00
49a9a70df3 chore: bump "com.highcapable.sweetproperty" version to 1.0.4 2023-11-04 02:18:30 +08:00
3304a1afef feat: use @Nonnull better for Kotlin code 2023-11-03 23:10:39 +08:00
111312463e chore: update dependencies 2023-11-03 22:37:03 +08:00
6963f1ca36 docs: update guide 2023-11-03 22:35:15 +08:00
609cbe644d refactor: replace not to ! 2023-11-03 22:27:18 +08:00
5d3642c1a3 refactor: remove kotlin-gradle-api and add sweet extension to kotlin mpp 2023-11-03 22:16:48 +08:00
7071951aa5 chore: update promotion 2023-10-24 22:22:23 +08:00
5dd68af7b5 chore: update samples 2023-09-26 08:46:10 +08:00
f92dcfa446 Bump version to 1.0.2 2023-09-26 08:35:44 +08:00
222ea51ac7 chore: bump "com.highcapable.sweetproperty" version to 1.0.3 2023-09-26 08:28:17 +08:00
2e298071d3 refactor: standardize Gradle project naming 2023-09-26 06:33:46 +08:00
87928e9af6 docs: update guide 2023-09-26 05:29:26 +08:00
fb5727fec7 feat: add dependencies version ref scope reference function 2023-09-26 05:29:10 +08:00
6627e99564 style: fix comment 2023-09-26 04:30:38 +08:00
7fe824bab5 fix: Gradle lifecycle problem 2023-09-26 04:29:57 +08:00
46683cfb2e feat: replace "/" to "or" 2023-09-26 04:28:11 +08:00
586499c4f4 docs: update guide 2023-09-26 04:13:33 +08:00
78527bb302 feat: add enable / disable auto generate dependencies namespace function 2023-09-26 04:13:07 +08:00
f767fb6694 fix: checking update function 2023-09-26 03:40:37 +08:00
f2949d9039 fix: constructor maybe not first statement every time 2023-09-26 02:05:03 +08:00
43c7c35309 refactor: unconditionally to output the sources even got an error 2023-09-26 01:59:54 +08:00
4e18f9f011 style: rename examples to samples 2023-09-21 00:20:08 +08:00
15282cb16d docs: fix description 2023-09-16 00:28:31 +08:00
afe30a9ec1 docs: fix code comment 2023-09-14 05:43:39 +08:00
800d97dace docs: update comments 2023-09-12 13:55:03 +08:00
9209be3ea0 chore: optimize SweetProperty configs 2023-09-08 13:13:22 +08:00
fab9eee279 docs: update readme zh-cn 2023-09-08 12:22:40 +08:00
2b81ae41b2 Bump version to 1.0.1 2023-09-07 01:46:46 +08:00
c44dc6f4c3 chore: update samples 2023-09-07 01:38:42 +08:00
a56d2ed895 fix: legacy Gradle maybe crashed when using "excludeGroupAndSubgroups" and "includeGroupAndSubgroups" 2023-09-07 01:09:47 +08:00
301283a1d0 chore: bump "com.highcapable.sweetproperty" version to 1.0.2 2023-09-07 00:40:00 +08:00
710a597454 docs: update guide 2023-09-06 21:36:47 +08:00
e9a71f29ef refactor: using fixed version for plugins deployed and disallowed non-autowire version deployed 2023-09-06 20:20:38 +08:00
a6770e3e03 fix: project url wrong 2023-09-06 20:12:29 +08:00
6fedc9ef50 refactor: using new way to checking load build script class exists 2023-09-06 19:33:17 +08:00
ff0ae7f0ab refactor: using relative pom path to resolve generated dependencies jar 2023-09-06 19:32:00 +08:00
a2ca412ec9 refactor: replace packaging jar method using "net.lingala.zip4j" 2023-09-06 02:26:41 +08:00
7e419b758f chore: bump "com.highcapable.sweetproperty" version to 1.0.1 2023-09-04 02:42:09 +08:00
9b014cdb77 docs: add readme badge link 2023-09-04 01:05:44 +08:00
de339a49f6 docs: update readme badge 2023-09-04 00:58:47 +08:00
158 changed files with 1104 additions and 769 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

117
.gitignore vendored
View File

@@ -1,13 +1,110 @@
## 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
# 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/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
.idea/modules
.idea/caches
.idea/material_theme**
.idea/other.xml
*.iml
.gradle
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
*.ipr
# Kotlin
.kotlin
# Misc
.idea/misc.xml
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# 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
.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>

12
.idea/compiler.xml generated
View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17">
<module name="SweetDependency.buildSrc" target="17" />
<module name="SweetDependency.buildSrc.main" target="17" />
<module name="SweetDependency.buildSrc.test" target="17" />
<module name="SweetDependency.main" target="17" />
<module name="SweetDependency.test" target="17" />
</bytecodeTargetLevel>
</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="GrazieInspection" enabled="false" level="GRAMMAR_ERROR" enabled_by_default="false" />
<inspection_tool class="HttpUrlsUsage" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
</component>
</project>

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>

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

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettings">
<option name="showProblemsInCodeBlocks" value="false" />
</component>
</project>

124
.idea/uiDesigner.xml generated
View File

@@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@@ -1,14 +1,20 @@
# Sweet Dependency
[![Blank](https://img.shields.io/badge/license-Apache2.0-blue)](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
![Blank](https://img.shields.io/badge/version-v1.0.0-green)
[![Telegram](https://img.shields.io/badge/Discussion-Telegram-blue.svg?logo=telegram)](https://t.me/HighCapable_Dev)
[![GitHub license](https://img.shields.io/github/license/HighCapable/SweetDependency?color=blue&style=flat-square)](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/HighCapable/SweetDependency?display_name=release&logo=github&color=green&style=flat-square)](https://github.com/HighCapable/SweetDependency/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/HighCapable_Dev)
[![QQ](https://img.shields.io/badge/discussion-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/HighCapable/SweetDependency/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"/>
一个轻松自动装配和管理依赖的 Gradle 插件。
[English](https://github.com/HighCapable/SweetDependency/blob/master/README.md) | 简体中文
[English](README.md) | 简体中文
| <img src="https://github.com/HighCapable/.github/blob/main/img-src/logo.jpg?raw=true" width = "30" height = "30" alt="LOGO"/> | [HighCapable](https://github.com/HighCapable) |
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
这个项目属于上述组织,**点击上方链接关注这个组织**,发现更多好项目。
## 这是什么
@@ -52,11 +58,11 @@
## 开始使用
- [点击这里](https://github.com/HighCapable/SweetDependency/blob/master/docs/guide-zh-CN.md) 查看使用文档
- [点击这里](docs/guide-zh-CN.md) 查看使用文档
## 更新日志
- [点击这里](https://github.com/HighCapable/SweetDependency/blob/master/docs/changelog-zh-CN.md) 查看历史更新日志
- [点击这里](docs/changelog-zh-CN.md) 查看历史更新日志
## 项目推广
@@ -64,6 +70,15 @@
本项目同样使用了 **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
![Star History Chart](https://api.star-history.com/svg?repos=HighCapable/SweetDependency&type=Date)
@@ -75,7 +90,7 @@
```
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.
@@ -90,4 +105,4 @@ See the License for the specific language governing permissions and
limitations under the License.
```
版权所有 © 2019-2023 HighCapable
版权所有 © 2019 HighCapable

View File

@@ -1,14 +1,20 @@
# Sweet Dependency
[![Blank](https://img.shields.io/badge/license-Apache2.0-blue)](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
![Blank](https://img.shields.io/badge/version-v1.0.0-green)
[![Telegram](https://img.shields.io/badge/Discussion-Telegram-blue.svg?logo=telegram)](https://t.me/HighCapable_Dev)
[![GitHub license](https://img.shields.io/github/license/HighCapable/SweetDependency?color=blue&style=flat-square)](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/HighCapable/SweetDependency?display_name=release&logo=github&color=green&style=flat-square)](https://github.com/HighCapable/SweetDependency/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/HighCapable_Dev)
[![QQ](https://img.shields.io/badge/discussion-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/HighCapable/SweetDependency/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 autowire and manage dependencies Gradle plugin.
English | [简体中文](https://github.com/HighCapable/SweetDependency/blob/master/README-zh-CN.md)
English | [简体中文](README-zh-CN.md)
| <img src="https://github.com/HighCapable/.github/blob/main/img-src/logo.jpg?raw=true" width = "30" height = "30" alt="LOGO"/> | [HighCapable](https://github.com/HighCapable) |
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
This project belongs to the above-mentioned organization, **click the link above to follow this organization** and discover more good projects.
## What's this
@@ -54,11 +60,11 @@ Some functions will be gradually improved following the needs of users.
## Get Started
- [Click here](https://github.com/HighCapable/SweetDependency/blob/master/docs/guide.md) to view the documentation
- [Click here](docs/guide.md) to view the documentation
## Changelog
- [Click here](https://github.com/HighCapable/SweetDependency/blob/master/docs/changelog.md) to view the historical changelog
- [Click here](docs/changelog.md) to view the historical changelog
## Promotion
@@ -67,6 +73,15 @@ you can check out the [SweetProperty](https://github.com/HighCapable/SweetProper
This project also uses **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
![Star History Chart](https://api.star-history.com/svg?repos=HighCapable/SweetDependency&type=Date)
@@ -78,7 +93,7 @@ This project also uses **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.
@@ -93,4 +108,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

@@ -2,4 +2,34 @@
## 1.0.0 | 2023.09.03
- 首个版本提交至 Maven
- 首个版本提交至 Maven
## 1.0.1 | 2023.09.07
- 使用 `net.lingala.zip4j` 取代 JDK 默认创建压缩文档功能修复在 Windows 平台中 Gradle 8.0.2+ 版本创建的 JAR 损坏导致找不到生成的 Class 问题
- 重构自动生成代码部分的装载功能,增加可能找不到 Class 的错误提示
- 新增在设置了未定义版本的插件依赖条件下直接运行自动装配相关 Gradle Task 将抛出异常
- 修复可能的旧版本 Gradle 在使用 `repositories``content` 功能会抛出异常
## 1.0.2 | 2023.09.26
- 自动生成代码功能将始终输出源码文件,以方便在生成失败的时候进行调试
- 修复部分连续名称的依赖可能导致生成失败的问题
- 修复插件自身检查更新功能失效
- 修复 Gradle 生命周期问题,可能导致 `autowire` 方法的项目作用域不正确
- 改进并采用 Gradle 项目命名规范
- 新增依赖命名空间可启用或禁用生成功能,更新后需要参考文档自行迁移部分配置文件的节点名称否则会发生错误
- 新增使用 `<plugins>::``<libraries>::` 可以访问其它节点的依赖名称、别名并设置到 `version-ref` 功能
## 1.0.3 | 2023.11.04
- 修复从 `1.0.0` 版本开始的一个本插件与 `Kotlin` 插件的 `Class` 冲突问题
- 更换 Kotlin Multiplatform 中的配置依赖 `autowire(...)` 写法为 `sweet.autowire(...)`
- 生成的代码使用 `@Nonnull` 标记以使其能够在 Kotlin DSL 脚本中识别为非空返回值类型
- 一些其它功能性的改进
## 1.0.4 | 2023.11.14
- 新增 `isUseDependencyResolutionManagement` 选项,默认启用,现在你可以选择是否允许插件使用 `dependencyResolutionManagement` 配置库依赖
- 新增 `isDebug` 选项,默认不启用,你可以启用此选项来在自动装配时输出详细的依赖搜索信息
- 一些其它功能性的改进

View File

@@ -2,4 +2,38 @@
## 1.0.0 | 2023.09.03
- The first version is submitted to Maven
- The first version is submitted to Maven
## 1.0.1 | 2023.09.07
- Use `net.lingala.zip4j` to replace JDK's default function of creating compressed files and fix the problem that the JAR created by Gradle 8.0.2+
version on Windows platform is broken and the generated classes cannot be found
- Refactor the loading function of the automatically generated code part, and add an error message that classes may not be found
- Added an exception will be thrown when running the autowire related Gradle task directly
under the condition of setting an undefined version of plugins
- Fix possible old version of Gradle throwing exception when using `content` function of `repositories`
## 1.0.2 | 2023.09.26
- The automatic code generation function will always output source code files to facilitate debugging when the generation fails
- Fix dependencies with some consecutive names may cause generation failure
- Fix plugin own update function
- Fix Gradle lifecycle problem that may cause the project scope of the `autowire` method to be incorrect
- Improve and adopt Gradle project naming convention
- Added dependencies namespace to enable or disable the generation function, after the update, you need to refer to the documentation to migrate the
node names of some configuration files yourself, otherwise errors will occur
- Added the function of using `<plugins>::` or `<libraries>::` to access the dependencies name and alias of other nodes and set them to `version-ref`
## 1.0.3 | 2023.11.04
- Fix a `Class` conflict between this plugin and the `Kotlin` plugin starting from `1.0.0` version
- Change the configuration dependency `autowire(...)` in Kotlin Multiplatform to `sweet.autowire(...)`
- Generated code is marked with `@Nonnull` to make it recognized as a non-null return type in Kotlin DSL scripts
- Some other functional improvements
## 1.0.4 | 2023.11.14
- Added `isUseDependencyResolutionManagement` option, enabled by default, now you can choose whether to allow plugins to
use `dependencyResolutionManagement` to configure library dependencies
- Added `isDebug` option, not enabled by default, you can enable this option to output detailed dependency search information during autowiring
- Some other functional improvements

View File

@@ -2,7 +2,7 @@
在开始使用之前,建议你仔细阅读此文档,以便你能更好地了解它的作用方式与功能。
你可以在项目的根目录找到 examples 中的 Demo并参考此文档食用效果更佳。
你可以在项目的根目录找到 samples 中的 Demo并参考此文档食用效果更佳。
## 工作原理
@@ -31,6 +31,9 @@
如果你的项目依然在使用 `buildscript` 的方式进行管理,请迁移到新方式,否则会发生错误。
如果你的项目不能使用 `dependencyResolutionManagement` 进行管理,你可以参考此页面最下方的 [自定义选项](#自定义选项)
通过配置 `isUseDependencyResolutionManagement = false` 来使用传统的库依赖管理方式。
## 快速开始
首先,打开你根项目的 `settings.gradle``settings.gradle.kts`
@@ -151,11 +154,19 @@ preferences:
# 没有命名空间implementation(com.mydemo.test.test)
# 存在命名空间implementation(libs.com.mydemo.test.test)
dependencies-namespace:
# 插件依赖必须存在命名空间,如果不设置,其默认为 "libs"
plugins: libs
# 库依赖的命名空间可选
# 如果你不需要库依赖的命名空间,请删除此节点
libraries: libs
plugins:
# 如果你希望关闭自动生成,可以设置为 false
# 在决定关闭时请确保构建脚本中已不存在自动生成的代码,防止发生错误
enable: true
# 插件依赖必须存在命名空间,如果不设置,其默认为 "libs"
name: libs
libraries:
# 如果你希望关闭自动生成,可以设置为 false
# 在决定关闭时请确保构建脚本中已不存在自动生成的代码,防止发生错误
enable: true
# 库依赖的命名空间可选
# 如果你不需要库依赖的命名空间,请删除此节点
name: libs
# 依赖版本过滤器
# 如果你需要排除一些不希望被更新到的依赖版本 (例如测试版本) 可以手动进行配置
# 默认情况下过滤器已帮你自动排除测试版本,无需对此项进行配置
@@ -332,6 +343,9 @@ plugins:
org.jetbrains.kotlin.android:
alias: kotlin-android
version: 1.8.10
com.google.devtools.ksp:
alias: kotlin-ksp
version: 1.8.10-1.0.9
# 配置需要使用的库依赖
libraries:
@@ -375,6 +389,12 @@ libraries:
# 注意:如果你声明了 "version-ref",此依赖将在自动装配和更新中被排除
# 注意:如果你声明了 "version-ref""auto-update"、"repositories"、"version-filter" 将无效
version-ref: <this>::core # 或 "androidx.core:core" 以及 "androidx-core" (别名)
com.google.devtools.ksp:
symbol-processing-api:
# 如果你想引用一个不属于当前作用域 ("libraries") 的依赖或别名,你需要声明其所属的作用域
# 例如引用 "plugins" 作用域中的依赖别名 "kotlin-ksp",你需要使用 "<plugins>::" 作为开头进行声明
# 同理,在 "plugins" 作用域中需要使用 "<libraries>::" 作为开头进行声明
version-ref: <plugins>::kotlin-ksp # 或 "<plugins>::com.google.devtools.ksp"
com.squareup.okhttp3:
okhttp:
# 如果你在版本中声明了一个 "version-filter" 中存在的版本 (内置过滤器或排除列表)
@@ -792,14 +812,16 @@ dependencies {
在 Kotlin Multiplatform 中与一般依赖部署方式一致。
为了解决可能的插件冲突,无论是 Kotlin 还是 Groovy都需要使用 `sweet.autowire`
> Kotlin DSL
```kotlin
sourceSets {
val androidMain by getting {
dependencies {
implementation(autowire("androidx.core:core-ktx"))
implementation(autowire("libs/*.jar"))
implementation(sweet.autowire("androidx.core:core-ktx"))
implementation(sweet.autowire("libs/*.jar"))
}
}
}
@@ -1127,9 +1149,18 @@ sweetDependency {
// 启用 SweetDependency设置为 false 将禁用所有功能
isEnable = true
// 是否启用调试模式
// 默认不启用,启用后将在自动装配时输出详细的依赖搜索信息
isDebug = false
// SweetDependency 配置文件名称
configFileName = "sweet-dependency-config.yaml"
// 是否使用 Settings.dependencyResolutionManagement 管理库依赖
// 此功能默认启用,如果你的项目必须存在自定义的 "repositories" 方法块,请关闭此功能
// 注意:关闭后配置文件中的 "repositories-mode" 选项将不再有效
isUseDependencyResolutionManagement = true
// 是否启用依赖自动装配日志
// 此功能默认启用,会在当前根项目 (Root Project) 的 ".gradle/sweet-dependency" 目录下创建日志文件
isEnableDependenciesAutowireLog = true
@@ -1145,7 +1176,9 @@ sweetDependency {
```groovy
sweetDependency {
enable true
debug false
configFileName 'sweet-dependency-config.yaml'
useDependencyResolutionManagement true
enableDependenciesAutowireLog true
enableVerboseMode true
}

View File

@@ -2,7 +2,7 @@
Before you start using it, it is recommended that you read this document carefully so that you can better understand how it works and its functions.
You can find the demo in examples in the root directory of the project, and refer to this document for better use.
You can find the demo in samples in the root directory of the project, and refer to this document for better use.
## Working Principle
@@ -32,6 +32,10 @@ Note that `SweetDependency` supports at least Gradle `7.x.x` and is managed usin
If your project is still managed using the `buildscript` method, please migrate to the new method, otherwise errors will occur.
If your project cannot be managed using `dependencyResolutionManagement`, you can refer to the [Custom Preferences](#custom-preferences)
at the bottom of this page,
use traditional library dependency management by configuring `isUseDependencyResolutionManagement = false`.
## Quick Start
First, open `settings.gradle` or `settings.gradle.kts` of your root project.
@@ -157,11 +161,21 @@ preferences:
# No namespace: implementation(com.mydemo.test.test)
# Has namespace: implementation(libs.com.mydemo.test.test)
dependencies-namespace:
# Plugin dependencies namespace must exist, if not set, the default is "libs"
plugins: libs
# Library dependencies namespace is optional
# If you don't need the namespace of library dependencies, delete this node
plugins:
# If you want to turn off automatic generation, you can set it to false
# Note: When deciding to close,
# make sure that there is no automatically generated code in the build script to prevent errors
enable: true
# Plugin dependencies namespace must exist, if not set, the default is "libs"
name: libs
libraries: libs
# If you want to turn off automatic generation, you can set it to false
# Note: When deciding to close,
# make sure that there is no automatically generated code in the build script to prevent errors
enable: true
# Library dependencies namespace is optional
# If you don't need the namespace of library dependencies, delete this node
name: libs
# Dependencies version filter
# If you need to exclude some dependency versions that you don't want to be updated to (such as test versions),
# you can configure them manually
@@ -349,6 +363,9 @@ plugins:
org.jetbrains.kotlin.android:
alias: kotlin-android
version: 1.8.10
com.google.devtools.ksp:
alias: kotlin-ksp
version: 1.8.10-1.0.9
# Configure libraries that need to be used
libraries:
@@ -397,6 +414,14 @@ libraries:
# Note: If you declare "version-ref", this dependency will be excluded from autowiring and updating
# Note: If you declare "version-ref", "auto-update", "repositories", "version-filter" will not work
version-ref: <this>::core # Or "androidx.core:core" and "androidx-core" (alias)
com.google.devtools.ksp:
symbol-processing-api:
# If you want to reference a dependency or alias that does not belong to the current scope ("libraries"),
# you need to declare the scope it belongs to
# For example, to reference the dependency alias "kotlin-ksp" in the "plugins" scope,
# you need to use "<plugins>::" as the beginning of the declaration
# Similarly, you need to use "<libraries>::" as the beginning of the declaration in the "plugins" scope
version-ref: <plugins>::kotlin-ksp # Or "<plugins>::com.google.devtools.ksp"
com.squareup.okhttp3:
okhttp:
# If you declare a version in the version that exists in "version-filter" (internal filter or exclude list)
@@ -842,14 +867,16 @@ dependencies {
In Kotlin Multiplatform, it is consistent with the general dependency deployment method.
To resolve possible plugin conflicts, whether Kotlin or Groovy, you need to use `sweet.autowire`.
> Kotlin DSL
```kotlin
sourceSets {
val androidMain by getting {
dependencies {
implementation(autowire("androidx.core:core-ktx"))
implementation(autowire("libs/*.jar"))
implementation(sweet.autowire("androidx.core:core-ktx"))
implementation(sweet.autowire("libs/*.jar"))
}
}
}
@@ -1193,9 +1220,20 @@ sweetDependency {
// Enable SweetDependency, set to false will disable all functions
isEnable = true
// Whether to enable debug mode
// Not enabled by default,
// if enabled, detailed dependencies search information will be output during autowiring
isDebug = false
// SweetDependency configuration file name
configFileName = "sweet-dependency-config.yaml"
// Whether to use Settings.dependencyResolutionManagement to manage library dependencies
// This function is enabled by default,
// if your project must have a custom "repositories" method block, please disable this function
// Note: The "repositories-mode" option in the configuration file will no longer be effective after disabled
isUseDependencyResolutionManagement = true
// Whether to enable dependency autowiring logging
// This function is enabled by default and will create a log file in the ".gradle/sweet-dependency" directory of the current root project
isEnableDependenciesAutowireLog = true
@@ -1212,7 +1250,9 @@ sweetDependency {
```groovy
sweetDependency {
enable true
debug false
configFileName 'sweet-dependency-config.yaml'
useDependencyResolutionManagement true
enableDependenciesAutowireLog true
enableVerboseMode true
}

View File

@@ -1,19 +1,27 @@
# Project Configuration
project.name=SweetDependency
project.description=An easy autowire and manage dependencies Gradle plugin
project.url=https://github.com/fankes/HighCapable/SweetDependency
project.url=https://github.com/HighCapable/SweetDependency
project.groupName=com.highcapable.sweetdependency
project.moduleName=sweet-dependency
project.version=1.0.0
project.licence.name=Apache License 2.0
project.licence.url=https://github.com/fankes/HighCapable/SweetDependency/blob/master/LICENSE
project.developer.id=0
project.developer.name=fankes
project.developer.email=qzmmcn@163.com
project.version=1.0.4
# Gradle Plugin Configuration
gradle.plugin.moduleName=${project.groupName}.gradle.plugin
gradle.plugin.implementationClass=${project.groupName}.plugin.SweetDependencyPlugin
# Maven Publish Configuration
maven.publish.scm.connection=scm:git:git://github.com/HighCapable/SweetDependency.git
maven.publish.scm.developerConnection=scm:git:ssh://github.com/HighCapable/SweetDependency.git
maven.publish.scm.url=https://github.com/HighCapable/SweetDependency
SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true
# Maven POM Configuration
POM_NAME=SweetDependency
POM_ARTIFACT_ID=sweet-dependency
POM_DESCRIPTION=An easy autowire and manage dependencies Gradle plugin.
POM_URL=https://github.com/HighCapable/SweetDependency
POM_LICENSE_NAME=Apache License 2.0
POM_LICENSE_URL=https://github.com/HighCapable/SweetDependency/blob/master/LICENSE
POM_LICENSE_DIST=repo
POM_SCM_URL=https://github.com/HighCapable/SweetDependency
POM_SCM_CONNECTION=scm:git:git://github.com/HighCapable/SweetDependency.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com/HighCapable/SweetDependency.git
POM_DEVELOPER_ID=0
POM_DEVELOPER_NAME=fankes
POM_DEVELOPER_EMAIL=qzmmcn@163.com
POM_DEVELOPER_URL=https://github.com/fankes

View File

@@ -12,27 +12,27 @@ repositories:
plugins:
org.jetbrains.kotlin.jvm:
alias: kotlin-jvm
version: 1.9.10
version: 2.2.10
org.jetbrains.kotlin.plugin.serialization:
alias: kotlin-serialization
version-ref: kotlin-jvm
com.vanniktech.maven.publish:
alias: maven-publish
version: 0.25.3
version: 0.34.0
libraries:
org.jetbrains.kotlin:
kotlin-gradle-plugin-api:
version: 1.9.10
org.snakeyaml:
snakeyaml-engine:
version: 2.7
version: 2.10
com.charleskorn.kaml:
kaml:
version: 0.55.0
version: 0.92.0
com.squareup.okhttp3:
okhttp:
version: 4.11.0
version: 5.1.0
com.squareup:
javapoet:
version: 1.13.0
version: 1.13.0
net.lingala.zip4j:
zip4j:
version: 2.11.5

View File

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

View File

@@ -5,12 +5,12 @@ plugins {
android {
namespace = "com.highcapable.sweetdependency.demo_app"
compileSdk = 33
compileSdk = 34
defaultConfig {
applicationId = "com.highcapable.sweetdependency.demo_app"
minSdk = 24
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -5,11 +5,10 @@ plugins {
android {
namespace = "com.highcapable.sweetdependency.demo_library"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 24
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

View File

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

View File

@@ -8,7 +8,7 @@ pluginManagement {
plugins {
// Import the SweetDependency plugin here
// 在这里引入 SweetDependency 插件
id("com.highcapable.sweetdependency") version "1.0.0"
id("com.highcapable.sweetdependency") version "1.0.4"
}
sweetDependency {
configFileName = "sweet-dependency-config.yaml"

View File

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

View File

@@ -8,7 +8,7 @@ pluginManagement {
plugins {
// Import the SweetDependency plugin here
// 在这里引入 SweetDependency 插件
id("com.highcapable.sweetdependency") version "1.0.0"
id("com.highcapable.sweetdependency") version "1.0.4"
}
sweetDependency {
configFileName = "sweet-dependency-config.yaml"

View File

@@ -1,4 +1,3 @@
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
pluginManagement {
repositories {
gradlePluginPortal()
@@ -8,8 +7,8 @@ pluginManagement {
}
}
plugins {
id("com.highcapable.sweetdependency") version "1.0.0"
id("com.highcapable.sweetproperty") version "1.0.0"
id("com.highcapable.sweetdependency") version "1.0.4"
id("com.highcapable.sweetproperty") version "1.0.8"
}
sweetDependency {
isEnableVerboseMode = false
@@ -18,13 +17,14 @@ sweetProperty {
global {
sourcesCode {
className = rootProject.name
includeKeys(
"^project\\..*\$".toRegex(),
"^gradle\\..*\$".toRegex()
)
isEnableRestrictedAccess = true
}
}
rootProject { sourcesCode { isEnable = false } }
project("sweetdependency-gradle-plugin") {
buildScript { isEnableTypeAutoConversion = false }
}
rootProject { all { isEnable = false } }
}
rootProject.name = "SweetDependency"
include(":sweetdependency-gradle-plugin")

View File

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

View File

@@ -5,28 +5,33 @@ plugins {
autowire(libs.plugins.maven.publish)
}
allprojects {
group = property.project.groupName
version = property.project.version
}
group = property.project.groupName
version = property.project.version
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
withSourcesJar()
}
kotlin {
jvmToolchain(17)
jvmToolchain(21)
sourceSets.all { languageSettings { languageVersion = "2.0" } }
compilerOptions {
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
dependencies {
implementation(org.jetbrains.kotlin.kotlin.gradle.plugin.api)
implementation(org.snakeyaml.snakeyaml.engine)
implementation(com.charleskorn.kaml.kaml)
implementation(com.squareup.okhttp3.okhttp)
implementation(com.squareup.javapoet)
implementation(net.lingala.zip4j.zip4j)
}
gradlePlugin {
@@ -36,34 +41,4 @@ gradlePlugin {
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

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/17.
* This file is created by fankes on 2023/5/17.
*/
package com.highcapable.sweetdependency

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/18.
* This file is created by fankes on 2023/5/18.
*/
@file:Suppress("unused")

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/17.
* This file is created by fankes on 2023/5/17.
*/
package com.highcapable.sweetdependency.document
@@ -48,30 +48,43 @@ internal data class PreferencesDocument(
internal var versionFilter: VersionFilterDocument = VersionFilterDocument()
) : IYamlDocument {
/**
* 依赖命名空间文档实体
* @param plugins 插件依赖
* @param libraries 库依赖
*/
@Serializable
internal data class DependenciesNamespaceDocument(
@SerialName("plugins")
var plugins: String = "libs",
var plugins: NamespaceOptionDocument = NamespaceOptionDocument(name = "libs"),
@SerialName("libraries")
var libraries: String = ""
var libraries: NamespaceOptionDocument = NamespaceOptionDocument()
) : IYamlDocument {
init {
if (plugins.isNotBlank() && libraries.isNotBlank() && plugins == libraries)
if (plugins.name.isNotBlank() && libraries.name.isNotBlank() && plugins.name == libraries.name)
SError.make("Duplicated dependencies namespace \"$plugins\"")
}
}
/**
* 命名空间选项文档实体
* @param isEnable 是否启用
* @param name 名称
*/
@Serializable
internal data class NamespaceOptionDocument(
@SerialName("enable")
var isEnable: Boolean = true,
@SerialName("name")
var name: String = ""
) : IYamlDocument {
/**
* 获取插件依赖命名空间
* 获取名称
* @return [String]
*/
internal fun plugins() = plugins.apply { checkingName("plugins namespace", isCheckExtName = true) }.camelcase()
/**
* 获取库依赖命名空间
* @return [String]
*/
internal fun libraries() = libraries.apply { checkingName("libraries namespace", isCheckExtName = true) }.camelcase()
internal fun name() = name.apply { checkingName("dependencies namespace", isCheckExtName = true) }.camelcase()
}
/**

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/17.
* This file is created by fankes on 2023/5/17.
*/
package com.highcapable.sweetdependency.document
@@ -267,7 +267,7 @@ internal data class RepositoryDocument(
}; nodeName = name
if (url.isNotBlank() && path.isNotBlank()) SError.make("There can only be one \"url\" and \"path\" parameter of \"$name\"")
if (path.isNotBlank() && (path.startsWith("https://") || path.startsWith("http://"))) SError.make("Invalid repository path: $path")
if (url.isNotBlank() && url.startsWith("https://").not() && url.startsWith("http://").not()) SError.make("Invalid repository URL: $url")
if (url.isNotBlank() && !url.startsWith("https://") && !url.startsWith("http://")) SError.make("Invalid repository URL: $url")
if (path.isNotBlank()) path = path.parseUnixFileSeparator()
}
}

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/17.
* This file is created by fankes on 2023/5/17.
*/
@file:Suppress("MemberVisibilityCanBePrivate")
@@ -29,7 +29,6 @@ import com.highcapable.sweetdependency.document.factory.RepositoryList
import com.highcapable.sweetdependency.document.factory.checkingName
import com.highcapable.sweetdependency.document.factory.convertToDependencyAmbiguousName
import com.highcapable.sweetdependency.gradle.entity.DependencyName
import com.highcapable.sweetdependency.gradle.entity.DependencyVersion
import com.highcapable.sweetdependency.utils.capitalize
import com.highcapable.sweetdependency.utils.debug.SError
import com.highcapable.sweetdependency.utils.findDuplicates
@@ -141,30 +140,37 @@ internal data class RootConfigDocument(
* @param duplicate 允许重复 - 忽略处理后版本重复的异常 - 默认否
* @return [DependencyMap]
*/
internal fun plugins(duplicate: Boolean = false) = createPlugins().resolveDependencies(typeName = "plugin", duplicate)
internal fun plugins(duplicate: Boolean = false) = resolveDependencies(typeName = "plugin", duplicate)
/**
* 获取当前库依赖数组
* @param duplicate 允许重复 - 忽略处理后版本重复的异常 - 默认否
* @return [DependencyMap]
*/
internal fun libraries(duplicate: Boolean = false) = createLibraries().resolveDependencies(typeName = "library", duplicate)
internal fun libraries(duplicate: Boolean = false) = resolveDependencies(typeName = "library", duplicate)
/**
* 处理依赖数组
* @param typeName 依赖类型名称
* @param duplicate 允许重复 - 忽略处理后版本重复的异常 - 默认否
* @return [DependencyMap]
*/
private fun DependencyMap.resolveDependencies(typeName: String, duplicate: Boolean = false) = apply {
private fun resolveDependencies(typeName: String, duplicate: Boolean = false): DependencyMap {
val plugins = createPlugins()
val libraries = createLibraries()
val currentDependencies = when (typeName) {
"plugin" -> plugins
"library" -> libraries
else -> SError.make("Unknown dependency type \"$typeName\"")
}
val firstTypeName = typeName.capitalize()
val checkDuplicateAlias = mutableMapOf<String, String>()
val refLibraries = mutableListOf<Triple<DependencyName, String, DependencyVersion>>()
val ambiguousNames = mutableListOf<String>()
eachDependencies { dependencyName, artifact ->
currentDependencies.eachDependencies { dependencyName, artifact ->
artifact.alias.checkingName("$typeName \"$dependencyName\" alias", isCheckMultiName = true)
artifact.versions().forEach { (name, _) -> name.checkingName("$typeName \"$dependencyName\" version alias") }
if (artifact.alias.isNotBlank())
if (checkDuplicateAlias.contains(artifact.alias).not())
if (!checkDuplicateAlias.contains(artifact.alias))
checkDuplicateAlias[artifact.alias] = dependencyName.current
else SError.make(
"Duplicated alias \"${artifact.alias}\", " +
@@ -177,27 +183,46 @@ internal data class RootConfigDocument(
)
if (artifact.versionRef.isNotBlank() && artifact.versionRef.startsWith("<this>::"))
artifact.versionRef = artifact.versionRef.replace("<this>:", dependencyName.groupId)
refLibraries.add(Triple(dependencyName, artifact.alias, artifact.version()))
}
eachDependencies { dependencyName, artifact ->
currentDependencies.eachDependencies { dependencyName, artifact ->
/** 处理版本引用 */
fun resolveVersionRef() {
refLibraries.firstOrNull { artifact.versionRef.let { e -> e == it.first.current || e == it.second } }?.also {
if (dependencyName == it.first || dependencyName.current == it.second)
var scopeName = typeName
val versionRef = artifact.versionRef.replace("<plugins>::", "").replace("<libraries>::", "")
when {
artifact.versionRef.startsWith("<plugins>::") -> {
scopeName = "plugins"
plugins
}
artifact.versionRef.startsWith("<libraries>::") -> {
scopeName = "libraries"
libraries
}
else -> {
scopeName = when (typeName) {
"plugin" -> "plugins"
"library" -> "libraries"
else -> "unknown"
}; currentDependencies
}
}.filter { (dependencyName, artifact) ->
versionRef.let { it == dependencyName.current || it == artifact.alias }
}.entries.firstOrNull()?.also { (resolveDependencyName, resolveArtifact) ->
if (dependencyName == resolveDependencyName || dependencyName.current == resolveArtifact.alias)
SError.make("$firstTypeName \"$dependencyName\" declared \"version-ref\" from itself (recursive call found)")
when {
it.third.isNoSpecific -> SError.make(
"$firstTypeName \"${it.first}\" does not specify a version, so it can no longer be " +
resolveArtifact.version().isNoSpecific -> SError.make(
"$firstTypeName \"$resolveDependencyName\" does not specify a version, so it can no longer be " +
"declared as \"version-ref\" by $typeName \"$dependencyName\""
)
it.third.isBlank -> SError.make(
"$firstTypeName \"${it.first}\" already has \"version-ref\" declared, so it can no longer" +
resolveArtifact.version().isBlank -> SError.make(
"$firstTypeName \"$resolveDependencyName\" already has \"version-ref\" declared, so it can no longer" +
" be declared as \"version-ref\" by $typeName \"$dependencyName\" (recursive call found)"
)
}; artifact.updateVersion(it.third)
}; artifact.updateVersion(resolveArtifact.version())
} ?: SError.make(
"Could not found any versions or dependencies associated with " +
"version-ref \"${artifact.versionRef}\" of $typeName \"$dependencyName\""
"Could not found any versions or $scopeName associated with " +
"version-ref \"$versionRef\" of $typeName \"$dependencyName\""
)
}
if (artifact.version().isNoSpecific) return@eachDependencies
@@ -205,19 +230,20 @@ internal data class RootConfigDocument(
if (artifact.versionRef.isNotBlank())
versions()[artifact.versionRef]?.also { artifact.version = it } ?: resolveVersionRef()
else SError.make("Missing declared version when configuring $typeName \"$dependencyName\"")
else if (artifact.version().isBlank.not() && artifact.versionRef.isNotBlank() && duplicate.not())
else if (!artifact.version().isBlank && artifact.versionRef.isNotBlank() && !duplicate)
SError.make("$firstTypeName \"$dependencyName\" can only have one \"version\" or \"version-ref\" node, please delete one")
}
eachDependencies { dependencyName, artifact ->
currentDependencies.eachDependencies { dependencyName, artifact ->
ambiguousNames.add(dependencyName.ambiguousName())
if (artifact.alias.isNotBlank()) {
artifact.alias.checkingName("$typeName \"$dependencyName\" alias", isCheckMultiName = true)
ambiguousNames.add(artifact.alias.convertToDependencyAmbiguousName())
}; this[dependencyName] = artifact
}; currentDependencies[dependencyName] = artifact
}
if (ambiguousNames.hasDuplicate()) ambiguousNames.findDuplicates().forEach {
SError.make("Found ambiguous name \"$it\" in declared dependencies, please checking your $typeName aliases that your declared")
} else ambiguousNames.clear()
return currentDependencies
}
/**

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/6/9.
* This file is created by fankes on 2023/6/9.
*/
package com.highcapable.sweetdependency.document
@@ -64,7 +64,7 @@ internal data class VersionFilterDocument(
* 当前是否不存在排除列表
* @return [Boolean]
*/
internal fun isNotEmpty() = isEmpty().not()
internal fun isNotEmpty() = !isEmpty()
/**
* 依赖于当前 [version] 提供的版本并在 [all] 中排除 (不区分大小写)
@@ -74,7 +74,7 @@ internal data class VersionFilterDocument(
* @return [ExclusionList]
*/
internal fun depends(version: DependencyVersion) = clone().apply {
if (version.isAutowire.not() && version.isBlank.not()) all().removeAll { version.deployed.lowercase().contains(it.lowercase()) }
if (!version.isAutowire && !version.isBlank) all().removeAll { version.deployed.lowercase().contains(it.lowercase()) }
}
/**

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/31.
* This file is created by fankes on 2023/5/31.
*/
package com.highcapable.sweetdependency.document.factory

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/6/1.
* This file is created by fankes on 2023/6/1.
*/
package com.highcapable.sweetdependency.document.mapping
@@ -158,12 +158,12 @@ internal class RootConfigDocumentMapping internal constructor(private val config
}
}
pluginsContents.onEachIndexed { index, content ->
if ((content.trim().startsWith(VERSION_NODE_CONTENT) && content.startsWith(SPACE_OF_4)).not()) return@onEachIndexed
if (!(content.trim().startsWith(VERSION_NODE_CONTENT) && content.startsWith(SPACE_OF_4))) return@onEachIndexed
pluginsMapping[pluginsLine].versionLine = index + pluginsStartLine
pluginsLine++
}.clear()
librariesContents.onEachIndexed { index, content ->
if ((content.trim().startsWith(VERSION_NODE_CONTENT) && content.startsWith(SPACE_OF_6)).not()) return@onEachIndexed
if (!(content.trim().startsWith(VERSION_NODE_CONTENT) && content.startsWith(SPACE_OF_6))) return@onEachIndexed
librariesMapping[librariesLine].versionLine = index + librariesStartLine
librariesLine++
}.clear()

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/6/1.
* This file is created by fankes on 2023/6/1.
*/
package com.highcapable.sweetdependency.document.mapping.entity

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/6/28.
* This file is created by fankes on 2023/6/28.
*/
package com.highcapable.sweetdependency.environment
@@ -42,13 +42,13 @@ internal object Environment {
* 获取 [SweetDependency] 缓存存放目录
* @return [File]
*/
private val memoryDir get() = "${GradleHelper.rootDir.absolutePath}/$MEMORY_DIR_PATH".toFile().also { if (it.exists().not()) it.mkdirs() }
private val memoryDir get() = "${GradleHelper.rootDir.absolutePath}/$MEMORY_DIR_PATH".toFile().also { if (!it.exists()) it.mkdirs() }
/**
* 获取 [SweetDependency] 功能存放目录
* @return [File]
*/
private val resourcesDir get() = "${GradleHelper.rootDir.absolutePath}/$RESOURCES_DIR_PATH".toFile().also { if (it.exists().not()) it.mkdirs() }
private val resourcesDir get() = "${GradleHelper.rootDir.absolutePath}/$RESOURCES_DIR_PATH".toFile().also { if (!it.exists()) it.mkdirs() }
/**
* 获取系统信息

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/31.
* This file is created by fankes on 2023/5/31.
*/
package com.highcapable.sweetdependency.exception

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/26.
* This file is created by fankes on 2023/5/26.
*/
package com.highcapable.sweetdependency.gradle.delegate
@@ -47,10 +47,10 @@ internal object GradleDelegate {
callOnSettingsLoaded(settings)
settings.gradle.settingsEvaluated { callOnSettingsEvaluate(settings = this) }
settings.gradle.projectsLoaded {
callOnProjectLoaded(rootProject, isRoot = true)
rootProject.beforeEvaluate { callOnProjectLoaded(project = this, isRoot = true) }
rootProject.afterEvaluate { callOnProjectEvaluate(project = this, isRoot = true) }
rootProject.subprojects.forEach {
callOnProjectLoaded(it, isRoot = false)
it.beforeEvaluate { callOnProjectLoaded(project = this, isRoot = false) }
it.afterEvaluate { callOnProjectEvaluate(project = this, isRoot = false) }
}
}

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/29.
* This file is created by fankes on 2023/5/29.
*/
package com.highcapable.sweetdependency.gradle.delegate

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/6/25.
* This file is created by fankes on 2023/6/25.
*/
@file:Suppress("USELESS_ELVIS", "KotlinRedundantDiagnosticSuppress")
@@ -51,7 +51,7 @@ internal open class ExternalDependencyDelegate internal constructor(
override fun getVersion(): String {
val notation = spliceToDependencyNotation(groupId, artifactId)
if (version == DependencyVersion.AUTOWIRE_VERSION_NAME && GradleTaskManager.isInternalRunningTask.not()) SError.make(
if (version == DependencyVersion.AUTOWIRE_VERSION_NAME && !GradleTaskManager.isInternalRunningTask) SError.make(
"""
This library "$notation" is not autowired and cannot be deployed
You can try the following solutions to resolve this problem:

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/8/16.
* This file is created by fankes on 2023/8/16.
*/
@file:Suppress("unused", "MemberVisibilityCanBePrivate")

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/8/18.
* This file is created by fankes on 2023/8/18.
*/
package com.highcapable.sweetdependency.gradle.entity

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/6/16.
* This file is created by fankes on 2023/6/16.
*/
@file:Suppress("MemberVisibilityCanBePrivate")
@@ -54,7 +54,7 @@ internal class DependencyVersion(internal var actual: String, optionalType: Opti
if (current.startsWith("<") && current.endsWith(">"))
if (current != NO_SPECIFIC_VERSION_NAME && current != LATEST_VERSION_NAME)
SError.make("The parameter \"$current\" is not recognized as any available function")
if (isOptional.not()) when (optionalType) {
if (!isOptional) when (optionalType) {
OptionalUpdateType.NONE -> {}
OptionalUpdateType.NORMAL -> actual = "$OPTIONAL_VERSION_NORMAL_PREFIX$actual"
OptionalUpdateType.PERMANENT -> actual = "$OPTIONAL_VERSION_PERMANENT_PREFIX$actual"
@@ -78,13 +78,31 @@ internal class DependencyVersion(internal var actual: String, optionalType: Opti
else -> current
}
/**
* 获取固定存在的版本
*
* 满足以下情况
*
* - [isBlank]
* - [isNoSpecific]
*
* 这些情况都会返回 [AUTOWIRE_VERSION_NAME]
*
* 其余情况会返回 [current]
* @return [String]
*/
internal val fixed get() = when {
isBlank || isNoSpecific -> AUTOWIRE_VERSION_NAME
else -> current
}
/**
* 获取部署版本
*
* 如果为 [isNoSpecific] 则会返回空
* @return [String]
*/
internal val deployed get() = current.takeIf { isNoSpecific.not() } ?: ""
internal val deployed get() = current.takeIf { !isNoSpecific } ?: ""
/**
* 获取存在版本

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/6/23.
* This file is created by fankes on 2023/6/23.
*/
package com.highcapable.sweetdependency.gradle.entity

View File

@@ -1,6 +1,6 @@
/*
* SweetDependency - An easy autowire and manage dependencies Gradle plugin
* Copyright (C) 2019-2023 HighCapable
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
* Copyright (C) 2019 HighCapable
* https://github.com/HighCapable/SweetDependency
*
* Apache License Version 2.0
@@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is Created by fankes on 2023/5/27.
* This file is created by fankes on 2023/5/27.
*/
@file:Suppress("unused", "USELESS_CAST", "KotlinRedundantDiagnosticSuppress")
@@ -38,7 +38,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() ?: SError.make("Create or get extension failed with name \"$sName\"")
}
}
@@ -51,7 +51,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() ?: SError.make("Create or get extension failed with name \"$sName\"")
}
}

Some files were not shown because too many files have changed in this diff Show More