Gradle: create ZIP package with exec permissions

To create distribution zip package with executable permissions for script files (*.sh files in the example) use following gradle task:


// zip into build/distributions
def installDir=new File('./install')
task makeDist(type: Zip /*, dependsOn: [add your dependencies]*/) {
    //compression = Compression.GZIP // for Tar type
    from(installDir.toString()) {
        exclude('*.sh')
    }
    from(installDir.toString()) {
        include('*.sh')
        fileMode = 0755
    }
}

Before task is run, adjust dependencies to fill installDir with package content.

Tested with gradle-1.0-milestone2.

First post 🙂

Advertisements

One Response to Gradle: create ZIP package with exec permissions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: