Skip to content

Commit

Permalink
Kotlin: Fix build with 2.0.0-Beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
igfoo committed Nov 20, 2023
1 parent 72bafd8 commit 95de749
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions java/kotlin-extractor/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,14 @@ def write_arg_file(arg_file, args):
def compile_to_dir(build_dir, srcs, version, classpath, java_classpath, output):
# Use kotlinc to compile .kt files:
kotlin_arg_file = build_dir + '/kotlin.args'
kotlin_args = ['-Werror',
'-opt-in=kotlin.RequiresOptIn',
'-opt-in=org.jetbrains.kotlin.ir.symbols.IrSymbolInternals',
'-d', output,
opt_in_args = ['-opt-in=kotlin.RequiresOptIn']
if version.lessThan(kotlin_plugin_versions.Version(2, 0, 0, "")):
opt_in_args.append('-opt-in=org.jetbrains.kotlin.ir.symbols.IrSymbolInternals')
else:
opt_in_args.append('-opt-in=org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI')
kotlin_args = ['-Werror'] \
+ opt_in_args \
+ ['-d', output,
'-module-name', 'codeql-kotlin-extractor',
'-Xsuppress-version-warnings',
'-language-version', version.toLanguageVersionString(),
Expand Down
3 changes: 3 additions & 0 deletions java/kotlin-extractor/kotlin_plugin_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def toTupleWithTag(self):
def toTupleNoTag(self):
return [self.major, self.minor, self.patch]

def lessThan(self, other):
return self.toTupleNoTag() < other.toTupleNoTag()

def lessThanOrEqual(self, other):
return self.toTupleNoTag() <= other.toTupleNoTag()

Expand Down

0 comments on commit 95de749

Please sign in to comment.