mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #16177 from igfoo/igfoo/kt2.0.0-rc1
Kotlin: Add 2.0.0-RC1 support (and remove 2.0.0-Beta4)
This commit is contained in:
@@ -46,7 +46,7 @@ def version_string_to_version(version):
|
||||
# Version number used by CI.
|
||||
ci_version = '1.9.0'
|
||||
|
||||
many_versions = [ '1.5.0', '1.5.10', '1.5.20', '1.5.30', '1.6.0', '1.6.20', '1.7.0', '1.7.20', '1.8.0', '1.9.0-Beta', '1.9.20-Beta', '2.0.0-Beta4', '2.0.255-SNAPSHOT' ]
|
||||
many_versions = [ '1.5.0', '1.5.10', '1.5.20', '1.5.30', '1.6.0', '1.6.20', '1.7.0', '1.7.20', '1.8.0', '1.9.0-Beta', '1.9.20-Beta', '2.0.0-RC1' ]
|
||||
|
||||
many_versions_versions = [version_string_to_version(v) for v in many_versions]
|
||||
many_versions_versions_asc = sorted(many_versions_versions, key = lambda v: v.toTupleWithTag())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.codeql.comments
|
||||
|
||||
import com.github.codeql.*
|
||||
import com.github.codeql.utils.versions.*
|
||||
import com.intellij.lang.LighterASTNode
|
||||
import com.intellij.util.diff.FlyweightCapableTreeStructure
|
||||
import org.jetbrains.kotlin.fir.backend.FirMetadataSource
|
||||
@@ -26,7 +27,7 @@ class CommentExtractorLighterAST(
|
||||
// Returns true if it extracted the comments; false otherwise.
|
||||
fun extract(): Boolean {
|
||||
val sourceElement =
|
||||
(file.metadata as? FirMetadataSource.File)?.files?.elementAtOrNull(0)?.source
|
||||
(file.metadata as? FirMetadataSource.File)?.firFile?.source
|
||||
val treeStructure = sourceElement?.treeStructure
|
||||
if (treeStructure == null) {
|
||||
return false
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.fir.backend.FirMetadataSource
|
||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||
|
||||
val FirMetadataSource.File.firFile: FirFile?
|
||||
get() = this.files.elementAtOrNull(0)
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.codeql
|
||||
|
||||
import com.github.codeql.utils.versions.*
|
||||
import com.intellij.lang.LighterASTNode
|
||||
import com.intellij.util.diff.FlyweightCapableTreeStructure
|
||||
import org.jetbrains.kotlin.KtSourceElement
|
||||
@@ -14,7 +15,7 @@ class LinesOfCodeLighterAST(val logger: FileLogger, val tw: FileTrapWriter, val
|
||||
|
||||
fun linesOfCodeInFile(id: Label<DbFile>): Boolean {
|
||||
val sourceElement =
|
||||
(file.metadata as? FirMetadataSource.File)?.files?.elementAtOrNull(0)?.source
|
||||
(file.metadata as? FirMetadataSource.File)?.firFile?.source
|
||||
if (sourceElement == null) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.fir.backend.FirMetadataSource
|
||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||
|
||||
val FirMetadataSource.File.firFile: FirFile?
|
||||
get() = this.fir
|
||||
@@ -0,0 +1 @@
|
||||
// Nothing to do
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 1.9.30.",
|
||||
"markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 2.0.10.",
|
||||
"severity": "error",
|
||||
"source": {
|
||||
"extractorName": "java",
|
||||
|
||||
Reference in New Issue
Block a user