Skip to content

Commit

Permalink
Merge pull request #14 from trello/dlew/add-library-support
Browse files Browse the repository at this point in the history
Added support for Victor in Android libraries
  • Loading branch information
dlew committed Apr 29, 2015
2 parents 8ecad32 + c0ef669 commit f45a379
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

0.1.3
-----

- Added support for using Victor in Android libraries

0.1.2
-----

Expand Down
2 changes: 1 addition & 1 deletion victor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies {
// Plugin publishing

group = 'com.trello'
version = '0.1.2-SNAPSHOT'
version = '0.1.3-SNAPSHOT'

plugindev {
pluginId 'com.trello.victor'
Expand Down
13 changes: 12 additions & 1 deletion victor/src/main/groovy/com/trello/victor/VictorPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,19 @@ class VictorPlugin implements Plugin<Project> {
densities.remove(Density.valueOf(density.toUpperCase()))
}

def variants = null
if (project.android.hasProperty('applicationVariants')) {
variants = project.android.applicationVariants
}
else if (project.android.hasProperty('libraryVariants')) {
variants = project.android.libraryVariants
}
else {
throw new IllegalStateException('Android project must have applicationVariants or libraryVariants!')
}

// Register our task with the variant's resources
project.android.applicationVariants.all { variant ->
variants.all { variant ->
// TODO: Use lazier evaluation for files by sticking this in a prep task?
FileCollection svgFiles = project.files()
variant.sourceSets.each { sourceSet ->
Expand Down

0 comments on commit f45a379

Please sign in to comment.