Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stephentuso/pubxml
Generates public.xml for Android library projects
https://github.com/stephentuso/pubxml
android android-development android-library
Last synced: about 1 month ago
JSON representation
Generates public.xml for Android library projects
- Host: GitHub
- URL: https://github.com/stephentuso/pubxml
- Owner: stephentuso
- License: mit
- Created: 2016-10-07T23:37:41.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-14T04:22:19.000Z (over 6 years ago)
- Last Synced: 2024-10-02T03:02:12.370Z (about 2 months ago)
- Topics: android, android-development, android-library
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
pubxml
======[![npm](https://img.shields.io/npm/v/pubxml.svg)](https://www.npmjs.com/package/pubxml) [![Build Status](https://travis-ci.org/stephentuso/pubxml.svg?branch=master)](https://travis-ci.org/stephentuso/pubxml)
Generates `public.xml` for Android libraries, which allows resources to be hidden from clients. [More info](https://developer.android.com/studio/projects/android-library.html#PrivateResources)
Usage
-----Install with `npm install -g pubxml`
For now, this assumes that public and private resources are in separate directories, such as `res` and `res-public`.
To add `res-public`, make a folder with that name in the same directory as `res`, probably `[library-module]/src/main`. Add the following to the module's `build.gradle`:
```groovy
android {
...
sourceSets {
main.res.srcDirs += 'src/main/res-public'
}
...
}
```Once the public resources are in a separate directory, open a terminal and navigate to that dir. Generate `public.xml` by running `pubxml`.
You can also run `pubxml` automatically before each build in Android Studio. To get it working on Mac OS and linux, you can add the following to the library module gradle file:
```
task generatePublicXml(type: Exec) {
workingDir 'src/main/res-public'
commandLine 'bash', '-c', 'export PATH="$PATH:/usr/local/bin"; pubxml'
ignoreExitValue true
}//Don't run pubxml task on Windows
if (! System.getProperty('os.name').toLowerCase().contains('windows')) {
preBuild.dependsOn generatePublicXml
}
```Change `workingDir` if you used a different folder name. I don't have a Windows computer to test it on, so it is disabled on Windows to prevent the build from failing.
License
-------Released under the MIT License.