Add test for a too-new Kotlin version

This commit is contained in:
Chris Smowton
2023-02-22 14:28:42 +00:00
parent d734982e7b
commit eb8a0c1129
13 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
{
"markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 1.8.30",
"severity": "error",
"source": {
"extractorName": "java",
"id": "java/extractor-agent/kotlin-version-too-new",
"name": "Android build failure"
},
"visibility": {
"cliSummaryTable": true,
"statusPage": true,
"telemetry": true
}
}

View File

@@ -0,0 +1,3 @@
package com.intellij.mock;
public class MockProject { }

View File

@@ -0,0 +1,3 @@
package com.intellij.openapi;
public class Disposable { }

View File

@@ -0,0 +1,20 @@
package driver;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments;
import org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt;
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler;
public class Main {
public static void main(String[] args) {
List<String> compilerArgs = new ArrayList<String>();
K2JVMCompilerArguments parsedArgs = new K2JVMCompilerArguments();
(new ParseCommandLineArgumentsKt()).parseCommandLineArguments(compilerArgs, parsedArgs);
(new K2JVMCompiler()).doExecute(parsedArgs, null, null, null);
}
}

View File

@@ -0,0 +1,7 @@
package kotlin;
public class KotlinVersion {
public static String CURRENT = "999.999.999";
}

View File

@@ -0,0 +1,3 @@
package org.jetbrains.kotlin.cli.common;
public class ExitCode { }

View File

@@ -0,0 +1,3 @@
package org.jetbrains.kotlin.cli.common.arguments;
class CommonToolArguments { }

View File

@@ -0,0 +1,3 @@
package org.jetbrains.kotlin.cli.common.arguments;
public class K2JVMCompilerArguments extends CommonToolArguments { }

View File

@@ -0,0 +1,7 @@
package org.jetbrains.kotlin.cli.common.arguments;
public class ParseCommandLineArgumentsKt {
public void parseCommandLineArguments(java.util.List p0, org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments p1) { }
}

View File

@@ -0,0 +1,9 @@
package org.jetbrains.kotlin.cli.jvm;
public class K2JVMCompiler {
public org.jetbrains.kotlin.cli.common.ExitCode doExecute(org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments p0, org.jetbrains.kotlin.config.CompilerConfiguration p1, com.intellij.openapi.Disposable p2, org.jetbrains.kotlin.utils.KotlinPaths p3) {
return null;
}
}

View File

@@ -0,0 +1,3 @@
package org.jetbrains.kotlin.config;
public class CompilerConfiguration { }

View File

@@ -0,0 +1,3 @@
package org.jetbrains.kotlin.utils;
public class KotlinPaths { }

View File

@@ -0,0 +1,11 @@
from create_database_utils import *
from diagnostics_test_utils import *
import glob
import os.path
os.mkdir('fake-kotlinc-classes')
runSuccessfully(["javac"] + [os.path.relpath(x, "fake-kotlinc-source") for x in glob.glob("fake-kotlinc-source/**/*.java", recursive = True)] + ["-d", "../fake-kotlinc-classes"], cwd = "fake-kotlinc-source")
run_codeql_database_create(["java -cp fake-kotlinc-classes driver.Main"], lang = "java", runFunction = runUnsuccessfully, db = None)
check_diagnostics()