File tree Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Expand file tree Collapse file tree 2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 11const {
22 spawnSync
33} = require ( 'child_process' ) ;
4+ const { join} = require ( 'path' )
45
5- function determineGradleCommand ( ) {
6+ function determineGradleCommand ( debugLog ) {
67 let gradleCommand = null
78 let gradleWrapper = false
9+ debugLog ( 'Determining gradle command' )
810 try {
911 const isWindows = process . platform === 'win32'
12+ debugLog ( 'isWindows: ' + isWindows )
1013 const gradleWrapperFile = isWindows ? 'gradlew.bat' : 'gradlew'
11- if ( existsSync ( gradleWrapperFile ) ) {
14+
15+ const gradleWrapperFilePath = join ( './' , gradleWrapperFile )
16+
17+ debugLog ( `Checking if wrapper file ${ gradleWrapperFilePath } exists` )
18+ if ( existsSync ( gradleWrapperFilePath ) ) {
19+ debugLog ( 'Wrapper file exists' )
1220 gradleCommand = ( isWindows ? '' : './' ) + gradleWrapperFile
1321 gradleWrapper = true
22+ } else {
23+ debugLog ( 'Wrapper file not found' )
1424 }
1525 } catch ( err ) { }
1626
@@ -21,6 +31,8 @@ function determineGradleCommand() {
2131 }
2232 }
2333
34+ debugLog ( `Determined gradle command: ${ gradleCommand } , wrapper: ${ gradleWrapper } ` )
35+
2436 return {
2537 gradleCommand,
2638 gradleWrapper
Original file line number Diff line number Diff line change 77 argv
88} = require ( './args' )
99
10+ function debugLog ( message ) {
11+ if ( argv . debug ) {
12+ console . log ( message . blue )
13+ }
14+ }
15+
1016const prompts = require ( 'prompts' ) ;
1117const {
1218 existsSync,
@@ -37,7 +43,7 @@ const {
3743const {
3844 gradleCommand,
3945 gradleWrapper
40- } = determineGradleCommand ( )
46+ } = determineGradleCommand ( debugLog )
4147
4248if ( ! gradleCommand ) {
4349 console . log ( 'Unable to find Gradle Wrapper or Gradle CLI.' . bgRed )
@@ -271,8 +277,3 @@ function informUserAboutInstallingUpdatePlugin() {
271277 ` . green ) ;
272278}
273279
274- function debugLog ( message ) {
275- if ( argv . debug ) {
276- console . log ( message . blue )
277- }
278- }
You can’t perform that action at this time.
0 commit comments