Scaffold an Android library (
.aar
) with boilerplate code including CLI tasks that build, test, and deploy with quality gates, CI-services, and dependency management.
- Table of contents
- 1. Features
- 2. Installation
- 3. Usage
- 4. Extend this generator
- 5. Sub-generators
- 6. Contributors
- 7. License
generator-android-lib
creates a base template to start a new Android library (.aar
).
- License selection with many SPDX options
- Gradle build (with support of optional and provided dependencies)
- Maven central compatible artifacts (aar, sources, javadocs)
- Ready for spock tests (documentation)
- Bintray publication (+ jars signing and maven central publishing)
- Travis-CI integration (CI and healthy badge)
- Coveralls integration (code coverage badge)
- Target jdk compatibility check with animal sniffer (you may use newer jdk to build, and keep compatibility with older jdk)
- Code quality checks (checkstyle, pmd, findbugs)
- Release process (like maven release)
$ npm install --global generator-android-lib
β οΈ This template generates files in the current directory.Be sure to change to a new directory first if you don't want to overwrite existing files.
$ yo android-lib
That'll generate a project with all the common tools setup. This includes:
- Android Studio-compatible source code
- Ready-to-run
*.
- JUnit, Robolectric, and Jacoco unit test and code coverage (optionally tracked on Coveralls)
- Linters
checkstyle
for code standardsPMD
for complexity analysisFindBugs
for potential defects
- GitHub repository set-up, including
- GitHub Issue labels with git-labelmaker
github-changelog-generator
- A
README.md
with Badges - Travis CI continuous integration (optional)
- An SPDX License
- JCenter binary publication
Once the project is scaffolded, inside the project folder run:
$ ./gradlew test
Once your tests are passing (ideally with Travis CI and and Coveralls green runs), you might be ready to publish your code to JCenter. We recommend you using npm version to tag release correctly.
$ # TODO: add version bump command
$ git push --follow-tags
# ATTENTION: There is no turning back here.
$ # TODO: add publish command
First of all, make sure you're comfortable with Yeoman composability feature. Then in your own generator:
var Generator = require('yeoman-generator');
module.exports = class extends Generator({
default() {
this.composeWith(require.resolve('generator-android-lib/generators/app'), {
/* provide the options you want */
});
}
});
Running into problems? Read
- π How to debug Yeoman generators for instructions on debugging with
node-inspector
and Chrome dev-tools.- π Debugging Generators (official documentation).
Here's a list of our supported options:
boilerplate
(Boolean, default true) include or not the Android Studio directories and fileslinters
(Boolean, default true) include or notcheckstyle
,PMD
, andFindBugs
git
(Boolean, default true) include or not the git files (.gitattributes
,.gitignore
).license
(Boolean, default true) include or not aLICENSE
file.travis
(Boolean, default true) include or not a.travis.yml
file.githubAccount
(String) Account name for GitHub repo location.readme
(String) content of theREADME.md
file. Given this option, generator-android-lib will still generate the title (with badges) and the license section.
If you don't need all the features provided by the main generator, you can still use a limited set of features by composing with our sub generators directly.
Remember you can see the options of each sub generators by running yo android-lib:sub --help
.
android-lib:boilerplate
android-lib:linters
android-lib:git
android-lib:security
installs the OWASP LAPSE+ Projectandroid-lib:readme
- Greg Swindle and
- Mukesh Korat.
We warmly welcome collaboration with the inclusive Contributor Covenant Code of Conduct.
If you want help us out with defect reports, documentation, development, or testing, please read the CONTRIBUTING document.
This generator was inspired by:
cesarferreira/generator-android-library
We originally forked this, but soon decided to start over: its dependencies are so outdated, refactoring would essentially be a rewrite. :person_frowning:xvik/generator-lib-java
Great features, Android's' idiosyncrasies demand different dependencies. π½yeoman/generator-node
generator-android-lib
basically plagiarizesgenerator-node
. π
Apache 2.0 Β© Greg Swindle and Mukesh Korat.