Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 89f68765c5
Fetching contributors…

Cannot retrieve contributors at this time

285 lines (260 sloc) 15.293 kB
import org.gradle.api.internal.artifacts.dependencies.DefaultSelfResolvingDependency
allprojects {
apply plugin: "idea"
}
subprojects {
plugins.withType(JavaPlugin) {
idea {
module {
scopes.RUNTIME.plus.add(configurations.detachedConfiguration(new DefaultSelfResolvingDependency(files { sourceSets.main.resources.srcDirs })))
scopes.TEST.plus.add(configurations.detachedConfiguration(new DefaultSelfResolvingDependency(files { sourceSets*.resources*.srcDirs })))
}
}
}
}
idea {
module {
excludeDirs += file('intTestHomeDir')
excludeDirs += file('buildSrc/build')
excludeDirs += file('buildSrc/.gradle')
}
project {
wildcards += ['?*.gradle']
languageLevel = '1.5'
ipr {
withXml { provider ->
// Exclude resource directories from compilation and add them back in as classpath resources
def node = provider.asNode()
def compilerConfig = node.component.find { it.'@name' == 'CompilerConfiguration' }
def exclude = compilerConfig.excludeFromCompile
if (exclude) {
compilerConfig.remove(exclude)
}
exclude = compilerConfig.appendNode('excludeFromCompile')
Collection resourceFolder = groovyProjects.collect { project -> project.sourceSets*.resources*.srcDirs }.flatten()
resourceFolder.each {
if (it.exists()) {
exclude.appendNode('directory', [url: "file://\$PROJECT_DIR\$/${rootProject.relativePath(it)}", includeSubdirectories: true])
}
}
// exclude java version specific classes from compilation when not compilable with current java version
def excludeSource = { version, sourceFolder ->
if (sourceFolder.exists()) {
sourceFolder.eachDirRecurse { packageFolder ->
if (packageFolder.name == version) {
exclude.appendNode('directory', [url: "file://\$PROJECT_DIR\$/${rootProject.relativePath(packageFolder)}", includeSubdirectories: true])
}
}
}
}
Collection sourceDirs = groovyProjects.collect { project -> project.sourceSets*.allSource*.srcDirs }.flatten()
sourceDirs.each { sourceFolder ->
if (!javaVersion.java7) {
excludeSource("jdk7", sourceFolder)
}
if (!javaVersion.java6Compatible) {
excludeSource("jdk6", sourceFolder)
}
}
// Use git
def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
vcsConfig.mapping[0].'@vcs' = 'Git'
// Set gradle home
def gradleSettings = node.appendNode('component', [name: 'GradleSettings'])
gradleSettings.appendNode('option', [name: 'SDK_HOME', value: gradle.gradleHomeDir.absolutePath])
// set compiler heap space
def javacSettings = node.appendNode('component', [name: 'JavacSettings'])
javacSettings.appendNode('option', [name: 'MAXIMUM_HEAP_SIZE', value: "256"])
// license header
def copyrightManager = node.component.find { it.'@name' == 'CopyrightManager' }
copyrightManager.@default = "ASL2"
def aslCopyright = copyrightManager.copyright.find { it.option.find { it.@name == "myName" }?.@value == "ASL2" }
if (aslCopyright == null) {
copyrightManager.append(new XmlParser().parseText('''
<copyright>
<option name="notice" value="Copyright 2012 the original author or authors.&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
<option name="keyword" value="Copyright" />
<option name="allowReplaceKeyword" value="" />
<option name="myName" value="ASL2" />
<option name="myLocal" value="true" />
</copyright>
'''))
}
// Code formatting options
def codeFormatSettings = new XmlParser().parseText('''
<component name="CodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="USE_SAME_INDENTS" value="true" />
<option name="RIGHT_MARGIN" value="200" />
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
<option name="JD_P_AT_EMPTY_LINES" value="false" />
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
<option name="WRAP_COMMENTS" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<ADDITIONAL_INDENT_OPTIONS fileType="groovy">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="java">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="js">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="jsp">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="php">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="scala">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sql">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="xml">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
''')
node.append(codeFormatSettings)
}
}
}
workspace.iws.withXml { provider ->
Node node = provider.asNode()
Node runManagerConfig = node.component.find { it.'@name' == 'RunManager' }
// Add int test configuration to JUnit defaults
Node runConfig = runManagerConfig.configuration.find { it.'@type' == 'JUnit'}
Node vmParameters = runConfig.option.find { it.'@name' == 'VM_PARAMETERS' }
vmParameters.'@value' = "\"-DintegTest.gradleHomeDir=${intTestImage.destinationDir}\" -ea -Dorg.gradle.integtest.executer=embedded -XX:MaxPermSize=256m -Xmx512m"
// Add an application configuration
runManagerConfig.'@selected' = 'Application.Gradle'
def appConfig =
runManagerConfig.append(new XmlParser().parseText('''
<configuration default="false" name="Gradle" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" />
<option name="MAIN_CLASS_NAME" value="org.gradle.debug.GradleRunConfiguration" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="integTest" />
<envs />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="63810" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
'''))
def gradleRunners = [
"Quick Check (precommit)": "quickCheck --daemon",
"Regenerate IDEA metadata": "idea --daemon",
"Regenerate Int Test Image": "intTestImage --daemon"
]
def runnerClass = "org.gradle.testing.internal.util.GradlewRunner"
def runnerClassModule = "internalTesting"
def listItems = []
gradleRunners.each { runnerName, commandLine ->
runManagerConfig.append(new XmlParser().parseText("""
<configuration default='false' name='${runnerName}' type='Application' factoryName='Application'>
<extension name='coverage' enabled='false' merge='false' />
<option name='MAIN_CLASS_NAME' value='${runnerClass}' />
<option name='VM_PARAMETERS' value='' />
<option name='PROGRAM_PARAMETERS' value='${commandLine}' />
<option name='WORKING_DIRECTORY' value='file://\$PROJECT_DIR\$' />
<option name='ALTERNATIVE_JRE_PATH_ENABLED' value='false' />
<option name='ALTERNATIVE_JRE_PATH' value='' />
<option name='ENABLE_SWING_INSPECTOR' value='false' />
<option name='ENV_VARIABLES' />
<option name='PASS_PARENT_ENVS' value='true' />
<module name='${runnerClassModule}' />
<envs />
<method />
</configuration>
"""))
listItems << "<item index='${listItems.size() + 1}' class='java.lang.String' itemvalue='Application.${runnerName}' />"
}
runManagerConfig.append(new XmlParser().parseText("""
<list size='${listItems.size() + 1}'>
<item index='0' class='java.lang.String' itemvalue='Application.Gradle' />
${listItems}
</list>
"""))
}
}
Jump to Line
Something went wrong with that request. Please try again.