Fixes after review

This commit is contained in:
Ilya Chernikov
2018-01-15 12:49:50 +01:00
committed by Vyacheslav Gerasimov
parent 14e586d5a5
commit 058ef31d7a
15 changed files with 41 additions and 51 deletions
+4 -5
View File
@@ -80,8 +80,8 @@ dependencies {
} }
val commonBuildDir = File(rootDir, "build") val commonBuildDir = File(rootDir, "build")
val distDir = "$rootDir/dist" val distDir by extra("$rootDir/dist")
val distKotlinHomeDir = "$distDir/kotlinc" val distKotlinHomeDir by extra("$distDir/kotlinc")
val distLibDir = "$distKotlinHomeDir/lib" val distLibDir = "$distKotlinHomeDir/lib"
val commonLocalDataDir = "$rootDir/local" val commonLocalDataDir = "$rootDir/local"
val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox" val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
@@ -89,8 +89,7 @@ val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin" val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin"
val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin" val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin"
extra["distDir"] = distDir // TODO: use "by extra()" syntax where possible
extra["distKotlinHomeDir"] = distKotlinHomeDir
extra["distLibDir"] = project.file(distLibDir) extra["distLibDir"] = project.file(distLibDir)
extra["libsDir"] = project.file(distLibDir) extra["libsDir"] = project.file(distLibDir)
extra["commonLocalDataDir"] = project.file(commonLocalDataDir) extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
@@ -139,7 +138,7 @@ extra["versions.jflex"] = "1.7.0"
val markdownVer = "4054 - Kotlin 1.0.2-dev-566".replace(" ", "%20") // fixed here, was last with "status:SUCCESS,tag:forKotlin" val markdownVer = "4054 - Kotlin 1.0.2-dev-566".replace(" ", "%20") // fixed here, was last with "status:SUCCESS,tag:forKotlin"
extra["markdownParserRepo"] = "https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/$markdownVer/([artifact]_[ext]/)[artifact](.[ext])" extra["markdownParserRepo"] = "https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/$markdownVer/([artifact]_[ext]/)[artifact](.[ext])"
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty("intellijUltimateEnabled")?.let { fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {
val v = it.toString() val v = it.toString()
if (v.isBlank()) true if (v.isBlank()) true
else v.toBoolean() else v.toBoolean()
-1
View File
@@ -51,7 +51,6 @@ extra["intellijRepo"] = "https://www.jetbrains.com/intellij-repository"
extra["intellijReleaseType"] = "releases" // or "snapshots" extra["intellijReleaseType"] = "releases" // or "snapshots"
extra["versions.androidDxSources"] = "5.0.0_r2" extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsRepo"] = "$rootDir/repo"
extra["customDepsOrg"] = "kotlin.build.custom.deps" extra["customDepsOrg"] = "kotlin.build.custom.deps"
repositories { repositories {
@@ -12,8 +12,8 @@ val intellijUltimateEnabled: Boolean by rootProject.extra
val intellijRepo: String by rootProject.extra val intellijRepo: String by rootProject.extra
val intellijReleaseType: String by rootProject.extra val intellijReleaseType: String by rootProject.extra
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
val androidStudioRelease = if (rootProject.extra.has("versions.androidStudioRelease")) rootProject.extra["versions.androidStudioRelease"] as String else null val androidStudioRelease = rootProject.findProperty("versions.androidStudioRelease") as String?
val androidStudioBuild = if (rootProject.extra.has("versions.androidStudioBuild")) rootProject.extra["versions.androidStudioBuild"] as String else null val androidStudioBuild = rootProject.findProperty("versions.androidStudioBuild") as String?
val intellijSeparateSdks: Boolean by rootProject.extra val intellijSeparateSdks: Boolean by rootProject.extra
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
val installIntellijUltimate = intellijUltimateEnabled val installIntellijUltimate = intellijUltimateEnabled
-1
View File
@@ -69,7 +69,6 @@ val protobufLiteTask = "$protobufLiteProject:prepare"
fun DependencyHandler.protobufFull(): ProjectDependency = fun DependencyHandler.protobufFull(): ProjectDependency =
project(protobufRelocatedProject, configuration = "default").apply { isTransitive = false } project(protobufRelocatedProject, configuration = "default").apply { isTransitive = false }
val protobufFullTask = "$protobufLiteProject:prepare"
fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex()) fun File.matchMaybeVersionedArtifact(baseName: String) = name.matches(baseName.toMaybeVersionedJarRegex())
+2 -2
View File
@@ -86,8 +86,8 @@ projectTest {
workingDir = rootDir workingDir = rootDir
systemProperty("kotlin.test.script.classpath", the<JavaPluginConvention>().sourceSets.getByName("test").output.classesDirs.joinToString(File.pathSeparator)) systemProperty("kotlin.test.script.classpath", the<JavaPluginConvention>().sourceSets.getByName("test").output.classesDirs.joinToString(File.pathSeparator))
doFirst { doFirst {
systemProperty("ant.classpath", antLauncherJar.asPath) systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
systemProperty("ant.launcher.class", "org.apache.tools.ant.Main") systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
systemProperty("idea.home.path", intellijRootDir().canonicalPath) systemProperty("idea.home.path", intellijRootDir().canonicalPath)
} }
} }
@@ -527,7 +527,9 @@ class KotlinCoreEnvironment private constructor(
?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) } ?: PathUtil.getResourcePathForClass(this::class.java).takeIf { it.hasConfigFile(configFilePath) }
// hack for load extensions when compiler run directly from project directory (e.g. in tests) // hack for load extensions when compiler run directly from project directory (e.g. in tests)
?: File("compiler/cli/src").takeIf { it.hasConfigFile(configFilePath) } ?: File("compiler/cli/src").takeIf { it.hasConfigFile(configFilePath) }
?: throw IllegalStateException("Unable to find extension point configuration $configFilePath (cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})") ?: throw IllegalStateException(
"Unable to find extension point configuration $configFilePath " +
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})")
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea()) CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, configFilePath, Extensions.getRootArea())
} }
+1 -1
View File
@@ -1,7 +1,7 @@
<project name="KotlinLexer" default="lexer"> <project name="KotlinLexer" default="lexer">
<property name="home" value="${basedir}"/> <property name="home" value="${basedir}"/>
<property name="builddir" value="${basedir}/build"/> <property name="builddir" value="${basedir}/build"/>
<property name="flex.classpath" value="${home}/../../dependencies/jflex/JFlex.jar"/> <property name="flex.classpath" value=""/>
<property name="out.dir" value="${builddir}/tmpout"/> <property name="out.dir" value="${builddir}/tmpout"/>
<macrodef name="flex"> <macrodef name="flex">
@@ -25,14 +25,14 @@ public abstract class AbstractAntTaskTest extends KotlinIntegrationTestBase {
protected void doTest(String testFile) throws Exception { protected void doTest(String testFile) throws Exception {
String testDataDir = new File(testFile).getAbsolutePath(); String testDataDir = new File(testFile).getAbsolutePath();
String antClasspath = System.getProperty("ant.classpath"); String antClasspath = System.getProperty("kotlin.ant.classpath");
if (antClasspath == null) { if (antClasspath == null) {
throw new RuntimeException("Unable to get a valid classpath from 'ant.classpath' property, please set it accordingly"); throw new RuntimeException("Unable to get a valid classpath from 'kotlin.ant.classpath' property, please set it accordingly");
} }
String antLauncherClass = System.getProperty("ant.launcher.class"); String antLauncherClass = System.getProperty("kotlin.ant.launcher.class");
if (antLauncherClass == null) { if (antLauncherClass == null) {
throw new RuntimeException("Unable to get a valid class FQN from 'ant.launcher.class' property, please set it accordingly"); throw new RuntimeException("Unable to get a valid class FQN from 'kotlin.ant.launcher.class' property, please set it accordingly");
} }
runJava( runJava(
@@ -97,7 +97,6 @@ val extractAndroidJar by tasks.creating {
inputs.files(androidPlatform) inputs.files(androidPlatform)
val targetFile = File(libsDestDir, "android.jar") val targetFile = File(libsDestDir, "android.jar")
outputs.files(targetFile) outputs.files(targetFile)
outputs.upToDateWhen { targetFile.exists() } // TODO: consider more precise check, e.g. hash-based
doFirst { doFirst {
project.copy { project.copy {
from(zipTree(androidPlatform.singleFile).matching { include("**/android.jar") }.files.first()) from(zipTree(androidPlatform.singleFile).matching { include("**/android.jar") }.files.first())
@@ -21,10 +21,7 @@ dependencies {
} }
task("prepare") { task("prepare") {
// TODO: find out why it doesn't work without explicit dependsOn inputs.files(relocatedProtobuf) // this also adds a dependency
dependsOn(":custom-dependencies:protobuf-relocated:prepare")
val inputJar = relocatedProtobuf.files.single()
inputs.files(inputJar)
outputs.file(outputJarPath) outputs.file(outputJarPath)
doFirst { doFirst {
File(outputJarPath).parentFile.mkdirs() File(outputJarPath).parentFile.mkdirs()
@@ -49,7 +46,7 @@ task("prepare") {
return result return result
} }
val allFiles = loadAllFromJar(File(inputJar)) val allFiles = loadAllFromJar(File(relocatedProtobuf.singleFile))
val keepClasses = arrayListOf<String>() val keepClasses = arrayListOf<String>()
+4 -2
View File
@@ -58,8 +58,10 @@ afterEvaluate {
"-Dapple.laf.useScreenMenuBar=true", "-Dapple.laf.useScreenMenuBar=true",
"-Dapple.awt.graphics.UseQuartz=true", "-Dapple.awt.graphics.UseQuartz=true",
"-Dsun.io.useCanonCaches=false", "-Dsun.io.useCanonCaches=false",
"-Dkotlin.internal.mode.enabled=true", "-Dkotlin.internal.mode.enabled=true"
"-Didea.ProcessCanceledException=disabled"
) )
if (project.hasProperty("noPCE")) {
jvmArgs("-Didea.ProcessCanceledException=disabled")
}
} }
} }
+14 -19
View File
@@ -1,22 +1,6 @@
apply { plugin("kotlin") } apply { plugin("kotlin") }
val usedIntellijPlugins = arrayOf(
"properties",
"gradle",
"Groovy",
"coverage",
"maven",
"android",
"junit",
"testng",
"IntelliLang",
"testng",
"copyright",
"properties",
"java-i18n",
"java-decompiler")
dependencies { dependencies {
testRuntime(intellijCoreDep()) { includeJars("intellij-core") } testRuntime(intellijCoreDep()) { includeJars("intellij-core") }
testRuntime(intellijDep()) testRuntime(intellijDep())
@@ -41,9 +25,20 @@ dependencies {
testRuntime(project(":sam-with-receiver-ide-plugin")) testRuntime(project(":sam-with-receiver-ide-plugin"))
testRuntime(project(":allopen-ide-plugin")) testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin")) testRuntime(project(":noarg-ide-plugin"))
usedIntellijPlugins.forEach { testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep(it)) testRuntime(intellijPluginDep("gradle"))
} testRuntime(intellijPluginDep("Groovy"))
testRuntime(intellijPluginDep("coverage"))
testRuntime(intellijPluginDep("maven"))
testRuntime(intellijPluginDep("android"))
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("testng"))
testRuntime(intellijPluginDep("IntelliLang"))
testRuntime(intellijPluginDep("testng"))
testRuntime(intellijPluginDep("copyright"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("java-i18n"))
testRuntime(intellijPluginDep("java-decompiler"))
} }
sourceSets { sourceSets {
+4 -4
View File
@@ -62,8 +62,8 @@ projectTest {
dependsOn(*testDistProjects.map { "$it:dist" }.toTypedArray()) dependsOn(*testDistProjects.map { "$it:dist" }.toTypedArray())
workingDir = rootDir workingDir = rootDir
doFirst { doFirst {
systemProperty("ant.classpath", antLauncherJar.asPath) systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
systemProperty("ant.launcher.class", "org.apache.tools.ant.Main") systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
} }
} }
@@ -74,8 +74,8 @@ projectTest("quickTest") {
workingDir = rootDir workingDir = rootDir
systemProperty("kotlin.js.skipMinificationTest", "true") systemProperty("kotlin.js.skipMinificationTest", "true")
doFirst { doFirst {
systemProperty("ant.classpath", antLauncherJar.asPath) systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
systemProperty("ant.launcher.class", "org.apache.tools.ant.Main") systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
} }
} }
@@ -62,7 +62,6 @@ class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider {
val module = moduleBuildTarget.module val module = moduleBuildTarget.module
if (!hasAndroidJpsPlugin() || !isAndroidModuleWithoutGradle(module)) return emptyList() if (!hasAndroidJpsPlugin() || !isAndroidModuleWithoutGradle(module)) return emptyList()
val inJar = File(PathUtil.getJarPathForClass(this::class.java)).isFile
val manifestFile = getAndroidManifest(moduleBuildTarget.module) val manifestFile = getAndroidManifest(moduleBuildTarget.module)
return if (manifestFile != null) { return if (manifestFile != null) {
@@ -74,7 +73,7 @@ class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider {
compilerPluginJar = File("dist/kotlinc/lib/$JAR_FILE_NAME") compilerPluginJar = File("dist/kotlinc/lib/$JAR_FILE_NAME")
} else { } else {
// Inside Kotlin/jps directory (Kotlin plugin) // Inside Kotlin/jps directory (Kotlin plugin)
val libDirectory = File(PathUtil.getJarPathForClass(this::class.java)).parentFile.parentFile val libDirectory = jpsPluginJar.parentFile.parentFile
compilerPluginJar = File(libDirectory, JAR_FILE_NAME) compilerPluginJar = File(libDirectory, JAR_FILE_NAME)
} }
-1
View File
@@ -90,7 +90,6 @@ val packCompiler by task<ShadowJar> {
configurations = listOf(fatJar) configurations = listOf(fatJar)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = File(buildDir, "libs") destinationDir = File(buildDir, "libs")
dependsOn(protobufFullTask)
setupPublicJar("before-proguard") setupPublicJar("before-proguard")
from(fatJarContents) from(fatJarContents)