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

Three handy predicates to check classpath #70

Merged
merged 16 commits into from
Mar 31, 2022

Conversation

da-tubi
Copy link
Contributor

@da-tubi da-tubi commented Mar 22, 2022

README preview: https://github.com/darcy-shen/enableIf.scala/tree/feature/enableWithClasspath2

The original idea of checking classpath in enableIf comes from @Renkai

closes #57

@Atry
Copy link
Collaborator

Atry commented Mar 23, 2022

You forgot import

@da-tubi
Copy link
Contributor Author

da-tubi commented Mar 23, 2022

You forgot import

No, import enableIf._ imports it.

@Atry
Copy link
Collaborator

Atry commented Mar 23, 2022

The import should be put in the quasiquote

@da-tubi da-tubi force-pushed the feature/enableWithClasspath2 branch from 7d415e8 to cc2639b Compare March 24, 2022 08:11
@da-tubi
Copy link
Contributor Author

da-tubi commented Mar 24, 2022

I don't know how to import in the quasiquote. I decide to evaluate it. Now, in macro, the two handy functions only accept String/Regex literals. And now, it only supports @enableIf. I'm waiting for your reply on the current impl. If it is OK, let me make it work for @enableMembersIf and polish the docs.

@da-tubi
Copy link
Contributor Author

da-tubi commented Mar 24, 2022

Thanks for the review! I will complete this PR tomorrow with three handy functions on the two existing macros:

  • classpathMatches
  • classpathMatchesArtifact
  • classpathMatchesScalaArtifact

@Atry
Copy link
Collaborator

Atry commented Mar 24, 2022

I don't know how to import in the quasiquote. I decide to evaluate it. Now, in macro, the two handy functions only accept String/Regex literals. And now, it only supports @enableIf. I'm waiting for your reply on the current impl. If it is OK, let me make it work for @enableMembersIf and polish the docs.

Just like this

q"""
import ...
${you code here}
"""

@da-tubi
Copy link
Contributor Author

da-tubi commented Mar 24, 2022

Cool, it works. I just tested it. Let me complete the PR now!

@da-tubi da-tubi changed the title Attempt2: wrap predicates in a function Three handy predicates to check classpath Mar 24, 2022
@da-tubi da-tubi requested a review from Atry March 24, 2022 16:31
@da-tubi
Copy link
Contributor Author

da-tubi commented Mar 24, 2022

@Atry Please review it again. This pr is complete now!

@da-tubi da-tubi requested a review from Atry March 25, 2022 04:01
@da-tubi da-tubi requested a review from Atry March 29, 2022 12:12
@da-tubi
Copy link
Contributor Author

da-tubi commented Mar 30, 2022

@Atry Here is final handy func combos:

  • classpathContains
  • classpathMatches
  • classpathMatchesArtifact(aid, version)
  • classpathMatchesArtifact(crossScalaBinaryVersion(aid), version)

@Atry Atry merged commit 56fd8fb into ThoughtWorksInc:master Mar 31, 2022
@Atry
Copy link
Collaborator

Atry commented Mar 31, 2022

Looks good. Thank you!

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.

Enhanced enableIf for arbitrary jar dependencies
2 participants