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

Gradle support #74

Merged
merged 6 commits into from
Mar 2, 2018
Merged

Gradle support #74

merged 6 commits into from
Mar 2, 2018

Conversation

elldritch
Copy link
Member

@elldritch elldritch commented Mar 2, 2018

Follow-up work:

  • Install Android SDK prerequisites for Gradle fixture inside Dockerfile (or document how to, since we probably don't want to accept licenses on behalf of users)
  • Add syntax for providing module names on the command line (for Gradle builder)

@elldritch elldritch requested a review from xizhao March 2, 2018 00:31
if err == nil {
builder.GradleCmd = gradleCmd

gradleVersionMatchRe := regexp.MustCompile(`Gradle ([0-9]+\.[0-9]+.\w+)`)
Copy link
Member Author

Choose a reason for hiding this comment

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

It's probably more useful (for debugging purposes) to just capture the entire --version output rather than checking for a version.


// TODO: We need to let the user configure the right configurations
dependenciesOutput, err := exec.Command(builder.GradleCmd, m.Name+":dependencies", "-q", "--configuration=compile", "--offline", "-a").Output()
// Do not handle error, as gradle will exit with status 1 regardless
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what this comment means -- aren't you handling err just below?

}

var deps []module.Dependency
dependenciesRe := regexp.MustCompile(`- ([\w\.-]+):([\w\.-]+):([\w\.-]+)( -> ([\w\.-]+))?`)
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 regex is unmaintainable without a very detailed comment. I think it would be much cleaner to loop through each line and check for --- instead (which prefixes all lines with dependency names).

Copy link
Contributor

Choose a reason for hiding this comment

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

That's not true, since it renders as a tree the parent nodes have a different prefix. There is no way to guarantee a specific format for each level as well.

The only common prefix i found was -

Copy link
Member Author

Choose a reason for hiding this comment

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

Really? I see all nodes being prefixed with either \--- or +--- . Is this because we're using different versions? Do you have an example project where this isn't true?

if err := builder.Initialize(); err != nil {
return nil, err
}
// Look for the root Gradle build
Copy link
Member Author

Choose a reason for hiding this comment

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

These comments are out of date.

Copy link
Contributor

Choose a reason for hiding this comment

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

How so?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're parsing gradle tasks output instead of looking for *.gradle files now. I might have been looking at an older commit.

trimmed := strings.TrimSpace(line)
if len(trimmed) > 0 {
depMatchIndicies := taskListRe.FindStringIndex(trimmed)
if len(depMatchIndicies) > 0 && depMatchIndicies[0] == 0 {
Copy link
Member Author

Choose a reason for hiding this comment

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

*Indices

@elldritch
Copy link
Member Author

LGTM, modulo nits. @xizhao, can you LGTM this PR when ready? I opened it so it won't let me LGTM.

@xizhao
Copy link
Contributor

xizhao commented Mar 2, 2018

Gradle still needs the build cmd, it's missing APIs

@xizhao xizhao merged commit ddcc341 into master Mar 2, 2018
@xizhao xizhao deleted the feat/gradle-support branch March 2, 2018 04:39
meghfossa pushed a commit that referenced this pull request Nov 12, 2021
Only run IPR scan if all of the IPR options are provided
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