squakez commented on code in PR #4987:
URL: https://github.com/apache/camel-k/pull/4987#discussion_r1429686319


##########
pkg/controller/integration/kits.go:
##########
@@ -257,10 +259,32 @@ func matchesTrait(it map[string]interface{}, kt 
map[string]interface{}) bool {
 }
 
 func hasMatchingSources(it *v1.Integration, kit *v1.IntegrationKit) bool {
-       if len(it.Sources()) != len(kit.Spec.Sources) {
+       // A kit may have fewer sources during native builds but should not 
have more
+       if len(kit.Spec.Sources) > len(it.Sources()) {
                return false
        }
+
+       isNativeKit := false
+       if kit.Spec.Traits.Quarkus != nil {
+               // TODO: Verify proper way to determine mode
+               mode := kit.Spec.Traits.Quarkus.Modes[0]
+               isNativeKit = mode == traitv1.NativeQuarkusMode
+       }
+
+       var kitRuntimeCatalog *camel.RuntimeCatalog
+       if isNativeKit {
+               var err error
+               kitRuntimeCatalog, err = 
camel.GetVersionedCatalog(kit.Status.RuntimeVersion)
+               if err != nil {
+                       // TODO: log error here?
+                       return false
+               }
+       }
+
        for _, itSource := range it.Sources() {
+               if isNativeKit && !sourceRequiredByKitCatalog(itSource, 
kitRuntimeCatalog) {

Review Comment:
   Yes. ATM `generatedSources` are only used by Openapi and Kamelets. If we 
want to have a more complete and consistent solution we probably need to 
include the same concept of generated sources in the IntegrationKit. However, I 
think it may add more complication at this stage. We probably need to review 
and understand the concept of "generated source" in general and refactor 
according to the expectation of having this available at build time. For the 
time being my suggestion is to maintain the design as it is and only fix the 
problematic bug we are facing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to