alibaba / virtualview_tools

MIT License
190 stars 44 forks source link
tangram virtualview

Attention. This project is not maintained any more !!!

VirtualView Tools

中文文档

This project is a tool library as a part of VirtualView library, used to compile XML files:

How-to

Run From CMD

Tools Introduction

Download the source code, the executable is located at folder TemplateWorkSpace. There are several files here:

File Introduction
config.properties configs of widget's ID and attribute's value type
templatelist.properties the file list of XML template
build output folder after compiling XML files
template the source code XML files
compiler.jar executable jar file exported from the total source code
buildTemplate.sh the command script to run compiler.jar
How to Run
How to Configure config.properties
How to Configure templatelist.properties
How to Write XML
Artifacts after Compiling

Use as API

Except that use as a command tool to compile file, there is an another way to compile XML data from an IDE plugin, a client, a backend service or somewhere else. So it's possible to use JAVA API to compile data, the example code is as follow:

//Build a ViewCompilerApi instance
ViewCompilerApi viewCompiler = new ViewCompilerApi();
//init a ConfigLoader to load config.properties.
viewCompiler.setConfigLoader(new LocalConfigLoader());
//read XML data from file or somewhere else
FileInputStream fis = new FileInputStream(rootDir);
//Parameters are XML data's InputStream, template name, template version
byte[] result = viewCompiler.compile(fis, "icon", 13);

Contributing

Before you open an issue or create a pull request, please read Contributing Guide first.

LICENSE

VirtualView tools is available under the MIT license.