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 1
1
const {
2
2
spawnSync
3
3
} = require ( 'child_process' ) ;
4
+ const { join} = require ( 'path' )
4
5
5
- function determineGradleCommand ( ) {
6
+ function determineGradleCommand ( debugLog ) {
6
7
let gradleCommand = null
7
8
let gradleWrapper = false
9
+ debugLog ( 'Determining gradle command' )
8
10
try {
9
11
const isWindows = process . platform === 'win32'
12
+ debugLog ( 'isWindows: ' + isWindows )
10
13
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' )
12
20
gradleCommand = ( isWindows ? '' : './' ) + gradleWrapperFile
13
21
gradleWrapper = true
22
+ } else {
23
+ debugLog ( 'Wrapper file not found' )
14
24
}
15
25
} catch ( err ) { }
16
26
@@ -21,6 +31,8 @@ function determineGradleCommand() {
21
31
}
22
32
}
23
33
34
+ debugLog ( `Determined gradle command: ${ gradleCommand } , wrapper: ${ gradleWrapper } ` )
35
+
24
36
return {
25
37
gradleCommand,
26
38
gradleWrapper
Original file line number Diff line number Diff line change 7
7
argv
8
8
} = require ( './args' )
9
9
10
+ function debugLog ( message ) {
11
+ if ( argv . debug ) {
12
+ console . log ( message . blue )
13
+ }
14
+ }
15
+
10
16
const prompts = require ( 'prompts' ) ;
11
17
const {
12
18
existsSync,
@@ -37,7 +43,7 @@ const {
37
43
const {
38
44
gradleCommand,
39
45
gradleWrapper
40
- } = determineGradleCommand ( )
46
+ } = determineGradleCommand ( debugLog )
41
47
42
48
if ( ! gradleCommand ) {
43
49
console . log ( 'Unable to find Gradle Wrapper or Gradle CLI.' . bgRed )
@@ -271,8 +277,3 @@ function informUserAboutInstallingUpdatePlugin() {
271
277
` . green ) ;
272
278
}
273
279
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