Skip to content

Commit

Permalink
Merge pull request #78 from trello/dlew/move-to-gradle-publishing
Browse files Browse the repository at this point in the history
Switch to Gradle publishing
  • Loading branch information
dlew authored Mar 24, 2021
2 parents f138c0d + fc19fc1 commit f73567d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
50 changes: 23 additions & 27 deletions victor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
*/

plugins {
id 'nu.studer.plugindev' version '1.0.12'

// Should come along with plugindev, but plugindev uses an old version
id 'com.jfrog.bintray' version '1.8.5'
id 'java-gradle-plugin'
id "com.gradle.plugin-publish" version "0.13.0"
}

apply plugin: 'groovy'
Expand Down Expand Up @@ -54,32 +52,30 @@ dependencies {
group = 'com.trello'
version = '1.1.0-SNAPSHOT'

plugindev {
pluginId 'com.trello.victor'
pluginName 'victor'
pluginImplementationClass 'com.trello.victor.VictorPlugin'
pluginDescription 'Gradle plugin that lets an Android project use SVGs as resources.'
pluginLicenses 'Apache-2.0'
pluginTags 'gradle', 'plugin', 'android'
authorId 'danlew42'
authorName 'Dan Lew'
authorEmail '[email protected]'
projectUrl 'https://github.com/trello/victor'
projectInceptionYear '2015'
done() // do not omit this

gradlePlugin {
plugins {
victorPlugin {
id = 'com.trello.victor'
implementationClass = 'com.trello.victor.VictorPlugin'
}
}
}

// If you want to upload this, make sure to set BINTRAY_USER and BINTRAY_API_KEY in gradle.properties
if (project.hasProperty('BINTRAY_USER') && project.hasProperty('BINTRAY_API_KEY')) {
bintray {
dryRun = true // Turn off when actually deploying
publish = false // Maybe someday turn this on for auto-publishing
pluginBundle {
website = 'https://github.com/trello/victor'
vcsUrl = 'https://github.com/trello/victor'
description = 'Gradle plugin that lets an Android project use SVGs as resources.'
tags = ['gradle', 'plugin', 'android']

user = "$BINTRAY_USER"
key = "$BINTRAY_API_KEY"
pkg {
repo = 'gradle-plugins'
userOrg = 'trello'
plugins {
victorPlugin {
displayName = 'victor'
}
}

mavenCoordinates {
groupId = "com.trello"
artifactId = "victor"
}
}
7 changes: 4 additions & 3 deletions victor/src/main/groovy/com/trello/victor/RasterizeTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class RasterizeTask extends DefaultTask {
/**
* The densities to scale assets for.
*/
@Input
List<Density> includeDensities

/**
Expand Down Expand Up @@ -148,17 +149,17 @@ class RasterizeTask extends DefaultTask {
}
}

void createOutput(@Nullable Density density = null) {
private void createOutput(@Nullable Density density = null) {
File resDir = getResourceDir(density)
resDir.mkdirs()
}

File getResourceDir(@Nullable Density density = null) {
private File getResourceDir(@Nullable Density density = null) {
String suffix = density? "-${density.name().toLowerCase()}" : ""
return new File(outputDir, "/drawable${suffix}")
}

String getDestinationFile(String name, String suffix) {
private String getDestinationFile(String name, String suffix) {
int suffixStart = name.lastIndexOf '.'
return suffixStart == -1 ? name : "${name.substring(0, suffixStart)}.$suffix"
}
Expand Down

0 comments on commit f73567d

Please sign in to comment.