• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2021 The Android Open Source Project
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
15package rust
16
17import (
18	"android/soong/android"
19)
20
21func init() {
22	android.RegisterSingletonType("rustdoc", RustdocSingleton)
23}
24
25func RustdocSingleton() android.Singleton {
26	return &rustdocSingleton{}
27}
28
29type rustdocSingleton struct{}
30
31func (n *rustdocSingleton) GenerateBuildActions(ctx android.SingletonContext) {
32	ctx.VisitAllModules(func(module android.Module) {
33		if !module.Enabled() {
34			return
35		}
36
37		if m, ok := module.(*Module); ok {
38			if m.docTimestampFile.Valid() {
39				ctx.Phony("rustdoc", m.docTimestampFile.Path())
40			}
41		}
42	})
43}
44