Gradle Dependency using Make

407 views Asked by At

I decided to give Gradle a shot in my latest project which is featuring graphics I create using gimp.

I use git for my project and I refuse to commit exportet .png-graphics in my repository. Instead I want to save gimps .xcf files in order to be able to edit the graphics later on.

However my android application will need them as .png files and there is a whole lot of them and I am also trying to completely automate my build-process so I want Gradle to build .png-graphics from my .xcf files when executing gradle build.

There is a plugin featuring ImageMagick for gradle which does not work as it produces images with transparency-issues. Example:

This is the image created by gradle:

enter image description here

And this is how it should look like (exportet from gimp):

enter image description here

There are no hidden layers and they also do not have opacity.

build.gradle:

buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath 'com.eowise:gradle-imagemagick:0.4.0'
  }
}

task build(type: com.eowise.imagemagick.tasks.Magick) {
    convert 'xcf/', { include '*.xcf' }
    into 'png/'
    actions {
    -alpha('on')
    -background('none')
    inputFile()
    -flatten()
        outputFile { filename, extension -> "${filename}.png" }
    }
}

task clean() {
    FileTree tree = fileTree (dir: "xcf/");
    tree.each { File file ->
        File pngFile = new File("png/" + file.name.replaceFirst(~/\.[^\.]+$/, '') + ".png")
        pngFile.delete()
    }
}

The problems seem to be related to ImageMagick itself (source: google), which is having its issues with .xcf-Files. (I also just run the command on the commandline and it produces images with the same issues.)

XCFTools

There is however a toolbox called xcftools which can export the images correctly.

However it is only provided as git repository hosted on github and is built using the gnu build system. (./configure && make).

As I assume that no one building my project has xcftools installed and it is also not available for all distributions.

Which is why I would love to have it as a dependency which leads me to my the question:

How do I add git-repositories to Gradle as dependency (or repository)?

How do I make Gradle build it to compile time and then use it?

0

There are 0 answers