Added merging prerelease sdk and addons with regular one#363
Added merging prerelease sdk and addons with regular one#363michalwedzik wants to merge 5 commits into
Conversation
| return feature; | ||
| } | ||
|
|
||
| private boolean isEffectivelyEmpty(final Feature feature) { |
There was a problem hiding this comment.
I'm not sure what is expected for the empty feature.
rombert
left a comment
There was a problem hiding this comment.
I think checking for 'empty' features is not the right heuristic. I suggest that you take a look at some of the add-on SDK APIs published on Maven Central and either test directly against them or add simplifed copies to git. AFAICT there are two main scenarios:
- a prerelease sdk add-on API that repeats the 'main' add-on API and includes some extra exports/bundles, like https://repo1.maven.org/maven2/com/adobe/aem/aem-dox-prerelease-sdk-api/2026.3.1/aem-dox-prerelease-sdk-api-2026.3.1-aem-dox-sdk.slingosgifeature
- a prerelase sdk add-on API that is additive (technically speaking empty ones like https://repo1.maven.org/maven2/com/adobe/aem/aem-prerelease-sdk-api/2026.6.26635.20260611T122956Z-260500/ are additive :-) )
In both scenarios feature aggregation should work and we probably need to either define a merge handler or conflict policies. If you did not try out the two cases outlined above please do and let's see how this plays out.
91d8c9e to
272e8bc
Compare
ea1e563 to
3767e12
Compare
|
I implemented it the way we discussed. I added ApiRegionsMergeHandler to handle merging apiRegions, and AssemblyBasedFeatureConflictResolver.java to choose the correct version when conflicts occur. I think I've covered all the scenarios. |
|
|
||
| final JsonObject mergedRegion = firstObjectRegion(ApiRegionsMergeHandler.merge(stableJson, prereleaseJson)); | ||
|
|
||
| assertEquals("prerelease.api", mergedRegion.getJsonArray("exports").getString(0)); |
There was a problem hiding this comment.
I think this should assert that both exports are kept, right?
There was a problem hiding this comment.
No, I adopted the strategy that whenever a specific key exists, I replace its value with the prerelease version.
I want to avoid writing a complex merging strategy for the content:
"api-regions:JSON|false":[
{
"name":"global",
"exports":[
{
"name":"ch.qos.logback.classic",
"deprecated":{
"msg":"This internal logback API is not supported by AEM as a Cloud Service.",
"since":"2022-01-27",
"for-removal":"2025-08-31"
}
}
]
},
{
"name":"com.adobe.aem.deprecated",
"exports":[
{
"name":"org.apache.abdera.ext.opensearch",
"deprecated":{
"msg":"Legacy AEM 6.x API.",
"since":"2019-04-08",
"for-removal":"2025-08-31"
}
}
]
}
],
Otherwise, I'll have to implement a strategy for handling duplicates.
There was a problem hiding this comment.
I afraid of to have structure like:
"api-regions:JSON|false":[
{
"name":"global",
"exports":[
{
"name":"ch.qos.logback.classic",
"deprecated":{
"msg":"This internal logback API is not supported by AEM as a Cloud Service.",
"since":"2022-01-27",
"for-removal":"2025-08-31"
}
},
{
"name":"ch.qos.logback.classic",
"deprecated":{
"msg":",
"since":"2022-01-28",
"for-removal":"2025-08-31"
}
]
}
],
In this PR, I added support for merging prerelease SDKs and add-ons with their regular counterparts.
Description
For now, this functionality is available only through AemAggregator when the following fields are provided:
prereleaseSdkId
prereleaseAddOnIds
If these fields are left empty, the behavior remains unchanged. When they are set, the features from the prerelease SDK and/or add-ons are merged with the corresponding regular SDK and add-ons.
Related Issue
#362
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: