Skip to content
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

fix: gradle warning color #611

Merged
merged 1 commit into from
Dec 30, 2022
Merged

fix: gradle warning color #611

merged 1 commit into from
Dec 30, 2022

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Dec 30, 2022

Will show the gradle warnings as warnings and not as errors:

Screenshot_20221230_114735

Copy link
Contributor

@cb1kenobi cb1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cb1kenobi cb1kenobi merged commit 4f62f41 into master Dec 30, 2022
@cb1kenobi
Copy link
Contributor

I accidentally merged #611 too quickly and reverted it in #612.

The correct place to fix the Gradle warning is in the createReadableDataHandlerUsing() function: https://github.com/tidev/titanium_mobile/blob/master/android/cli/lib/gradle-wrapper.js#L178-L204

Fixing this isn't too hard. The code directs all Gradle stdout to this._logger.info and all stderr to this._logger.error. I recommend passing this._logger into createReadableDataHandlerUsing() (or use an arrow function) and also pass in a string with 'stdout' or 'stderr' (or use 1 and 2 like the file descriptor number). Then in that function do:

for (const nextMessage of messageArray) {
    let logMethod = fd === 'stdout' ? 'info' : nextMessage.includes('Warning') ? 'warn' : 'error';
    this._logger[logMethod]('[GRADLE] ' + nextMessage.replace(/\r/g, ''));
}

This certainly could be cleaned up.

@m1ga
Copy link
Contributor Author

m1ga commented Dec 30, 2022

works fine: tidev/titanium-sdk#13694
I've used the string parameter and pass in "error" or "info"

@m1ga m1ga deleted the 221230_gradle_Warning branch September 23, 2023 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants