├── .gitignore ├── _config.yml ├── example ├── package.json └── src │ └── BasicGtkWindow.vala ├── src ├── BuildConfig.vala ├── ValaBuild.vala ├── FilesProcessor.vala ├── ArgumentParser.vala ├── CommandBuilder.vala └── ConfigParser.vala ├── README.md └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | vbuild -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-merlot -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Test Application", 3 | "description": "This is some test description", 4 | "version": "1.0.0-SNAPSHOT", 5 | "author": "Patrick J", 6 | "website" : "https://github.com/pddstudio/vbuild", 7 | "dependencies" : [ 8 | "gtk+-3.0" 9 | ], 10 | "scripts": { 11 | "run" : "./ {}" 12 | }, 13 | "compiler" : { 14 | "flags" : [ "-l somelib" ] 15 | }, 16 | "files" : [ 17 | "src/", 18 | "Test.vala" 19 | ], 20 | "binary" : "sample-binary" 21 | } 22 | -------------------------------------------------------------------------------- /example/src/BasicGtkWindow.vala: -------------------------------------------------------------------------------- 1 | using Gtk; 2 | 3 | int main (string[] args) { 4 | Gtk.init (ref args); 5 | 6 | var window = new Window (); 7 | window.title = "First GTK+ Program"; 8 | window.border_width = 10; 9 | window.window_position = WindowPosition.CENTER; 10 | window.set_default_size (350, 70); 11 | window.destroy.connect (Gtk.main_quit); 12 | 13 | var button = new Button.with_label ("Click me!"); 14 | button.clicked.connect (() => { 15 | button.label = "Thank you"; 16 | }); 17 | 18 | window.add (button); 19 | window.show_all (); 20 | 21 | Gtk.main (); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /src/BuildConfig.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Patrick J 3 | */ 4 | 5 | using Gee; 6 | 7 | namespace VBuild { 8 | 9 | public class BuildConfig : Object { 10 | 11 | public string name { get; set; } 12 | 13 | public string description { get; set; } 14 | 15 | public string version { get; set; } 16 | 17 | public string author { get; set; } 18 | 19 | public string binary { get; set; } 20 | 21 | public ArrayList dependencies { get; set; default = new ArrayList (); } 22 | 23 | public ArrayList compiler_flags { get; set; default = new ArrayList (); } 24 | 25 | public ArrayList build_files { get; set; default = new ArrayList (); } 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/ValaBuild.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Patrick J 3 | */ 4 | 5 | namespace VBuild { 6 | 7 | public class Builder : Object { 8 | 9 | private ConfigParser config_parser; 10 | 11 | public Builder() { 12 | this.config_parser = new ConfigParser (); 13 | } 14 | 15 | public void process_build_config (string location) { 16 | string? file_content = read_package_json (location); 17 | if (file_content != null) { 18 | BuildConfig build_config = config_parser.parse_configuration (file_content); 19 | trigger_build_process (build_config); 20 | } else { 21 | stdout.printf ("content is null. Aborting.\n"); 22 | } 23 | } 24 | 25 | private void trigger_build_process (BuildConfig? build_config) { 26 | if (build_config != null) { 27 | CommandBuilder.build (build_config); 28 | } 29 | } 30 | 31 | private string? read_package_json (string location) { 32 | try { 33 | string content; 34 | FileUtils.get_contents (location, out content); 35 | return content; 36 | } catch (FileError e) { 37 | stderr.printf("%s\n", e.message); 38 | return null; 39 | } 40 | } 41 | 42 | } 43 | 44 | public static int main(string[] args) { 45 | return ArgumentParser.process_command_arguments (args); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## vbuilder 2 | 3 | > A small build system for `Vala` Projects. 4 | 5 | ### Description 6 | 7 | `vbuilder` can be used to build your `Vala`-Projects. 8 | 9 | ### Usage 10 | 11 | A vala project can be build using the following command: 12 | 13 | ```bash 14 | vbuilder --build 15 | ``` 16 | 17 | This requires your project to have a `vbuilder` compatible `package.json` file in your project's root directory. 18 | 19 | For more detailed configuration instructions see the `package.json` example section below. 20 | 21 | ### Installing `vbuilder` 22 | 23 | #### From Source 24 | 25 | As of now, `vbuilder` is only available if you build it from source. 26 | 27 | To do this, follow the instructions below: 28 | 29 | ```bash 30 | git clone https://github.com/pddstudio/vbuilder 31 | cd vbuilder/ 32 | ./build.sh 33 | ``` 34 | 35 | ### Building `vbuilder` 36 | 37 | Get a copy of this repository and execute the `build.sh` located at the top of this repository. 38 | 39 | ```bash 40 | git clone https://github.com/pddstudio/vbuilder 41 | cd vbuilder/ 42 | ./build.sh 43 | ``` 44 | 45 | ### `package.json` Example 46 | 47 | Below is an example configuration with all current available fields. 48 | 49 | ```json 50 | { 51 | "name": "Test Application", 52 | "description": "This is some test description", 53 | "version": "1.0.0-SNAPSHOT", 54 | "author": "Patrick J", 55 | "website" : "https://github.com/pddstudio/vbuild", 56 | "dependencies" : [ 57 | "gtk+-3.0" 58 | ], 59 | "scripts": { 60 | "run" : "./ {}" 61 | }, 62 | "compiler" : { 63 | "flags" : [ "-l somelib" ] 64 | }, 65 | "files" : [ 66 | "src/", 67 | "Test.vala" 68 | ], 69 | "binary" : "sample-binary" 70 | } 71 | ``` 72 | 73 | ### Author 74 | 75 | * Patrick Jung [](mailto:patrick.pddstudio@gmail.com) 76 | * Google+ [Profile](https://plus.google.com/+PatrickJung42) 77 | 78 | 79 | ### License 80 | 81 | Copyright 2017 Patrick Jung 82 | 83 | Licensed under the Apache License, Version 2.0 (the "License"); 84 | you may not use this file except in compliance with the License. 85 | You may obtain a copy of the License at 86 | 87 | http://www.apache.org/licenses/LICENSE-2.0 88 | 89 | Unless required by applicable law or agreed to in writing, software 90 | distributed under the License is distributed on an "AS IS" BASIS, 91 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 92 | See the License for the specific language governing permissions and 93 | limitations under the License. 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/FilesProcessor.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Patrick J 3 | */ 4 | 5 | using Gee; 6 | using GLib; 7 | 8 | namespace VBuild { 9 | 10 | public class FilesProcessor : Object { 11 | 12 | public static ArrayList get_project_files (ArrayList files) { 13 | FilesProcessor processor = new FilesProcessor (); 14 | return processor.get_included_files (files); 15 | } 16 | 17 | private string current_directory; 18 | 19 | public FilesProcessor () { 20 | this.current_directory = Environment.get_current_dir (); 21 | } 22 | 23 | private bool is_valid_file (string file_location) { 24 | File file = File.new_for_path (file_location); 25 | string file_name = file.get_basename (); 26 | return file_name.has_suffix (".vala"); 27 | } 28 | 29 | private bool is_directory (string location) { 30 | return FileUtils.test (location, FileTest.IS_DIR); 31 | } 32 | 33 | private bool is_file (string location) { 34 | return FileUtils.test (location, FileTest.IS_REGULAR); 35 | } 36 | 37 | private string build_file_name (string file) { 38 | return Path.build_filename (current_directory, file); 39 | } 40 | 41 | private ArrayList list_files_in_directory (string location) { 42 | var files = new ArrayList (); 43 | Dir dir = Dir.open (location); 44 | string name; 45 | while ((name = dir.read_name ()) != null) { 46 | if(is_valid_file (name)) { 47 | files.add (Path.build_filename (location, name)); 48 | } 49 | } 50 | return files; 51 | } 52 | 53 | public ArrayList get_included_files (ArrayList files) { 54 | stdout.printf("Current dir: %s\n", current_directory); 55 | ArrayList project_files = new ArrayList (); 56 | 57 | foreach (string entry in files) { 58 | string location = build_file_name (entry); 59 | if (is_directory (location)) { 60 | ArrayList dir_content = list_files_in_directory (location); 61 | foreach (string dir_file in dir_content) { 62 | if(is_file (dir_file) && is_valid_file (dir_file)) { 63 | project_files.add (dir_file); 64 | } else if(is_directory (dir_file)) { 65 | //TODO 66 | } 67 | } 68 | } else if (is_file (location) && is_valid_file (location)) { 69 | project_files.add (location); 70 | } else { 71 | stdout.printf ("%s does not exist!\n", location); 72 | } 73 | } 74 | 75 | return project_files; 76 | } 77 | 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/ArgumentParser.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Patrick J 3 | */ 4 | 5 | namespace VBuild { 6 | 7 | public class ArgumentParser : Object { 8 | 9 | private static string APP_VERSION = "v0.0.1"; 10 | private static string APP_NAME = "vbuild"; 11 | 12 | private static string[] ARG_HELP = { "--help", "-h" }; 13 | private static string[] ARG_VERSION = { "--version", "-v" }; 14 | private static string[] ARG_BUILD = { "--build", "-b" }; 15 | 16 | public static int process_command_arguments (string[] args) { 17 | ArgumentParser parser = new ArgumentParser (args); 18 | if (should_show_help (args)) { 19 | parser.show_help (); 20 | } else { 21 | parser.parse_args (); 22 | } 23 | return 0; 24 | } 25 | 26 | private static bool should_show_help (string[] args) { 27 | if (args.length == 1) { 28 | return true; 29 | } else if (args.length == 2 && is_help_arg (args[1])) { 30 | return true; 31 | } 32 | return false; 33 | } 34 | 35 | private static bool is_help_arg (string arg) { 36 | foreach(string item in ARG_HELP) { 37 | if (arg == item) { 38 | return true; 39 | } 40 | } 41 | return false; 42 | } 43 | 44 | private string[] args; 45 | 46 | private ArgumentParser (string[] args) { 47 | this.args = args; 48 | } 49 | 50 | private void print_line (string message) { 51 | stdout.printf (message + "\n"); 52 | } 53 | 54 | private bool is_in_array (string[] array, string entry) { 55 | foreach(string item in array) { 56 | if(item == entry) { 57 | return true; 58 | } 59 | } 60 | return false; 61 | } 62 | 63 | private void parse_args () { 64 | if (args.length >= 2) { 65 | string arg = args[1]; 66 | if (is_in_array (ARG_HELP, arg)) { 67 | show_help (); 68 | } else if (is_in_array (ARG_VERSION, arg)) { 69 | show_version (); 70 | } else if (is_in_array (ARG_BUILD, arg)) { 71 | if(args.length < 3) { 72 | show_help (); 73 | } else { 74 | trigger_build (args[2]); 75 | } 76 | } 77 | } 78 | } 79 | 80 | private void show_help () { 81 | print_line ("vbuild - Tiny Vala Build System"); 82 | print_line (" "); 83 | print_line ("usage:"); 84 | print_line (" "); 85 | print_line ("vbuild [-h/--help] - Print this help information"); 86 | print_line ("vbuild [-v/--version] - Prints the current version"); 87 | print_line (" "); 88 | print_line ("vbuild [-b/--build] - Build a project with the given "); 89 | } 90 | 91 | private void show_version () { 92 | print_line (APP_NAME + " " + APP_VERSION); 93 | } 94 | 95 | private void trigger_build (string file_name) { 96 | Builder builder = new Builder (); 97 | builder.process_build_config (file_name); 98 | } 99 | 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/CommandBuilder.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Patrick J 3 | */ 4 | 5 | using GLib; 6 | 7 | namespace VBuild { 8 | 9 | public class CommandBuilder : Object { 10 | 11 | public static void build (BuildConfig build_config) { 12 | CommandBuilder builder = new CommandBuilder (build_config); 13 | builder.start_building (); 14 | } 15 | 16 | private static string PKG_DEPENDENCY = "--pkg"; 17 | private static string COMPILER_PARAM_OUT = "-o"; 18 | 19 | private static string VALA_COMPILER_BINARY = "valac"; 20 | 21 | private BuildConfig build_config; 22 | 23 | public CommandBuilder (BuildConfig build_config) { 24 | this.build_config = build_config; 25 | } 26 | 27 | private string build_dependencies_snippet () { 28 | var builder = new StringBuilder (); 29 | foreach (string dependency in build_config.dependencies) { 30 | builder.append ( PKG_DEPENDENCY ); 31 | builder.append ( " " ); 32 | builder.append ( dependency ); 33 | builder.append ( " " ); 34 | } 35 | return builder.str; 36 | } 37 | 38 | private bool binary_name_defined () { 39 | return build_config.binary != null; 40 | } 41 | 42 | private string build_binary_output_name () { 43 | return COMPILER_PARAM_OUT + " " + build_config.binary; 44 | } 45 | 46 | private string build_files_list () { 47 | var builder = new StringBuilder (); 48 | foreach (string file in build_config.build_files) { 49 | builder.append ( file ); 50 | builder.append ( " " ); 51 | } 52 | return builder.str; 53 | } 54 | 55 | private void execute_build_command (string build_command) { 56 | try { 57 | Process.spawn_command_line_sync (build_command); 58 | stdout.printf ("Build execution finished!\n"); 59 | } catch (SpawnError e) { 60 | stderr.printf("%s\n", e.message); 61 | } 62 | } 63 | 64 | //TODO: include compiler flags 65 | 66 | private void print_build_information () { 67 | stdout.printf ("\n"); 68 | stdout.printf ("---- BUILD SUMMARY ----\n"); 69 | stdout.printf ("Name: %s\n", build_config.name); 70 | stdout.printf ("Description: %s\n", build_config.description); 71 | stdout.printf ("Version: %s\n", build_config.version); 72 | stdout.printf ("Author: %s\n", build_config.author); 73 | stdout.printf ("---- BUILD SUMMARY ----\n"); 74 | stdout.printf ("\n"); 75 | } 76 | 77 | public void start_building () { 78 | string dep_snippet = build_dependencies_snippet (); 79 | string target_files = build_files_list (); 80 | 81 | var builder = new StringBuilder (); 82 | builder.append ( VALA_COMPILER_BINARY ); 83 | builder.append ( " " ); 84 | builder.append ( dep_snippet ); 85 | builder.append ( target_files ); 86 | 87 | if (binary_name_defined ()) { 88 | string binary_name_param = build_binary_output_name (); 89 | builder.append ( " " ); 90 | builder.append ( binary_name_param ); 91 | } 92 | 93 | print_build_information (); 94 | execute_build_command (builder.str); 95 | } 96 | 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/ConfigParser.vala: -------------------------------------------------------------------------------- 1 | /* 2 | Author: Patrick J 3 | */ 4 | 5 | using Json; 6 | using Gee; 7 | 8 | namespace VBuild { 9 | 10 | public errordomain ConfigParserError { 11 | INVALID_FORMAT 12 | } 13 | 14 | public class ConfigParser : GLib.Object { 15 | 16 | private static string[] config_fields = { "name", "description", "version", "author", "dependencies", "scripts" }; 17 | 18 | private Json.Parser parser; 19 | 20 | public ConfigParser () { 21 | this.parser = new Json.Parser (); 22 | } 23 | 24 | private bool is_valid_config_entry (string entry) { 25 | foreach (unowned string item in config_fields) { 26 | if (item == entry) { 27 | return true; 28 | } 29 | } 30 | return false; 31 | } 32 | 33 | private string? parse_object_string (Json.Object obj, string key) { 34 | string? val = obj.get_string_member (key); 35 | return val; 36 | } 37 | 38 | private Json.Array? parse_object_array (Json.Object obj, string key) { 39 | if(!obj.has_member (key)) { 40 | stdout.printf ("Member does not exist: %s\n", key); 41 | return null; 42 | } else { 43 | Json.Array? array = obj.get_array_member (key); 44 | return array; 45 | } 46 | } 47 | 48 | private ArrayList parse_object_dependencies (Json.Array? array) { 49 | var dependency_list = new ArrayList (); 50 | 51 | if(array == null) { 52 | stdout.printf ("No dependencies found. Skipping!\n"); 53 | return dependency_list; 54 | } 55 | 56 | foreach (unowned Json.Node node in array.get_elements ()) { 57 | if (node != null) { 58 | string dep = node.get_string (); 59 | dependency_list.add (dep); 60 | } else { 61 | stdout.printf("Node is null!\n"); 62 | } 63 | } 64 | return dependency_list; 65 | } 66 | 67 | private ArrayList parse_json_array (Json.Array? array) { 68 | var items = new ArrayList (); 69 | 70 | if(array != null) { 71 | foreach (unowned Json.Node node in array.get_elements ()) { 72 | if (node != null) { 73 | string item = node.get_string (); 74 | items.add (item); 75 | } 76 | } 77 | } 78 | 79 | return items; 80 | } 81 | 82 | private ArrayList parse_object_compiler (Json.Object? obj) { 83 | Json.Array compiler_flags_array = parse_object_array (obj, "flags"); 84 | ArrayList compiler_flags = parse_json_array (compiler_flags_array); 85 | return compiler_flags; 86 | } 87 | 88 | private ArrayList parse_files_array (Json.Array? array) { 89 | var files = new ArrayList (); 90 | 91 | if(array != null) { 92 | ArrayList file_list = parse_json_array (array); 93 | files = FilesProcessor.get_project_files (file_list); 94 | } 95 | 96 | return files; 97 | } 98 | 99 | private BuildConfig process (Json.Node node) throws Error { 100 | if (node.get_node_type () != Json.NodeType.OBJECT) { 101 | throw new ConfigParserError.INVALID_FORMAT ("Unexpected element type: %s", node.type_name ()); 102 | } 103 | 104 | BuildConfig build_config = new BuildConfig (); 105 | unowned Json.Object jsonObject = node.get_object (); 106 | 107 | string name = parse_object_string (jsonObject, "name"); 108 | build_config.name = name; 109 | 110 | string description = parse_object_string (jsonObject, "description"); 111 | build_config.description = description; 112 | 113 | string version = parse_object_string (jsonObject, "version"); 114 | build_config.version = version; 115 | 116 | string author = parse_object_string (jsonObject, "author"); 117 | build_config.author = author; 118 | 119 | string binary = parse_object_string (jsonObject, "binary"); 120 | build_config.binary = binary; 121 | 122 | Json.Array dependencies = parse_object_array (jsonObject, "dependencies"); 123 | ArrayList deps = parse_object_dependencies (dependencies); 124 | build_config.dependencies = deps; 125 | 126 | Json.Object compiler_flags = jsonObject.get_object_member ("compiler"); 127 | ArrayList flags = parse_object_compiler (compiler_flags); 128 | build_config.compiler_flags = flags; 129 | 130 | Json.Array files_array = parse_object_array (jsonObject, "files"); 131 | ArrayList files = parse_files_array (files_array); 132 | build_config.build_files = files; 133 | 134 | return build_config; 135 | } 136 | 137 | public BuildConfig? parse_configuration (string config) { 138 | try { 139 | parser.load_from_data (config); 140 | //get the root node of the config 141 | Json.Node root = parser.get_root (); 142 | //process the given node 143 | return process (root); 144 | } catch (Error e) { 145 | stdout.printf ("Unable to process config file: %s\n", e.message); 146 | return null; 147 | } 148 | } 149 | 150 | } 151 | 152 | } 153 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------