Build scripts: introduce buildSrc module

This commit is contained in:
Alexander Zolotov
2017-04-29 01:57:45 +03:00
parent 623d7d49a4
commit 1be957beb2
5 changed files with 107 additions and 25 deletions
+1
View File
@@ -68,6 +68,7 @@
<module fileurl="file://$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" filepath="$PROJECT_DIR$/java/debugger/impl/debugger-impl.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml" filepath="$PROJECT_DIR$/java/debugger/openapi/debugger-openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/build/dependencies/dependencies.iml" filepath="$PROJECT_DIR$/build/dependencies/dependencies.iml" />
<module fileurl="file://$PROJECT_DIR$/build/dependencies/buildSrc/buildSrc.iml" filepath="$PROJECT_DIR$/build/dependencies/buildSrc/buildSrc.iml" />
<module fileurl="file://$PROJECT_DIR$/android/designer/designer.iml" filepath="$PROJECT_DIR$/android/designer/designer.iml" group="android" />
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/devkit.iml" filepath="$PROJECT_DIR$/plugins/devkit/devkit.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/plugins/devkit/jps-plugin/devkit-jps-plugin.iml" filepath="$PROJECT_DIR$/plugins/devkit/jps-plugin/devkit-jps-plugin.iml" group="plugins" />
+49
View File
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="buildSrc" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/groovy" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/groovy" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Gradle: gradle-api-2.14">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/caches/2.14/generated-gradle-jars/gradle-api-2.14.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Gradle: groovy-all-2.4.4">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/wrapper/dists/gradle-2.14-all/t7wfomcrmv8dmyii9c9waem8/gradle-2.14/lib/groovy-all-2.4.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Gradle: gradle-installation-beacon-2.14">
<CLASSES>
<root url="jar://$USER_HOME$/.gradle/wrapper/dists/gradle-2.14-all/t7wfomcrmv8dmyii9c9waem8/gradle-2.14/lib/gradle-installation-beacon-2.14.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$USER_HOME$/.gradle/wrapper/dists/gradle-2.14-all/t7wfomcrmv8dmyii9c9waem8/gradle-2.14/src/installation-beacon" />
</SOURCES>
</library>
</orderEntry>
</component>
</module>
@@ -0,0 +1,44 @@
package org.jetbrains.intellij.build
import groovy.transform.CompileStatic
import org.gradle.api.logging.Logger
import org.gradle.api.logging.Logging
import org.gradle.internal.os.OperatingSystem
@CompileStatic
class DependenciesBuildUtils {
private static final Logger LOG = Logging.getLogger('DependenciesBuild')
private static Boolean isInJetBrainsNetwork = null
static def getInJetBrainsNetwork() {
if (isInJetBrainsNetwork == null) {
try {
isInJetBrainsNetwork = InetAddress.getByName("repo.labs.intellij.net").isReachable(1000)
if (!isInJetBrainsNetwork && OperatingSystem.current().isWindows()) {
isInJetBrainsNetwork = Runtime.runtime.exec("ping -n 1 repo.labs.intellij.net").waitFor() == 0
}
if (!isInJetBrainsNetwork) {
LOG.info('repo.labs.intellij.net is not reachable')
}
}
catch (UnknownHostException e) {
LOG.info('repo.labs.intellij.net is not reachable', e)
isInJetBrainsNetwork = false
}
}
return isInJetBrainsNetwork
}
static def getJdkRepo() {
return inJetBrainsNetwork ? 'http://repo.labs.intellij.net/intellij-jdk' : 'https://dl.bintray.com/jetbrains/intellij-jdk'
}
static def intellijProjectDir(File gradleProjectDir) {
def communityDir = new File(gradleProjectDir, "../..").canonicalFile
return communityDir.name == 'community' ? communityDir.parent : communityDir
}
static def isInUltimateContext(File gradleProjectDir) {
return new File(gradleProjectDir, "../..").canonicalFile.name == 'community'
}
}
+6 -16
View File
@@ -1,3 +1,5 @@
import org.jetbrains.intellij.build.DependenciesBuildUtils
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
@@ -16,9 +18,7 @@
task setupJdks(dependsOn: ['setupJdk18', 'setupJdk16'])
cleanSetupJdks.dependsOn('cleanSetupJdk18', 'cleanSetupJdk16', 'cleanDownloadJdk18')
def jdkRepo = inJetBrainsNetwork ? 'http://repo.labs.intellij.net' : 'https://dl.bintray.com/jetbrains/'
def checkoutDir = intellijProjectDir()
def checkoutDir = DependenciesBuildUtils.intellijProjectDir(file('.'))
def jdkDir = "$checkoutDir/build/jdk"
project.ext.jdk18OutputDir = "${System.getProperty("intellij.jdk18.output.dir", "$jdkDir/1.8")}"
@@ -35,9 +35,9 @@ task downloadJdk18 {
inputs.property('build', jdkBuild)
outputs.file(outputFile)
doLast {
logger.info("Downloading up JDK 1.8 to compile (using $jdkRepo repo)")
logger.info("Downloading up JDK 1.8 to compile (using $DependenciesBuildUtils.jdkRepo repo)")
download {
src "$jdkRepo/intellij-jdk/${artifactName}"
src "$DependenciesBuildUtils.jdkRepo/intellij-jdk/${artifactName}"
dest outputFile
onlyIfNewer true
}
@@ -108,10 +108,7 @@ dependencies {
}
task setupJdk16(dependsOn: configurations.jdk16) {
if (!inJetBrainsNetwork) {
return
}
onlyIf { DependenciesBuildUtils.inJetBrainsNetwork }
def jdkArchive = { configurations.jdk16.singleFile }
def outputDir = "$jdkDir/1.6"
inputs.file(jdkArchive)
@@ -134,13 +131,6 @@ private void deleteBrokenSymlink(def outputDir) {
}
}
setupJdk16.onlyIf { inJetBrainsNetwork }
def intellijProjectDir() {
def communityDir = project.file("../..")
communityDir.name == 'community' ? communityDir.parent : communityDir
}
static def jdk16Version() {
def os = org.gradle.internal.os.OperatingSystem.current()
if (os.isWindows()) {
+7 -9
View File
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.jetbrains.intellij.build.DependenciesBuildUtils
repositories {
maven {
url 'http://repo.labs.intellij.net/jet-sign'
@@ -28,22 +30,18 @@ dependencies {
}
task setupJetSign(dependsOn: configurations.jetSign) {
if (!inJetBrainsNetwork) {
return
}
def ultimateProjectDir = ultimateProjectDir()
if (!ultimateProjectDir) {
return
}
onlyIf { DependenciesBuildUtils.inJetBrainsNetwork && ultimateProjectDir }
doFirst { logger.info("Setting up JetSign") }
if (!ultimateProjectDir) return
def jetSignJar = { configurations.jetSign.singleFile }
def outputDir = file("$ultimateProjectDir/build/lib/")
def outputDir = "$ultimateProjectDir/build/lib/"
inputs.file(jetSignJar)
outputs.file("$outputDir/jet-sign.jar")
doLast {
logger.info("Copying $jetSignJar to $outputDir")
logger.info("Setting up JetSign. Copying $jetSignJar to $outputDir")
copy {
from file(jetSignJar)
into outputDir