blob: 076abfaaf9955084fc970c7f79828931223d49cf [file] [log] [blame]
LaMont Jonesac796792024-04-11 11:01:18 -07001// Copyright 2024 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 main
16
17import (
18 "flag"
19 "os"
20
21 rc_lib "android/soong/cmd/release_config/release_config_lib"
22)
23
24func main() {
25 var top string
26 var releaseConfigMapPaths rc_lib.StringList
27 var targetRelease string
28 var outputDir string
29 var err error
30 var configs *rc_lib.ReleaseConfigs
31
32 flag.StringVar(&top, "top", ".", "path to top of workspace")
33 flag.Var(&releaseConfigMapPaths, "map", "path to a release_config_map.textproto. may be repeated")
34 flag.StringVar(&targetRelease, "release", "trunk_staging", "TARGET_RELEASE for this build")
35 flag.StringVar(&outputDir, "out_dir", rc_lib.GetDefaultOutDir(), "basepath for the output. Multiple formats are created")
36 flag.Parse()
37
38 if err = os.Chdir(top); err != nil {
39 panic(err)
40 }
41 configs, err = rc_lib.ReadReleaseConfigMaps(releaseConfigMapPaths, targetRelease)
42 if err != nil {
43 panic(err)
44 }
45 err = os.MkdirAll(outputDir, 0775)
46 if err != nil {
47 panic(err)
48 }
49 err = configs.DumpMakefile(outputDir, targetRelease)
50 if err != nil {
51 panic(err)
52 }
53 err = configs.DumpArtifact(outputDir)
54 if err != nil {
55 panic(err)
56 }
57}