blob: 3c68ba19e5631cb1c9b7aeea60d2b79973b35b54 [file] [log] [blame]
// Copyright (C) 2017 Google Inc
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.googlesource.gerrit.plugins.supermanifest;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/** Refer https://fuchsia.googlesource.com/jiri/+/HEAD/manifest.md for manifest specification. */
@XmlRootElement(name = "manifest")
class JiriManifest {
@XmlElement public Imports imports;
@XmlElement public JiriProjects projects;
public JiriManifest() {
imports = new Imports();
projects = new JiriProjects();
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer("\nmanifest:\n");
buf.append(StringUtil.addTab(imports.toString()));
buf.append(StringUtil.addTab(projects.toString()));
return buf.toString();
}
static class LocalImport {
@XmlAttribute(required = true)
private String file;
@Override
public String toString() {
return file;
}
/** @return the file */
public String getFile() {
return file;
}
}
static class Import {
// Don't need all fields, as we don't use it
}
static class Imports {
@XmlElement(name = "import")
private Import[] imports;
@XmlElement(name = "localimport")
private LocalImport[] localImports;
public Imports() {
this.imports = new Import[0];
this.localImports = new LocalImport[0];
}
@Override
public String toString() {
StringBuffer buf = new StringBuffer("");
if (imports.length > 0) {
buf.append("import: " + imports.length + "\n");
}
if (localImports.length > 0) {
buf.append("localImports:\n");
for (LocalImport l : localImports) {
buf.append(StringUtil.addTab(l.toString()));
}
}
return buf.toString();
}
/** @return the imports */
public Import[] getImports() {
return imports;
}
/** @return the localImports */
public LocalImport[] getLocalImports() {
return localImports;
}
}
}