Ali
Ali

Reputation: 9994

custom shell script as a build step in order to define which task to run first

In my Android studio project. I want to have custom shell script as a build step in order to define which task to run first.

task printHello(type: Exec) {

    workingDir "$rootProject.projectDir/"

    //on linux
    commandLine './hello.sh'
}

And following is hello.sh :

#!/bin/bash
# declare STRING variable
STRING="Hello World"
#print variable on a screen
echo $STRING

I also wonder if I can execute Gradle tasks using bash script?

Addenda

./gradlew task1
./gradlew task2

Can I use following in .sh file?

Upvotes: 1

Views: 777

Answers (1)

orium
orium

Reputation: 3813

You can set order in command line ./gradlew task1 task2 or ./gradlew task2 task1

Upvotes: 2

Related Questions