├── flatbuffers-compiler ├── bin │ ├── linux │ │ └── flatc.zip │ ├── osx │ │ └── flatc.zip │ └── windows │ │ └── flatc.zip ├── src │ └── assembly │ │ ├── osx.xml │ │ ├── linux.xml │ │ └── windows.xml └── pom.xml ├── .gitignore ├── .github ├── dependabot.yml └── workflows │ └── ci.yml ├── example ├── src │ ├── main │ │ └── fbs │ │ │ └── monster.fbs │ └── test │ │ └── java │ │ └── example │ │ └── ExampleTest.java └── pom.xml ├── pom.xml ├── README.md └── LICENSE /flatbuffers-compiler/bin/linux/flatc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidmoten/flatbuffers/HEAD/flatbuffers-compiler/bin/linux/flatc.zip -------------------------------------------------------------------------------- /flatbuffers-compiler/bin/osx/flatc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidmoten/flatbuffers/HEAD/flatbuffers-compiler/bin/osx/flatc.zip -------------------------------------------------------------------------------- /flatbuffers-compiler/bin/windows/flatc.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidmoten/flatbuffers/HEAD/flatbuffers-compiler/bin/windows/flatc.zip -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | release.properties 7 | dependency-reduced-pom.xml 8 | buildNumber.properties 9 | .mvn/timing.properties 10 | .project 11 | .settings 12 | .classpath 13 | .DS_Store 14 | *.iml 15 | .idea/ 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "maven" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /example/src/main/fbs/monster.fbs: -------------------------------------------------------------------------------- 1 | // Example IDL file for our monster's schema. 2 | 3 | namespace example; 4 | 5 | enum Color:byte { Red = 0, Green, Blue = 2 } 6 | 7 | union Equipment { Weapon } // Optionally add more tables. 8 | 9 | struct Vec3 { 10 | x:float; 11 | y:float; 12 | z:float; 13 | } 14 | 15 | table Monster { 16 | pos:Vec3; 17 | mana:short = 150; 18 | hp:short = 100; 19 | name:string; 20 | friendly:bool = false (deprecated); 21 | inventory:[ubyte]; 22 | color:Color = Blue; 23 | weapons:[Weapon]; 24 | equipped:Equipment; 25 | } 26 | 27 | table Weapon { 28 | name:string; 29 | damage:short; 30 | } 31 | 32 | root_type Monster; 33 | -------------------------------------------------------------------------------- /flatbuffers-compiler/src/assembly/osx.xml: -------------------------------------------------------------------------------- 1 | 5 | distribution-osx 6 | false 7 | 8 | tar.gz 9 | 10 | 11 | 12 | ${project.build.directory}/osx 13 | /bin 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /flatbuffers-compiler/src/assembly/linux.xml: -------------------------------------------------------------------------------- 1 | 5 | distribution-linux 6 | false 7 | 8 | tar.gz 9 | 10 | 11 | 12 | ${project.build.directory}/linux 13 | /bin 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /flatbuffers-compiler/src/assembly/windows.xml: -------------------------------------------------------------------------------- 1 | 5 | distribution-windows 6 | false 7 | 8 | zip 9 | 10 | 11 | 12 | ${project.build.directory}/windows 13 | /bin 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | ## Does continuous integration build with Java 8 and 11 and 4 | ## if succeeds and due to a dependabot pull request (minor or 5 | ## patch verson change) it will automatically merge the PR. 6 | 7 | ## Unlike many sample automerge workflows this does not rely 8 | ## on third-party libraries apart from the official dependabot 9 | ## repository ones. This reduces the security risk significantly 10 | ## (we don't want to unknowingly merge malicious code or expose 11 | ## secrets to a malicious third party). 12 | 13 | on: [push, pull_request] 14 | 15 | jobs: 16 | build: 17 | runs-on: ubuntu-latest 18 | strategy: 19 | matrix: 20 | java: ['8', '11', '17'] 21 | steps: 22 | - uses: actions/checkout@v2 23 | - name: Set up JDK ${{ matrix.java }} 24 | uses: actions/setup-java@v2 25 | with: 26 | java-version: ${{ matrix.java }} 27 | distribution: 'adopt' 28 | - name: Build with Maven 29 | run: mvn --batch-mode --update-snapshots verify 30 | - uses: codecov/codecov-action@v1 31 | with: 32 | file: ./**/target/site/jacoco/jacoco.xml 33 | name: codecov 34 | dependabot: 35 | runs-on: ubuntu-latest 36 | needs: build 37 | permissions: 38 | pull-requests: write 39 | contents: write 40 | if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }} 41 | steps: 42 | - name: Dependabot metadata 43 | id: metadata 44 | uses: dependabot/fetch-metadata@v1.1.1 45 | with: 46 | github-token: "${{ secrets.GITHUB_TOKEN }}" 47 | - name: Enable auto-merge for Dependabot PRs 48 | if: ${{!contains(steps.metadata.outputs.dependency-names, 'maven-plugin-api') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch')}} 49 | run: gh pr merge --auto --rebase "$PR_URL" 50 | env: 51 | PR_URL: ${{github.event.pull_request.html_url}} 52 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 53 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.github.davidmoten 5 | sonatype-parent 6 | 0.2.4 7 | 8 | flatbuffers-parent 9 | pom 10 | 2.0.9-SNAPSHOT 11 | artifacts for use with flatbuffers including repackaged builds of google flatbuffers source code 12 | 13 | 1.3.0 14 | scm:git:https://github.com/davidmoten/flatbuffers-compiler.git 15 | 16 | 17 | 18 | 19 | The Apache Software License, Version 2.0 20 | http://www.apache.org/licenses/LICENSE-2.0.txt 21 | repo 22 | A business-friendly OSS license 23 | 24 | 25 | 26 | 27 | Travis 28 | https://travis-ci.org/davidmoten/flatbuffers 29 | 30 | 31 | 32 | GitHub 33 | https://github.com/davidmoten/flatbuffers/issues 34 | 35 | 36 | 2016 37 | 38 | 39 | dave 40 | Dave Moten 41 | https://github.com/davidmoten/ 42 | 43 | architect 44 | developer 45 | 46 | +10 47 | 48 | 49 | 50 | 51 | ${scm.url} 52 | ${scm.url} 53 | ${scm.url} 54 | HEAD 55 | 56 | 57 | 58 | flatbuffers-compiler 59 | example 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /flatbuffers-compiler/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.github.davidmoten 5 | flatbuffers-parent 6 | 2.0.9-SNAPSHOT 7 | 8 | flatbuffers-compiler 9 | pom 10 | Compressed archive of binaries for flatbuffers particularly flatc for generating classes. Multiple platforms supported vi different classifications. 11 | 12 | 13 | 14 | 15 | maven-antrun-plugin 16 | 3.2.0 17 | 18 | 19 | generate-resources 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | run 32 | 33 | 34 | 35 | 36 | 37 | maven-assembly-plugin 38 | 3.8.0 39 | 40 | 41 | src/assembly/linux.xml 42 | src/assembly/osx.xml 43 | src/assembly/windows.xml 44 | 45 | 46 | 47 | 48 | make-assembly 49 | package 50 | 51 | single 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /example/src/test/java/example/ExampleTest.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import java.nio.ByteBuffer; 4 | 5 | import org.junit.Test; 6 | 7 | import com.google.flatbuffers.FlatBufferBuilder; 8 | 9 | public class ExampleTest { 10 | 11 | @Test 12 | public void test() { 13 | FlatBufferBuilder builder = new FlatBufferBuilder(0); 14 | 15 | // Create some weapons for our Monster ('Sword' and 'Axe'). 16 | int weaponOneName = builder.createString("Sword"); 17 | short weaponOneDamage = 3; 18 | int weaponTwoName = builder.createString("Axe"); 19 | short weaponTwoDamage = 5; 20 | 21 | // Use the `createWeapon()` helper function to create the weapons, since we set every field. 22 | int[] weaps = new int[2]; 23 | weaps[0] = Weapon.createWeapon(builder, weaponOneName, weaponOneDamage); 24 | weaps[1] = Weapon.createWeapon(builder, weaponTwoName, weaponTwoDamage); 25 | 26 | // Serialize the FlatBuffer data. 27 | int name = builder.createString("Orc"); 28 | byte[] treasure = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; 29 | int inv = Monster.createInventoryVector(builder, treasure); 30 | int weapons = Monster.createWeaponsVector(builder, weaps); 31 | int pos = Vec3.createVec3(builder, 1.0f, 2.0f, 3.0f); 32 | 33 | Monster.startMonster(builder); 34 | Monster.addPos(builder, pos); 35 | Monster.addName(builder, name); 36 | Monster.addColor(builder, Color.Red); 37 | Monster.addHp(builder, (short)300); 38 | Monster.addInventory(builder, inv); 39 | Monster.addWeapons(builder, weapons); 40 | Monster.addEquippedType(builder, Equipment.Weapon); 41 | Monster.addEquipped(builder, weaps[1]); 42 | int orc = Monster.endMonster(builder); 43 | 44 | builder.finish(orc); // You could also call `Monster.finishMonsterBuffer(builder, orc);`. 45 | 46 | // We now have a FlatBuffer that can be stored on disk or sent over a network. 47 | 48 | // ...Code to store to disk or send over a network goes here... 49 | 50 | // Instead, we are going to access it right away, as if we just received it. 51 | 52 | ByteBuffer buf = builder.dataBuffer(); 53 | 54 | // Get access to the root: 55 | Monster monster = Monster.getRootAsMonster(buf); 56 | 57 | // Note: We did not set the `mana` field explicitly, so we get back the default value. 58 | assert monster.mana() == (short)150; 59 | assert monster.hp() == (short)300; 60 | assert monster.name().equals("Orc"); 61 | assert monster.color() == Color.Red; 62 | assert monster.pos().x() == 1.0f; 63 | assert monster.pos().y() == 2.0f; 64 | assert monster.pos().z() == 3.0f; 65 | 66 | // Get and test the `inventory` FlatBuffer `vector`. 67 | for (int i = 0; i < monster.inventoryLength(); i++) { 68 | assert monster.inventory(i) == (byte)i; 69 | } 70 | 71 | // Get and test the `weapons` FlatBuffer `vector` of `table`s. 72 | String[] expectedWeaponNames = {"Sword", "Axe"}; 73 | int[] expectedWeaponDamages = {3, 5}; 74 | for (int i = 0; i < monster.weaponsLength(); i++) { 75 | assert monster.weapons(i).name().equals(expectedWeaponNames[i]); 76 | assert monster.weapons(i).damage() == expectedWeaponDamages[i]; 77 | } 78 | 79 | // Get and test the `equipped` FlatBuffer `union`. 80 | assert monster.equippedType() == Equipment.Weapon; 81 | Weapon equipped = (Weapon)monster.equipped(new Weapon()); 82 | assert equipped.name().equals("Axe"); 83 | assert equipped.damage() == 5; 84 | 85 | System.out.println("The FlatBuffer was successfully created and verified!"); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | com.github.davidmoten 5 | flatbuffers-parent 6 | 2.0.9-SNAPSHOT 7 | 8 | example 9 | Example project demonstrating generating sources using flatc and running a test with the generated classes using the flatbuffers-java runtime library 10 | 11 | 12 | ${basedir}/src/main/fbs 13 | ${project.build.directory}/generated-sources/java 14 | UTF-8 15 | 16 | 17 | 18 | 19 | com.google.flatbuffers 20 | flatbuffers-java 21 | 2.0.8 22 | 23 | 24 | 25 | 26 | junit 27 | junit 28 | 4.13.2 29 | test 30 | 31 | 32 | 33 | 34 | 35 | 36 | maven-compiler-plugin 37 | 3.14.1 38 | 39 | 1.8 40 | 1.8 41 | 42 | 43 | 44 | org.apache.maven.plugins 45 | maven-dependency-plugin 46 | 3.9.0 47 | 48 | 49 | unpack 50 | generate-sources 51 | 52 | unpack 53 | 54 | 55 | 56 | 57 | com.github.davidmoten 58 | flatbuffers-compiler 59 | ${project.version} 60 | tar.gz 61 | distribution-linux 62 | true 63 | ${project.build.directory} 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | org.codehaus.mojo 72 | exec-maven-plugin 73 | 3.6.2 74 | 75 | 76 | 77 | exec 78 | 79 | generate-sources 80 | 81 | 82 | 83 | ${project.build.directory}/bin/flatc 84 | 85 | ${fbs.sources} 86 | 87 | --java 88 | --gen-mutable 89 | -o 90 | ${fbs.generated.sources} 91 | monster.fbs 92 | 93 | 94 | 95 | 96 | org.codehaus.mojo 97 | build-helper-maven-plugin 98 | 3.6.1 99 | 100 | 101 | add-source 102 | generate-sources 103 | 104 | add-source 105 | 106 | 107 | 108 | ${fbs.generated.sources} 109 | 110 | 111 | 112 | 113 | 114 | 115 | org.apache.maven.plugins 116 | maven-deploy-plugin 117 | 3.1.4 118 | 119 | true 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flatbuffers 2 |
3 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.davidmoten/flatbuffers-parent/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.github.davidmoten/flatbuffers-parent)
4 | 5 | Maven artifacts for use with [flatbuffers](https://github.com/google/flatbuffers). 6 | 7 | For years the Google flatbuffers project team did not publish artifacts of any sort for flatbuffers to repositories like Maven Central. Users were expected to build from source. In May 2021 Google started publishing the built artifacts as downloads from their [releases](https://github.com/google/flatbuffers/releases) page but did not wrap them as Maven artifacts. This project shortcuts these actions for you and allows you to do all using Maven artifacts from Maven Central. 8 | 9 | * Supports flatbuffers 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.10, 1.12, 2.0.3 10 | * Supports Java 1.6+ (Java 8 for 1.10+) 11 | 12 | Status: *released to Maven Central* 13 | 14 | ## Versioning 15 | The artifacts carry versions like 1.6.0.3 which correspond to a 0.3 release of the flatbuffers [1.6.0 release](https://github.com/google/flatbuffers/releases/tag/v1.6.0) (from google). 16 | 17 | Current versions: 18 | 19 | | flatbuffers-compiler, flatbuffers-java | Supports | 20 | | ----------------------------------------- | -------- | 21 | | 1.3.0.1 | 1.3 | 22 | | 1.4.0.1 | 1.4 | 23 | | 1.5.0.3 | 1.5 | 24 | | 1.6.0.3 | 1.6 | 25 | | 1.7.0.1 | 1.7 | 26 | | 1.8.0.1 | 1.8 | 27 | | 1.10.0.2 | 1.10 | 28 | | 1.12.0.1 | 1.12 | 29 | | 2.0.3.2 | 2.0.3 | 30 | | 2.0.8 | 2.0.8 | 31 | 32 | ## flatbuffers-compiler 33 | Contains compiled binaries to generate java classes (and other) from flatbuffers schema files: 34 | 35 | * linux (x86 64-bit) (*tar.gz* artifact) 36 | * osx (*tar.gz* artifact) (from 1.6, 1.7 will be supported in 1.7.0.2+) 37 | * windows (*zip* artifact) 38 | 39 | This artifact is used with *maven-dependency-plugin* to unpack, *maven-exec-plugin* to execute and *build-helper-maven-plugin* to add the generated source to the build path. See [example project](example) for details. 40 | 41 | ## flatbuffers-java 42 | Runtime library artifact for use with flatbuffers generated java classes. 43 | 44 | ```xml 45 | 46 | com.google.flatbuffers 47 | flatbuffers-java 48 | 2.0.3 49 | 50 | ``` 51 | 52 | ## Example usage 53 | See [example project](example) which is also used to unit test the artifacts. 54 | 55 | Essentially you add this block of xml to the build/plugins section of your pom.xml to generate flatbuffers classes (java): 56 | 57 | ```xml 58 | 59 | org.apache.maven.plugins 60 | maven-dependency-plugin 61 | 2.10 62 | 63 | 64 | unpack 65 | generate-sources 66 | 67 | unpack 68 | 69 | 70 | 71 | 72 | com.github.davidmoten 73 | flatbuffers-compiler 74 | 2.0.3.1 75 | tar.gz 76 | distribution-linux 77 | true 78 | ${project.build.directory} 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | org.codehaus.mojo 87 | exec-maven-plugin 88 | 1.6.0 89 | 90 | 91 | 92 | exec 93 | 94 | generate-sources 95 | 96 | 97 | 98 | ${project.build.directory}/bin/flatc 99 | ${fbs.sources} 100 | 101 | --java 102 | --gen-mutable 103 | -o 104 | ${fbs.generated.sources} 105 | monster.fbs 106 | 107 | 108 | 109 | 110 | org.codehaus.mojo 111 | build-helper-maven-plugin 112 | 3.1.0 113 | 114 | 115 | add-source 116 | generate-sources 117 | 118 | add-source 119 | 120 | 121 | 122 | ${fbs.generated.sources} 123 | 124 | 125 | 126 | 127 | 128 | ``` 129 | 130 | If you run the build on different operating systems, you can use kr.motd.maven:os-maven-plugin Maven extension to make 131 | Maven download binaries specifically for your operating system. 132 | 133 | ```xml 134 | 135 | 136 | 137 | kr.motd.maven 138 | os-maven-plugin 139 | 1.7.1 140 | 141 | 142 | 143 | 144 | org.apache.maven.plugins 145 | maven-dependency-plugin 146 | 2.10 147 | 148 | 149 | unpack 150 | generate-sources 151 | 152 | unpack 153 | 154 | 155 | 156 | 157 | com.github.davidmoten 158 | flatbuffers-compiler 159 | 2.0.3.1 160 | tar.gz 161 | distribution-${os.detected.name} 162 | true 163 | ${project.build.directory} 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | ``` 173 | 174 | There are a couple of properties mentioned in the xml block above. I set them to these values for my projects: 175 | 176 | ```xml 177 | 178 | ${basedir}/src/main/fbs 179 | ${project.build.directory}/generated-sources/java 180 | 181 | ``` 182 | 183 | To use the generated classes you'll need the runtime dependency *flatbuffers-java*. Add the following to the dependencies section in pom.xml: 184 | 185 | ```xml 186 | 187 | com.github.davidmoten 188 | flatbuffers-java 189 | 1.12.0.1 190 | 191 | ``` 192 | 193 | ## How to build the binaries that are placed in this artifact 194 | You don't need to do this (it's why this artifact exists!): 195 | 196 | Note that google now makes available the binaries for each platform at [https://github.com/google/flatbuffers/releases]. Just download them from there and replace the zip files in flatbuffers-compiler/bin. 197 | 198 | ```bash 199 | sudo apt-get install cmake 200 | git clone https://github.com/google/flatbuffers.git 201 | git checkout vN.N.N 202 | 203 | ## for flatbuffers < 1.9.0 204 | cd flatbuffers 205 | mkdir build 206 | cd build 207 | cmake .. 208 | 209 | ## for flatbuffers >= 1.9.0 on xenial 210 | cmake . 211 | make 212 | mkdir bin 213 | cp flat* bin 214 | cp libflat* bin 215 | ``` 216 | The `flatbuffers/build/bin` directory now contains the binaries that are placed in the bin directory of this artifact. 217 | 218 | In addition, the java source classes need to be copied from `flatbuffers/java`(google repo) into `flatbuffers/flatbuffers-java/src/main/java`. 219 | 220 | To generate java sources manually here's an example: 221 | ```bash 222 | cd src/fbs 223 | ../../bin/flatc --java --gen-mutable -o ../../target/generated-sources/java monster.fbs 224 | ``` 225 | 226 | ### For project maintainers 227 | To update this project with executables for a new version of flatbuffers: 228 | * copy the files in `flatbuffers/build/bin` above to `flatbuffers-compiler/bin/linux/` 229 | * download `flatc_windows_exe.zip` from [releases](https://github.com/google/flatbuffers/releases), unpack it and copy `flatc.exe` to `flatbuffers-compiler/bin/windows/` 230 | * update the google flatbuffers-java dependency in example/pom.xml to latest 231 | * build and release! 232 | 233 | 234 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------