Skip to content

Disable coloring in build output when --console=plain is used#3087

Merged
mpeddada1 merged 5 commits intoGoogleContainerTools:masterfrom
vinod-tahelyani:FIX/disable-coloring-on-console-plain
Mar 11, 2021
Merged

Disable coloring in build output when --console=plain is used#3087
mpeddada1 merged 5 commits intoGoogleContainerTools:masterfrom
vinod-tahelyani:FIX/disable-coloring-on-console-plain

Conversation

@vinod-tahelyani
Copy link
Contributor

Fixes #2764

@google-cla

This comment has been minimized.

@google-cla google-cla bot added the cla: no label Feb 26, 2021
@codecov
Copy link

codecov bot commented Feb 26, 2021

Codecov Report

Merging #3087 (8b533b6) into master (73a6395) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3087      +/-   ##
============================================
+ Coverage     71.09%   71.15%   +0.06%     
- Complexity     2307     2316       +9     
============================================
  Files           278      278              
  Lines          9755     9790      +35     
  Branches        989      991       +2     
============================================
+ Hits           6935     6966      +31     
+ Misses         2480     2478       -2     
- Partials        340      346       +6     
Impacted Files Coverage Δ Complexity Δ
...jib/plugins/common/logging/PlainConsoleLogger.java 90.90% <100.00%> (+0.90%) 4.00 <1.00> (ø)
...loud/tools/jib/gradle/GradleProjectProperties.java 65.21% <0.00%> (-0.65%) 31.00% <0.00%> (-2.00%)
...ogle/cloud/tools/jib/api/JavaContainerBuilder.java 82.17% <0.00%> (-0.50%) 53.00% <0.00%> (-1.00%)
...om/google/cloud/tools/jib/gradle/BuildTarTask.java 4.47% <0.00%> (-0.29%) 2.00% <0.00%> (ø%)
.../google/cloud/tools/jib/gradle/BuildImageTask.java 5.00% <0.00%> (-0.27%) 2.00% <0.00%> (ø%)
...google/cloud/tools/jib/gradle/BuildDockerTask.java 4.68% <0.00%> (-0.24%) 2.00% <0.00%> (ø%)
...com/google/cloud/tools/jib/maven/BuildTarMojo.java 0.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
...m/google/cloud/tools/jib/maven/BuildImageMojo.java 0.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
.../google/cloud/tools/jib/maven/BuildDockerMojo.java 0.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
...d/tools/jib/cli/jar/StandardPackagedProcessor.java 100.00% <0.00%> (ø) 5.00% <0.00%> (+1.00%)
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73a6395...8b533b6. Read the comment docs.

@vinod-tahelyani
Copy link
Contributor Author

@mpeddada1 Can u pls review this?

@chanseokoh
Copy link
Member

@vinod-tahelyani please follow the instructions above to sign the CLA so that we can accept your contribution.

@vinod-tahelyani
Copy link
Contributor Author

@googlebot I signed it!

@google-cla

This comment has been minimized.

1 similar comment
@google-cla

This comment has been minimized.

@vinod-tahelyani
Copy link
Contributor Author

@googlebot I fixed it.

@google-cla

This comment has been minimized.

@vinod-tahelyani vinod-tahelyani force-pushed the FIX/disable-coloring-on-console-plain branch from 455b68a to 43770e3 Compare February 27, 2021 07:29
@google-cla

This comment has been minimized.

@vinod-tahelyani vinod-tahelyani force-pushed the FIX/disable-coloring-on-console-plain branch from 43770e3 to 82fd82a Compare February 27, 2021 07:47
@google-cla

This comment has been minimized.

@vinod-tahelyani vinod-tahelyani force-pushed the FIX/disable-coloring-on-console-plain branch from 82fd82a to c835d3c Compare February 27, 2021 07:50
@google-cla google-cla bot added cla: yes and removed cla: no labels Feb 27, 2021
@mpeddada1
Copy link
Contributor

@vinod-tahelyani, thanks for creating the PR! The change looks good. Can you add a test for it in PlainConsoleLoggerTest?

@vinod-tahelyani
Copy link
Contributor Author

vinod-tahelyani commented Mar 7, 2021

@mpeddada1 we are expected to remove \u001B[31;1m kind as well right, in PlainConsoleLogger?

Copy link
Contributor

@mpeddada1 mpeddada1 left a comment

Choose a reason for hiding this comment

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

@vinod-tahelyani Just added a few comments:)

@mpeddada1 we are expected to remove \u001B[31;1m kind as well right, in PlainConsoleLogger?

does this remove bright colors?


singleThreadedExecutor.execute(() -> messageConsumer.accept(message));
// remove the color from the message
final String plainMessage = message.replaceAll("\u001B\\[[0-9;]{1,5}m", "");
Copy link
Member

@chanseokoh chanseokoh Mar 9, 2021

Choose a reason for hiding this comment

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

I think this is too lenient and actually more confusing. For example, [0-9;]{1,5} accepts a string like ;;8;3;. I think there can only be one ;.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, actually, it turns out there can be multiple semi-colons.

Several attributes can be set in the same sequence, separated by semicolons.

Therefore, \u001B\\[[0-9;]*m is more accurate. However, I am fine limiting the scope by finding up to 5 characters.

@vinod-tahelyani
Copy link
Contributor Author

@vinod-tahelyani Just added a few comments:)

@mpeddada1 we are expected to remove \u001B[31;1m kind as well right, in PlainConsoleLogger?

does this remove bright colors?

the intention is to remove a combination of (color + bold). example It will remove

Copy link
Contributor

@mpeddada1 mpeddada1 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for your contribution!

@mpeddada1 mpeddada1 merged commit 3a0944f into GoogleContainerTools:master Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable cyan coloring in build output when --console=plain is used.

4 participants