@@ -72,35 +72,72 @@ func resolveManifestPackage(project tools.Project, pkg string, reqPackage string
72
72
var val tools.Package
73
73
var ok bool
74
74
75
- log .Printf (">>>>>>>>>>>> XXX Looking for package [%s] of type [%s]" , pkg , reqPackage )
76
-
77
- for pkgName := range project .Packages {
78
- if strings .HasPrefix (pkgName , pkg ) {
79
- log .Printf (">>>>>>>>>>> XXX Package: %s <<<<" , pkgName )
80
- firstSplit := strings .Split (pkgName , pkg + "-" )
81
- secondHalf := firstSplit [1 ]
82
- if strings .Contains (secondHalf , reqPackage ) {
83
- log .Printf (">>>>>>>>>>> XXX Second Half: %s <<<<" , secondHalf )
84
- pkgVersion := strings .Split (secondHalf , "-" + reqPackage )[0 ]
85
- log .Printf (">>>>>>>>>>> XXX Got Version: %s <<<<" , pkgVersion )
86
-
87
- foundPkgKey := fmt .Sprintf ("%s-%s-%s" , pkg , pkgVersion , reqPackage )
88
- log .Printf (">>>>>>>>>>> XXX Found Pkg Key: %s <<<<" , foundPkgKey )
89
-
90
- val , ok = project .Packages [foundPkgKey ]
91
- if ! ok {
92
- return nil
75
+ // Try the normal/easy case first
76
+ packageName := fmt .Sprintf ("%s-%s-%s" , pkg , version , reqPackage )
77
+ val , ok = project .Packages [packageName ]
78
+ if ! ok {
79
+ // If we didn't find it, it may be an Independent Agent Release, where
80
+ // the opted-in projects will have a patch version one higher than
81
+ // the rest of the projects, so we need to seek that out
82
+ if mg .Verbose () {
83
+ log .Printf (">>>>>>>>>>> Looking for package [%s] of type [%s]" , pkg , reqPackage )
84
+ }
85
+
86
+ var foundIt bool
87
+ for pkgName := range project .Packages {
88
+ if strings .HasPrefix (pkgName , pkg ) {
89
+ firstSplit := strings .Split (pkgName , pkg + "-" )
90
+ if len (firstSplit ) < 2 {
91
+ continue
93
92
}
94
93
95
- if mg .Verbose () {
96
- log .Printf (">>>>>>>>>>> Project branch/commit [%s, %s]" , project .Branch , project .CommitHash )
94
+ secondHalf := firstSplit [1 ]
95
+ // Make sure we're finding one w/ the same required package type
96
+ if strings .Contains (secondHalf , reqPackage ) {
97
+
98
+ // Split again after the version with the required package string
99
+ secondSplit := strings .Split (secondHalf , "-" + reqPackage )
100
+ if len (secondSplit ) < 2 {
101
+ continue
102
+ }
103
+
104
+ // The first element after the split should normally be the version
105
+ pkgVersion := secondSplit [0 ]
106
+ if mg .Verbose () {
107
+ log .Printf (">>>>>>>>>>> Using derived version for package [%s]: %s " , pkgName , pkgVersion )
108
+ }
109
+
110
+ // Create a project/package key with the package, derived version, and required package
111
+ foundPkgKey := fmt .Sprintf ("%s-%s-%s" , pkg , pkgVersion , reqPackage )
112
+ if mg .Verbose () {
113
+ log .Printf (">>>>>>>>>>> Looking for project package key: [%s]" , foundPkgKey )
114
+ }
115
+
116
+ // Get the package value, if it exists
117
+ val , ok = project .Packages [foundPkgKey ]
118
+ if ! ok {
119
+ continue
120
+ }
121
+
122
+ if mg .Verbose () {
123
+ log .Printf (">>>>>>>>>>> Found package key [%s]" , foundPkgKey )
124
+ }
125
+
126
+ foundIt = true
97
127
}
98
128
}
99
129
}
130
+
131
+ if ! foundIt {
132
+ return nil
133
+ }
100
134
}
101
135
102
- return []string {val .URL , val .ShaURL , val .AscURL }
136
+ if mg .Verbose () {
137
+ log .Printf (">>>>>>>>>>> Project branch/commit [%s, %s]" , project .Branch , project .CommitHash )
138
+ }
103
139
140
+ return []string {val .URL , val .ShaURL , val .AscURL }
104
141
}
105
142
106
143
// DownloadComponentsFromManifest is going to download a set of components from the given manifest into the destination
0 commit comments