1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.build.jetpad;
18 
19 import java.io.Serializable;
20 import java.util.ArrayList;
21 import java.util.Objects;
22 import java.util.Set;
23 
24 /**
25  * Object outlining the format of a library's build info file.
26  * This object will be serialized to json.
27  * This file should match the corresponding class in Jetpad because
28  * this object will be serialized to json and the result will be parsed by Jetpad.
29  * DO NOT TOUCH.
30  *
31  * @property groupId library maven group Id
32  * @property artifactId library maven artifact Id
33  * @property version library maven version
34  * @property path local project directory path used for development, rooted at framework/support
35  * @property sha the sha of the latest commit to modify the library (aka a commit that
36  * touches a file within [path])
37  * @property groupIdRequiresSameVersion boolean that determines if all libraries with [groupId]
38  * have the same version
39  * @property dependencies a list of dependencies on other androidx libraries
40  * @property checks arraylist of [Check]s that is used by Jetpad
41  */
42 public final class LibraryBuildInfoFile {
43     public String groupId;
44     public String artifactId;
45     public String version;
46     public String kotlinVersion;
47     public String path;
48     public String sha;
49     public String projectZipPath;
50     public Boolean groupIdRequiresSameVersion;
51     public ArrayList<Dependency> dependencies;
52     public ArrayList<Dependency> dependencyConstraints;
53     public Boolean shouldPublishDocs;
54     public Boolean isKmp;
55     public String target;
56     public ArrayList<Check> checks;
57     public Set<String> kmpChildren;
58     public Set<String> testModuleNames;
59 
60     /**
61      * @property isTipOfTree boolean that specifies whether the dependency is tip-of-tree
62      */
63     public static final class Dependency implements Serializable {
64         public String groupId;
65         public String artifactId;
66         public String version;
67         public boolean isTipOfTree;
68         public static final long serialVersionUID = 12345L;
69 
70         @Override
equals(Object o)71         public boolean equals(Object o) {
72             if (this == o) return true;
73             if (o == null || getClass() != o.getClass()) return false;
74             Dependency that = (Dependency) o;
75             return isTipOfTree == that.isTipOfTree && groupId.equals(that.groupId)
76                     && artifactId.equals(
77                     that.artifactId) && version.equals(that.version);
78         }
79 
80         @Override
hashCode()81         public int hashCode() {
82             return Objects.hash(groupId, artifactId, version, isTipOfTree);
83         }
84     }
85 
86     public static final class Check {
87         public String name;
88         public boolean passing;
89     }
90 }
91