comparison init.gradle @ 136:9ce07c211984

for idea: add enabling hg, set default codestyle, set standard copyright notice
author smith@nwoca.org
date Mon, 12 Aug 2013 20:09:49 +0100
parents bef2bfc61f6e
children cc3cd7da35a7
comparison
equal deleted inserted replaced
135:51e4ee02d47a 136:9ce07c211984
66 } 66 }
67 } 67 }
68 68
69 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" 69 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle"
70 70
71 task wrapper(type: Wrapper) {} 71 rootProject.afterEvaluate { r ->
72 72
73 wrapper << { 73 if (r.plugins.hasPlugin(org.gradle.plugins.ide.idea.IdeaPlugin)) {
74 // patch wrapper path for 1.0-milestone-7 (http://issues.gradle.org/browse/GRADLE-1823) 74
75 ant.replace(file: 'gradlew', token: '\\wrapper\\gradle-wrapper.jar',value:'/wrapper/gradle-wrapper.jar') 75 r.idea.project.ipr.withXml { xml ->
76 if (file('.hg').exists()) {
77 println 'enabling HG on project'
78 def vcs = findComponent(xml.asNode(),'VcsDirectoryMappings')
79 vcs.mapping.@vcs = 'hg4idea'
80 }
81
82 def codeStyle = findComponent(xml.asNode(),'ProjectCodeStyleSettingsManager')
83 if (codeStyle) { xml.asNode().remove(codeStyle) }
84
85 def styleManager = xml.asNode().appendNode('component', [name: 'ProjectCodeStyleSettingsManager'])
86 styleManager.appendNode 'option', [name: 'USE_PER_PROJECT_SETTINGS',value: true]
87
88 def styleOptions = new NodeBuilder().option(name:'PER_PROJECT_SETTINGS') {
89 value {
90 GroovyCodeStyleSettings {
91 option(name: 'CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND', value:'10')
92 option(name: 'PACKAGES_TO_USE_IMPORT_ON_DEMAND') {
93 value {
94 'package'( name:"java.awt", withSubpackages: false, static: false )
95 'package'( name:"javax.swing", withSubpackages:false, static:false )
96 'package'( name:"javax.persistence", withSubpackages:false, static:false )
97 'package'( name:"javax.validation", withSubpackages: true, static:false )
98 }
99 }
100 }
101 XML {
102 option(name: 'XML_LEGACY_SETTINGS_IMPORTED',value:true)
103 }
104
105 }
106 }
107
108 styleManager.append styleOptions
109
110 if (r.group.contains('org.ssdt') ) {
111
112 def copyRight = findComponent(xml.asNode(),'CopyrightManager')
113 if (copyRight) { xml.asNode().remove(copyRight) }
114
115 copyRight = new NodeBuilder().component(name: 'CopyrightManager', default: 'ODE') {
116
117 copyright {
118 option (name: 'notice', value:'Copyright (c) $today.year. Ohio Department of Education. - All Rights Reserved.\nUnauthorized copying of this file, in any medium, is strictly prohibited.\nWritten by State Software Development Team (http://ssdt.oecn.k12.oh.us/)' )
119 option (name: 'keyword', value: 'Copyright')
120 option (name: 'allowReplaceKeyword', value: 'South Front' )
121 option (name: 'myName', value: 'ODE' )
122 option (name: 'myLocal', value: true )
123 }
124 LanguageOptions(name: 'CSS') {
125 option(name:'fileTypeOverride', value: 1)
126 }
127 LanguageOptions(name: 'JSP') {
128 option(name:'fileTypeOverride', value: 1)
129 option(name:'prefixLines', value: false)
130 }
131 LanguageOptions(name: 'JSPX') {
132 option(name:'fileTypeOverride', value: 1)
133 option(name:'prefixLines', value: false)
134 }
135 LanguageOptions(name: 'JavaScript') {
136 option(name:'fileTypeOverride', value: 1)
137 }
138 LanguageOptions(name: 'Properties') {
139 option(name:'fileTypeOverride', value: 1)
140 }
141 }
142
143 xml.asNode().append copyRight
144
145 }
146 }
147 }
148
149 }
150
151 def findComponent(project, name) {
152 project.component.find { it.@name == name }
76 } 153 }
77 154
78 allprojects { 155 allprojects {
79 156
80 task cleanLocal(description: "removes all artifacts from developer's local repository") << { 157 task cleanLocal(description: "removes all artifacts from developer's local repository") << {