@@ -84,6 +84,17 @@ lazy val commonSettings = Seq[Setting[_]](
84
84
cleanFiles += (classDirectory in Compile ).value
85
85
)
86
86
87
+ // disable various tasks that are not needed for projects that are used
88
+ // only for compiling code and not publishing it as a standalone artifact
89
+ // we disable those tasks by overriding them and returning bogus files when
90
+ // needed. This is a bit sketchy but I haven't found any better way.
91
+ val disableDocsAndPublishingTasks = Seq [Setting [_]](
92
+ (doc := file(" !!! NO DOCS !!!" )),
93
+ (publishLocal := {}),
94
+ (publish := {}),
95
+ (packageBin in Compile := file(" !!! NO PACKAGING !!!" ))
96
+ )
97
+
87
98
lazy val scalaSubprojectSettings = commonSettings ++ Seq [Setting [_]](
88
99
artifactPath in packageBin in Compile := {
89
100
// two lines below are copied over from sbt's sources:
@@ -121,16 +132,26 @@ lazy val reflect = configureAsSubproject(project).
121
132
dependsOn(library)
122
133
123
134
lazy val compiler = configureAsSubproject(project).
124
- settings(libraryDependencies += " org.apache.ant" % " ant" % " 1.9.4" ).
135
+ settings(libraryDependencies += " org.apache.ant" % " ant" % " 1.9.4" ,
136
+ // this a way to make sure that classes from interactive and scaladoc projects
137
+ // end up in compiler jar (that's what Ant build does)
138
+ // we need to use LocalProject references (with strings) to deal with mutual recursion
139
+ mappings in Compile in packageBin :=
140
+ (mappings in Compile in packageBin).value ++
141
+ (mappings in Compile in packageBin in LocalProject (" interactive" )).value ++
142
+ (mappings in Compile in packageBin in LocalProject (" scaladoc" )).value
143
+ ).
125
144
dependsOn(library, reflect, asm)
126
145
127
146
lazy val interactive = configureAsSubproject(project).
147
+ settings(disableDocsAndPublishingTasks : _* ).
128
148
dependsOn(compiler)
129
149
130
150
lazy val repl = configureAsSubproject(project).
131
151
// TODO: in Ant build def, this version is defined in versions.properties
132
152
// figure out whether we also want to externalize jline's version
133
153
settings(libraryDependencies += " jline" % " jline" % " 2.12" ).
154
+ settings(disableDocsAndPublishingTasks : _* ).
134
155
dependsOn(compiler)
135
156
136
157
lazy val scaladoc = configureAsSubproject(project).
@@ -141,6 +162,7 @@ lazy val scaladoc = configureAsSubproject(project).
141
162
" org.scala-lang.modules" %% " scala-partest" % " 1.0.5"
142
163
)
143
164
).
165
+ settings(disableDocsAndPublishingTasks : _* ).
144
166
dependsOn(compiler)
145
167
146
168
lazy val scalap = configureAsSubproject(project).
@@ -192,18 +214,9 @@ def configureAsSubproject(project: Project): Project = {
192
214
*/
193
215
def configureAsForkOfJavaProject (project : Project ): Project = {
194
216
val base = file(" ." ) / " src" / project.id
195
- // disable various tasks that do not make sense for forks of Java projects
196
- // we disable those task by overriding them and returning bogus files when
197
- // needed. This is a bit sketchy but I haven't found any better way.
198
- val disableTasks = Seq [Setting [_]](
199
- (doc := file(" !!! NO DOCS !!!" )),
200
- (publishLocal := {}),
201
- (publish := {}),
202
- (packageBin in Compile := file(" !!! NO PACKAGING !!!" ))
203
- )
204
217
(project in base).
205
218
settings(commonSettings : _* ).
206
- settings(disableTasks : _* ).
219
+ settings(disableDocsAndPublishingTasks : _* ).
207
220
settings(
208
221
sourceDirectory in Compile := baseDirectory.value,
209
222
javaSource in Compile := (sourceDirectory in Compile ).value,
0 commit comments