Full Code of uber/stylist for AI

master e198d4bde23d cached
64 files
128.6 KB
32.9k tokens
7 symbols
1 requests
Download .txt
Repository: uber/stylist
Branch: master
Commit: e198d4bde23d
Files: 64
Total size: 128.6 KB

Directory structure:
gitextract_zfjguc9g/

├── .buildscript/
│   └── deploy_snapshot.sh
├── .editorconfig
├── .github/
│   ├── ISSUE_TEMPLATE.md
│   └── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── RELEASING.md
├── build.gradle
├── buildSrc/
│   ├── build.gradle
│   └── settings.gradle
├── config/
│   ├── checkstyle/
│   │   ├── checkstyle-suppressions.xml
│   │   ├── checkstyle-test.xml
│   │   └── checkstyle.xml
│   └── lint/
│       └── lint.xml
├── gradle/
│   ├── checkstyle.gradle
│   ├── dependencies.gradle
│   ├── gradle-mvn-push.gradle
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── sample/
│   ├── app/
│   │   ├── build.gradle
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── uber/
│   │           │           └── stylist/
│   │           │               └── myapplication/
│   │           │                   └── MainActivity.java
│   │           └── res/
│   │               ├── drawable/
│   │               │   └── divider.xml
│   │               ├── layout/
│   │               │   └── activity_main.xml
│   │               ├── mipmap-anydpi-v26/
│   │               │   ├── ic_launcher.xml
│   │               │   └── ic_launcher_round.xml
│   │               └── values/
│   │                   ├── colors.xml
│   │                   ├── dimens.xml
│   │                   ├── ic_launcher_background.xml
│   │                   ├── strings.xml
│   │                   └── themes.xml
│   ├── library/
│   │   ├── build.gradle
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── uber/
│   │           │           └── stylist/
│   │           │               └── mylibrary/
│   │           │                   └── MyUtils.java
│   │           └── res/
│   │               └── values/
│   │                   ├── attrs.xml
│   │                   └── strings.xml
│   └── providers/
│       ├── build.gradle
│       └── src/
│           └── main/
│               └── java/
│                   └── com/
│                       └── uber/
│                           └── stylist/
│                               └── myproviders/
│                                   └── SampleThemeStencilProvider.java
├── settings.gradle
├── stylist/
│   ├── build.gradle
│   ├── gradle.properties
│   └── src/
│       └── main/
│           ├── kotlin/
│           │   └── com/
│           │       └── uber/
│           │           └── stylist/
│           │               ├── StylistExtension.kt
│           │               ├── StylistPlugin.kt
│           │               ├── StylistTask.kt
│           │               └── internal/
│           │                   └── util/
│           │                       └── Util.kt
│           └── resources/
│               └── META-INF/
│                   └── gradle-plugins/
│                       └── com.uber.stylist.properties
├── stylist-api/
│   ├── build.gradle
│   ├── gradle.properties
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── uber/
│                       └── stylist/
│                           └── api/
│                               ├── StyleItem.kt
│                               ├── StyleItemGroup.kt
│                               ├── ThemeStencil.kt
│                               ├── ThemeStencilProvider.kt
│                               └── ThemeStencilService.kt
└── stylist-core/
    ├── build.gradle
    ├── gradle.properties
    └── src/
        ├── main/
        │   └── kotlin/
        │       └── com/
        │           └── uber/
        │               └── stylist/
        │                   └── Stylist.kt
        └── test/
            └── kotlin/
                └── com/
                    └── uber/
                        └── stylist/
                            └── StylistTest.kt

================================================
FILE CONTENTS
================================================

================================================
FILE: .buildscript/deploy_snapshot.sh
================================================
#!/bin/bash
#
# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.
#
# Adapted from https://coderwall.com/p/9b_lfq and
# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/

SLUG="uber/stylist"
JDK="oraclejdk8"
BRANCH="master"

set -e

if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then
  echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'."
elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
  echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  echo "Skipping snapshot deployment: was pull request."
elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
  echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
else
  echo "Deploying snapshot..."
  ./gradlew clean uploadArchives -Dorg.gradle.parallel=false
  echo "Snapshot deployed!"
fi


================================================
FILE: .editorconfig
================================================
[*.{kt,kts}]
# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
indent_size=2
continuation_indent_size=4
insert_final_newline=true
# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
max_line_length=off


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
Thanks for using Stylist. Before you create an issue, please consider the following points:

  - [ ] If you think you found a bug, please include a code sample that reproduces the problem. A test case that reproduces the issue is preferred. A stack trace alone is ok but may not contain enough context for us to address the issue.

  - [ ] Please include the library version number, including the minor and patch version, in the issue text.


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
Thank you for contributing to Stylist. Before pressing the "Create Pull Request" button, please provide the following:

  - [ ] A description about what and why you are contributing, even if it's trivial.

  - [ ] The issue number(s) or PR number(s) in the description if you are contributing in response to those.

  - [ ] If applicable, unit tests.


================================================
FILE: .gitignore
================================================
###OSX###

.DS_Store
.AppleDouble
.LSOverride

# Icon must ends with two \r.
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes


###Linux###

*~

# KDE directory preferences
.directory


###Android###

# Built application files
*.apk
*.ap_

# Files for ART and Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
.gradletasknamecache
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Lint
lint-report.html
lint-report_files/
lint_result.txt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


###IntelliJ###

*.iml
*.ipr
*.iws
.idea/


###Eclipse###

*.pydevproject
.metadata
tmp/
*.tmp
*.bak
*.swp
*~.nib
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse

# kotlin
annotations/


================================================
FILE: .travis.yml
================================================
language: android

android:
  components:
    - tools
    - platform-tools
    - build-tools-28.0.3
    - android-28
    - extra-android-m2repository

jdk:
  - oraclejdk8

script:
  - ./gradlew assembleDebug test check

after_success:
  - .buildscript/deploy_snapshot.sh

env:
  global:
    - secure: UiOM+Qr3ghDO6QyWmXcPpBmbuBe80OqLBM6+g7r+elbWjLgcsvaS4tsOuPJnvX+SSzgrUnMJLruzw0w7JXDGCtDsxR/ygN5+C/YkjVjEA0qyCDaTnJQVh9tYVwBy4zbaSaRFMVAxleBQwR1OjMetLMMTsOR8q7YpUt1I6AJzcQGUscobbEOks7TiWUNX21kDzjWbyV5sC/xPx52uAi4SVJJosExlnRz8THGBSTl7COMxE4yw5XksDw/BYDi8A8y21GP0tqgo8wdE3NTpfdMylhkOMwL5cYBAjxudAWn8XtfG54pRYjyFjdgQpKNcDM2JLUE7IjQ+DrC2DvjMKaATWHmohGOZZmb4gYCONoLZyR4UsnMObvKFpooc8401wHxPZ3Yk4vFNMJH1Nik/KsCnV0PITPVrEn135XVsjdwkR8Ntl7f2DVqOHfJrJhEtU+QnSQhAOK5+S/TAGPVlbRhDKpLxfnMZh61tqgfZFBqWFsDtmuq4B8A/FmffFzPstzMWv+/sp6xAXgVfK+UvSBGifm3RgayXpO4qDi7nt38w2lyhQVtgrXLtZVqBKGzvRJRIAQgoe8MJprbU2z90xKPj8smkOMkIGAsdbSEgyC3QrrJMWGKv1rFfpZT7AhyVRsZlb4FAEKEInE0MCRudMWRdI8S+X+rqbRXaQQvwCkd/DXA=
    - secure: Fo9GFxUsipCp5n4KuOK8ap6NTEV9Vt8a8dqUi+/ZgQQcFeNEUhg79h88DnVxTUZTVfB4VNWz5L2uOdhNIcBn3UCkW+I56obDc4VC85QJoZCOyagTQueLLExcklLdxyTMK2577d8P9bVsqLX7oNfnGI7y/6Z2Vh5u/kNfOOR6GkeFuP9ptX34TrCv0JDBrwuBgCPz+/daDiFFEpNDjGahWjSIZ8rs91gh4QGIWZk1tq3czP+3Biuj6Urk78RFO+UM9QlXk0Ayl6brodjGCjlRzjITzkKWaD7o+mw1EDRimkgTT0HwiiSEJJgQhxPwyIL4M4r7cKLUmx86FEgVtLY/tOcylNwYWEsotW4NIeiWZDG4kOFZQjoBhsvzGgS23r9aUQi03eYjDQ2SDTurH/DSe2IEm6BVaDDBOIA88FoU040TbiSf59OwSic1S+UlMRGUxmG/r69g+RVG6CZMUxTI2ypHtpAK3Sv2oR7GNcIOeAciwDCuNATBy60x13zyWnXI0mbmFBe7o0YqqwCO4ANxCX9agNdQ7E5IqdHZv7TF7DZfVo2skmyM4DI1oRN82icCDdw1QmdIfw2okq4D5c2Deuc0gRnZU/iXIUgKenkxcnjd0BeUUHe4eioR4ihCSHqwkIyI/zWYIaekRQ8Lz3w+ov2XKK1zCqeMcN+9OcroWkc=

branches:
  except:
    - gh-pages

notifications:
  email: false

cache:
  directories:
    - $HOME/.gradle


================================================
FILE: CHANGELOG.md
================================================
Changelog
=========

Version 0.0.2
-------------

_2018-12-03_

