Skip to content

Commit 95de749

Browse files
committed
Kotlin: Fix build with 2.0.0-Beta1
1 parent 72bafd8 commit 95de749

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

java/kotlin-extractor/build.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,14 @@ def write_arg_file(arg_file, args):
9090
def compile_to_dir(build_dir, srcs, version, classpath, java_classpath, output):
9191
# Use kotlinc to compile .kt files:
9292
kotlin_arg_file = build_dir + '/kotlin.args'
93-
kotlin_args = ['-Werror',
94-
'-opt-in=kotlin.RequiresOptIn',
95-
'-opt-in=org.jetbrains.kotlin.ir.symbols.IrSymbolInternals',
96-
'-d', output,
93+
opt_in_args = ['-opt-in=kotlin.RequiresOptIn']
94+
if version.lessThan(kotlin_plugin_versions.Version(2, 0, 0, "")):
95+
opt_in_args.append('-opt-in=org.jetbrains.kotlin.ir.symbols.IrSymbolInternals')
96+
else:
97+
opt_in_args.append('-opt-in=org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI')
98+
kotlin_args = ['-Werror'] \
99+
+ opt_in_args \
100+
+ ['-d', output,
97101
'-module-name', 'codeql-kotlin-extractor',
98102
'-Xsuppress-version-warnings',
99103
'-language-version', version.toLanguageVersionString(),

java/kotlin-extractor/kotlin_plugin_versions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def toTupleWithTag(self):
2727
def toTupleNoTag(self):
2828
return [self.major, self.minor, self.patch]
2929

30+
def lessThan(self, other):
31+
return self.toTupleNoTag() < other.toTupleNoTag()
32+
3033
def lessThanOrEqual(self, other):
3134
return self.toTupleNoTag() <= other.toTupleNoTag()
3235

0 commit comments

Comments
 (0)