github.com/bazelbuild/bazel-gazelle@v0.36.1-0.20240520142334-61b277ba6fed/language/lifecycle.go (about) 1 /* Copyright 2023 The Bazel Authors. All rights reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 */ 15 16 package language 17 18 import "context" 19 20 // LifecycleManager allows an extension to initialize and 21 // free up resources at different points. Extensions should 22 // embed BaseLifecycleManager instead of implementing this 23 // interface directly. 24 type LifecycleManager interface { 25 FinishableLanguage 26 Before(ctx context.Context) 27 AfterResolvingDeps(ctx context.Context) 28 } 29 30 var _ LifecycleManager = (*BaseLifecycleManager)(nil) 31 32 type BaseLifecycleManager struct{} 33 34 func (m *BaseLifecycleManager) Before(ctx context.Context) {} 35 36 func (m *BaseLifecycleManager) DoneGeneratingRules() {} 37 38 func (m *BaseLifecycleManager) AfterResolvingDeps(ctx context.Context) {}