build scripts: dbe_test_jars scripts reuses new code to compile the project

This commit is contained in:
nik
2017-03-29 17:56:37 +03:00
parent f5e2c46720
commit c2b353bf1a
3 changed files with 22 additions and 17 deletions
@@ -35,4 +35,6 @@ interface CompilationContext {
JpsModule findRequiredModule(String name)
JpsModule findModule(String name)
void notifyArtifactBuilt(String artifactPath)
}
@@ -16,7 +16,6 @@
package org.jetbrains.intellij.build.impl
import com.intellij.openapi.util.Pair
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.text.StringUtil
import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
@@ -29,7 +28,6 @@ import org.jetbrains.jps.model.java.JavaSourceRootProperties
import org.jetbrains.jps.model.module.JpsModule
import java.util.function.BiFunction
/**
* @author nik
*/
@@ -146,6 +144,11 @@ class BuildContextImpl extends BuildContext {
return compilationContext.findModule(name)
}
@Override
void notifyArtifactBuilt(String artifactPath) {
compilationContext.notifyArtifactBuilt(artifactPath)
}
@Override
File findFileInModuleSources(String moduleName, String relativePath) {
getSourceRootsWithPrefixes(findRequiredModule(moduleName)).collect {
@@ -264,19 +267,4 @@ class BuildContextImpl extends BuildContext {
}
return jvmArgs.trim()
}
@Override
void notifyArtifactBuilt(String artifactPath) {
def file = new File(artifactPath)
def baseDir = new File(paths.projectHome)
if (!FileUtil.isAncestor(baseDir, file, true)) {
messages.warning("Artifact '$artifactPath' is not under '$paths.projectHome', it won't be reported")
return
}
def relativePath = FileUtil.toSystemIndependentName(FileUtil.getRelativePath(baseDir, file))
if (file.isDirectory()) {
relativePath += "=>" + file.name
}
messages.artifactBuild(relativePath)
}
}
@@ -216,6 +216,21 @@ class CompilationContextImpl implements CompilationContext {
project.modules.find { it.name == name }
}
@Override
void notifyArtifactBuilt(String artifactPath) {
def file = new File(artifactPath)
def baseDir = new File(paths.projectHome)
if (!FileUtil.isAncestor(baseDir, file, true)) {
messages.warning("Artifact '$artifactPath' is not under '$paths.projectHome', it won't be reported")
return
}
def relativePath = FileUtil.toSystemIndependentName(FileUtil.getRelativePath(baseDir, file))
if (file.isDirectory()) {
relativePath += "=>" + file.name
}
messages.artifactBuild(relativePath)
}
private static String toCanonicalPath(String communityHome) {
FileUtil.toSystemIndependentName(new File(communityHome).canonicalPath)
}