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

Add version number to CLI output #339

Merged
merged 4 commits into from
Dec 16, 2020
Merged

Add version number to CLI output #339

merged 4 commits into from
Dec 16, 2020

Conversation

alancai98
Copy link
Member

@alancai98 alancai98 commented Dec 11, 2020

Adds current PartiQL version number (from gradle) and the most recent commit hash to the CLI output.

Example output shown below:

Welcome to the PartiQL REPL!
Using version: 0.2.5-SNAPSHOT-6786c36
PartiQL> 1+1;
==='
2
---
OK!

This approach follows from this similar stackoverflow answer. Essentially, the root build.gradle file will output the version to a file in the Gradle build, which can be accessed as a resource by the CLI/REPL.

Retrieving the most recent commit hash follows this stackoverflow answer. We similarly store the commit hash to a Gradle build file.

Also, some existing REPL tests (previously ignored by #266) were updated to incorporate this change.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@alancai98 alancai98 self-assigned this Dec 11, 2020
Comment on lines -225 to -230
@Test
fun astWithMetas() {
ReplTester().assertReplPrompt("""
#Welcome to the PartiQL REPL!
#PartiQL> 1 + 1
# | !?
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was removed due to removal of printing ASTs without metas in #272.

Comment on lines 215 to +216
#(
# plus
# (
# lit
# 1
# )
# (
# lit
# 1
# )
#)
#---
#OK!
#PartiQL>
""".trimMargin("#"))
}

@Test
fun astWithMetas() {
ReplTester().assertReplPrompt("""
#Welcome to the PartiQL REPL!
#PartiQL> 1 + 1
# | !?
#==='
#
#(
# meta
# query
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix to the existing test's AST.

dlurton
dlurton previously approved these changes Dec 15, 2020
Copy link
Member

@dlurton dlurton left a comment

Choose a reason for hiding this comment

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

Overall LGTM, however is it useful/possible/feasible to include the short git hash in the version string? i.e.

Welcome to the PartiQL REPL!
Using version: 0.2.5-SNAPSHOT-c6a3b073
PartiQL>

@alancai98
Copy link
Member Author

I think providing the commit hash would be pretty useful. New revision adds the short commit hash to the REPL output following this approach to get the hash and storing it as another property.

New REPL output looks like:

Welcome to the PartiQL REPL!
Using version: 0.2.5-SNAPSHOT-6786c36
PartiQL>

@codecov-io
Copy link

codecov-io commented Dec 15, 2020

Codecov Report

Merging #339 (6786c36) into master (a22e529) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #339      +/-   ##
============================================
- Coverage     82.35%   82.30%   -0.06%     
  Complexity     1233     1233              
============================================
  Files           157      157              
  Lines          9365     9371       +6     
  Branches       1526     1526              
============================================
  Hits           7713     7713              
- Misses         1192     1198       +6     
  Partials        460      460              
Flag Coverage Δ Complexity Δ
CLI 17.73% <0.00%> (-0.39%) 0.00 <0.00> (ø)
EXAMPLES 76.01% <ø> (ø) 0.00 <ø> (ø)
LANG 85.00% <ø> (ø) 0.00 <ø> (ø)
PTS 100.00% <ø> (ø) 0.00 <ø> (ø)
TEST_SCRIPT 79.68% <ø> (ø) 0.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
cli/src/org/partiql/cli/Repl.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

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 a22e529...6786c36. Read the comment docs.

@alancai98 alancai98 merged commit de1fe32 into master Dec 16, 2020
@alancai98 alancai98 deleted the add-version-to-cli branch December 16, 2020 20:46
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.

3 participants