blob: 2a4c17cd82410f9da5146c6c327f65ee55c972f9 [file] [log] [blame]
Jaewoong Jung5b425e22019-06-17 17:40:56 -07001// Copyright 2019 Google Inc. 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
15package android
16
17import (
Colin Crossaa1cab02022-01-28 14:49:24 -080018 "strings"
Jaewoong Jung5b425e22019-06-17 17:40:56 -070019)
20
Colin Crossaa1cab02022-01-28 14:49:24 -080021// BuildNoticeTextOutputFromLicenseMetadata writes out a notice text file based on the module's
22// generated license metadata file.
23func BuildNoticeTextOutputFromLicenseMetadata(ctx ModuleContext, outputFile WritablePath) {
24 depsFile := outputFile.ReplaceExtension(ctx, strings.TrimPrefix(outputFile.Ext()+".d", "."))
25 rule := NewRuleBuilder(pctx, ctx)
26 rule.Command().
27 BuiltTool("textnotice").
28 FlagWithOutput("-o ", outputFile).
29 FlagWithDepFile("-d ", depsFile).
30 Input(ctx.Module().base().licenseMetadataFile)
Bob Badourde6a0872022-04-01 18:00:00 +000031 rule.Build("text_notice", "container notice file")
32}
33
34// BuildNoticeHtmlOutputFromLicenseMetadata writes out a notice text file based on the module's
35// generated license metadata file.
36func BuildNoticeHtmlOutputFromLicenseMetadata(ctx ModuleContext, outputFile WritablePath) {
37 depsFile := outputFile.ReplaceExtension(ctx, strings.TrimPrefix(outputFile.Ext()+".d", "."))
38 rule := NewRuleBuilder(pctx, ctx)
39 rule.Command().
40 BuiltTool("htmlnotice").
41 FlagWithOutput("-o ", outputFile).
42 FlagWithDepFile("-d ", depsFile).
43 Input(ctx.Module().base().licenseMetadataFile)
44 rule.Build("html_notice", "container notice file")
Dan Willemsen9fe14102021-07-13 21:52:04 -070045}