Jaewoong Jung | 5b425e2 | 2019-06-17 17:40:56 -0700 | [diff] [blame] | 1 | // 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 | |
| 15 | package android |
| 16 | |
| 17 | import ( |
Colin Cross | aa1cab0 | 2022-01-28 14:49:24 -0800 | [diff] [blame] | 18 | "strings" |
Jaewoong Jung | 5b425e2 | 2019-06-17 17:40:56 -0700 | [diff] [blame] | 19 | ) |
| 20 | |
Colin Cross | aa1cab0 | 2022-01-28 14:49:24 -0800 | [diff] [blame] | 21 | // BuildNoticeTextOutputFromLicenseMetadata writes out a notice text file based on the module's |
| 22 | // generated license metadata file. |
| 23 | func 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 Badour | de6a087 | 2022-04-01 18:00:00 +0000 | [diff] [blame^] | 31 | 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. |
| 36 | func 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 Willemsen | 9fe1410 | 2021-07-13 21:52:04 -0700 | [diff] [blame] | 45 | } |