blob: 6bf3c87a226e9f82037ecaed23f53ceef4b7b509 [file] [log] [blame]
Kiyoung Kim48f37782021-07-07 12:42:39 +09001// 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//
Colin Crossd079e0b2022-08-16 10:27:33 -07007// http://www.apache.org/licenses/LICENSE-2.0
Kiyoung Kim48f37782021-07-07 12:42:39 +09008//
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.
14package snapshot
15
16import (
17 "android/soong/android"
Kiyoung Kim48f37782021-07-07 12:42:39 +090018)
19
Kiyoung Kim37693d02024-04-04 09:56:15 +090020var pctx = android.NewPackageContext("android/soong/snapshot")
Kiyoung Kim48f37782021-07-07 12:42:39 +090021
Kiyoung Kim37693d02024-04-04 09:56:15 +090022func init() {
23 pctx.Import("android/soong/android")
Kiyoung Kim48f37782021-07-07 12:42:39 +090024}
Rob Seymour925aa092021-08-10 20:42:03 +000025
26// This is to be saved as .json files, which is for development/vendor_snapshot/update.py.
27// These flags become Android.bp snapshot module properties.
28//
29// Attributes are optional and will be populated based on each module's need.
30// Common attributes are defined here, languages may extend this struct to add
31// additional attributes.
32type SnapshotJsonFlags struct {
33 ModuleName string `json:",omitempty"`
34 RelativeInstallPath string `json:",omitempty"`
35 Filename string `json:",omitempty"`
36 ModuleStemName string `json:",omitempty"`
Ivan Lozano872d5792022-03-23 17:31:39 -040037 RustProcMacro bool `json:",omitempty"`
38 CrateName string `json:",omitempty"`
Rob Seymour925aa092021-08-10 20:42:03 +000039
40 // dependencies
Inseob Kima1888ce2022-10-04 14:42:02 +090041 Required []string `json:",omitempty"`
42 Overrides []string `json:",omitempty"`
Justin Yun1db97482023-04-11 18:20:07 +090043
44 // license information
45 LicenseKinds []string `json:",omitempty"`
46 LicenseTexts []string `json:",omitempty"`
47}
48
49func (prop *SnapshotJsonFlags) InitBaseSnapshotPropsWithName(m android.Module, name string) {
50 prop.ModuleName = name
51
52 prop.LicenseKinds = m.EffectiveLicenseKinds()
53 prop.LicenseTexts = m.EffectiveLicenseFiles().Strings()
54}
55
56func (prop *SnapshotJsonFlags) InitBaseSnapshotProps(m android.Module) {
57 prop.InitBaseSnapshotPropsWithName(m, m.Name())
Rob Seymour925aa092021-08-10 20:42:03 +000058}