-
Notifications
You must be signed in to change notification settings - Fork 1k
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 support for gradle ecosystem metrics collection #11030
Conversation
|
||
module Dependabot | ||
module Gradle | ||
LANGUAGE = "jvm_languages" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Gradle can build non-JVM projects like C++ and JavaScript, is jvm_languages
is the right value here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, perhaps, I should just use unknown / not available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just FYI
To identify the programming language from a Gradle build file, you can look for specific plugins and configurations that are commonly associated with certain languages. Here are some key indicators:
- Java: Look for the java plugin.
plugins {
id 'java'
}
- Kotlin: Look for the kotlin plugin.
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.5.21'
}
- Groovy: Look for the groovy plugin.
plugins {
id 'groovy'
}
- Scala: Look for the scala plugin.
plugins {
id 'scala'
}
- Android: Look for the com.android.application or com.android.library plugins.
plugins {
id 'com.android.application'
}
By examining the plugins section of the build.gradle file, you can determine the primary programming language used in the project.
And for
6. C++
plugins {
id 'cpp'
}
- Javacript
plugins {
id 'com.github.node-gradle.node' version '3.0.1'
}
If this information is not there then we can say unknown. This is my reading, Nonblocking comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thavaahariharangit can you provide a doc for this, it might be useful for @amazimbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no plugins.id in the build.gradle file, you can look for other indicators to identify the programming language. Here are some additional clues:
- Java: Look for apply plugin: 'java' or dependencies like implementation 'org.springframework.boot:spring-boot-starter'.
- Kotlin: Look for apply plugin: 'kotlin' or dependencies like implementation "org.jetbrains.kotlin:kotlin-stdlib".
- Groovy: Look for apply plugin: 'groovy' or dependencies like implementation 'org.codehaus.groovy:groovy-all'.
- Scala: Look for apply plugin: 'scala' or dependencies like implementation 'org.scala-lang:scala-library'.
- Android: Look for apply plugin: 'com.android.application' or apply plugin: 'com.android.library'.
By examining these elements, you can determine the primary programming language used in the project.
JavaScript
Look for:
apply plugin: 'node'
apply plugin: 'com.github.node-gradle.node'
Dependencies like implementation 'org.nodejs:node' or implementation 'com.github.node-gradle:node'
C++
Look for:
apply plugin: 'cpp'
Dependencies like implementation 'org.gradle.cpp:cpp-library'
By examining these elements, you can determine if the project is using JavaScript or C++.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge this but will create another PR if I manage to do the parsing consistently and reliably.
fd3b646
to
221d912
Compare
What are you trying to accomplish?
Update the Gradle ecosystem to add support for gathering ecosystem metrics.
Anything you want to highlight for special attention from reviewers?
As agreed at standup, in this PR, I'm returning
jvm_based_languages
as the language name. In addition, NOT-AVAILABLE is being returned for the language and gradle versions as there is no consistent way to extract this data based on the Gradle dependency file alone. In future, we might be able to improve on this but that will have to await the completion of install Gradle on docker images.How will you know you've accomplished your goal?
Checklist