-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows Customizing Project Location on Gradle Wrapper #73
Allows Customizing Project Location on Gradle Wrapper #73
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running this code locally, I get a different exception:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'assembleRelease' not found in root project 'pwabuilder-llamapack'
In other words, even though we've specified the path to gradlew.bat, it's still looking in the process' current directory for the assembleRelease
task.
I'll follow up here when I find out the additional changes needed. Perhaps I can submit a PR for it.
OK, I think the issue is we should instead be setting the current directory of the node child process. I think the final code would look like this: class GradleWrapper {
constructor(process, androidSdkTools, gradleDirectory) {
this.process = process;
this.gradleDirectory = gradleDirectory;
this.androidSdkTools = androidSdkTools;
if (process.platform === 'win32') {
this.gradleCmd = 'gradlew.bat';
} else {
this.gradleCmd = './gradlew';
}
}
async assembleRelease() {
const env = this.androidSdkTools.getEnv();
await exec(`${this.gradleCmd} assembleRelease --stacktrace`, {
env: env,
cwd: this.gradleDirectory
});
} I'll test this first and follow up shortly with the results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of appending the directory to the gradle file, we only need to set the working directory option on the child process:
await exec(`${this.gradleCmd} assembleRelease --stacktrace`, {
env: androidSdkTools.getEnv(),
cwd: gradleDirectory // set the current directory for the child process
});
Once we do that, everything works. 😎
Ha! Sounds like I was overcomplicating things. Thanks for checking this out. I'll update the PR. |
@JudahGabriel does this sound good? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 😎
@JudahGabriel drafted this to enable customizing the Gradle Wrapper.