diff --git a/libraries/pom.xml b/libraries/pom.xml
index ae97ad124f5..5441e389523 100644
--- a/libraries/pom.xml
+++ b/libraries/pom.xml
@@ -79,8 +79,6 @@
tools/maven-archetypes
-
- tools/idl2k
tools/kotlin-annotation-processing-maven
tools/kotlin-maven-allopen
tools/kotlin-maven-noarg
diff --git a/libraries/tools/idl2k/build.gradle b/libraries/tools/idl2k/build.gradle
new file mode 100644
index 00000000000..490b3dc4989
--- /dev/null
+++ b/libraries/tools/idl2k/build.gradle
@@ -0,0 +1,43 @@
+buildscript {
+ ext.antlr4_version = '4.7.1'
+}
+
+apply plugin: "antlr"
+apply plugin: "kotlin"
+
+if (project.findProperty("idl2k.deploy")?.toBoolean()) {
+ configurePublishing(project)
+}
+
+repositories {
+ mavenCentral()
+}
+
+project.sourceSets.main.antlr.srcDirs = ["src/main/antlr4"]
+
+dependencies {
+ antlr "org.antlr:antlr4:$antlr4_version"
+ implementation "org.antlr:antlr4-runtime:$antlr4_version"
+ implementation project(':kotlin-stdlib')
+ implementation "org.jsoup:jsoup:1.8.2"
+}
+
+sourceSets.main.kotlin.srcDirs += file("$buildDir/generated-src/antlr/main/")
+
+generateGrammarSource {
+ arguments += ["-visitor", "-long-messages", "-package", "org.antlr.webidl"]
+}
+
+
+compileKotlin.dependsOn generateGrammarSource
+compileTestKotlin.dependsOn generateTestGrammarSource
+
+task downloadAllIdls(type: JavaExec) {
+ main = "org.jetbrains.idl2k.dl.DownloadKt"
+ classpath = sourceSets.main.runtimeClasspath
+}
+
+task idl2k(type: JavaExec) {
+ main = "org.jetbrains.idl2k.MainKt"
+ classpath = sourceSets.main.runtimeClasspath
+}
diff --git a/libraries/tools/idl2k/pom.xml b/libraries/tools/idl2k/pom.xml
deleted file mode 100644
index 7e1aea84645..00000000000
--- a/libraries/tools/idl2k/pom.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
- 4.0.0
-
-
-
- org.jetbrains.kotlin
- kotlin-project
- 1.3-SNAPSHOT
- ../../pom.xml
-
-
- idl2k
- 1.3-SNAPSHOT
-
-
- ${project.version}
- 4.5.3
- true
-
-
-
-
- org.jetbrains.kotlin
- kotlin-stdlib
- ${kotlin.version}
-
-
- org.antlr
- antlr4-runtime
- ${antlr.version}
-
-
-
- org.jsoup
- jsoup
- 1.8.2
-
-
-
-
- ${project.basedir}/src/main/kotlin
-
-
-
-
- org.antlr
- antlr4-maven-plugin
- ${antlr.version}
-
-
- antlr
-
- antlr4
-
-
- true
-
-
-
-
-
-
- kotlin-maven-plugin
- org.jetbrains.kotlin
- ${kotlin.version}
-
-
-
- compile
- compile
-
- compile
-
-
-
-
- test-compile
- test-compile
-
- test-compile
-
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.2.1
-
-
- download-idl
-
- java
-
-
- org.jetbrains.idl2k.dl.DlPackage
-
-
-
- idl2k
-
- java
-
-
- org.jetbrains.idl2k.Idl2kPackage
-
-
-
-
- ${project.basedir}
- compile
-
-
-
-
- maven-deploy-plugin
-
- ${idl2k.deploy.skip}
-
-
-
-
-
diff --git a/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4 b/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4
index b46a2d632b3..c1b738b26f3 100644
--- a/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4
+++ b/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4
@@ -1,7 +1,7 @@
/*
BSD License
-Copyright (c) 2013, Rainer Schuster
+Copyright (c) 2013, 2015 Rainer Schuster
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -571,7 +571,7 @@ INTEGER_WEBIDL
;
FLOAT_WEBIDL
- : '-'?(([0-9]+'.'[0-9]*|[0-9]*'.'[0-9]+)([Ee][\+\-]?[0-9]+)?|[0-9]+[Ee][\+\-]?[0-9]+)
+ : '-'?(([0-9]+'.'[0-9]*|[0-9]*'.'[0-9]+)([Ee][+\-]?[0-9]+)?|[0-9]+[Ee][+\-]?[0-9]+)
;
IDENTIFIER_WEBIDL
@@ -579,7 +579,7 @@ IDENTIFIER_WEBIDL
;
STRING_WEBIDL
- : '"'~['"']*'"'
+ : '"' ~["]* '"'
;
WHITESPACE_WEBIDL
diff --git a/libraries/tools/idl2k/src/main/kotlin/download.kt b/libraries/tools/idl2k/src/main/kotlin/dl/download.kt
similarity index 100%
rename from libraries/tools/idl2k/src/main/kotlin/download.kt
rename to libraries/tools/idl2k/src/main/kotlin/dl/download.kt
diff --git a/libraries/tools/idl2k/src/main/kotlin/copyright.kt b/libraries/tools/idl2k/src/main/kotlin/util/copyright.kt
similarity index 100%
rename from libraries/tools/idl2k/src/main/kotlin/copyright.kt
rename to libraries/tools/idl2k/src/main/kotlin/util/copyright.kt
diff --git a/libraries/tools/idl2k/src/main/kotlin/utils.kt b/libraries/tools/idl2k/src/main/kotlin/util/utils.kt
similarity index 100%
rename from libraries/tools/idl2k/src/main/kotlin/utils.kt
rename to libraries/tools/idl2k/src/main/kotlin/util/utils.kt
diff --git a/settings.gradle b/settings.gradle
index ac8e42fc6a2..6ccad2dc54e 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -196,7 +196,8 @@ include ":kotlin-build-common",
":kotlinx-serialization-compiler-plugin",
":kotlinx-serialization-ide-plugin",
":kotlin-serialization",
- ":kotlin-serialization-unshaded"
+ ":kotlin-serialization-unshaded",
+ ":kotlin-idl2k"
def isTeamcityBuild = hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
def includeUltimate = hasProperty("intellijUltimateEnabled") && intellijUltimateEnabled != 'false'
@@ -317,3 +318,4 @@ project(':kotlinx-serialization-compiler-plugin').projectDir = file("$rootDir/pl
project(':kotlinx-serialization-ide-plugin').projectDir = file("$rootDir/plugins/kotlin-serialization/kotlin-serialization-ide")
project(':kotlin-serialization').projectDir = file("$rootDir/libraries/tools/kotlin-serialization")
project(':kotlin-serialization-unshaded').projectDir = file("$rootDir/libraries/tools/kotlin-serialization-unshaded")
+project(':kotlin-idl2k').projectDir = file("$rootDir/libraries/tools/idl2k")