Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial implementation of gradle plugin #73 #1005

Merged
merged 10 commits into from
Oct 30, 2024
11 changes: 11 additions & 0 deletions sofa-ark-parent/support/ark-gradle-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ark Gradle打包插件使用
`sofa-ark-gradle-plugin`模块是Ark打包工具的Gradle版本实现,和Maven打包工具`sofa-ark-maven-plugin`有同样的功能,用于打包ark包和biz包。
# 配置
`sofa-ark-gradle-plugin` 使用 arkConfig 来进行配置。
Comment on lines +3 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Enhance the configuration section with detailed examples.

The configuration section is too brief. Consider adding:

  • Complete list of available configuration options in arkConfig
  • Example configurations for common use cases
  • Default values for each configuration option

Would you like me to help create a comprehensive configuration documentation section?


# 如何使用
1. 本地发布引用
2. 远程仓库引入(待申请)

参考`sofa-ark-plugin-gradle-plugin`的本地发布和引入。
使用Gradle刷新后,如果一切正常,会在IDEA右侧Gradle任务列表中出现arkJar,具体如下: Tasks > build > arkJar,点击arkJar执行,会在指定的outputDirectory中输出ark包和biz包。
Comment on lines +10 to +11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

Based on the gathered information, I can now provide a comprehensive response about the build instructions.

Enhance the build instructions with more details and configuration options.

The current documentation should be expanded to include:

  1. Configuration options through arkConfig:

    • arkVersion: Version of SOFAArk to use
    • bizName: Name of the business module
    • bizClassifier: Classifier for the biz package (defaults to "ark-biz")
    • arkClassifier: Classifier for the ark package (defaults to "ark-executable")
    • excludes: Dependencies to exclude
    • excludeGroupIds: Group IDs to exclude
    • excludeArtifactIds: Artifact IDs to exclude
  2. Task outputs:

    • The arkJar task generates two artifacts:
      • An executable ark package (with classifier "ark-executable")
      • A business module package (with classifier "ark-biz")
    • Output files are placed in the project's build directory
  3. Task dependencies:

    • The task is added to the build group
    • It depends on the project's classes and resources being compiled
  4. Example configuration:

arkConfig {
    arkVersion = "2.2.14"
    bizName = "example-biz"
    excludes = ["group:artifact"]
}
🔗 Analysis chain

Enhance the build instructions with more details.

The build instructions should include:

  1. Expected output artifacts and their locations
  2. Description of the arkJar task and its dependencies
  3. Available configuration options for output directory
  4. Troubleshooting guide for common issues

Let's check the actual implementation to ensure documentation accuracy:


Let me try a different approach to find the Gradle task and configuration details.


Let me check the README files to understand the documented behavior and configuration options.


Let me try one final search to find the configuration options and task details.


Let me check the ArkJar task implementation and configuration options.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Look for the arkJar task implementation
ast-grep --pattern 'class $_ implements Task {
  $$$
  arkJar($$$) {
    $$$
  }
  $$$
}'

Length of output: 47


Script:

#!/bin/bash
# Search for arkJar task definition in Gradle files
rg -l "task.*arkJar" --type groovy --type gradle

# Search for configuration and task details
rg "arkJar|outputDirectory|ark" --type groovy --type gradle -A 5

# Look for any documentation about the task
fd "README" -e md -x rg -l "arkJar|ark.*plugin"

Length of output: 875


Script:

#!/bin/bash
# Check content of relevant README files
echo "=== Main README ==="
cat README.md | rg -A 5 "arkJar|gradle.*plugin"

echo -e "\n=== Gradle Plugin README ==="
cat sofa-ark-parent/support/ark-gradle-plugin/README.md | rg -A 10 "arkJar|gradle.*plugin|配置项"

# Look for any test files that might document the behavior
rg -l "arkJar" --type-add 'test:*{Test,Spec}.*' --type test

Length of output: 677


Script:

#!/bin/bash
# Search for arkConfig configuration options in source files
rg "arkConfig" --type groovy --type java -B 2 -A 5

# Look for any source files that define the task
fd -e java -e groovy --exec rg -l "class.*ArkJar|task.*arkJar"

# Check for any examples in test resources
fd -e gradle -t f -x rg -l "arkConfig"

Length of output: 8871


Script:

#!/bin/bash
# Check the ArkJar task implementation
cat sofa-ark-parent/support/ark-gradle-plugin/src/main/java/com/alipay/sofa/ark/plugin/ArkJar.java

# Check the extension class for configuration options
rg -A 10 "class SofaArkGradlePluginExtension" --type java

# Look for any example configurations in test resources
fd -t f -e gradle -x rg -A 5 "arkConfig \{" 

Length of output: 9987

22 changes: 22 additions & 0 deletions sofa-ark-parent/support/ark-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id 'java'
id 'java-gradle-plugin'
}

group = 'com.alipay.sofa'
version = '1.0.0'

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation 'org.ow2.asm:asm:9.4'
implementation 'org.apache.commons:commons-compress:1.26.1'
implementation 'com.alipay.sofa:sofa-ark-tools:2.2.12'
}

test {
useJUnitPlatform()
}
2 changes: 2 additions & 0 deletions sofa-ark-parent/support/ark-gradle-plugin/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'ark-gradle-plugin'

Loading
Loading