use of com.taobao.android.builder.tools.guide.AtlasConfigField in project atlas by alibaba.
the class AtlasListTask method executeTask.
@TaskAction
public void executeTask() {
Project project = getProject();
AtlasExtension atlasExtension = project.getExtensions().getByType(AtlasExtension.class);
List<AtlasConfigField> list = null;
try {
list = AtlasConfigHelper.readConfig(atlasExtension, "atlas");
} catch (Throwable e) {
e.printStackTrace();
return;
}
List<String> lines = new ArrayList<>();
lines.add(" function | The name of the configuration | type | value ");
lines.add(" ------------- | ------------- | ------------- | ------------- ");
for (AtlasConfigField configField : list) {
lines.add(configField.desc + " | " + configField.name + " | " + configField.type + " | " + configField.value);
}
for (String line : lines) {
project.getLogger().error(line);
}
File file = new File(project.getProjectDir(), "atlasConfigList.MD");
try {
FileUtils.writeLines(file, lines);
project.getLogger().error(file.getAbsolutePath() + " has generated");
} catch (IOException e) {
e.printStackTrace();
}
try {
FileUtils.write(new File(project.getProjectDir(), "atlasConfigList.json"), JSON.toJSONString(list, true));
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations