Skip to content

Commit

Permalink
fix: set gradle command as full path (#764)
Browse files Browse the repository at this point in the history
* fix: set gradle command as full path

* follow gradlew.bat on win for now
  • Loading branch information
KazuCocoa authored Apr 3, 2022
1 parent 2d78337 commit 2d7ac7d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/server-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ServerBuilder {
}

getCommand () {
const cmd = system.isWindows() ? 'gradlew.bat' : './gradlew';
const cmd = system.isWindows() ? 'gradlew.bat' : path.resolve(this.serverPath, 'gradlew');
const buildProperty = (key, value) => value ? `-P${key}=${value}` : null;
let args = VERSION_KEYS
.filter((key) => key !== GRADLE_VERSION_KEY)
Expand Down
13 changes: 8 additions & 5 deletions test/unit/server-builder-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ chai.use(chaiAsPromised);

describe('server-builder', function () {
describe('getCommand', function () {
const expectedCmd = system.isWindows() ? 'gradlew.bat' : './gradlew';
const expectedCmd = system.isWindows() ? 'gradlew.bat' : '/path/to/project/gradlew';

it('should not pass properties when no versions are specified', function () {
const expected = {cmd: expectedCmd, args: ['app:assembleAndroidTest']};
new ServerBuilder(log).getCommand().should.eql(expected);
new ServerBuilder(log, {serverPath: '/path/to/project'}).getCommand().should.eql(expected);
});

it('should pass only specified versions as properties and pass them correctly', function () {
Expand All @@ -26,7 +26,8 @@ describe('server-builder', function () {
toolsVersions: {
androidGradlePlugin: '1.2.3'
}
}
},
serverPath: '/path/to/project'
});
serverBuilder.getCommand().should.eql(expected);
});
Expand All @@ -41,7 +42,8 @@ describe('server-builder', function () {
toolsVersions: {
[unknownKey]: '1.2.3'
}
}
},
serverPath: '/path/to/project'
});
serverBuilder.getCommand().should.eql(expected);
});
Expand All @@ -53,7 +55,8 @@ describe('server-builder', function () {
toolsVersions: {
gradle_version: '1.2.3'
}
}
},
serverPath: '/path/to/project'
});
serverBuilder.getCommand().should.eql(expected);
});
Expand Down

0 comments on commit 2d7ac7d

Please sign in to comment.