* **Breaking change:** Project migrated to [AndroidX](https://developer.android.com/jetpack/androidx/). See the [class and package mappings](https://developer.android.com/jetpack/androidx/migrate) for help migrating
* **Breaking change:** `com.commit451.uresourcespoet.StyleItem` moved to `com.uber.stylist.api.StyleItem`

Version 0.0.1
-------------

_2018-08-22_

* Initial release


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mobile-open-source@uber.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/


================================================
FILE: CONTRIBUTING.md
================================================
Contributing to Uber's Android Template
=======================

Uber welcomes contributions of all kinds and sizes. This includes everything from from simple bug reports to large features.

Workflow
--------

We love GitHub issues!

For small feature requests, an issue first proposing it for discussion or demo implementation in a PR suffice.

For big features, please open an issue so that we can agree on the direction, and hopefully avoid investing a lot of time on a feature that might need reworking.

Small pull requests for things like typos, bug fixes, etc are always welcome.

DOs and DON'Ts
--------------

* DO follow our [coding style](https://github.com/uber/java-code-styles) 
* DO include tests when adding new features. When fixing bugs, start with adding a test that highlights how the current behavior is broken.
* DO keep the discussions focused. When a new or related topic comes up it's often better to create new issue than to side track the discussion.

* DON'T submit PRs that alter licensing related files or headers. If you believe there's a problem with them, file an issue and we'll be happy to discuss it.

Guiding Principles
------------------

* We allow anyone to participate in our projects. Tasks can be carried out by anyone that demonstrates the capability to complete them
* Always be respectful of one another. Assume the best in others and act with empathy at all times
* Collaborate closely with individuals maintaining the project or experienced users. Getting ideas out in the open and seeing a proposal before it's a pull request helps reduce redundancy and ensures we're all connected to the decision making process


================================================
FILE: LICENSE.txt
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   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.


================================================
FILE: README.md
================================================
# Stylist [![Build Status](https://travis-ci.org/uber/stylist.svg?branch=master)](https://travis-ci.org/uber/stylist)

As Android apps grow, providing common styling across app themes becomes challenging. Typically, this results in copy-pasting style items across themes, monolithic themes, or complicated inheritance trees. Stylist is a highly-extensible platform for creating and maintaining an app’s base set of Android XML themes.

## Overview

Stylist is a Gradle plugin written in Kotlin that generates a base set of Android XML themes. Stylist-generated themes are created using a stencil and trait system. Each theme is declared with a single stencil, which is comprised of sets of logically-grouped style items. All of this comes together to create an easily maintainable system of stencils and traits.

*ThemeStencils*: A 1:1 ratio of `ThemeStencil`s to corresponding generated themes. Each `ThemeStencil` declares a theme name and parent theme plus any extra `StyleItemGroup`s that should be included in addition to the globally applicable set.

*StyleItemGroups*: Each `StyleItemGroup` can be declared by multiple `ThemeStencil`s and generate otherwise duplicated style items across all themes that include them. Common examples include default app colors, font sizes, and common dimension values. They are a logical groupings of custom theme attributes that get included in each theme that declares the group.

## Usage

A simple `ThemeStencilProvider` that defines text sizes in Dark and Light themes would look like:

```kotlin
@AutoService(ThemeStencilProvider::class)
class SampleThemeStencilProvider : ThemeStencilProvider {

  private val textSizes = StyleItemGroup(
      StyleItem("textSizeSmall", "12dp"),
      StyleItem("textSizeMedium","16dp"),
      StyleItem("textSizeLarge", "20dp")
  )

  override fun stencils() = linkedSetOf(
      ThemeStencil("Theme.Sample.Dark", "Theme.AppCompat"),
      ThemeStencil("Theme.Sample.Light", "Theme.AppCompat.Light")
  )

  override fun globalStyleItemGroups() = linkedSetOf(
      textSizes
  )
}
```

Leaving you with a generated themes XML resource file like this:

```xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
  <style name="Theme.Sample.Dark" parent="Theme.AppCompat">
    <item name="textSizeSmall">12dp</item>
    <item name="textSizeMedium">16dp</item>
    <item name="textSizeLarge">20dp</item>
  </style>
  <style name="Theme.Sample.Light" parent="Theme.AppCompat.Light">
    <item name="textSizeSmall">12dp</item>
    <item name="textSizeMedium">16dp</item>
    <item name="textSizeLarge">20dp</item>
  </style>
</resources>
```

This may look like a lot of boilerplate for simple style item shared by two themes, but it scales quite well when you want to have many custom color, dimension, and other style items on _numerous_ app themes and custom theme attributes.

## Download

Stylist [![Maven Central](https://img.shields.io/maven-central/v/com.uber.stylist/stylist.svg)](https://mvnrepository.com/artifact/com.uber.stylist/stylist)
```gradle
classpath 'com.uber.stylist:stylist:0.0.2'
```

Stylist Core [![Maven Central](https://img.shields.io/maven-central/v/com.uber.stylist/stylist-core.svg)](https://mvnrepository.com/artifact/com.uber.stylist/stylist-core)
```gradle
classpath 'com.uber.stylist:stylist-core:0.0.2'
```

Stylist API [![Maven Central](https://img.shields.io/maven-central/v/com.uber.stylist/stylist-api.svg)](https://mvnrepository.com/artifact/com.uber.stylist/stylist-api)
```gradle
classpath 'com.uber.stylist:stylist-api:0.0.2'
```

## License

```
Copyright (C) 2018 Uber Technologies

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.
```


================================================
FILE: RELEASING.md
================================================
Releasing
=========

 1. Change the version in `gradle.properties` to a non-SNAPSHOT version.
 2. Update the `CHANGELOG.md` for the impending release.
 3. Update the `README.md` with the new version.
 4. `git commit -am "Prepare for release X.Y.Z"` (where X.Y.Z is the new version)
 5. `git tag -a X.Y.Z -m "Version X.Y.Z"` (where X.Y.Z is the new version)
 6. `./gradlew clean uploadArchives -Dorg.gradle.parallel=false`
 7. Update the `gradle.properties` to the next SNAPSHOT version.
 8. `git commit -am "Prepare next development version"`
 9. `git push && git push --tags`
 10. Visit [Sonatype Nexus](https://oss.sonatype.org/) and promote the artifact.


================================================
FILE: build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

buildscript {
    apply from: project.file('gradle/dependencies.gradle')

    repositories {
        google()
        jcenter()
        maven { url deps.build.gradlePluginsUrl }
    }

    dependencies {
        classpath deps.build.androidPlugin
        classpath deps.kotlin.gradlePlugin
    }
}

apply from: project.file('gradle/dependencies.gradle')
subprojects {
    buildscript {
        repositories {
            google()
            jcenter()
        }
    }

    repositories {
        google()
        jcenter()
        maven { url deps.build.gradlePluginsUrl }
    }

    apply plugin: 'checkstyle'

    checkstyle { -> rootProject
        configFile rootProject.file('config/checkstyle/checkstyle.xml')
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '4.7'
    distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}

task clean(type: Delete) {
    rootProject.allprojects {
        delete it.buildDir
    }
}

apply from: 'gradle/dependencies.gradle'
apply from: 'gradle/checkstyle.gradle'


================================================
FILE: buildSrc/build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

buildscript {
    apply from: project.rootProject.file("../gradle/dependencies.gradle")

    repositories {
        google()
        jcenter()
        maven { url deps.build.gradlePluginsUrl }
    }

    dependencies {
        classpath deps.build.androidPlugin
        classpath deps.kotlin.gradlePlugin
    }
}

apply from: project.rootProject.file("../gradle/dependencies.gradle")
repositories {
    google()
    jcenter()
}

subprojects { subproject ->
    if (subproject.buildFile.exists()) {
        apply from: project.rootProject.file("../gradle/dependencies.gradle")
        repositories {
            google()
            jcenter()
        }

        rootProject.dependencies {
            runtime project(path)
        }
    }
    subproject.afterEvaluate {
        // Disable useless tasks in buildSrc
        if (subproject.plugins.hasPlugin("kotlin")) {
            subproject.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
                kotlinOptions.suppressWarnings = true
            }
        }

        subproject.tasks.findAll {
            it.name.toLowerCase().contains("test") ||
                it.name.toLowerCase().contains("lint") ||
                it.name.toLowerCase().contains("checkstyle") }.each {
            it.enabled = false
        }
    }
}


================================================
FILE: buildSrc/settings.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

// These are not needed if consuming the Stylist plugin from Maven Central instead of the local copy from this repo
include ':stylist'
include ':stylist-api'
include ':stylist-core'

include ':sample:providers'


================================================
FILE: config/checkstyle/checkstyle-suppressions.xml
================================================
<?xml version="1.0"?>

<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<!DOCTYPE suppressions PUBLIC
    "-//Puppy Crawl//DTD Suppressions 1.1//EN"
    "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
    <suppress checks="JavadocType" files="[\\/]test[\\/]" />
    <suppress checks="JavadocMethod" files="[\\/]test[\\/]" />
</suppressions>


================================================
FILE: config/checkstyle/checkstyle-test.xml
================================================
<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">
    <property name="charset" value="UTF-8"/>

    <!-- Javadoc Comments                                          -->
    <!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
    <!--module name="JavadocPackage"/-->


    <!-- Miscellaneous                                          -->
    <!-- See http://checkstyle.sourceforge.net/config_misc.html -->
    <module name="NewlineAtEndOfFile"/>
    <!--module name="Translation"/-->
    <!--module name="UniqueProperties"/-->


    <!-- Size Violations                                         -->
    <!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
    <module name="FileLength">
        <property name="max" value="5500"/>
    </module>


    <!-- Whitespace                                          -->
    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
    <module name="FileTabCharacter">
        <property name="eachLine" value="true"/>
    </module>


    <!-- Tree Walker                                                  -->
    <!-- See http://checkstyle.sourceforge.net/config.html#TreeWalker -->
    <module name="TreeWalker">

        <!-- Annotations                                                  -->
        <!-- See http://checkstyle.sourceforge.net/config_annotation.html -->
        <!--module name="AnnotationUseStyle"/-->
        <!--module name="MissingDeprecated"/-->
        <module name="MissingOverride"/>
        <module name="PackageAnnotation"/>
        <!--module name="SuppressWarnings"/-->
        <!--module name="SuppressWarningsHolder"/-->
        <module name="AnnotationLocation">
            <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
            <property name="allowSamelineMultipleAnnotations" value="false"/>
            <property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
            <property name="allowSamelineParameterizedAnnotation" value="false"/>
        </module>
        <module name="AnnotationLocation">
            <property name="tokens" value="VARIABLE_DEF"/>
            <property name="allowSamelineMultipleAnnotations" value="true"/>
            <property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
            <property name="allowSamelineParameterizedAnnotation" value="true"/>
        </module>


        <!-- Blocks Checks                                            -->
        <!-- See http://checkstyle.sourceforge.net/config_blocks.html -->
        <module name="EmptyBlock">
            <property name="tokens" value="LITERAL_WHILE,LITERAL_TRY,LITERAL_FINALLY,LITERAL_DO,LITERAL_IF,LITERAL_ELSE,LITERAL_FOR,INSTANCE_INIT,STATIC_INIT,LITERAL_SWITCH"/>
        </module>
        <!--module name="EmptyCatchBlock"/-->
        <module name="LeftCurly">
            <property name="maxLineLength" value="120"/>
        </module>
        <module name="NeedBraces"/>
        <module name="RightCurly"/>
        <module name="AvoidNestedBlocks"/>


        <!-- Class Design                                             -->
        <!-- See http://checkstyle.sourceforge.net/config_design.html -->
        <!--module name="VisibilityModifier"/-->
        <!--module name="FinalClass"/-->
        <module name="InterfaceIsType"/>
        <module name="HideUtilityClassConstructor"/>
        <!--module name="DesignForExtension"/-->
        <!--module name="MutableException"/-->
        <!--module name="ThrowsCount"/-->
        <module name="InnerTypeLast"/>
        <module name="OneTopLevelClass"/>


        <!-- Coding                                                   -->
        <!-- See http://checkstyle.sourceforge.net/config_coding.html -->
        <!--module name="ArrayTrailingComma"/-->
        <!--module name="AvoidInlineConditionals"/-->
        <module name="CovariantEquals"/>
        <module name="EmptyStatement"/>
        <!--module name="EqualsAvoidNull"/-->
        <module name="EqualsHashCode"/>
        <!--module name="FinalLocalVariable"/-->
        <!--module name="HiddenField"/-->
        <module name="IllegalInstantiation"/>
        <!--module name="IllegalToken"/-->
        <!--module name="IllegalTokenText"/-->
        <module name="InnerAssignment"/>
        <!--module name="MagicNumber"/-->
        <!--module name="MissingSwitchDefault"/-->
        <!--module name="ModifiedControlVariable"/-->
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>
        <module name="StringLiteralEquality"/>
        <!--module name="NestedForDepth"/-->
        <!--module name="NestedIfDepth"/-->
        <!--module name="NestedTryDepth"/-->
        <module name="NoClone"/>
        <module name="NoFinalizer"/>
        <module name="SuperClone"/>
        <!--module name="SuperFinalize"/-->
        <!--module name="IllegalCatch"/-->
        <!--module name="IllegalThrows"/-->
        <module name="PackageDeclaration"/>
        <!--module name="ReturnCount"/-->
        <!--module name="IllegalType"/-->
        <module name="DeclarationOrder"/>
        <!--module name="ParameterAssignment"/-->
        <!--module name="ExplicitInitialization"/-->
        <module name="DefaultComesLast"/>
        <!--module name="MissingCtor"/-->
        <module name="FallThrough"/>
        <!--module name="MultipleStringLiterals"/-->
        <module name="MultipleVariableDeclarations"/>
        <!--module name="RequireThis"/-->
        <!--module name="UnnecessaryParentheses"/-->
        <module name="OneStatementPerLine"/>
        <!--module name="VariableDeclarationUsageDistance"/-->
        <!--module name="OverloadMethodsDeclarationOrder"/-->


        <!-- Headers                                                  -->
        <!-- See http://checkstyle.sourceforge.net/config_header.html -->
        <!--module name="Header"/-->
        <!--module name="RegexpHeader"/-->


        <!-- Imports                                                   -->
        <!-- See http://checkstyle.sourceforge.net/config_imports.html -->
        <module name="AvoidStarImport"/>
        <!--module name="AvoidStaticImport"/-->
        <module name="IllegalImport"/>
        <module name="RedundantImport"/>
        <module name="UnusedImports">
            <property name="processJavadoc" value="true"/>
        </module>
        <!--module name="ImportOrder"/-->
        <!--module name="ImportControl"/-->
        <!--module name="CustomImportOrder"/-->


        <!-- Javadoc Comments                                          -->
        <!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
        <!--module name="JavadocType"/-->
        <!--module name="JavadocMethod">
            <property name="scope" value="public"/>
        </module-->
        <!--module name="JavadocVariable"/-->
        <!--module name="JavadocStyle"/-->
        <!--module name="WriteTag"/-->
        <!--module name="NonEmptyAtclauseDescription"/-->
        <!--module name="JavadocTagContinuationIndentation"/-->
        <!--module name="SummaryJavadoc"/-->
        <!--module name="AtclauseOrder"/-->
        <!--module name="JavadocParagraph"/-->
        <!--module name="SingleLineJavadoc"/-->


        <!-- Metrics                                               -->
        <!-- http://checkstyle.sourceforge.net/config_metrics.html -->
        <!--module name="BooleanExpressionComplexity"/-->
        <!--module name="ClassDataAbstractionCoupling"/-->
        <!--module name="ClassFanOutComplexity"/-->
        <!--module name="CyclomaticComplexity"/-->
        <!--module name="NPathComplexity"/-->
        <!--module name="JavaNCSS"/-->


        <!-- Miscellaneous                                          -->
        <!-- See http://checkstyle.sourceforge.net/config_misc.html -->
        <module name="TodoComment">
            <property name="format" value="\bTODO\b.*"/>
        </module>
        <module name="TodoComment">
            <property name="format" value="\btodo\b.*"/>
        </module>
        <module name="TodoComment">
            <property name="format" value="\bFIXME\b.*"/>
        </module>
        <module name="TodoComment">
            <property name="format" value="\bfixme\b.*"/>
        </module>
        <!--module name="CommentsIndentation"/-->
        <!--module name="UncommentedMain"/-->
        <module name="UpperEll"/>
        <module name="ArrayTypeStyle"/>
        <!--module name="FinalParameters"/-->
        <!--module name="DescendantToken"/-->
        <module name="Indentation">
            <property name="lineWrappingIndentation" value="0"/>
            <property name="arrayInitIndent" value="8"/>
        </module>
        <module name="TrailingComment"/>
        <module name="OuterTypeFilename"/>
        <!--module name="UniqueProperties"/-->
        <!--module name="AvoidEscapedUnicodeCharacters"/-->


        <!-- Modifiers                                                  -->
        <!-- See http://checkstyle.sourceforge.net/config_modifier.html -->
        <module name="ModifierOrder"/>
        <module name="RedundantModifier">
            <property name="severity" value="ignore"/>
        </module>


        <!-- Naming Conventions                                       -->
        <!-- See http://checkstyle.sourceforge.net/config_naming.html -->
        <!--module name="AbstractClassName"/-->
        <module name="ClassTypeParameterName"/>
        <module name="ConstantName"/>
        <module name="LocalFinalVariableName"/>
        <module name="LocalVariableName"/>
        <module name="MemberName">
            <property name="applyToPublic" value="true"/>
            <property name="applyToPackage" value="true"/>
            <property name="applyToProtected" value="false"/>
            <property name="applyToPrivate" value="false"/>
            <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
        </module>
        <module name="MethodName">
            <property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/>
        </module>
        <module name="MethodTypeParameterName"/>
        <module name="InterfaceTypeParameterName"/>
        <module name="PackageName"/>
        <module name="ParameterName"/>
        <!--module name="StaticVariableName"/-->
        <module name="TypeName"/>
        <!--module name="AbbreviationAsWordInName"/-->


        <!-- Regexp                                               -->
        <!-- http://checkstyle.sourceforge.net/config_regexp.html -->
        <!--module name="Regexp"/-->
        <!--module name="RegexpSingleLineJava"-->


        <!-- Size Violations                                         -->
        <!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
        <!--module name="ExecutableStatementCount"/-->
        <module name="LineLength">
            <property name="max" value="120"/>
            <property name="ignorePattern" value="^(package|import) .+?;$"/>
        </module>
        <!--module name="MethodLength"/-->
        <!--module name="AnonInnerLength"/-->
        <!--module name="ParameterNumber"/-->
        <!--module name="OuterTypeNumber"/-->
        <!--module name="MethodCount"/-->


        <!-- Whitespace                                                   -->
        <!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
        <module name="GenericWhitespace"/>
        <module name="EmptyForInitializerPad"/>
        <module name="EmptyForIteratorPad"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceAfter">
            <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
        </module>
        <module name="NoWhitespaceBefore"/>
        <module name="OperatorWrap"/>
        <module name="ParenPad"/>
        <module name="TypecastParenPad"/>
        <module name="WhitespaceAfter"/>
        <module name="WhitespaceAround"/>
        <module name="NoLineWrap"/>
        <!--module name="EmptyLineSeparator"/-->
        <!--module name="SeparatorWrap"/-->
    </module>


    <!-- Regexp                                               -->
    <!-- http://checkstyle.sourceforge.net/config_regexp.html -->
    <module name="RegexpSingleline">
        <property name="format" value="\s+$"/>
        <property name="message" value="Line has trailing spaces."/>
    </module>
    <module name="RegexpMultiline">
        <property name="format" value="\n\n\n"/>
        <property name="message" value="Double blank lines."/>
    </module>

    <module name="SuppressionFilter">
        <property name="file" value="config/checkstyle/checkstyle-suppressions.xml"/>
    </module>
</module>


================================================
FILE: config/checkstyle/checkstyle.xml
================================================
<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<!DOCTYPE module PUBLIC
    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">
    <property name="charset" value="UTF-8"/>

    <!-- Javadoc Comments                                          -->
    <!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
    <!--module name="JavadocPackage"/-->


    <!-- Miscellaneous                                          -->
    <!-- See http://checkstyle.sourceforge.net/config_misc.html -->
    <module name="NewlineAtEndOfFile"/>
    <!--module name="Translation"/-->
    <!--module name="UniqueProperties"/-->


    <!-- Size Violations                                         -->
    <!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
    <module name="FileLength">
        <property name="max" value="1500"/>
    </module>


    <!-- Whitespace                                          -->
    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
    <module name="FileTabCharacter">
        <property name="eachLine" value="true"/>
    </module>


    <!-- Tree Walker                                                  -->
    <!-- See http://checkstyle.sourceforge.net/config.html#TreeWalker -->
    <module name="TreeWalker">

        <!-- Annotations                                                  -->
        <!-- See http://checkstyle.sourceforge.net/config_annotation.html -->
        <!--module name="AnnotationUseStyle"/-->
        <!--module name="MissingDeprecated"/-->
        <module name="MissingOverride"/>
        <module name="PackageAnnotation"/>
        <!--module name="SuppressWarnings"/-->
        <!--module name="SuppressWarningsHolder"/-->
        <module name="AnnotationLocation">
            <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
            <property name="allowSamelineMultipleAnnotations" value="false"/>
            <property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
            <property name="allowSamelineParameterizedAnnotation" value="false"/>
        </module>
        <module name="AnnotationLocation">
            <property name="tokens" value="VARIABLE_DEF"/>
            <property name="allowSamelineMultipleAnnotations" value="true"/>
            <property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
            <property name="allowSamelineParameterizedAnnotation" value="true"/>
        </module>


        <!-- Blocks Checks                                            -->
        <!-- See http://checkstyle.sourceforge.net/config_blocks.html -->
        <module name="EmptyBlock">
            <property name="tokens" value="LITERAL_WHILE,LITERAL_TRY,LITERAL_FINALLY,LITERAL_DO,LITERAL_IF,LITERAL_ELSE,LITERAL_FOR,INSTANCE_INIT,STATIC_INIT,LITERAL_SWITCH"/>
        </module>
        <!--module name="EmptyCatchBlock"/-->
        <module name="LeftCurly">
            <property name="maxLineLength" value="120"/>
        </module>
        <module name="NeedBraces"/>
        <module name="RightCurly"/>
        <module name="AvoidNestedBlocks"/>


        <!-- Class Design                                             -->
        <!-- See http://checkstyle.sourceforge.net/config_design.html -->
        <!--module name="VisibilityModifier"/-->
        <!--module name="FinalClass"/-->
        <module name="InterfaceIsType"/>
        <module name="HideUtilityClassConstructor"/>
        <!--module name="DesignForExtension"/-->
        <!--module name="MutableException"/-->
        <!--module name="ThrowsCount"/-->
        <module name="InnerTypeLast"/>
        <module name="OneTopLevelClass"/>


        <!-- Coding                                                   -->
        <!-- See http://checkstyle.sourceforge.net/config_coding.html -->
        <!--module name="ArrayTrailingComma"/-->
        <!--module name="AvoidInlineConditionals"/-->
        <module name="CovariantEquals"/>
        <module name="EmptyStatement"/>
        <!--module name="EqualsAvoidNull"/-->
        <module name="EqualsHashCode"/>
        <!--module name="FinalLocalVariable"/-->
        <!--module name="HiddenField"/-->
        <module name="IllegalInstantiation"/>
        <!--module name="IllegalToken"/-->
        <!--module name="IllegalTokenText"/-->
        <module name="InnerAssignment"/>
        <!--module name="MagicNumber"/-->
        <!--module name="MissingSwitchDefault"/-->
        <!--module name="ModifiedControlVariable"/-->
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>
        <module name="StringLiteralEquality"/>
        <!--module name="NestedForDepth"/-->
        <!--module name="NestedIfDepth"/-->
        <!--module name="NestedTryDepth"/-->
        <module name="NoClone"/>
        <module name="NoFinalizer"/>
        <module name="SuperClone"/>
        <!--module name="SuperFinalize"/-->
        <!--module name="IllegalCatch"/-->
        <!--module name="IllegalThrows"/-->
        <module name="PackageDeclaration"/>
        <!--module name="ReturnCount"/-->
        <!--module name="IllegalType"/-->
        <module name="DeclarationOrder"/>
        <!--module name="ParameterAssignment"/-->
        <!--module name="ExplicitInitialization"/-->
        <module name="DefaultComesLast"/>
        <!--module name="MissingCtor"/-->
        <module name="FallThrough"/>
        <!--module name="MultipleStringLiterals"/-->
        <module name="MultipleVariableDeclarations"/>
        <!--module name="RequireThis"/-->
        <!--module name="UnnecessaryParentheses"/-->
        <module name="OneStatementPerLine"/>
        <!--module name="VariableDeclarationUsageDistance"/-->
        <module name="OverloadMethodsDeclarationOrder"/>


        <!-- Headers                                                  -->
        <!-- See http://checkstyle.sourceforge.net/config_header.html -->
        <!--module name="Header"/-->
        <!--module name="RegexpHeader"/-->


        <!-- Imports                                                   -->
        <!-- See http://checkstyle.sourceforge.net/config_imports.html -->
        <module name="AvoidStarImport"/>
        <!--module name="AvoidStaticImport"/-->
        <module name="IllegalImport"/>
        <module name="RedundantImport"/>
        <module name="UnusedImports">
            <property name="processJavadoc" value="true"/>
        </module>
        <!--module name="ImportOrder"/-->
        <!--module name="ImportControl"/-->
        <!--module name="CustomImportOrder"/-->


        <!-- Javadoc Comments                                          -->
        <!-- See http://checkstyle.sourceforge.net/config_javadoc.html -->
        <module name="JavadocType">
            <property name="scope" value="public"/>
        </module>
        <module name="JavadocMethod">
            <property name="scope" value="public"/>
            <property name="tokens" value="METHOD_DEF" /> <!-- Constructors don't always need Javadoc -->
        </module>
        <!--module name="JavadocVariable"/-->
        <!--module name="JavadocStyle"/-->
        <!--module name="WriteTag"/-->
        <!--module name="NonEmptyAtclauseDescription"/-->
        <!--module name="JavadocTagContinuationIndentation"/-->
        <!--module name="SummaryJavadoc"/-->
        <!--module name="AtclauseOrder"/-->
        <!--module name="JavadocParagraph"/-->
        <!--module name="SingleLineJavadoc"/-->


        <!-- Metrics                                               -->
        <!-- http://checkstyle.sourceforge.net/config_metrics.html -->
        <!--module name="BooleanExpressionComplexity"/-->
        <!--module name="ClassDataAbstractionCoupling"/-->
        <!--module name="ClassFanOutComplexity"/-->
        <!--module name="CyclomaticComplexity"/-->
        <!--module name="NPathComplexity"/-->
        <!--module name="JavaNCSS"/-->


        <!-- Miscellaneous                                          -->
        <!-- See http://checkstyle.sourceforge.net/config_misc.html -->
        <module name="TodoComment">
            <property name="format" value="\bTODO\b.*"/>
        </module>
        <module name="TodoComment">
            <property name="format" value="\btodo\b.*"/>
        </module>
        <module name="TodoComment">
            <property name="format" value="\bFIXME\b.*"/>
        </module>
        <module name="TodoComment">
            <property name="format" value="\bfixme\b.*"/>
        </module>
        <!--module name="CommentsIndentation"/-->
        <!--module name="UncommentedMain"/-->
        <module name="UpperEll"/>
        <module name="ArrayTypeStyle"/>
        <!--module name="FinalParameters"/-->
        <!--module name="DescendantToken"/-->
        <module name="Indentation">
            <property name="basicOffset" value="2"/>
            <property name="caseIndent" value="2"/>
        </module>
        <module name="TrailingComment"/>
        <module name="OuterTypeFilename"/>
        <!--module name="UniqueProperties"/-->
        <!--module name="AvoidEscapedUnicodeCharacters"/-->


        <!-- Modifiers                                                  -->
        <!-- See http://checkstyle.sourceforge.net/config_modifier.html -->
        <module name="ModifierOrder"/>
        <module name="RedundantModifier">
            <property name="severity" value="ignore"/>
        </module>


        <!-- Naming Conventions                                       -->
        <!-- See http://checkstyle.sourceforge.net/config_naming.html -->
        <!--module name="AbstractClassName"/-->
        <module name="ClassTypeParameterName">
            <property name="format" value="([A-Z][a-z]*T)|[A-Z]"/>
        </module>
        <module name="ConstantName"/>
        <module name="LocalFinalVariableName"/>
        <module name="LocalVariableName"/>
        <module name="MemberName">
            <property name="applyToPublic" value="true"/>
            <property name="applyToPackage" value="true"/>
            <property name="applyToProtected" value="false"/>
            <property name="applyToPrivate" value="false"/>
            <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
        </module>
        <module name="MethodName"/>
        <module name="MethodTypeParameterName">
            <property name="format" value="([A-Z][a-z]*T)|[A-Z]"/>
        </module>
        <module name="InterfaceTypeParameterName">
            <property name="format" value="([A-Z][a-z]*T)|[A-Z]"/>
        </module>
        <module name="PackageName"/>
        <module name="ParameterName"/>
        <module name="StaticVariableName"/>
        <module name="TypeName"/>
        <!--module name="AbbreviationAsWordInName"/-->


        <!-- Regexp                                               -->
        <!-- http://checkstyle.sourceforge.net/config_regexp.html -->
        <!--module name="Regexp"/-->
        <!--module name="RegexpSingleLineJava"-->


        <!-- Size Violations                                         -->
        <!-- See http://checkstyle.sourceforge.net/config_sizes.html -->
        <!--module name="ExecutableStatementCount"/-->
        <module name="LineLength">
            <property name="max" value="120"/>
            <property name="ignorePattern" value="^(package|import) .+?;$"/>
        </module>
        <module name="MethodLength">
            <property name="max" value="250"/>
        </module>
        <!--module name="AnonInnerLength"/-->
        <!--module name="ParameterNumber"/-->
        <!--module name="OuterTypeNumber"/-->
        <!--module name="MethodCount"/-->


        <!-- Whitespace                                                   -->
        <!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
        <module name="GenericWhitespace"/>
        <module name="EmptyForInitializerPad"/>
        <module name="EmptyForIteratorPad"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceAfter">
            <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/>
        </module>
        <module name="NoWhitespaceBefore"/>
        <module name="OperatorWrap"/>
        <module name="ParenPad"/>
        <module name="TypecastParenPad"/>
        <module name="WhitespaceAfter"/>
        <module name="WhitespaceAround"/>
        <module name="NoLineWrap"/>
        <!--module name="EmptyLineSeparator"/-->
        <!--module name="SeparatorWrap"/-->
    </module>


    <!-- Regexp                                               -->
    <!-- http://checkstyle.sourceforge.net/config_regexp.html -->
    <module name="RegexpSingleline">
        <property name="format" value="\s+$"/>
        <property name="message" value="Line has trailing spaces."/>
    </module>

    <module name="RegexpMultiline">
        <property name="format" value="\n\n\n"/>
        <property name="message" value="Double blank lines."/>
    </module>

    <module name="SuppressionFilter">
        <property name="file" value="config/checkstyle/checkstyle-suppressions.xml"/>
    </module>
</module>


================================================
FILE: config/lint/lint.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->
<lint>
    <issue id="AppCompatCustomView" severity="ignore" />
    <issue id="GoogleAppIndexingWarning" severity="ignore" />
    <issue id="GradleCompatible" severity="ignore" />
    <issue id="IconLauncherFormat" severity="ignore" />
</lint>


================================================
FILE: gradle/checkstyle.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

subprojects {
    buildscript {
        repositories {
            jcenter()
        }
    }

    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
    }

    apply plugin: 'checkstyle'

    afterEvaluate {
        def checkstyleConfig = rootProject.file('config/checkstyle/checkstyle.xml')
        if (project.getPlugins().hasPlugin('com.android.application') ||
                project.getPlugins().hasPlugin('com.android.library')) {

            task checkstyleMain(type: Checkstyle) {
                ignoreFailures = false
                showViolations = true
                source 'src/main', 'src/release'
                include '**/*.java'
                exclude '**/gen/**'
                exclude '**/R.java'
                exclude '**/BuildConfig.java'
                reports {
                    xml.destination "$project.buildDir/reports/checkstyle/main.xml"
                }
                classpath = files()
                configFile = checkstyleConfig
            }

            task checkstyleTest(type: Checkstyle){
                ignoreFailures = false
                showViolations = true
                source 'src/test', 'src/androidTest'
                include '**/*.java'
                exclude '**/gen/**'
                exclude '**/R.java'
                exclude '**/BuildConfig.java'
                reports {
                    xml.destination "$project.buildDir/reports/checkstyle/test.xml"
                }
                classpath = files()
                configFile = checkstyleConfig
            }

            task checkstyle(dependsOn:['checkstyleMain', 'checkstyleTest']){
                description 'Runs Checkstyle inspection against Android sourcesets.'
                group = 'Code Quality'
            }

            project.tasks.getByName("check").dependsOn "checkstyle"
        } else {
            checkstyle {
                ignoreFailures = false
                showViolations = true
                configFile checkstyleConfig
            }                    
        }

        tasks.withType(Checkstyle) {
                configProperties = ['proj.module.dir'      : projectDir.absolutePath,
                          'checkstyle.cache.file': './build/cache/checkstyle-cache']
            }
    }
}


================================================
FILE: gradle/dependencies.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

def versions = [
    kotlin    : "1.3.10"
]

def androidx = [
    annotations      : "androidx.annotation:annotation:1.0.0",
    appcompat        : "androidx.appcompat:appcompat:1.0.0",
    constraintLayout : "androidx.constraintlayout:constraintlayout:1.1.2"
]

def apt = [
    autoService : "com.google.auto.service:auto-service:1.0-rc4"
]

def build = [
    androidPlugin       : "com.android.tools.build:gradle:3.2.1",
    buildToolsVersion   : "28.0.3",
    compileSdkVersion   : 28,
    ci: 'true' == System.getenv('CI'),
    googleJavaFormatter : "com.google.googlejavaformat:google-java-format:1.4",
    gradleAptPlugin     : "net.ltgt.gradle:gradle-apt-plugin:0.18",
    gradlePluginsUrl    : "https://plugins.gradle.org/m2/",
    minSdkVersion       : 19,
    targetSdkVersion    : 28
]

def external = [
    resourcesPoet : "com.commit451:resourcespoet:2.1.0"
]

def kotlin = [
    gradlePlugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
    stdLibJdk7   : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}",
    stdLibJdk8   : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}"
]

def test = [
    junit          : 'junit:junit:4.12',
    truth          : "com.google.truth:truth:0.40"
]

ext.deps = [
    "androidx"  : androidx,
    "apt"       : apt,
    "build"     : build,
    "external"  : external,
    "kotlin"    : kotlin,
    "test"      : test,
    "versions"  : versions
]



================================================
FILE: gradle/gradle-mvn-push.gradle
================================================
/*
 * Copyright (C) Chris Banes
 *
 * 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.
 */

apply plugin: 'maven'
apply plugin: 'signing'

version = VERSION_NAME
group = GROUP

def isReleaseBuild() {
  return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
  return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
          : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
  return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
          : "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
  return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
  return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : ""
}

afterEvaluate { project ->
  uploadArchives {
    repositories {
      mavenDeployer {
        beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

        pom.groupId = GROUP
        pom.artifactId = POM_ARTIFACT_ID
        pom.version = VERSION_NAME

        repository(url: getReleaseRepositoryUrl()) {
          authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
        }
        snapshotRepository(url: getSnapshotRepositoryUrl()) {
          authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
        }

        pom.project {
          name POM_NAME
          packaging POM_PACKAGING
          description POM_DESCRIPTION
          url POM_URL

          scm {
            url POM_SCM_URL
            connection POM_SCM_CONNECTION
            developerConnection POM_SCM_DEV_CONNECTION
          }

          licenses {
            license {
              name POM_LICENCE_NAME
              url POM_LICENCE_URL
              distribution POM_LICENCE_DIST
            }
          }

          developers {
            developer {
              id POM_DEVELOPER_ID
              name POM_DEVELOPER_NAME
            }
          }
        }
      }
    }
  }

  signing {
    required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
    sign configurations.archives
  }

  if (project.getPlugins().hasPlugin('com.android.application') ||
          project.getPlugins().hasPlugin('com.android.library')) {
    task install(type: Upload, dependsOn: assemble) {
      repositories.mavenInstaller {
        configuration = configurations.archives

        pom.groupId = GROUP
        pom.artifactId = POM_ARTIFACT_ID
        pom.version = VERSION_NAME

        pom.project {
          name POM_NAME
          packaging POM_PACKAGING
          description POM_DESCRIPTION
          url POM_URL

          scm {
            url POM_SCM_URL
            connection POM_SCM_CONNECTION
            developerConnection POM_SCM_DEV_CONNECTION
          }

          licenses {
            license {
              name POM_LICENCE_NAME
              url POM_LICENCE_URL
              distribution POM_LICENCE_DIST
            }
          }

          developers {
            developer {
              id POM_DEVELOPER_ID
              name POM_DEVELOPER_NAME
            }
          }
        }
      }
    }

    task androidJavadocs(type: Javadoc) {
      if (!project.plugins.hasPlugin('kotlin-android')) {
        source = android.sourceSets.main.java.srcDirs
      }
      classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
      exclude '**/internal/*'

      if (JavaVersion.current().isJava8Compatible()) {
        options.addStringOption('Xdoclint:none', '-quiet')
      }
    }

    task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
      classifier = 'javadoc'
      from androidJavadocs.destinationDir
    }

    task androidSourcesJar(type: Jar) {
      classifier = 'sources'
      from android.sourceSets.main.java.sourceFiles
    }
  } else {
    install {
      repositories.mavenInstaller {
        pom.groupId = GROUP
        pom.artifactId = POM_ARTIFACT_ID
        pom.version = VERSION_NAME

        pom.project {
          name POM_NAME
          packaging POM_PACKAGING
          description POM_DESCRIPTION
          url POM_URL

          scm {
            url POM_SCM_URL
            connection POM_SCM_CONNECTION
            developerConnection POM_SCM_DEV_CONNECTION
          }

          licenses {
            license {
              name POM_LICENCE_NAME
              url POM_LICENCE_URL
              distribution POM_LICENCE_DIST
            }
          }

          developers {
            developer {
              id POM_DEVELOPER_ID
              name POM_DEVELOPER_NAME
            }
          }
        }
      }
    }

    task sourcesJar(type: Jar, dependsOn: classes) {
      classifier = 'sources'
      from sourceSets.main.allSource
    }

    task javadocJar(type: Jar, dependsOn: javadoc) {
      classifier = 'javadoc'
      from javadoc.destinationDir
    }
  }

  if (JavaVersion.current().isJava8Compatible()) {
    allprojects {
      tasks.withType(Javadoc) {
        options.addStringOption('Xdoclint:none', '-quiet')
      }
    }
  }

  artifacts {
    if (project.getPlugins().hasPlugin('com.android.application') ||
            project.getPlugins().hasPlugin('com.android.library')) {
      archives androidSourcesJar
      archives androidJavadocsJar
    } else {
      archives sourcesJar
      archives javadocJar
    }
  }
}


================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists


================================================
FILE: gradle.properties
================================================
#
# Copyright (c) 2018. Uber Technologies
#
# 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.
#

# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

GROUP=com.uber.stylist
VERSION_NAME=0.0.3-SNAPSHOT
POM_DESCRIPTION=A Gradle plugin that generates a base set of XML themes
POM_URL=https://github.com/uber/stylist/
POM_SCM_URL=https://github.com/uber/stylist/
POM_SCM_CONNECTION=scm:git:git://github.com/uber/stylist.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/uber/stylist.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=uber
POM_DEVELOPER_NAME=Uber Technologies

android.useAndroidX=true
android.enableJetifier=true


================================================
FILE: gradlew
================================================
#!/usr/bin/env sh

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn () {
    echo "$*"
}

die () {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
  NONSTOP* )
    nonstop=true
    ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
    JAVACMD=`cygpath --unix "$JAVACMD"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Escape application args
save () {
    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
    echo " "
}
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
  cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"


================================================
FILE: sample/app/build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

apply plugin: 'com.android.application'

android {
    compileSdkVersion deps.build.compileSdkVersion
    buildToolsVersion deps.build.buildToolsVersion

    defaultConfig {
        applicationId "com.uber.stylist.myapplication"
        minSdkVersion deps.build.minSdkVersion
        targetSdkVersion deps.build.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    // Setup a simple lint config for an android app/library.
    lintOptions {
        abortOnError true
        lintConfig rootProject.file('config/lint/lint.xml')
    }
}

dependencies {
    implementation project(":sample:library")
    implementation deps.androidx.appcompat
    implementation deps.androidx.constraintLayout
}


================================================
FILE: sample/app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.uber.stylist.myapplication">

    <application
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


================================================
FILE: sample/app/src/main/java/com/uber/stylist/myapplication/MainActivity.java
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.myapplication;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

/**
 * Sample activity.
 */
public class MainActivity extends AppCompatActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
  }
}


================================================
FILE: sample/app/src/main/res/drawable/divider.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle">
  <solid android:color="@android:color/transparent" />
  <size
    android:width="1dp"
    android:height="@dimen/element_spacing" />
</shape>


================================================
FILE: sample/app/src/main/res/layout/activity_main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="16dp">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="?textSizeLarge"
        android:text="TextView"
        app:layout_constraintBottom_toTopOf="@+id/editText"
        app:layout_constraintTop_toTopOf="parent">
        <requestFocus/>
    </TextView>

    <EditText
        android:id="@+id/editText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName"
        android:hint="Name"
        app:layout_constraintBottom_toTopOf="@+id/button"
        app:layout_constraintTop_toBottomOf="@+id/textView" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button"
        app:layout_constraintBottom_toTopOf="@+id/switch1"
        app:layout_constraintTop_toBottomOf="@+id/editText" />

    <Switch
        android:id="@+id/switch1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingStart="4dp"
        android:text="Switch"
        android:checked="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/button" />

</androidx.constraintlayout.widget.ConstraintLayout>


================================================
FILE: sample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

================================================
FILE: sample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

================================================
FILE: sample/app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
</resources>


================================================
FILE: sample/app/src/main/res/values/dimens.xml
================================================
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="element_spacing">16dp</dimen>
</resources>


================================================
FILE: sample/app/src/main/res/values/ic_launcher_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<resources>
    <color name="ic_launcher_background">#000000</color>
</resources>

================================================
FILE: sample/app/src/main/res/values/strings.xml
================================================
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<resources>
    <string name="app_name">Stylist Sample</string>
</resources>


================================================
FILE: sample/app/src/main/res/values/themes.xml
================================================
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<resources>
    <style name="AppTheme" parent="Theme.Sample"/>
    <style name="AppTheme.Dialog.Light" parent="Theme.Sample.Light.Dialog"/>
</resources>


================================================
FILE: sample/library/build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

apply plugin: 'com.android.library'
if (project.rootProject.name != 'buildSrc') {
    apply plugin: 'com.uber.stylist'
}

android {
    compileSdkVersion deps.build.compileSdkVersion
    buildToolsVersion deps.build.buildToolsVersion

    defaultConfig {
        minSdkVersion deps.build.minSdkVersion
        targetSdkVersion deps.build.targetSdkVersion
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    // Setup a simple lint config for an android app/library.
    lintOptions {
        abortOnError false
        lintConfig rootProject.file('config/lint/lint.xml')
    }
}

dependencies {
    implementation deps.androidx.appcompat
}


================================================
FILE: sample/library/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.uber.stylist.mylibrary"/>


================================================
FILE: sample/library/src/main/java/com/uber/stylist/mylibrary/MyUtils.java
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.mylibrary;

/**
 * Sample utilities class.
 */
public final class MyUtils {

  private MyUtils() { }
}


================================================
FILE: sample/library/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<resources>
  <attr name="textSizeSmall"/>
  <attr name="textSizeMedium"/>
  <attr name="textSizeLarge"/>

  <attr name="dialogSpecificAttr1"/>
  <attr name="dialogSpecificAttr2"/>
</resources>


================================================
FILE: sample/library/src/main/res/values/strings.xml
================================================
<!--
  ~ Copyright (c) 2018. Uber Technologies
  ~
  ~ 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.
  -->

<resources>
    <string name="app_name">My Application</string>
</resources>


================================================
FILE: sample/providers/build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

buildscript {
    repositories {
        maven { url deps.build.gradlePluginsUrl }
    }

    dependencies {
        classpath deps.build.gradleAptPlugin
    }
}

apply plugin: 'net.ltgt.apt'
apply plugin: "java-library"

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
    annotationProcessor deps.apt.autoService
    compileOnly deps.apt.autoService

    implementation deps.androidx.annotations
    implementation project(":stylist-api")
}


================================================
FILE: sample/providers/src/main/java/com/uber/stylist/myproviders/SampleThemeStencilProvider.java
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.myproviders;

import androidx.annotation.NonNull;

import com.google.auto.service.AutoService;
import com.uber.stylist.api.StyleItem;
import com.uber.stylist.api.StyleItemGroup;
import com.uber.stylist.api.ThemeStencil;
import com.uber.stylist.api.ThemeStencilProvider;

import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * Sample provider for the themes to generate.
 */
@AutoService(ThemeStencilProvider.class)
public class SampleThemeStencilProvider implements ThemeStencilProvider {

  private StyleItemGroup basicAppColors = new StyleItemGroup(
      new StyleItem("colorPrimary", "@color/colorPrimary"),
      new StyleItem("colorPrimaryDark", "@color/colorPrimaryDark"),
      new StyleItem("colorAccent", "@color/colorAccent")
  );

  private StyleItemGroup textSizes = new StyleItemGroup(
      new StyleItem("textSizeSmall", "12dp"),
      new StyleItem("textSizeMedium", "16dp"),
      new StyleItem("textSizeLarge", "20dp")
  );

  private StyleItemGroup dialogAttrs = new StyleItemGroup(
      new StyleItem("dialogSpecificAttr1", "foo"),
      new StyleItem("dialogSpecificAttr2", "bar")
  );

  /**
   *
   * @return a set of theme stencils
   */
  @NonNull
  @Override
  public Set<ThemeStencil> stencils() {
    return new LinkedHashSet<>(Arrays.asList(
        new ThemeStencil("Theme.Sample", "Theme.AppCompat"),
        new ThemeStencil("Theme.Sample.Light", "Theme.AppCompat.Light"),
        new ThemeStencil("Theme.Sample.Dialog", "Theme.AppCompat.Dialog", dialogAttrs),
        new ThemeStencil("Theme.Sample.Light.Dialog", "Theme.AppCompat.Light.Dialog", dialogAttrs)
    ));
  }

  /**
   *
   * @return a set of StyleItemGroups
   */
  @NonNull
  @Override
  public Set<StyleItemGroup> globalStyleItemGroups() {
    return new LinkedHashSet<>(Arrays.asList(
        basicAppColors,
        textSizes
    ));
  }
}


================================================
FILE: settings.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

include ':stylist'
include ':stylist-api'
include ':stylist-core'
include ':sample:app'
include ':sample:library'
include ':sample:providers'


================================================
FILE: stylist/build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

apply plugin: "org.jetbrains.kotlin.jvm"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

dependencies {
    compileOnly gradleApi()

    implementation deps.build.androidPlugin
    implementation deps.kotlin.stdLibJdk8
    implementation project(":stylist-core")
}

if (rootProject.projectDir.name != "buildSrc") {
    apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
}


================================================
FILE: stylist/gradle.properties
================================================
#
# Copyright (c) 2018. Uber Technologies
#
# 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.
#

POM_NAME=stylist
POM_ARTIFACT_ID=stylist
POM_PACKAGING=jar


================================================
FILE: stylist/src/main/kotlin/com/uber/stylist/StylistExtension.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist

import com.uber.stylist.Stylist.DEFAULT_THEMES_XML_FILENAME

/**
 * Gradle task extension that allows for customizing the behavior of Stylist.
 */
class StylistExtension {

  /**
   * Optional setting to control the name of the generated themes.xml file. Defaults to
   * "themes_stylist_generated.xml" as defined in [Stylist.DEFAULT_THEMES_XML_FILENAME].
   */
  var themesXmlFilename: String = DEFAULT_THEMES_XML_FILENAME

  /**
   * Optional setting to control whether the source is formatted with Google Java Format. Defaults to true.
   */
  var formatSource: Boolean = true
}


================================================
FILE: stylist/src/main/kotlin/com/uber/stylist/StylistPlugin.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist

import com.android.build.gradle.AppExtension
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.LibraryPlugin
import com.android.build.gradle.api.BaseVariant
import com.uber.stylist.internal.util.resolveVariantOutputDir
import org.gradle.api.DomainObjectSet
import org.gradle.api.Plugin
import org.gradle.api.Project

/**
 * Gradle plugin that creates and configures a [StylistTask] for Android library and app modules.
 */
class StylistPlugin : Plugin<Project> {

  companion object {
    private const val STYLIST = "stylist"
  }

  private val stylistExtension = StylistExtension()

  override fun apply(project: Project) {
    project.extensions.add(STYLIST, stylistExtension)
    project.afterEvaluate {
      project.plugins.all {
        when (it) {
          is AppPlugin -> with(project.extensions.getByType(AppExtension::class.java)) {
            configureAndroid(project, applicationVariants)
          }
          is LibraryPlugin -> with(project.extensions.getByType(LibraryExtension::class.java)) {
            configureAndroid(project, libraryVariants)
          }
        }
      }
    }
  }

  private fun <T : BaseVariant> configureAndroid(
      project: Project,
      variants: DomainObjectSet<T>) {
    val generateThemes = project.task("generateThemes")
    variants.all { variant ->
      val outputDir = resolveVariantOutputDir(project, variant, STYLIST)
      val stylistTask = project.tasks.create(
          "generate${variant.name.capitalize()}Themes", StylistTask::class.java)
          .apply {
            group = STYLIST
            outputDirectory = outputDir
            description = "Generate ${variant.name} base themes."
            themesXmlFilename = stylistExtension.themesXmlFilename
            formatSource = stylistExtension.formatSource
          }
      stylistTask.outputs.dir(outputDir)
      generateThemes.dependsOn(stylistTask)

      variant.registerResGeneratingTask(stylistTask, stylistTask.outputDirectory)
    }
  }
}


================================================
FILE: stylist/src/main/kotlin/com/uber/stylist/StylistTask.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist

import com.uber.stylist.Stylist.DEFAULT_THEMES_XML_FILENAME
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.incremental.IncrementalTaskInputs
import java.io.File

/**
 * Gradle task responsible for invoking Stylist to generate the themes.
 */
open class StylistTask : DefaultTask() {

  @Input
  lateinit var outputDirectory: File

  @Input
  var themesXmlFilename: String = DEFAULT_THEMES_XML_FILENAME

  @Input
  var formatSource: Boolean = true

  @TaskAction
  fun execute(inputs: IncrementalTaskInputs) {
    Stylist.generateThemesFor(outputDirectory, themesXmlFilename, formatSource)
  }
}


================================================
FILE: stylist/src/main/kotlin/com/uber/stylist/internal/util/Util.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.internal.util

import com.android.build.gradle.api.BaseVariant
import org.gradle.api.Project
import java.io.File

internal fun resolveVariantOutputDir(project: Project, variant: BaseVariant, plugin: String): File = project.file(
    "${project.projectDir}/build/generated/res/$plugin/${variant.flavorName}/${variant.buildType.name}".sanitize()
)

internal fun String.sanitize(): String = replace('/', File.separatorChar)


================================================
FILE: stylist/src/main/resources/META-INF/gradle-plugins/com.uber.stylist.properties
================================================
implementation-class=com.uber.stylist.StylistPlugin


================================================
FILE: stylist-api/build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

apply plugin: "java-library"
apply plugin: "org.jetbrains.kotlin.jvm"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

dependencies {
    implementation deps.kotlin.stdLibJdk8
}

if (rootProject.projectDir.name != "buildSrc") {
    apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
}


================================================
FILE: stylist-api/gradle.properties
================================================
#
# Copyright (c) 2018. Uber Technologies
#
# 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.
#

POM_NAME=stylist-api
POM_ARTIFACT_ID=stylist-api
POM_PACKAGING=jar


================================================
FILE: stylist-api/src/main/kotlin/com/uber/stylist/api/StyleItem.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.api

/**
 * An item within a style. The name includes the "android" prefix for
 * platform attributes. The value can be a theme attribute (?foo),
 * resource (@color/foo), or raw value (16dp).
 */
data class StyleItem(val name: String, val value: String)


================================================
FILE: stylist-api/src/main/kotlin/com/uber/stylist/api/StyleItemGroup.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.api

import com.uber.stylist.api.StyleItem

/**
 * A [StyleItemGroup] defines a logically-grouped set of style items that are to be generated in an Android XML theme.
 * Each [StyleItemGroup] can be declared by multiple [ThemeStencils][ThemeStencil] and generate otherwise duplicated style items
 * across all themes that declare them.
 */
class StyleItemGroup(private vararg val styleItemVarArgs: StyleItem) {

  /**
   * Used to retrieve the [StyleItems][StyleItem] in this logical group.
   *
   * @return the collection of [StyleItems][StyleItem]
   */
  fun styleItems() = styleItemVarArgs.toList()
}


================================================
FILE: stylist-api/src/main/kotlin/com/uber/stylist/api/ThemeStencil.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.api

import com.uber.stylist.api.StyleItem

/**
 * The definition for an an XML theme to be generated.
 */
class ThemeStencil(
    val name: String,
    val parent: String,
    private vararg val addedStyleItemGroups: StyleItemGroup = emptyArray()) {

  private val globalStyleItemGroups = mutableSetOf<StyleItemGroup>()

  /**
   * Returns a collection of [StyleItems][StyleItem] to be included in the XML theme
   * including those that are globally applicable.
   *
   * @return the collection of [StyleItems][StyleItem]
   */
  fun styleItems(): List<StyleItem> = (globalStyleItemGroups + addedStyleItemGroups.toSet())
      .flatMap { it.styleItems() }
      .toList()

  /**
   * Applies the globally-applicable [StyleItemGroups][StyleItemGroup] to this [ThemeStencil].
   *
   * @param styleItemGroups the set of [StyleItemGroups][StyleItemGroup]
   */
  fun setGlobalStyleItemGroups(styleItemGroups: Set<StyleItemGroup>) {
    globalStyleItemGroups.apply {
      clear()
      addAll(styleItemGroups)
    }
  }
}


================================================
FILE: stylist-api/src/main/kotlin/com/uber/stylist/api/ThemeStencilProvider.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.api

/**
 * This interface should be implemented in order to provide theme definitions to Stylist.
 */
interface ThemeStencilProvider {

  /**
   * Provide a set of [ThemeStencils][ThemeStencil] to be used during code generation.
   *
   * @return The set of [ThemeStencils][ThemeStencil].
   */
  fun stencils(): Set<ThemeStencil>

  /**
   * Provide a set of [StyleItemGroups][StyleItemGroup] that should be applied to all [ThemeStencils][ThemeStencil].
   *
   * @return The set of [StyleItemGroups][StyleItemGroup].
   */
  fun globalStyleItemGroups(): Set<StyleItemGroup>
}


================================================
FILE: stylist-api/src/main/kotlin/com/uber/stylist/api/ThemeStencilService.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist.api

import java.util.ServiceLoader

/**
 * Service responsible for collecting the [ThemeStencils][ThemeStencil] to be used during code generation.
 */
class ThemeStencilService private constructor() {

  private val serviceLoader = ServiceLoader.load(ThemeStencilProvider::class.java)

  /**
   * Gets the [ThemeStencil] implementations loaded.
   *
   * @return The located [ThemeStencils][ThemeStencil].
   */
  fun getStencils(): Set<ThemeStencil> {
    val stencils = LinkedHashSet<ThemeStencil>()
    serviceLoader.iterator()
        .forEach { stencils.addAll(it.stencils()) }
    return stencils
  }

  /**
   * Gets the [StyleItemGroup] implementations that should be applied to every [ThemeStencil].
   *
   * @return The located global [StyleItemGroups][StyleItemGroup].
   */
  fun getGlobalStyleItemGroups(): Set<StyleItemGroup> {
    val styleItemGroups = LinkedHashSet<StyleItemGroup>()
    serviceLoader.iterator()
        .forEach { styleItemGroups.addAll(it.globalStyleItemGroups()) }
    return styleItemGroups
  }

  companion object {
    /**
     * Creates a new [ThemeStencilService].
     *
     * @return the [ThemeStencilService]
     */
    fun newInstance() = ThemeStencilService()
  }
}


================================================
FILE: stylist-core/build.gradle
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.
 */

apply plugin: "java-library"
apply plugin: "org.jetbrains.kotlin.jvm"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

dependencies {
    implementation deps.androidx.annotations
    implementation deps.external.resourcesPoet
    implementation deps.kotlin.stdLibJdk8
    implementation project(":stylist-api")

    // Dont need to run tests in buildSrc
    if (rootProject.projectDir.name != "buildSrc") {
        testImplementation deps.androidx.annotations
        testImplementation deps.test.junit
        testImplementation deps.test.truth
    }
}

if (rootProject.projectDir.name != "buildSrc") {
    apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
}


================================================
FILE: stylist-core/gradle.properties
================================================
#
# Copyright (c) 2018. Uber Technologies
#
# 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.
#

POM_NAME=stylist-core
POM_ARTIFACT_ID=stylist-core
POM_PACKAGING=jar


================================================
FILE: stylist-core/src/main/kotlin/com/uber/stylist/Stylist.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist

import androidx.annotation.VisibleForTesting
import java.io.File
import com.commit451.resourcespoet.ResourcesPoet
import com.commit451.resourcespoet.StyleItem
import com.uber.stylist.api.StyleItemGroup
import com.uber.stylist.api.ThemeStencil
import com.uber.stylist.api.ThemeStencilService

/**
 * This contains the core logic of the Stylist library.
 */
object Stylist {

  const val DEFAULT_THEMES_XML_FILENAME = "themes_stylist_generated.xml"

  /**
   * Generate Android XML themes for the [ThemeStencils][ThemeStencil] and [StyleItemGroups][StyleItemGroup]
   * provided by the [ThemeStencilService].
   *
   * @outputDir the res directory to generate the themes into
   * @themesXmlFilename the name of the file for the generated themes
   * @formatSource whether or not to format and indent the generated themes file
   */
  fun generateThemesFor(
      outputDir: File, themesXmlFilename: String, formatSource: Boolean) {
    val themeStencilService = ThemeStencilService.newInstance()
    val styleItemGroups = themeStencilService.getGlobalStyleItemGroups()
    val stencils = themeStencilService.getStencils()
    generateThemesForStencils(stencils, styleItemGroups, outputDir, themesXmlFilename, formatSource)
  }

  /**
   * See [Stylist.generateThemesFor]
   */
  @VisibleForTesting
  internal fun generateThemesForStencils(
      stencils: Set<ThemeStencil>,
      styleItemGroups: Set<StyleItemGroup>,
      outputDir: File,
      themesXmlFileName: String,
      formatSource: Boolean) {

    val themesXmlFile = File("$outputDir/values/$themesXmlFileName").apply {
      parentFile.mkdirs()
      createNewFile()
    }

    ResourcesPoet.create(indent = formatSource).apply {
      stencils.forEach {
        it.setGlobalStyleItemGroups(styleItemGroups)
        addStyle(it.name, it.parent, it.styleItems().map { StyleItem(it.name, it.value) })
      }
      build(themesXmlFile)
    }
  }
}


================================================
FILE: stylist-core/src/test/kotlin/com/uber/stylist/StylistTest.kt
================================================
/*
 * Copyright (c) 2018. Uber Technologies
 *
 * 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.uber.stylist

import com.google.common.io.Files
import com.google.common.truth.Truth.assertThat
import com.uber.stylist.Stylist.DEFAULT_THEMES_XML_FILENAME
import com.uber.stylist.api.StyleItem
import com.uber.stylist.api.StyleItemGroup
import com.uber.stylist.api.ThemeStencil
import org.junit.Test

class StylistTest {

  companion object {
    private const val THEMES_NO_THEMES = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources/>
"""

    private const val THEMES_NO_STYLE_GROUPS = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
    <style name="Theme.Test" parent="Theme.AppCompat"/>
    <style name="Theme.Test.Light" parent="Theme.AppCompat.Light"/>
    <style name="Theme.Test.Dialog" parent="Theme.AppCompat.Dialog"/>
    <style name="Theme.Test.Light.Dialog" parent="Theme.AppCompat.Light.Dialog"/>
</resources>
"""

    private const val THEMES_WITH_STYLE_GROUP = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
    <style name="Theme.Test" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="Theme.Test.Light" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="Theme.Test.Dialog" parent="Theme.AppCompat.Dialog">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="Theme.Test.Light.Dialog" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
</resources>
"""

    private const val THEMES_WITH_STYLE_GROUPS = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
    <style name="Theme.Test" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
    </style>
    <style name="Theme.Test.Light" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
    </style>
    <style name="Theme.Test.Dialog" parent="Theme.AppCompat.Dialog">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
    </style>
    <style name="Theme.Test.Light.Dialog" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
    </style>
</resources>
"""

    private const val THEMES_WITH_STYLE_GROUPS_PLUS_ADDED = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
    <style name="Theme.Test" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
    </style>
    <style name="Theme.Test.Light" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
    </style>
    <style name="Theme.Test.Dialog" parent="Theme.AppCompat.Dialog">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
        <item name="dialogSpecificAttr1">foo</item>
        <item name="dialogSpecificAttr2">bar</item>
    </style>
    <style name="Theme.Test.Light.Dialog" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="textSizeSmall">12dp</item>
        <item name="textSizeMedium">16dp</item>
        <item name="textSizeLarge">20dp</item>
        <item name="dialogSpecificAttr1">foo</item>
        <item name="dialogSpecificAttr2">bar</item>
    </style>
</resources>
"""

    private val THEMES_UNFORMATTED = """<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<style name="Theme.Test" parent="Theme.AppCompat">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Theme.Test.Light" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Theme.Test.Dialog" parent="Theme.AppCompat.Dialog">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Theme.Test.Light.Dialog" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>""".split("\n").joinToString(separator = "")

    private val basicAppColors = StyleItemGroup(
        StyleItem("colorPrimary", "@color/colorPrimary"),
        StyleItem("colorPrimaryDark", "@color/colorPrimaryDark"),
        StyleItem("colorAccent", "@color/colorAccent")
    )

    private val textSizes = StyleItemGroup(
        StyleItem("textSizeSmall", "12dp"),
        StyleItem("textSizeMedium", "16dp"),
        StyleItem("textSizeLarge", "20dp")
    )

    private val dialogAttrs = StyleItemGroup(
        StyleItem("dialogSpecificAttr1", "foo"),
        StyleItem("dialogSpecificAttr2", "bar")
    )

    val themeStencils: Set<ThemeStencil> = linkedSetOf(
        ThemeStencil("Theme.Test", "Theme.AppCompat"),
        ThemeStencil("Theme.Test.Light", "Theme.AppCompat.Light"),
        ThemeStencil("Theme.Test.Dialog", "Theme.AppCompat.Dialog"),
        ThemeStencil("Theme.Test.Light.Dialog", "Theme.AppCompat.Light.Dialog")
    )

    val themeStencilsAddedStyles: Set<ThemeStencil> = linkedSetOf(
        ThemeStencil("Theme.Test", "Theme.AppCompat"),
        ThemeStencil("Theme.Test.Light", "Theme.AppCompat.Light"),
        ThemeStencil("Theme.Test.Dialog", "Theme.AppCompat.Dialog", dialogAttrs),
        ThemeStencil("Theme.Test.Light.Dialog", "Theme.AppCompat.Light.Dialog", dialogAttrs)
    )
  }

  @Test
  fun testStylist_withNoThemes_shouldGenerateExpectedXml() {
    testXml(emptySet(), emptySet(), THEMES_NO_THEMES)
  }

  @Test
  fun testStylist_withNoStyleGroups_shouldGenerateExpectedXml() {
    testXml(themeStencils, linkedSetOf(), THEMES_NO_STYLE_GROUPS)
  }

  @Test
  fun testStylist_withSingleStyleGroup_shouldGenerateExpectedXml() {
    testXml(themeStencils, linkedSetOf(basicAppColors), THEMES_WITH_STYLE_GROUP)
  }

  @Test
  fun testStylist_withMultipleStyleGroups_shouldGenerateExpectedXml() {
    testXml(themeStencils, linkedSetOf(basicAppColors, textSizes), THEMES_WITH_STYLE_GROUPS)
  }

  @Test
  fun testStylist_withMultipleStyleGroupsPlusAdded_shouldGenerateExpectedXml() {
    testXml(themeStencilsAddedStyles, linkedSetOf(basicAppColors, textSizes), THEMES_WITH_STYLE_GROUPS_PLUS_ADDED)
  }

  @Test
  fun testStylist_withFormatFalse_shouldGenerateExpectedXml() {
    testXml(themeStencils, linkedSetOf(basicAppColors), THEMES_UNFORMATTED, formatSource = false)
  }

  @Test
  fun testStylist_withNonDefaultThemesXmlFilename_shouldCorrectFile() {
    testXml(themeStencils, linkedSetOf(basicAppColors), THEMES_WITH_STYLE_GROUP, themesXmlFileName = "generated_themes_xml_alt_filename.xml")
  }

  private fun testXml(
      stencils: Set<ThemeStencil>,
      globalStyleGroups: Set<StyleItemGroup>,
      expectedXml: String,
      themesXmlFileName: String = DEFAULT_THEMES_XML_FILENAME,
      formatSource: Boolean = true) {
    val outputDir = Files.createTempDir()
    outputDir.resolve("values").apply {
      Stylist.generateThemesForStencils(stencils, globalStyleGroups, outputDir, themesXmlFileName = themesXmlFileName, formatSource = formatSource)

      val xmlFileNames = listFiles().map { it.name }.toList()
      assertThat(xmlFileNames).containsExactly(themesXmlFileName)

      val generatedThemesXml = listFiles().first().readText()
      assertThat(generatedThemesXml).isEqualTo(expectedXml)
    }
    outputDir.deleteRecursively()
  }
}
Download .txt
gitextract_zfjguc9g/

├── .buildscript/
│   └── deploy_snapshot.sh
├── .editorconfig
├── .github/
│   ├── ISSUE_TEMPLATE.md
│   └── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE.txt
├── README.md
├── RELEASING.md
├── build.gradle
├── buildSrc/
│   ├── build.gradle
│   └── settings.gradle
├── config/
│   ├── checkstyle/
│   │   ├── checkstyle-suppressions.xml
│   │   ├── checkstyle-test.xml
│   │   └── checkstyle.xml
│   └── lint/
│       └── lint.xml
├── gradle/
│   ├── checkstyle.gradle
│   ├── dependencies.gradle
│   ├── gradle-mvn-push.gradle
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── sample/
│   ├── app/
│   │   ├── build.gradle
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── uber/
│   │           │           └── stylist/
│   │           │               └── myapplication/
│   │           │                   └── MainActivity.java
│   │           └── res/
│   │               ├── drawable/
│   │               │   └── divider.xml
│   │               ├── layout/
│   │               │   └── activity_main.xml
│   │               ├── mipmap-anydpi-v26/
│   │               │   ├── ic_launcher.xml
│   │               │   └── ic_launcher_round.xml
│   │               └── values/
│   │                   ├── colors.xml
│   │                   ├── dimens.xml
│   │                   ├── ic_launcher_background.xml
│   │                   ├── strings.xml
│   │                   └── themes.xml
│   ├── library/
│   │   ├── build.gradle
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── uber/
│   │           │           └── stylist/
│   │           │               └── mylibrary/
│   │           │                   └── MyUtils.java
│   │           └── res/
│   │               └── values/
│   │                   ├── attrs.xml
│   │                   └── strings.xml
│   └── providers/
│       ├── build.gradle
│       └── src/
│           └── main/
│               └── java/
│                   └── com/
│                       └── uber/
│                           └── stylist/
│                               └── myproviders/
│                                   └── SampleThemeStencilProvider.java
├── settings.gradle
├── stylist/
│   ├── build.gradle
│   ├── gradle.properties
│   └── src/
│       └── main/
│           ├── kotlin/
│           │   └── com/
│           │       └── uber/
│           │           └── stylist/
│           │               ├── StylistExtension.kt
│           │               ├── StylistPlugin.kt
│           │               ├── StylistTask.kt
│           │               └── internal/
│           │                   └── util/
│           │                       └── Util.kt
│           └── resources/
│               └── META-INF/
│                   └── gradle-plugins/
│                       └── com.uber.stylist.properties
├── stylist-api/
│   ├── build.gradle
│   ├── gradle.properties
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── uber/
│                       └── stylist/
│                           └── api/
│                               ├── StyleItem.kt
│                               ├── StyleItemGroup.kt
│                               ├── ThemeStencil.kt
│                               ├── ThemeStencilProvider.kt
│                               └── ThemeStencilService.kt
└── stylist-core/
    ├── build.gradle
    ├── gradle.properties
    └── src/
        ├── main/
        │   └── kotlin/
        │       └── com/
        │           └── uber/
        │               └── stylist/
        │                   └── Stylist.kt
        └── test/
            └── kotlin/
                └── com/
                    └── uber/
                        └── stylist/
                            └── StylistTest.kt
Download .txt
SYMBOL INDEX (7 symbols across 3 files)

FILE: sample/app/src/main/java/com/uber/stylist/myapplication/MainActivity.java
  class MainActivity (line 25) | public class MainActivity extends AppCompatActivity {
    method onCreate (line 27) | @Override

FILE: sample/library/src/main/java/com/uber/stylist/mylibrary/MyUtils.java
  class MyUtils (line 22) | public final class MyUtils {
    method MyUtils (line 24) | private MyUtils() { }

FILE: sample/providers/src/main/java/com/uber/stylist/myproviders/SampleThemeStencilProvider.java
  class SampleThemeStencilProvider (line 34) | @AutoService(ThemeStencilProvider.class)
    method stencils (line 58) | @NonNull
    method globalStyleItemGroups (line 73) | @NonNull
Condensed preview — 64 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (142K chars).
[
  {
    "path": ".buildscript/deploy_snapshot.sh",
    "chars": 962,
    "preview": "#!/bin/bash\n#\n# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.\n#\n# Adapted from https://coderwal"
  },
  {
    "path": ".editorconfig",
    "chars": 280,
    "preview": "[*.{kt,kts}]\n# possible values: number (e.g. 2), \"unset\" (makes ktlint ignore indentation completely)\nindent_size=2\ncont"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 441,
    "preview": "Thanks for using Stylist. Before you create an issue, please consider the following points:\n\n  - [ ] If you think you fo"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 351,
    "preview": "Thank you for contributing to Stylist. Before pressing the \"Create Pull Request\" button, please provide the following:\n\n"
  },
  {
    "path": ".gitignore",
    "chars": 1154,
    "preview": "###OSX###\n\n.DS_Store\n.AppleDouble\n.LSOverride\n\n# Icon must ends with two \\r.\nIcon\n\n\n# Thumbnails\n._*\n\n# Files that might"
  },
  {
    "path": ".travis.yml",
    "chars": 1795,
    "preview": "language: android\n\nandroid:\n  components:\n    - tools\n    - platform-tools\n    - build-tools-28.0.3\n    - android-28\n   "
  },
  {
    "path": "CHANGELOG.md",
    "chars": 448,
    "preview": "Changelog\n=========\n\nVersion 0.0.2\n-------------\n\n_2018-12-03_\n\n* **Breaking change:** Project migrated to [AndroidX](ht"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3224,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 1662,
    "preview": "Contributing to Uber's Android Template\n=======================\n\nUber welcomes contributions of all kinds and sizes. Thi"
  },
  {
    "path": "LICENSE.txt",
    "chars": 11358,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "README.md",
    "chars": 4149,
    "preview": "# Stylist [![Build Status](https://travis-ci.org/uber/stylist.svg?branch=master)](https://travis-ci.org/uber/stylist)\n\nA"
  },
  {
    "path": "RELEASING.md",
    "chars": 658,
    "preview": "Releasing\n=========\n\n 1. Change the version in `gradle.properties` to a non-SNAPSHOT version.\n 2. Update the `CHANGELOG."
  },
  {
    "path": "build.gradle",
    "chars": 1659,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "buildSrc/build.gradle",
    "chars": 1912,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "buildSrc/settings.gradle",
    "chars": 817,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "config/checkstyle/checkstyle-suppressions.xml",
    "chars": 938,
    "preview": "<?xml version=\"1.0\"?>\n\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache License, Version"
  },
  {
    "path": "config/checkstyle/checkstyle-test.xml",
    "chars": 13479,
    "preview": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache License, Version "
  },
  {
    "path": "config/checkstyle/checkstyle.xml",
    "chars": 13844,
    "preview": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache License, Version "
  },
  {
    "path": "config/lint/lint.xml",
    "chars": 905,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "gradle/checkstyle.gradle",
    "chars": 2935,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "gradle/dependencies.gradle",
    "chars": 2047,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "gradle/gradle-mvn-push.gradle",
    "chars": 5986,
    "preview": "/*\n * Copyright (C) Chris Banes\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 200,
    "preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributi"
  },
  {
    "path": "gradle.properties",
    "chars": 1760,
    "preview": "#\n# Copyright (c) 2018. Uber Technologies\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
  },
  {
    "path": "gradlew",
    "chars": 5296,
    "preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n##  Gradle start up"
  },
  {
    "path": "sample/app/build.gradle",
    "chars": 1452,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "sample/app/src/main/AndroidManifest.xml",
    "chars": 1348,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/app/src/main/java/com/uber/stylist/myapplication/MainActivity.java",
    "chars": 963,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "sample/app/src/main/res/drawable/divider.xml",
    "chars": 899,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/app/src/main/res/layout/activity_main.xml",
    "chars": 2435,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml",
    "chars": 888,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml",
    "chars": 888,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/app/src/main/res/values/colors.xml",
    "chars": 831,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/app/src/main/res/values/dimens.xml",
    "chars": 881,
    "preview": "<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n "
  },
  {
    "path": "sample/app/src/main/res/values/ic_launcher_background.xml",
    "chars": 743,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/app/src/main/res/values/strings.xml",
    "chars": 700,
    "preview": "<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n "
  },
  {
    "path": "sample/app/src/main/res/values/themes.xml",
    "chars": 776,
    "preview": "<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n "
  },
  {
    "path": "sample/library/build.gradle",
    "chars": 1336,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "sample/library/src/main/AndroidManifest.xml",
    "chars": 774,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/library/src/main/java/com/uber/stylist/mylibrary/MyUtils.java",
    "chars": 734,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "sample/library/src/main/res/values/attrs.xml",
    "chars": 856,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache "
  },
  {
    "path": "sample/library/src/main/res/values/strings.xml",
    "chars": 700,
    "preview": "<!--\n  ~ Copyright (c) 2018. Uber Technologies\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n "
  },
  {
    "path": "sample/providers/build.gradle",
    "chars": 1109,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "sample/providers/src/main/java/com/uber/stylist/myproviders/SampleThemeStencilProvider.java",
    "chars": 2505,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "settings.gradle",
    "chars": 748,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist/build.gradle",
    "chars": 1035,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist/gradle.properties",
    "chars": 649,
    "preview": "#\n# Copyright (c) 2018. Uber Technologies\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
  },
  {
    "path": "stylist/src/main/kotlin/com/uber/stylist/StylistExtension.kt",
    "chars": 1214,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist/src/main/kotlin/com/uber/stylist/StylistPlugin.kt",
    "chars": 2681,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist/src/main/kotlin/com/uber/stylist/StylistTask.kt",
    "chars": 1315,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist/src/main/kotlin/com/uber/stylist/internal/util/Util.kt",
    "chars": 1052,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist/src/main/resources/META-INF/gradle-plugins/com.uber.stylist.properties",
    "chars": 52,
    "preview": "implementation-class=com.uber.stylist.StylistPlugin\n"
  },
  {
    "path": "stylist-api/build.gradle",
    "chars": 947,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-api/gradle.properties",
    "chars": 657,
    "preview": "#\n# Copyright (c) 2018. Uber Technologies\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
  },
  {
    "path": "stylist-api/src/main/kotlin/com/uber/stylist/api/StyleItem.kt",
    "chars": 886,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-api/src/main/kotlin/com/uber/stylist/api/StyleItemGroup.kt",
    "chars": 1237,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-api/src/main/kotlin/com/uber/stylist/api/ThemeStencil.kt",
    "chars": 1652,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-api/src/main/kotlin/com/uber/stylist/api/ThemeStencilProvider.kt",
    "chars": 1210,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-api/src/main/kotlin/com/uber/stylist/api/ThemeStencilService.kt",
    "chars": 1847,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-core/build.gradle",
    "chars": 1323,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-core/gradle.properties",
    "chars": 659,
    "preview": "#\n# Copyright (c) 2018. Uber Technologies\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may "
  },
  {
    "path": "stylist-core/src/main/kotlin/com/uber/stylist/Stylist.kt",
    "chars": 2542,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  },
  {
    "path": "stylist-core/src/test/kotlin/com/uber/stylist/StylistTest.kt",
    "chars": 10873,
    "preview": "/*\n * Copyright (c) 2018. Uber Technologies\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the uber/stylist GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 64 files (128.6 KB), approximately 32.9k tokens, and a symbol index with 7 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!