Skip to content

Commit bbeba1a

Browse files
committedApr 3, 2022
Improvements and TODO list
1 parent be22d70 commit bbeba1a

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed
 

‎lyberator-gradle/src/main/groovy/at/schrottner/lyberator/resolving/ResolverExtension.groovy

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ package at.schrottner.lyberator.resolving
22

33
class ResolverExtension {
44
public static final String NAME = "commerceDependencies"
5-
public static final String CONFIGURATION_EXTENSION = "commerceExtension"
6-
public static final String CONFIGURATION_EXTENSION_POMS = "${CONFIGURATION_EXTENSION}Poms"
7-
public static final String CONFIGURATION_EXTENSION_ZIPS = "${CONFIGURATION_EXTENSION}Zips"
5+
6+
def extensionGroups = ["commerce", "thirdParty"]
7+
8+
89
}

‎lyberator-gradle/src/main/groovy/at/schrottner/lyberator/resolving/ResolverPlugin.groovy

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ class ResolverPlugin implements Plugin<Project> {
2121
void apply(Project project) {
2222
def extension = project.extensions.create(ResolverExtension.NAME, ResolverExtension)
2323

24+
extension.extensionGroups.each {
25+
def config = project.configurations.maybeCreate("${it}Extension")
2426

25-
def config = project.configurations.maybeCreate(ResolverExtension.CONFIGURATION_EXTENSION)
2627

27-
28-
def task = project.tasks.create("extractCommerce", ResolverTask, config, extension)
28+
def task = project.tasks.create("extract${it.capitalize()}Extensions", ResolverTask, config, extension)
29+
}
2930

3031
}
3132
}

‎lyberator-gradle/src/main/groovy/at/schrottner/lyberator/resolving/ResolverTask.groovy

+12-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ResolverTask extends DefaultTask {
2323
ResolverTask(config, extension) {
2424
this.extension = extension
2525
this.configuration = config
26-
this.description = "extract all CommerceExtensions"
26+
this.description = "extract all ${config.name}"
2727
this.group = "Commerce Extensions"
2828
}
2929

@@ -38,15 +38,21 @@ class ResolverTask extends DefaultTask {
3838
it.toString()
3939
}
4040
}
41+
42+
@Internal
43+
def getExtensionName() {
44+
configuration.name - "Extensions"
45+
}
46+
4147
@OutputFile
4248
def getDependencyStore() {
43-
project.file("$project.buildDir/commerce/extensions.json")
49+
project.file("$project.buildDir/commerce/${extensionName}.json")
4450
}
4551

4652
@TaskAction
4753
void performAction() {
48-
def configPoms = project.configurations.maybeCreate(ResolverExtension.CONFIGURATION_EXTENSION_POMS)
49-
def configZips = project.configurations.maybeCreate(ResolverExtension.CONFIGURATION_EXTENSION_ZIPS)
54+
def configPoms = project.configurations.maybeCreate("${configuration.name}Poms")
55+
def configZips = project.configurations.maybeCreate("${configuration.name}Zips")
5056

5157

5258
configuration.resolvedConfiguration.lenientConfiguration.allModuleDependencies.each { dependency ->
@@ -98,7 +104,7 @@ class ResolverTask extends DefaultTask {
98104
project.logger.info "Deleting unused extensions ${oldExt.entrySet().size()}"
99105
// delete old dead extensions
100106
oldExt.values().each {
101-
project.delete("hybris/bin/${it.path?: "thirdParty"}")
107+
project.delete("hybris/bin/${it.path?: "${extensionName}"}")
102108
project.logger.info "Deleting $it.name ($it.path) as it is no more part of the dependencies"
103109
}
104110

@@ -110,7 +116,7 @@ class ResolverTask extends DefaultTask {
110116
fileLookUp.entrySet().each { entry ->
111117

112118
def metaData = metaDataLookup.get(entry.key)
113-
def target = project.mkdir("hybris/bin/${metaData.path?: "thirdParty"}")
119+
def target = project.mkdir("hybris/bin/${metaData.path?: "${extensionName}"}")
114120
project.copy {
115121
from project.zipTree(entry.value)
116122
into target

‎testing/usage/settings.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ pluginManagement {
1313
}
1414
}
1515
rootProject.name = 'testing-usage'
16+
17+
/* TODO:
18+
- Iterate over local extensions, and create sub projects
19+
- parse extensionInfo.xml and add the dependencies to the sub project (evaluate if we can add them globally)
20+
-- we could even use the extensioninfo to determine all kind of extensions needed (but, we might have issues with differentiaten between, 3rdParty and commerce)
21+
- Still a two step start, extract, and add deps, see if missing extraction could be a problem
22+
*/

0 commit comments

Comments
 (0)