1package entities
2
3import (
4	"repodiff/constants"
5)
6
7type Project struct {
8	URL    string `json:"url"`
9	Branch string `json:"branch"`
10}
11
12type DiffTarget struct {
13	Upstream   Project `json:"upstream"`
14	Downstream Project `json:"downstream"`
15}
16
17type ApplicationConfig struct {
18	OutputDirectory   string       `json:"output_directory"`
19	AndroidProjectDir string       `json:"android_project_dir"`
20	DiffScript        string       `json:"diff_script"`
21	DiffTargets       []DiffTarget `json:"diff_targets"`
22	Port              int          `json:"port"`
23	CommonUpstream    Project      `json:"common_upstream"`
24}
25
26type DiffRow struct {
27	Date                 string
28	DownstreamProject    string
29	UpstreamProject      string
30	DiffStatus           int
31	FilesChanged         int
32	LineInsertions       int
33	LineDeletions        int
34	LineChanges          int
35	CommitsNotUpstreamed int
36	DBInsertTimestamp    int64
37}
38
39type AnalyzedDiffRow struct {
40	DiffRow
41	Type constants.ProjectType
42}
43
44type CommitRow struct {
45	Date              string
46	Commit            string
47	DownstreamProject string
48	Author            string
49	Subject           string
50}
51
52type AnalyzedCommitRow struct {
53	CommitRow
54	Type constants.ProjectType
55}
56
57type MappedDiffTarget struct {
58	UpstreamTarget   int16
59	DownstreamTarget int16
60}
61
62type StatusMessage struct {
63	JobStatus string
64	Meta      string
65}
66
67type remote struct {
68	Text   string `xml:",chardata"`
69	Fetch  string `xml:"fetch,attr"`
70	Name   string `xml:"name,attr"`
71	Review string `xml:"review,attr"`
72}
73
74// "default" is the actual corresponding name in the XML tree but is also a reserved keyword in Golang; renamed as "defaultXML"
75type defaultXML struct {
76	Text       string `xml:",chardata"`
77	DestBranch string `xml:"dest-branch,attr"`
78	Remote     string `xml:"remote,attr"`
79	Revision   string `xml:"revision,attr"`
80	SyncJ      string `xml:"sync-j,attr"`
81}
82
83type manifestServer struct {
84	Text string `xml:",chardata"`
85	URL  string `xml:"url,attr"`
86}
87
88type copyFile struct {
89	Text string `xml:",chardata"`
90	Dest string `xml:"dest,attr"`
91	Src  string `xml:"src,attr"`
92}
93
94type linkFile struct {
95	Text string `xml:",chardata"`
96	Dest string `xml:"dest,attr"`
97	Src  string `xml:"src,attr"`
98}
99
100type ManifestProject struct {
101	Text       string     `xml:",chardata"`
102	Groups     string     `xml:"groups,attr"`
103	Name       string     `xml:"name,attr"`
104	CloneDepth string     `xml:"clone-depth,attr"`
105	Path       string     `xml:"path,attr"`
106	Copyfile   copyFile   `xml:"copyfile"`
107	Linkfile   []linkFile `xml:"linkfile"`
108}
109
110type repoHooks struct {
111	Text        string `xml:",chardata"`
112	EnabledList string `xml:"enabled-list,attr"`
113	InProject   string `xml:"in-project,attr"`
114}
115
116type ManifestFile struct {
117	Text           string            `xml:",chardata"`
118	Remote         remote            `xml:"remote"`
119	Default        defaultXML        `xml:"default"`
120	ManifestServer manifestServer    `xml:"manifest-server"`
121	Projects       []ManifestProject `xml:"project"`
122	RepoHooks      repoHooks         `xml:"repo-hooks"`
123}
124
125type ManifestFileGroup struct {
126	Common     ManifestFile
127	Upstream   ManifestFile
128	Downstream ManifestFile
129}
130
131type RepoTimestamp int64
132