Skip to content

Commit

Permalink
fix(bom): bom组件项目不使用ihub-bom插件 (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
henry-hub authored Feb 5, 2023
1 parent 336d6ec commit ddc7a96
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ class IHubBomPlugin extends IHubProjectPluginAware<IHubBomExtension> {

@Override
void apply() {
// 如果项目为bom组件项目时,不执行插件
if (project.name == extension.findProjectProperty('iHubSettings.includeBom')) {
return
}

// 配置ihub-bom
extension.importBoms {
group 'pub.ihub.lib' module 'ihub-libs' version IHubLibsVersion.version
Expand All @@ -54,10 +59,6 @@ class IHubBomPlugin extends IHubProjectPluginAware<IHubBomExtension> {
ext.printConfigContent()
}
}

project.subprojects {
pluginManager.apply IHubBomPlugin
}
}

private void configVersions(IHubBomExtension ext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ class IHubBomPluginTest extends IHubSpecification {
'''

when: '添加子项目'
testProjectDir.newFile(DEFAULT_SETTINGS_FILE) << 'include \'a\', \'b\', \'c\''
testProjectDir.newFile(DEFAULT_SETTINGS_FILE) << 'include \'a\', \'b\', \'c\', \'demo-bom\''
testProjectDir.newFolder 'a'
testProjectDir.newFolder 'b'
testProjectDir.newFolder 'c'
propertiesFile << 'iHubSettings.includeBom=demo-bom\n'
buildFile << '''
allprojects {
iHubBom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ class IHubPluginsPlugin extends IHubProjectPluginAware<IHubPluginsExtension> {
checkForGradleUpdate = true
}
}
if (!hasPlugin(JavaPlatformPlugin)) {
applyPlugin IHubBomPlugin
}
}

// 非Java平台组件项目默认应用IHubBom插件
if (!hasPlugin(JavaPlatformPlugin)) {
applyPlugin IHubBomPlugin
}

project.subprojects {
Expand Down

0 comments on commit ddc7a96

Please sign in to comment.