@@ -28,19 +28,24 @@ func (c GradleCommand) Execute() {
2828
2929 banner := make ([]string , 0 )
3030 banner = append (banner , "Using gradle at '" + c .executable + "'" )
31- nearest , nargs := GrabFlag ("-gn" , c .args )
32- debug , nargs := GrabFlag ("-gd" , nargs )
31+ nearest , oargs := GrabFlag ("-gn" , c .args )
32+ debug , oargs := GrabFlag ("-gd" , oargs )
33+ skipReplace , oargs := GrabFlag ("-gr" , oargs )
34+
35+ nargs := replaceGradleTasks (skipReplace , oargs )
3336
3437 if debug {
3538 fmt .Println ("nearest = " , nearest )
36- fmt .Println ("args = " , nargs )
3739 fmt .Println ("rootBuildFile = " , c .rootBuildFile )
3840 fmt .Println ("buildFile = " , c .buildFile )
3941 fmt .Println ("settingsFile = " , c .settingsFile )
4042 fmt .Println ("explicitBuildFile = " , c .explicitBuildFile )
4143 fmt .Println ("explicitSettingsFile = " , c .explicitSettingsFile )
4244 fmt .Println ("explicitProjectDir = " , c .explicitProjectDir )
43- fmt .Println ("" )
45+ fmt .Println ("original args = " , oargs )
46+ if ! skipReplace {
47+ fmt .Println ("replaced args = " , nargs )
48+ }
4449 }
4550
4651 if len (c .explicitProjectDir ) > 0 {
@@ -79,6 +84,11 @@ func (c GradleCommand) Execute() {
7984 args = append (args , nargs [i ])
8085 }
8186
87+ if debug {
88+ fmt .Println ("actual args = " , args )
89+ fmt .Println ("" )
90+ }
91+
8292 if ! c .context .IsQuiet () {
8393 fmt .Println (strings .Join (banner , " " ))
8494 }
@@ -89,6 +99,22 @@ func (c GradleCommand) Execute() {
8999 cmd .Run ()
90100}
91101
102+ func replaceGradleTasks (skipReplace bool , args []string ) []string {
103+ var nargs []string = args
104+
105+ if ! skipReplace {
106+ replacements := map [string ]string {
107+ "compile" : "classes" ,
108+ "package" : "assemble" ,
109+ "verify" : "build" ,
110+ "install" : "publishToMavenLocal" }
111+
112+ nargs = replaceArgs (args , replacements )
113+ }
114+
115+ return nargs
116+ }
117+
92118// FindGradle finds and executes gradlew/gradle
93119func FindGradle (context Context , args []string ) * GradleCommand {
94120 pwd := context .GetWorkingDir ()
0 commit comments