mirror of
https://github.com/HighCapable/SweetDependency.git
synced 2025-09-04 01:35:46 +08:00
Compare commits
60 Commits
Author | SHA1 | Date | |
---|---|---|---|
16f8422424
|
|||
df85b8b8eb
|
|||
b4b3511c16
|
|||
040f619413
|
|||
46786f765b
|
|||
47055fd724
|
|||
1292f727dc
|
|||
bfb97905cc
|
|||
fd44cdff0f
|
|||
cd984201dc
|
|||
967e24889d
|
|||
12ff773c54
|
|||
5b353269ab
|
|||
a317610884
|
|||
36cc89a0ea
|
|||
38a93760b7
|
|||
2cbf00e997
|
|||
b93bca20dd
|
|||
2c58843942
|
|||
e24fe8d9cb
|
|||
7635ded918
|
|||
8528873fad
|
|||
e6286d4fd0
|
|||
eb5aeb4449
|
|||
258f559a9c
|
|||
69da68e1e2
|
|||
6cc079bcb1
|
|||
005c1b173f
|
|||
982e574e35
|
|||
4452afa408
|
|||
4e01ddacc3
|
|||
0ea6807231
|
|||
6834ea84da
|
|||
72d6263eaf
|
|||
47a59ae8c7
|
|||
c6d6de94d6
|
|||
a0279171d2
|
|||
e5229e8cb0
|
|||
bce37d80bf
|
|||
12713006a5
|
|||
845cc2c6d7
|
|||
c525a720f2
|
|||
10e3915197
|
|||
70aa40a5b1
|
|||
86e06bab69
|
|||
f0331ffee7
|
|||
6ff5801cb7
|
|||
d697a59c26
|
|||
d896554421
|
|||
68dfdbf648
|
|||
2f47d72904
|
|||
9b1b1050cf
|
|||
49a9a70df3
|
|||
3304a1afef
|
|||
111312463e
|
|||
6963f1ca36
|
|||
609cbe644d
|
|||
5d3642c1a3
|
|||
7071951aa5
|
|||
5dd68af7b5
|
@@ -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
117
.gitignore
vendored
@@ -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
10
.idea/.gitignore
generated
vendored
@@ -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
6
.idea/AndroidProjectSystem.xml
generated
Normal 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
12
.idea/compiler.xml
generated
@@ -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>
|
1
.idea/inspectionProfiles/Project_Default.xml
generated
1
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -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">
|
||||
|
20
.idea/jarRepositories.xml
generated
20
.idea/jarRepositories.xml
generated
@@ -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
2
.idea/kotlinc.xml
generated
@@ -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
7
.idea/ktlint-plugin.xml
generated
Normal 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
6
.idea/markdown.xml
generated
Normal 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
124
.idea/uiDesigner.xml
generated
@@ -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>
|
@@ -1,14 +1,20 @@
|
||||
# Sweet Dependency
|
||||
|
||||
[](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
|
||||
[](https://github.com/HighCapable/SweetDependency/releases)
|
||||
[](https://t.me/HighCapable_Dev)
|
||||
[](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
|
||||
[](https://github.com/HighCapable/SweetDependency/releases)
|
||||
[](https://t.me/HighCapable_Dev)
|
||||
[](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,11 +70,14 @@
|
||||
|
||||
本项目同样使用了 **SweetProperty**。
|
||||
|
||||
## 捐赠支持
|
||||
|
||||
工作不易,无意外情况此项目将继续维护下去,提供更多可能,欢迎打赏。
|
||||
|
||||
<img src="https://github.com/fankes/fankes/blob/main/img-src/payment_code.jpg?raw=true" width = "500" alt="Payment Code"/>
|
||||
<!--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
|
||||
|
||||
@@ -81,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.
|
||||
@@ -96,4 +105,4 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
```
|
||||
|
||||
版权所有 © 2019-2023 HighCapable
|
||||
版权所有 © 2019 HighCapable
|
33
README.md
33
README.md
@@ -1,14 +1,20 @@
|
||||
# Sweet Dependency
|
||||
|
||||
[](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
|
||||
[](https://github.com/HighCapable/SweetDependency/releases)
|
||||
[](https://t.me/HighCapable_Dev)
|
||||
[](https://github.com/HighCapable/SweetDependency/blob/master/LICENSE)
|
||||
[](https://github.com/HighCapable/SweetDependency/releases)
|
||||
[](https://t.me/HighCapable_Dev)
|
||||
[](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
|
||||
|
||||

|
||||
@@ -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
|
@@ -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
|
||||
}
|
@@ -19,4 +19,17 @@
|
||||
- 修复 Gradle 生命周期问题,可能导致 `autowire` 方法的项目作用域不正确
|
||||
- 改进并采用 Gradle 项目命名规范
|
||||
- 新增依赖命名空间可启用或禁用生成功能,更新后需要参考文档自行迁移部分配置文件的节点名称否则会发生错误
|
||||
- 新增使用 `<plugins>::` 或 `<libraries>::` 可以访问其它节点的依赖名称、别名并设置到 `version-ref` 功能
|
||||
- 新增使用 `<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` 选项,默认不启用,你可以启用此选项来在自动装配时输出详细的依赖搜索信息
|
||||
- 一些其它功能性的改进
|
@@ -22,4 +22,18 @@
|
||||
- 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`
|
||||
- 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
|
@@ -31,6 +31,9 @@
|
||||
|
||||
如果你的项目依然在使用 `buildscript` 的方式进行管理,请迁移到新方式,否则会发生错误。
|
||||
|
||||
如果你的项目不能使用 `dependencyResolutionManagement` 进行管理,你可以参考此页面最下方的 [自定义选项](#自定义选项)
|
||||
通过配置 `isUseDependencyResolutionManagement = false` 来使用传统的库依赖管理方式。
|
||||
|
||||
## 快速开始
|
||||
|
||||
首先,打开你根项目的 `settings.gradle` 或 `settings.gradle.kts`。
|
||||
@@ -80,12 +83,6 @@ plugins {
|
||||
|
||||
上述配置完成后,运行一次 Gradle Sync。
|
||||
|
||||
**可能遇到的问题**
|
||||
|
||||
如果在运行 Gradle Sync 后失败并报错 `Cannot have abstract method KotlinTarget. withSourcesJar()`,这可能是你当前项目的 Kotlin 插件版本的问题。
|
||||
|
||||
此问题为 Kotlin 插件从 `1.8.0+` → `1.9.0+` 升级导致的错误,解决方案为将 Kotlin 插件的版本修改为 `1.9.0+`。
|
||||
|
||||
**特别注意**
|
||||
|
||||
`SweetDependency` 会替换 `pluginManagement` 和 `dependencyResolutionManagement` 中设置的存储库,如果你手动在这些方法块中配置了存储库,它们都将会无效。
|
||||
@@ -815,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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1150,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
|
||||
@@ -1168,7 +1176,9 @@ sweetDependency {
|
||||
```groovy
|
||||
sweetDependency {
|
||||
enable true
|
||||
debug false
|
||||
configFileName 'sweet-dependency-config.yaml'
|
||||
useDependencyResolutionManagement true
|
||||
enableDependenciesAutowireLog true
|
||||
enableVerboseMode true
|
||||
}
|
||||
|
@@ -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.
|
||||
@@ -81,15 +85,6 @@ Please replace `<version>` in the above code with the latest version in
|
||||
|
||||
After the above configuration is complete, run Gradle Sync once.
|
||||
|
||||
**Possible Problems**
|
||||
|
||||
If running Gradle Sync fails with the error `Cannot have abstract method KotlinTarget. withSourcesJar()`,
|
||||
this may be a problem with the Kotlin plugin version of your current project.
|
||||
|
||||
This problem is an error caused by upgrading the Kotlin plugin from `1.8.0+` → `1.9.0+`.
|
||||
|
||||
The solution is to modify the version of the Kotlin plugin to `1.9.0+`.
|
||||
|
||||
**Pay Attention**
|
||||
|
||||
`SweetDependency` will replace the repositories set in `pluginManagement` and `dependencyResolutionManagement`,
|
||||
@@ -872,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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1223,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
|
||||
@@ -1242,7 +1250,9 @@ sweetDependency {
|
||||
```groovy
|
||||
sweetDependency {
|
||||
enable true
|
||||
debug false
|
||||
configFileName 'sweet-dependency-config.yaml'
|
||||
useDependencyResolutionManagement true
|
||||
enableDependenciesAutowireLog true
|
||||
enableVerboseMode true
|
||||
}
|
||||
|
@@ -1,19 +1,27 @@
|
||||
# Project Configuration
|
||||
project.name=SweetDependency
|
||||
project.description=An easy autowire and manage dependencies Gradle plugin.
|
||||
project.url=https://github.com/HighCapable/SweetDependency
|
||||
project.groupName=com.highcapable.sweetdependency
|
||||
project.moduleName=sweet-dependency
|
||||
project.version=1.0.2
|
||||
project.licence.name=Apache License 2.0
|
||||
project.licence.url=https://github.com/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
|
@@ -12,27 +12,24 @@ 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
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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
|
@@ -8,7 +8,7 @@ pluginManagement {
|
||||
plugins {
|
||||
// Import the SweetDependency plugin here
|
||||
// 在这里引入 SweetDependency 插件
|
||||
id("com.highcapable.sweetdependency") version "1.0.1"
|
||||
id("com.highcapable.sweetdependency") version "1.0.4"
|
||||
}
|
||||
sweetDependency {
|
||||
configFileName = "sweet-dependency-config.yaml"
|
||||
|
@@ -8,7 +8,7 @@ pluginManagement {
|
||||
plugins {
|
||||
// Import the SweetDependency plugin here
|
||||
// 在这里引入 SweetDependency 插件
|
||||
id("com.highcapable.sweetdependency") version "1.0.1"
|
||||
id("com.highcapable.sweetdependency") version "1.0.4"
|
||||
}
|
||||
sweetDependency {
|
||||
configFileName = "sweet-dependency-config.yaml"
|
||||
|
@@ -7,8 +7,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
|
||||
@@ -17,6 +17,10 @@ sweetProperty {
|
||||
global {
|
||||
sourcesCode {
|
||||
className = rootProject.name
|
||||
includeKeys(
|
||||
"^project\\..*\$".toRegex(),
|
||||
"^gradle\\..*\$".toRegex()
|
||||
)
|
||||
isEnableRestrictedAccess = true
|
||||
}
|
||||
}
|
||||
|
2
sweetdependency-gradle-plugin/.gitignore
vendored
2
sweetdependency-gradle-plugin/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
.gradle
|
||||
build/
|
@@ -5,24 +5,28 @@ 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)
|
||||
@@ -37,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()
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -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()
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -170,7 +170,7 @@ internal data class RootConfigDocument(
|
||||
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}\", " +
|
||||
@@ -230,7 +230,7 @@ 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")
|
||||
}
|
||||
currentDependencies.eachDependencies { dependencyName, artifact ->
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -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()) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -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()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -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() }
|
||||
|
||||
/**
|
||||
* 获取系统信息
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -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:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -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"
|
||||
@@ -102,7 +102,7 @@ internal class DependencyVersion(internal var actual: String, optionalType: Opti
|
||||
* 如果为 [isNoSpecific] 则会返回空
|
||||
* @return [String]
|
||||
*/
|
||||
internal val deployed get() = current.takeIf { isNoSpecific.not() } ?: ""
|
||||
internal val deployed get() = current.takeIf { !isNoSpecific } ?: ""
|
||||
|
||||
/**
|
||||
* 获取存在版本
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -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\"")
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -64,7 +64,7 @@ internal fun Project.fullName(isUseColon: Boolean = true): String {
|
||||
project.parent?.also { if (it != it.rootProject) fetchChild(it) }
|
||||
baseNames.add(project.name)
|
||||
}; fetchChild(project = this)
|
||||
return buildString { baseNames.onEach { append(":$it") }.clear() }.let { if (isUseColon && isRoot.not()) it else it.drop(1) }
|
||||
return buildString { baseNames.onEach { append(":$it") }.clear() }.let { if (isUseColon && !isRoot) it else it.drop(1) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ internal fun Project.libraries(isUseCache: Boolean = true) =
|
||||
* @return [Boolean]
|
||||
*/
|
||||
fun Dependency.checkingValid() = when (this) {
|
||||
is ExternalDependency -> group.isNullOrBlank().not() && name.isNullOrBlank().not()
|
||||
is ExternalDependency -> !group.isNullOrBlank() && !name.isNullOrBlank()
|
||||
is FileCollectionDependency -> runCatching { files.files.isNotEmpty() }.getOrNull() ?: false
|
||||
else -> true
|
||||
}
|
||||
@@ -144,7 +144,7 @@ internal fun Project.waitForPluginAdded(id: String, action: (Plugin<*>) -> Unit)
|
||||
*/
|
||||
internal inline fun <reified T : BaseTask> Project.createTask(group: String, name: String) = runCatching {
|
||||
T::class.java.getConstructor().newInstance().also { instance ->
|
||||
task(name) {
|
||||
tasks.register(name) {
|
||||
this.group = group
|
||||
outputs.upToDateWhen { false }
|
||||
doFirst { instance.onTransaction() }
|
||||
@@ -186,5 +186,5 @@ internal fun PluginDependenciesSpec.applyPlugin(alias: Any) = when (alias) {
|
||||
private fun PluginManager.findPluginId(plugin: Plugin<*>) = runCatching {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val pluginIds = (this as PluginManagerInternal).findPluginIdForClass(GeneratedSubclasses.unpackType(plugin) as Class<Plugin<*>>)
|
||||
if (pluginIds.isEmpty.not()) pluginIds.get() else null
|
||||
if (!pluginIds.isEmpty) pluginIds.get() else null
|
||||
}.getOrNull()?.id ?: ""
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -68,6 +68,7 @@ internal data class LibraryDependencyWrapper internal constructor(private val in
|
||||
* - [type] 需要为 [LibraryDependencyType.PROJECT] 否则始终为 null
|
||||
* @return [Project] or null
|
||||
*/
|
||||
// FIXME: https://stackoverflow.com/questions/79619019/how-replace-deprecated-getdependencyproject-in-a-backwards-compatible-way
|
||||
val project get() = runCatching { (instance as? ProjectDependency?)?.dependencyProject }.getOrNull()
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -92,11 +92,12 @@ internal object DependencyManager {
|
||||
*/
|
||||
internal fun deploy(rootProject: Project) {
|
||||
/**
|
||||
* 为 Groovy 创建扩展方法
|
||||
* 为自动装配创建扩展方法
|
||||
* @param extension 当前扩展实例
|
||||
* @param isGroovyOnly 是否仅为 Groovy 创建 - 默认是
|
||||
*/
|
||||
fun Project.deployForGroovy(extension: ExtensionAware) {
|
||||
if (buildFile.name.endsWith(".gradle"))
|
||||
fun Project.deployAutowire(extension: ExtensionAware, isGroovyOnly: Boolean = true) {
|
||||
if (!isGroovyOnly || buildFile.name.endsWith(".gradle"))
|
||||
extension.getOrCreate<SweetDependencyAutowireExtension>(SweetDependencyAutowireExtension.NAME, this)
|
||||
}
|
||||
|
||||
@@ -110,14 +111,14 @@ internal object DependencyManager {
|
||||
fun Project.deployForKotlinMultiplatform() =
|
||||
waitForPluginAdded("org.jetbrains.kotlin.multiplatform") {
|
||||
get("kotlin").also { extension ->
|
||||
deployForGroovy(extension)
|
||||
deployAutowire(extension, isGroovyOnly = false)
|
||||
deployEach(extension)
|
||||
}
|
||||
}
|
||||
|
||||
/** 部署到当前项目 */
|
||||
fun Project.deploy() {
|
||||
deployForGroovy(dependencies)
|
||||
deployAutowire(dependencies)
|
||||
deployEach(dependencies)
|
||||
deployForKotlinMultiplatform()
|
||||
}
|
||||
@@ -161,7 +162,7 @@ internal object DependencyManager {
|
||||
var updLbrariesCount = 0
|
||||
val needUpdateDependencies = mutableMapOf<String, Pair<DependencyName, DependencyVersion>>()
|
||||
findByType { _, artifact ->
|
||||
artifact.version().isNoSpecific.not() && (artifact.versionRef.isBlank() &&
|
||||
!artifact.version().isNoSpecific && (artifact.versionRef.isBlank() &&
|
||||
((updateMode.updateType == DependencyUpdateMode.UpdateType.UPDATE_ALL ||
|
||||
(updateMode.updateType == DependencyUpdateMode.UpdateType.UPDATE_OPTIONAL &&
|
||||
(artifact.version().isOptional || artifact.version().isAutowire)) ||
|
||||
@@ -212,7 +213,7 @@ internal object DependencyManager {
|
||||
if (SweetDependencyConfigs.configs.isEnableDependenciesAutowireLog)
|
||||
logIfNeeded(msg = "Autowiring logs have been automatically written to: ${DependencyAutowireLogHelper.logFile}", SLog.LINK)
|
||||
SweetDependencyConfigs.documentMapping.updateDependencies(needUpdateDependencies)
|
||||
if (isRunningOnSync.not()) SLog.warn(
|
||||
if (!isRunningOnSync) SLog.warn(
|
||||
"""
|
||||
**************************** NOTICE ****************************
|
||||
${needUpdateDependencies.size} dependencies (plugins: $updPluginsCount, libraries: $updLbrariesCount) has been changed
|
||||
@@ -252,7 +253,19 @@ internal object DependencyManager {
|
||||
forEachIndexed { index, entry ->
|
||||
val currentVersionFilterExclusionList = versionFilterExclusionList.depends(currentVersion)
|
||||
val availableVersions = mutableListOf<DependencyVersion>()
|
||||
poms.add(MavenParser.acquire(dependencyName, entry, currentVersion))
|
||||
poms.add(MavenParser.acquire(dependencyName, entry, currentVersion).also {
|
||||
if (!SweetDependencyConfigs.configs.isDebug) return@also
|
||||
val isNotFound = it.versions.isEmpty()
|
||||
logDoneOrWarn("$positionTagName > OBTAIN (${index + 1}/$size) ${dependencyName.description}", isNotFound)
|
||||
logDoneOrWarn(
|
||||
"""
|
||||
- Repository (${entry.nodeName}): ${it.url}
|
||||
- Last Updated: ${it.lastUpdated}
|
||||
- Versions: ${it.versions}
|
||||
- Adopted Versions: ${currentVersionFilterExclusionList.filter(it.versions)}
|
||||
""".trimIndent(), isNotFound, noTag = true
|
||||
)
|
||||
})
|
||||
if (index == lastIndex) poms.noEmpty()
|
||||
?.sortedByDescending { it.lastUpdated }
|
||||
?.let { if (it.all { e -> e.lastUpdated <= 0L }) it.sortedByDescending { e -> e.versions.size } else it }
|
||||
@@ -315,9 +328,9 @@ internal object DependencyManager {
|
||||
isAutoUpdate: Boolean,
|
||||
result: (newVersion: DependencyVersion) -> Unit
|
||||
) = when {
|
||||
currentVersion.isAutowire.not() && versions.contains(currentVersion).not() ->
|
||||
!currentVersion.isAutowire && !versions.contains(currentVersion) ->
|
||||
SLog.warn("$positionTagName > MISSING ${dependencyName.description} version $currentVersion, available are $versions")
|
||||
currentVersion.isAutowire.not() && alternateVersions.isNotEmpty() && alternateVersions.all { versions.contains(it) }.not() ->
|
||||
!currentVersion.isAutowire && alternateVersions.isNotEmpty() && !alternateVersions.all { versions.contains(it) } ->
|
||||
SLog.warn("$positionTagName > MISSING ${dependencyName.description} version alias $alternateVersions, available are $versions")
|
||||
latestVersion != currentVersion -> when {
|
||||
currentVersion.isAutowire -> {
|
||||
@@ -332,4 +345,13 @@ internal object DependencyManager {
|
||||
}
|
||||
else -> SLog.info("$positionTagName > UP-TO-DATE ${dependencyName.description} version $currentVersion", SLog.DONE)
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印完成或警告 Log
|
||||
* @param msg 消息内容
|
||||
* @param isWarn 是否为警告模式 - 默认否
|
||||
* @param noTag 无标签 - 默认否
|
||||
*/
|
||||
private fun logDoneOrWarn(msg: String, isWarn: Boolean = false, noTag: Boolean = false) =
|
||||
if (isWarn) SLog.warn(msg, noTag = noTag) else SLog.info(msg, SLog.DONE, noTag = noTag)
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -23,6 +23,7 @@ package com.highcapable.sweetdependency.manager
|
||||
|
||||
import com.highcapable.sweetdependency.document.PreferencesDocument
|
||||
import com.highcapable.sweetdependency.document.RepositoryDocument
|
||||
import com.highcapable.sweetdependency.document.factory.RepositoryList
|
||||
import com.highcapable.sweetdependency.exception.SweetDependencyUnresolvedException
|
||||
import com.highcapable.sweetdependency.gradle.helper.GradleHelper
|
||||
import com.highcapable.sweetdependency.manager.const.AdditionalRepositories
|
||||
@@ -33,6 +34,7 @@ import com.highcapable.sweetdependency.utils.debug.SLog
|
||||
import com.highcapable.sweetdependency.utils.noBlank
|
||||
import com.highcapable.sweetdependency.utils.noEmpty
|
||||
import com.highcapable.sweetdependency.utils.toFile
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.dsl.RepositoryHandler
|
||||
import org.gradle.api.artifacts.repositories.ArtifactRepository
|
||||
import org.gradle.api.artifacts.repositories.AuthenticationSupported
|
||||
@@ -46,32 +48,27 @@ import org.gradle.api.initialization.resolve.RepositoriesMode as GradleRepositor
|
||||
*/
|
||||
internal object RepositoryManager {
|
||||
|
||||
/** 当前存储库数组 */
|
||||
private var repositories: RepositoryList = mutableListOf()
|
||||
|
||||
/**
|
||||
* 当前是否使用 [Settings.dependencyResolutionManagement] 管理库依赖
|
||||
* @return [Boolean]
|
||||
*/
|
||||
private val isUseDependencyResolutionManagement get() = SweetDependencyConfigs.configs.isUseDependencyResolutionManagement
|
||||
|
||||
/**
|
||||
* 生成并应用存储库数组
|
||||
* @param settings 当前设置
|
||||
*/
|
||||
internal fun generateAndApply(settings: Settings) {
|
||||
val repositories = SweetDependencyConfigs.document.repositories()
|
||||
repositories = SweetDependencyConfigs.document.repositories()
|
||||
Repositories.generate(repositories)
|
||||
/**
|
||||
* 应用存储库数组到 Gradle
|
||||
* @param isPlugins 当前应用类型是否为插件依赖
|
||||
*/
|
||||
fun RepositoryHandler.apply(isPlugins: Boolean) = repositories.forEach {
|
||||
if (it.isIncludeScope(isPlugins)) when (it.nodeType) {
|
||||
RepositoryDocument.RepositoryType.GOOGLE -> google { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.MAVEN_CENTRAL -> mavenCentral { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.MAVEN_LOCAL -> mavenLocal { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.MAVEN -> maven { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.GRADLE_PLUGIN_PORTAL -> gradlePluginPortal { applyToArtifact(it) }
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
settings.pluginManagement {
|
||||
this.repositories.clear()
|
||||
this.repositories.apply(isPlugins = true)
|
||||
}
|
||||
settings.dependencyResolutionManagement {
|
||||
if (isUseDependencyResolutionManagement) settings.dependencyResolutionManagement {
|
||||
this.repositoriesMode.set(when (SweetDependencyConfigs.document.preferences().repositoriesMode) {
|
||||
PreferencesDocument.RepositoriesMode.PREFER_PROJECT -> GradleRepositoriesMode.PREFER_PROJECT
|
||||
PreferencesDocument.RepositoriesMode.PREFER_SETTINGS -> GradleRepositoriesMode.PREFER_SETTINGS
|
||||
@@ -82,6 +79,33 @@ internal object RepositoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用存储库数组
|
||||
* @param rootProject 当前根项目
|
||||
*/
|
||||
internal fun apply(rootProject: Project) {
|
||||
if (!isUseDependencyResolutionManagement)
|
||||
rootProject.allprojects {
|
||||
this.repositories.clear()
|
||||
this.repositories.apply(isPlugins = false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用存储库数组到 Gradle
|
||||
* @param isPlugins 当前应用类型是否为插件依赖
|
||||
*/
|
||||
private fun RepositoryHandler.apply(isPlugins: Boolean) = repositories.forEach {
|
||||
if (it.isIncludeScope(isPlugins)) when (it.nodeType) {
|
||||
RepositoryDocument.RepositoryType.GOOGLE -> google { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.MAVEN_CENTRAL -> mavenCentral { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.MAVEN_LOCAL -> mavenLocal { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.MAVEN -> maven { applyToArtifact(it) }
|
||||
RepositoryDocument.RepositoryType.GRADLE_PLUGIN_PORTAL -> gradlePluginPortal { applyToArtifact(it) }
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用存储库到 [ArtifactRepository]
|
||||
* @param document 存储库配置项文档实体
|
||||
@@ -90,7 +114,7 @@ internal object RepositoryManager {
|
||||
document.nodeName.noBlank()?.also { docName -> this.name = docName }
|
||||
if (this is AuthenticationSupported && document.credentials.let { it.username.isNotBlank() || it.password.isNotBlank() })
|
||||
credentials { this.username = document.credentials.username; this.password = document.credentials.password }
|
||||
if (document.content.isEmpty().not()) content {
|
||||
if (!document.content.isEmpty()) content {
|
||||
/**
|
||||
* 使用 ":" 分割字符串
|
||||
* @param size 期望的个数
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -85,7 +85,7 @@ internal object Dependencies {
|
||||
* 当前是否不存在依赖
|
||||
* @return [Boolean]
|
||||
*/
|
||||
internal fun isNotEmpty() = isEmpty().not()
|
||||
internal fun isNotEmpty() = !isEmpty()
|
||||
|
||||
/**
|
||||
* 查找是否存在指定的依赖
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -59,7 +59,7 @@ internal object Repositories {
|
||||
* 当前是否不存在存储库
|
||||
* @return [Boolean]
|
||||
*/
|
||||
internal fun isNotEmpty() = isEmpty().not()
|
||||
internal fun isNotEmpty() = !isEmpty()
|
||||
|
||||
/**
|
||||
* 生成存储库数组
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -50,7 +50,7 @@ internal object DependencyAutowireLogHelper {
|
||||
* @param toVersion 最终版本
|
||||
*/
|
||||
internal fun record(dependencyName: DependencyName, fromVersion: DependencyVersion, toVersion: DependencyVersion) {
|
||||
if (SweetDependencyConfigs.configs.isEnableDependenciesAutowireLog.not()) return
|
||||
if (!SweetDependencyConfigs.configs.isEnableDependenciesAutowireLog) return
|
||||
val versionInfo = if (fromVersion.isAutowire)
|
||||
"autowire version \"$toVersion\""
|
||||
else "update version \"$fromVersion\" -> \"$toVersion\""
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -141,7 +141,7 @@ internal object DependencyDeployHelper {
|
||||
*/
|
||||
internal fun resolveAccessors(rootProject: Project) {
|
||||
val librariesOption = SweetDependencyConfigs.document.preferences().dependenciesNamespace.libraries
|
||||
if (librariesOption.isEnable.not()) {
|
||||
if (!librariesOption.isEnable) {
|
||||
accessorsPomData.relativePomPath.toFile().takeIf { it.exists() }?.deleteRecursively()
|
||||
accessorsGenerator.clearGeneratedData()
|
||||
return
|
||||
@@ -198,7 +198,7 @@ internal object DependencyDeployHelper {
|
||||
*/
|
||||
internal fun resolveAutowire(project: Project = ProjectTransaction.current, params: Array<out String>): Any {
|
||||
if (params.isEmpty()) SError.make("The autowire function need a param to resolve library")
|
||||
return if (params[0].let { it.contains("/").not() && it.contains("\\").not() && it.startsWith("(").not() && it.endsWith(")").not() }) {
|
||||
return if (params[0].let { !it.contains("/") && !it.contains("\\") && !it.startsWith("(") && !it.endsWith(")") }) {
|
||||
if (params.size > 2) SError.make("The autowire function currently does not support more than 2 params of external dependency")
|
||||
val entry = Dependencies.findLibraries { key, value -> params[0] == key.current || params[0] == value.alias }.single()
|
||||
?: SError.make("Failed to resolve library \"${params[0]}\", also tried alias")
|
||||
@@ -210,7 +210,7 @@ internal object DependencyDeployHelper {
|
||||
params.forEach { param ->
|
||||
val relativePath = if (param.startsWith("(") && param.endsWith(")")) param.replace("(", "").replace(")", "") else param
|
||||
it.addAll(relativePath.toAbsoluteFilePaths(project.projectDir.absolutePath).onEach { path ->
|
||||
if (path.toFile().isValidZip().not()) SError.make(
|
||||
if (!path.toFile().isValidZip()) SError.make(
|
||||
"""
|
||||
Invalid library at file path $path
|
||||
The file collection dependency needs to be a valid zip package
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -57,26 +57,32 @@ internal object MavenParser {
|
||||
val isIncludeScope = repo.isIncludeScope(dependencyName.type == DependencyName.Type.PLUGIN)
|
||||
/** 离线模式下不会自动装配、更新在线依赖 */
|
||||
if (isIncludeScope && GradleHelper.isOfflineMode) return MavenMetadata()
|
||||
var currentUrl: String
|
||||
return when {
|
||||
repo.url.isNotBlank() -> "$headerUrlOrPath$METADATA_FILE_NAME".executeUrlBody(repo.credentials.username, repo.credentials.password)
|
||||
repo.path.isNotBlank() -> "$headerUrlOrPath$METADATA_LOCAL_FILE_NAME".executeFileBody()
|
||||
repo.url.isNotBlank() -> "$headerUrlOrPath$METADATA_FILE_NAME"
|
||||
.apply { currentUrl = this }
|
||||
.executeUrlBody(repo.credentials.username, repo.credentials.password)
|
||||
repo.path.isNotBlank() -> "$headerUrlOrPath$METADATA_LOCAL_FILE_NAME"
|
||||
.apply { currentUrl = this }
|
||||
.executeFileBody()
|
||||
else -> SError.make("Could not resolve this repository \"${repo.nodeName}\"")
|
||||
}.trim().toMetadata(currentVersion)
|
||||
}.trim().toMetadata(currentUrl, currentVersion)
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析 [METADATA_FILE_NAME]、[METADATA_LOCAL_FILE_NAME] 内容到 [MavenMetadata] 实体
|
||||
* @param url 当前依赖获取 URL
|
||||
* @param currentVersion 当前依赖版本
|
||||
* @return [MavenMetadata]
|
||||
*/
|
||||
private fun String.toMetadata(currentVersion: DependencyVersion) = runCatching {
|
||||
if ((contains("<metadata ") || contains("<metadata>")).not() || endsWith("</metadata>").not()) return@runCatching MavenMetadata()
|
||||
private fun String.toMetadata(url: String, currentVersion: DependencyVersion) = runCatching {
|
||||
if (!(contains("<metadata ") || contains("<metadata>")) || !endsWith("</metadata>")) return@runCatching MavenMetadata(url)
|
||||
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(InputSource(StringReader(this))).let { document ->
|
||||
val lastUpdated = document.getElementsByTagName("lastUpdated").item(0)?.textContent?.toLongOrNull() ?: 0L
|
||||
val versionNodeList = document.getElementsByTagName("version")
|
||||
val versions = mutableListOf<DependencyVersion>()
|
||||
for (i in 0..versionNodeList.length) versionNodeList.item(i)?.textContent?.also { versions.add(currentVersion.clone(it)) }
|
||||
MavenMetadata(versions.noEmpty()?.reversed()?.toMutableList() ?: mutableListOf(), lastUpdated)
|
||||
MavenMetadata(url, versions.noEmpty()?.reversed()?.toMutableList() ?: mutableListOf(), lastUpdated)
|
||||
}
|
||||
}.getOrNull() ?: MavenMetadata()
|
||||
}.getOrNull() ?: MavenMetadata(url)
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -25,10 +25,12 @@ import com.highcapable.sweetdependency.gradle.entity.DependencyVersion
|
||||
|
||||
/**
|
||||
* Maven Metadata 实体
|
||||
* @param url 依赖获取 URL
|
||||
* @param versions 版本数组
|
||||
* @param lastUpdated 最后更新时间戳
|
||||
*/
|
||||
internal data class MavenMetadata(
|
||||
internal var url: String = "",
|
||||
internal var versions: MutableList<DependencyVersion> = mutableListOf(),
|
||||
internal var lastUpdated: Long = 0L
|
||||
)
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -83,6 +83,8 @@ internal object RuntimeDebugTransaction {
|
||||
"Gradle Version" value GradleHelper.version,
|
||||
"Plugin Version" value SweetDependency.VERSION,
|
||||
"Plugin Configuration" to mapOf(
|
||||
"isEnable" value configs.isEnable,
|
||||
"isDebug" value configs.isDebug,
|
||||
"configFileName" with "(path) ${configs.configFilePath}" to mapOf(
|
||||
"preferences" to mapOf(
|
||||
"autowire-on-sync-mode" value preferences.autowireOnSyncMode,
|
||||
@@ -103,6 +105,7 @@ internal object RuntimeDebugTransaction {
|
||||
"plugins" to pluginsMap,
|
||||
"libraries" to librariesMap
|
||||
),
|
||||
"isUseDependencyResolutionManagement" value configs.isUseDependencyResolutionManagement,
|
||||
"isEnableDependenciesAutowireLog" value configs.isEnableDependenciesAutowireLog,
|
||||
"isEnableVerboseMode" value configs.isEnableVerboseMode
|
||||
),
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -42,7 +42,7 @@ internal fun ISweetDependencyConfigs.build() = configFilePath.loadOrCreateEmpty(
|
||||
*/
|
||||
private fun String.loadOrCreateEmpty(): RootConfigDocument {
|
||||
toFile().apply {
|
||||
if (name.endsWith(".yaml").not() && name.endsWith(".yml").not())
|
||||
if (!name.endsWith(".yaml") && !name.endsWith(".yml"))
|
||||
SError.make("Config file name must be end with \".yaml\" or \".yml\"")
|
||||
}.createTemplateFileOrNot()
|
||||
return Yaml.loadFromFile<RootConfigDocument>(path = this)
|
||||
@@ -56,11 +56,11 @@ private fun File.createTemplateFileOrNot() {
|
||||
}
|
||||
runCatching {
|
||||
when {
|
||||
exists().not() && parentFile.exists().not() -> {
|
||||
!exists() && !parentFile.exists() -> {
|
||||
parentFile.mkdirs()
|
||||
createTemplateFile()
|
||||
}
|
||||
exists().not() -> createTemplateFile()
|
||||
!exists() -> createTemplateFile()
|
||||
exists() && isDirectory -> SError.make("Tries to create file path is a directory")
|
||||
}
|
||||
}.onFailure { SError.make("Could not automatically created config file: $absolutePath", it) }
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.highcapable.sweetdependency.plugin.config.proxy
|
||||
|
||||
import com.highcapable.sweetdependency.SweetDependency
|
||||
import org.gradle.api.initialization.Settings
|
||||
|
||||
/**
|
||||
* [SweetDependency] 配置类接口类
|
||||
@@ -41,9 +42,15 @@ internal interface ISweetDependencyConfigs {
|
||||
/** 是否启用插件 */
|
||||
val isEnable: Boolean
|
||||
|
||||
/** 是否启用调试模式 */
|
||||
val isDebug: Boolean
|
||||
|
||||
/** [SweetDependency] 的配置文件路径 */
|
||||
val configFilePath: String
|
||||
|
||||
/** 是否使用 [Settings.dependencyResolutionManagement] 管理库依赖 */
|
||||
val isUseDependencyResolutionManagement: Boolean
|
||||
|
||||
/** 是否启用依赖自动装配日志 */
|
||||
val isEnableDependenciesAutowireLog: Boolean
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -26,6 +26,7 @@ package com.highcapable.sweetdependency.plugin.extension.dsl.configure
|
||||
import com.highcapable.sweetdependency.SweetDependency
|
||||
import com.highcapable.sweetdependency.environment.Environment
|
||||
import com.highcapable.sweetdependency.plugin.config.proxy.ISweetDependencyConfigs
|
||||
import org.gradle.api.initialization.Settings
|
||||
|
||||
/**
|
||||
* [SweetDependency] 配置方法体实现类
|
||||
@@ -46,6 +47,14 @@ open class SweetDependencyConfigureExtension internal constructor() {
|
||||
var isEnable = true
|
||||
@JvmName("enable") set
|
||||
|
||||
/**
|
||||
* 是否启用调试模式
|
||||
*
|
||||
* 默认不启用 - 启用后将在自动装配时输出详细的依赖搜索信息
|
||||
*/
|
||||
var isDebug = false
|
||||
@JvmName("debug") set
|
||||
|
||||
/**
|
||||
* [SweetDependency] 配置文件名称
|
||||
*
|
||||
@@ -54,6 +63,16 @@ open class SweetDependencyConfigureExtension internal constructor() {
|
||||
var configFileName = ISweetDependencyConfigs.DEFAULT_CONFIG_FILE_NAME
|
||||
@JvmName("configFileName") set
|
||||
|
||||
/**
|
||||
* 是否使用 [Settings.dependencyResolutionManagement] 管理库依赖
|
||||
*
|
||||
* 此功能默认启用 - 如果你的项目必须存在自定义的 "repositories" 方法块 - 请关闭此功能
|
||||
*
|
||||
* - 注意:关闭后配置文件中的 "repositories-mode" 选项将不再有效
|
||||
*/
|
||||
var isUseDependencyResolutionManagement = true
|
||||
@JvmName("useDependencyResolutionManagement") set
|
||||
|
||||
/**
|
||||
* 是否启用依赖自动装配日志
|
||||
*
|
||||
@@ -76,12 +95,16 @@ open class SweetDependencyConfigureExtension internal constructor() {
|
||||
*/
|
||||
internal fun build(): ISweetDependencyConfigs {
|
||||
val currentEnable = isEnable
|
||||
val currentDebug = isDebug
|
||||
val currentConfigFilePath = Environment.resourcesDir(configFileName).absolutePath
|
||||
val currentUseDependencyResolutionManagement = isUseDependencyResolutionManagement
|
||||
val currentEnableDependenciesAutowireLog = isEnableDependenciesAutowireLog
|
||||
val currentEnableVerboseMode = isEnableVerboseMode
|
||||
return object : ISweetDependencyConfigs {
|
||||
override val isEnable get() = currentEnable
|
||||
override val isDebug get() = currentDebug
|
||||
override val configFilePath get() = currentConfigFilePath
|
||||
override val isUseDependencyResolutionManagement get() = currentUseDependencyResolutionManagement
|
||||
override val isEnableDependenciesAutowireLog get() = currentEnableDependenciesAutowireLog
|
||||
override val isEnableVerboseMode get() = currentEnableVerboseMode
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -44,6 +44,7 @@ import com.squareup.javapoet.MethodSpec
|
||||
import com.squareup.javapoet.TypeSpec
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import javax.annotation.Nonnull
|
||||
import javax.lang.model.element.Modifier
|
||||
|
||||
/**
|
||||
@@ -100,7 +101,7 @@ internal class LibrariesAccessorsGenerator {
|
||||
*/
|
||||
private inline fun noRepeated(vararg tags: String, block: () -> Unit) {
|
||||
val allTag = tags.joinToString("-")
|
||||
if (usedSuccessiveTags.contains(allTag).not()) block()
|
||||
if (!usedSuccessiveTags.contains(allTag)) block()
|
||||
usedSuccessiveTags.add(allTag)
|
||||
}
|
||||
|
||||
@@ -205,6 +206,7 @@ internal class LibrariesAccessorsGenerator {
|
||||
else -> "\"$accessors\" accessors"
|
||||
}; addJavadoc("Resolve the $actual")
|
||||
}.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
|
||||
.addAnnotation(Nonnull::class.java)
|
||||
.returns(className.capitalized().asClassType())
|
||||
.addStatement("return ${className.uncapitalized()}")
|
||||
.build()
|
||||
@@ -228,6 +230,7 @@ internal class LibrariesAccessorsGenerator {
|
||||
MethodSpec.methodBuilder("get${alias.uppercamelcase()}")
|
||||
.addJavadoc("Resolve the \"$dependency\" version alias \"$alias\"")
|
||||
.addModifiers(Modifier.PUBLIC, Modifier.FINAL)
|
||||
.addAnnotation(Nonnull::class.java)
|
||||
.returns(ExternalDependencyDelegate::class.java)
|
||||
.addStatement("return ${alias.camelcase()}")
|
||||
.build()
|
||||
@@ -432,6 +435,10 @@ internal class LibrariesAccessorsGenerator {
|
||||
*/
|
||||
internal val compileStubFiles get(): List<JavaFile> {
|
||||
val stubFiles = mutableListOf<JavaFile>()
|
||||
val nonnullFile =
|
||||
TypeSpec.annotationBuilder(Nonnull::class.java.simpleName)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
.build().createJavaFile(Nonnull::class.java.packageName)
|
||||
val iExtensionAccessorsFile =
|
||||
TypeSpec.interfaceBuilder(IExtensionAccessors::class.java.simpleName)
|
||||
.addModifiers(Modifier.PUBLIC)
|
||||
@@ -447,6 +454,7 @@ internal class LibrariesAccessorsGenerator {
|
||||
.addParameter(String::class.java, "version")
|
||||
.build()
|
||||
).build().createJavaFile(ExternalDependencyDelegate::class.java.packageName)
|
||||
stubFiles.add(nonnullFile)
|
||||
stubFiles.add(iExtensionAccessorsFile)
|
||||
stubFiles.add(externalDependencyDelegateFile)
|
||||
return stubFiles
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -35,8 +35,8 @@ import javax.xml.parsers.DocumentBuilderFactory
|
||||
*/
|
||||
internal object PluginUpdateHelper {
|
||||
|
||||
/** OSS Release URL 地址 */
|
||||
private const val SONATYPE_OSS_RELEASES_URL = "https://s01.oss.sonatype.org/content/repositories/releases"
|
||||
/** Maven Central Release URL 地址 */
|
||||
private const val SONATYPE_OSS_RELEASES_URL = "https://repo1.maven.org/maven2"
|
||||
|
||||
/** 依赖配置文件名 */
|
||||
private const val METADATA_FILE_NAME = "maven-metadata.xml"
|
||||
@@ -70,7 +70,7 @@ internal object PluginUpdateHelper {
|
||||
* @return [String]
|
||||
*/
|
||||
private fun String.findLatest() = runCatching {
|
||||
if ((contains("<metadata ") || contains("<metadata>")).not() || endsWith("</metadata>").not()) return@runCatching ""
|
||||
if (!(contains("<metadata ") || contains("<metadata>")) || !endsWith("</metadata>")) return@runCatching ""
|
||||
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(InputSource(StringReader(this))).let { document ->
|
||||
document.getElementsByTagName("latest")?.let { if (it.length > 0) it.item(0)?.textContent ?: "" else "" }
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -63,7 +63,7 @@ internal class SweetDependencyExtensionImpl : BaseExtensionImpl() {
|
||||
""".trimIndent(), noTag = true
|
||||
)
|
||||
}
|
||||
if (GradleHelper.version.let { it.startsWith("7.") || it.startsWith("8.") }.not()) SError.make(
|
||||
if (GradleHelper.version.let { !it.startsWith("7.") && !it.startsWith("8.") }) SError.make(
|
||||
"${SweetDependency.TAG} ${SweetDependency.VERSION} " +
|
||||
"does not support Gradle ${GradleHelper.version}, please update Gradle or plugin version"
|
||||
)
|
||||
@@ -81,8 +81,10 @@ internal class SweetDependencyExtensionImpl : BaseExtensionImpl() {
|
||||
}
|
||||
|
||||
override fun onTransaction(transaction: ProjectTransaction) {
|
||||
if (transaction.isRoot) DependencyManager.resolve(transaction.current)
|
||||
transaction.evaluation { project, isRoot -> if (isRoot) DependencyManager.deploy(project) }
|
||||
if (transaction.isRoot) {
|
||||
RepositoryManager.apply(transaction.current)
|
||||
DependencyManager.resolve(transaction.current)
|
||||
}; transaction.evaluation { project, isRoot -> if (isRoot) DependencyManager.deploy(project) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +93,7 @@ internal class SweetDependencyExtensionImpl : BaseExtensionImpl() {
|
||||
*/
|
||||
private fun configureProject(configs: ISweetDependencyConfigs) {
|
||||
SLog.isVerboseMode = configs.isEnableVerboseMode
|
||||
if (isPluginLoaded.not() || GradleHelper.isSyncMode.not()) SLog.verbose(SweetDependency.bannerContent, noTag = true)
|
||||
if (!isPluginLoaded || !GradleHelper.isSyncMode) SLog.verbose(SweetDependency.bannerContent, noTag = true)
|
||||
if (isPluginLoaded) return
|
||||
isPluginLoaded = true
|
||||
SLog.verbose("Welcome to ${SweetDependency.TAG} ${SweetDependency.VERSION}! Using Gradle ${GradleHelper.version}")
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -56,7 +56,7 @@ internal fun String.parseUnixFileSeparator() = replace("\\", "/")
|
||||
*/
|
||||
internal fun String.toRelativeFilePath(basePath: String, rootPath: String = "") =
|
||||
parseFileSeparator().runCatching {
|
||||
if (rootPath.isNotBlank() && contains(rootPath).not()) return this
|
||||
if (rootPath.isNotBlank() && !contains(rootPath)) return this
|
||||
return Paths.get(basePath).relativize(Paths.get(this)).toString()
|
||||
}.getOrNull() ?: parseFileSeparator()
|
||||
|
||||
@@ -107,8 +107,8 @@ internal fun String.toAbsoluteFilePaths(basePath: String) =
|
||||
* @return [Boolean]
|
||||
*/
|
||||
internal fun File.isValidZip(): Boolean {
|
||||
if (isFile.not()) return true
|
||||
if (exists().not()) return false
|
||||
if (!isFile) return true
|
||||
if (!exists()) return false
|
||||
return runCatching { ZipFile(this).use {}; true }.getOrNull() ?: false
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ internal fun File.isValidZip(): Boolean {
|
||||
* - 如果文件不存在 - 返回 true
|
||||
* @return [Boolean]
|
||||
*/
|
||||
internal fun File.isEmpty() = exists().not() || isDirectory.not() || listFiles().isNullOrEmpty()
|
||||
internal fun File.isEmpty() = !exists() || !isDirectory || listFiles().isNullOrEmpty()
|
||||
|
||||
/** 删除目录下的空子目录 */
|
||||
internal fun File.deleteEmptyRecursively() {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
@@ -60,7 +60,7 @@ internal object CodeCompiler {
|
||||
if (files.isEmpty()) {
|
||||
if (outputDir.exists()) outputDir.deleteRecursively()
|
||||
return
|
||||
} else outputDir.also { if (it.exists().not()) it.mkdirs() }
|
||||
} else outputDir.also { if (!it.exists()) it.mkdirs() }
|
||||
val outputBuildDir = "$outputDirPath/build".toFile().also { if (it.exists()) it.deleteRecursively(); it.mkdirs() }
|
||||
val outputClassesDir = "${outputBuildDir.absolutePath}/classes".toFile().apply { mkdirs() }
|
||||
val outputSourcesDir = "${outputBuildDir.absolutePath}/sources".toFile().apply { mkdirs() }
|
||||
@@ -100,7 +100,7 @@ internal object CodeCompiler {
|
||||
* @param sourcesDir 编译源码目录
|
||||
*/
|
||||
private fun createJarAndPom(pomData: MavenPomData, outputDir: File, buildDir: File, classesDir: File, sourcesDir: File) {
|
||||
val pomDir = outputDir.resolve(pomData.relativePomPath).also { if (it.exists().not()) it.mkdirs() }
|
||||
val pomDir = outputDir.resolve(pomData.relativePomPath).also { if (!it.exists()) it.mkdirs() }
|
||||
packageToJar(classesDir, pomDir, pomData, isSourcesJar = false)
|
||||
packageToJar(sourcesDir, pomDir, pomData, isSourcesJar = true)
|
||||
writePom(pomDir, pomData)
|
||||
@@ -160,7 +160,7 @@ internal object CodeCompiler {
|
||||
* @throws SweetDependencyUnresolvedException 如果编译输出目录不存在
|
||||
*/
|
||||
private fun packageToJar(buildDir: File, outputDir: File, pomData: MavenPomData, isSourcesJar: Boolean) {
|
||||
if (buildDir.exists().not()) SError.make("Jar file output path not found: ${buildDir.absolutePath}")
|
||||
if (!buildDir.exists()) SError.make("Jar file output path not found: ${buildDir.absolutePath}")
|
||||
val jarFile = outputDir.resolve("${pomData.artifactId}-${pomData.version}${if (isSourcesJar) "-sources" else ""}.jar")
|
||||
if (jarFile.exists()) jarFile.delete()
|
||||
ZipFile(jarFile).addFolder(buildDir, ZipParameters().apply { isIncludeRootFolder = false })
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SweetDependency - An easy autowire and manage dependencies Gradle plugin.
|
||||
* Copyright (C) 2019-2023 HighCapable
|
||||
* Copyright (C) 2019 HighCapable
|
||||
* https://github.com/HighCapable/SweetDependency
|
||||
*
|
||||
* Apache License Version 2.0
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user