@@ -164,6 +164,9 @@ def pin_version(old_configuration, version)
164
164
if Utils ::VersionUtils . openjdk_jre? old_configuration
165
165
rake_output_message "Pinning JRE #{ sub_component_id || component_id } version to #{ version } "
166
166
pin_jre ( component_id , sub_component_id , version )
167
+ elsif Utils ::VersionUtils . tomcat? old_configuration
168
+ rake_output_message "Pinning Tomcat #{ sub_component_id || component_id } version to #{ version } "
169
+ pin_tomcat ( component_id , sub_component_id , version )
167
170
else
168
171
rake_output_message "Pinning #{ sub_component_id || component_id } version to #{ version } "
169
172
pin_component ( component_id , sub_component_id , version )
@@ -187,6 +190,17 @@ def pin_jre(component_id, sub_component_id, version)
187
190
JavaBuildpack ::Util ::ConfigurationUtils . write ( component_id , configuration_to_update )
188
191
end
189
192
193
+ def pin_tomcat ( component_id , sub_component_id , version )
194
+ # update configuration file, pin version & version lines
195
+ configuration_to_update = JavaBuildpack ::Util ::ConfigurationUtils . load ( component_id , false , true )
196
+ update_configuration ( configuration_to_update , version , sub_component_id )
197
+ configuration_to_update [ 'tomcat' ] [ 'version_lines' ] . each_with_index do |version_pattern , index |
198
+ configuration_to_update [ 'tomcat' ] [ 'version_lines' ] [ index ] = version \
199
+ if Utils ::VersionUtils . version_matches? ( version_pattern , [ version ] )
200
+ end
201
+ JavaBuildpack ::Util ::ConfigurationUtils . write ( component_id , configuration_to_update )
202
+ end
203
+
190
204
def update_configuration ( config , version , sub_component )
191
205
if sub_component . nil?
192
206
config [ 'version' ] = version
0 commit comments