@@ -16,6 +16,32 @@ class CommunityBuildTest {
16
16
new String (Files .readAllBytes(file), UTF_8 )
17
17
}
18
18
19
+ def testSbt (project : String , testCommand : String , updateCommand : String , extraSbtArgs : Seq [String ] = Nil ) = {
20
+ // Workaround for https://github.com/sbt/sbt/issues/4395
21
+ new File (sys.props(" user.home" ) + " /.sbt/1.0/plugins" ).mkdirs()
22
+ val pluginFilePath = communitybuildDir.resolve(" sbt-dotty-sbt" ).toAbsolutePath().toString()
23
+
24
+ // Run the sbt command with the compiler version and sbt plugin set in the build
25
+ val arguments = {
26
+ val sbtProps = Option (System .getProperty(" sbt.ivy.home" )) match {
27
+ case Some (ivyHome) =>
28
+ Seq (s " -Dsbt.ivy.home= $ivyHome" )
29
+ case _ =>
30
+ Seq ()
31
+ }
32
+ extraSbtArgs ++ sbtProps ++ Seq (
33
+ " -sbt-version" , " 1.2.7" ,
34
+ s " --addPluginSbtFile= $pluginFilePath" ,
35
+ s " ;clean ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++ $compilerVersion! $testCommand"
36
+ )
37
+ }
38
+
39
+ test(project, " sbt" , arguments)
40
+ }
41
+
42
+ def testMill (project : String , testCommand : String , extraMillArgs : Seq [String ] = Nil ) =
43
+ test(project, " ./mill" , extraMillArgs :+ testCommand)
44
+
19
45
/** Build the given project with the published local compiler and sbt plugin.
20
46
*
21
47
* This test reads the compiler version from community-build/dotty-bootstrapped.version
@@ -26,7 +52,7 @@ class CommunityBuildTest {
26
52
* @param updateCommand The sbt command used to update the project
27
53
* @param extraSbtArgs Extra arguments to pass to sbt
28
54
*/
29
- def test (project : String , testCommand : String , updateCommand : String , extraSbtArgs : Seq [String ] = Nil ): Unit = {
55
+ def test (project : String , command : String , arguments : Seq [String ]): Unit = {
30
56
def log (msg : String ) = println(Console .GREEN + msg + Console .RESET )
31
57
32
58
log(s " Building $project with dotty-bootstrapped $compilerVersion... " )
@@ -53,149 +79,130 @@ class CommunityBuildTest {
53
79
exitCode
54
80
}
55
81
56
- // Workaround for https://github.com/sbt/sbt/issues/4395
57
- new File (sys.props(" user.home" ) + " /.sbt/1.0/plugins" ).mkdirs()
58
- val pluginFilePath = communitybuildDir.resolve(" sbt-dotty-sbt" ).toAbsolutePath().toString()
59
-
60
- // Run the sbt command with the compiler version and sbt plugin set in the build
61
- val arguments = {
62
- val sbtProps = Option (System .getProperty(" sbt.ivy.home" )) match {
63
- case Some (ivyHome) =>
64
- Seq (s " -Dsbt.ivy.home= $ivyHome" )
65
- case _ =>
66
- Seq ()
67
- }
68
- extraSbtArgs ++ sbtProps ++ Seq (
69
- " -sbt-version" , " 1.2.7" ,
70
- s " --addPluginSbtFile= $pluginFilePath" ,
71
- s " ;clean ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++ $compilerVersion! $testCommand"
72
- )
73
- }
74
-
75
- val exitCode = exec(" sbt" , arguments : _* )
82
+ val exitCode = exec(command, arguments : _* )
76
83
77
84
if (exitCode != 0 ) {
78
85
fail(s """
79
86
|
80
- |sbt exited with an error code. To reproduce without JUnit, use:
87
+ | $command exited with an error code. To reproduce without JUnit, use:
81
88
|
82
89
| sbt community-build/prepareCommunityBuild
83
90
| cd community-build/community-projects/ $project
84
- | sbt ${arguments.init.mkString(" " )} " ${arguments.last}"
91
+ | $command ${arguments.init.mkString(" " )} " ${arguments.last}"
85
92
|
86
- |For a faster feedback loop, one can try to extract a direct call to dotc
93
+ |For a faster feedback loop on SBT projects , one can try to extract a direct call to dotc
87
94
|using the sbt export command. For instance, for scalacheck, use
88
95
| sbt export jvm/test:compileIncremental
89
96
|
90
97
| """ .stripMargin)
91
98
}
92
99
}
93
100
94
- @ Test def intent = test (
101
+ @ Test def intent = testSbt (
95
102
project = " intent" ,
96
103
testCommand = " test" ,
97
104
updateCommand = " update"
98
105
)
99
106
100
- @ Test def algebra = test (
107
+ @ Test def algebra = testSbt (
101
108
project = " algebra" ,
102
109
testCommand = " coreJVM/compile" ,
103
110
updateCommand = " coreJVM/update"
104
111
)
105
112
106
- @ Test def scalacheck = test (
113
+ @ Test def scalacheck = testSbt (
107
114
project = " scalacheck" ,
108
115
testCommand = " jvm/test:compile" ,
109
116
updateCommand = " jvm/test:update"
110
117
)
111
118
112
- @ Test def scalatest = test (
119
+ @ Test def scalatest = testSbt (
113
120
project = " scalatest" ,
114
121
testCommand = " ;scalacticDotty/clean;scalacticTestDotty/test;scalatestTestDotty/test" ,
115
122
updateCommand = " scalatest/update"
116
123
)
117
124
118
- @ Test def scalaXml = test (
125
+ @ Test def scalaXml = testSbt (
119
126
project = " scala-xml" ,
120
127
testCommand = " xml/test" ,
121
128
updateCommand = " xml/update"
122
129
)
123
130
124
- @ Test def scopt = test (
131
+ @ Test def scopt = testSbt (
125
132
project = " scopt" ,
126
133
testCommand = " scoptJVM/compile" ,
127
134
updateCommand = " scoptJVM/update"
128
135
)
129
136
130
- @ Test def scalap = test (
137
+ @ Test def scalap = testSbt (
131
138
project = " scalap" ,
132
139
testCommand = " scalap/compile" ,
133
140
updateCommand = " scalap/update"
134
141
)
135
142
136
- @ Test def squants = test (
143
+ @ Test def squants = testSbt (
137
144
project = " squants" ,
138
145
testCommand = " squantsJVM/compile" ,
139
146
updateCommand = " squantsJVM/update"
140
147
)
141
148
142
- @ Test def betterfiles = test (
149
+ @ Test def betterfiles = testSbt (
143
150
project = " betterfiles" ,
144
151
testCommand = " dotty-community-build/compile" ,
145
152
updateCommand = " dotty-community-build/update"
146
153
)
147
154
148
- @ Test def ScalaPB = test (
155
+ @ Test def ScalaPB = testSbt (
149
156
project = " ScalaPB" ,
150
157
testCommand = " dotty-community-build/compile" ,
151
158
updateCommand = " dotty-community-build/update"
152
159
)
153
160
154
- @ Test def minitest = test (
161
+ @ Test def minitest = testSbt (
155
162
project = " minitest" ,
156
163
testCommand = " dotty-community-build/compile" ,
157
164
updateCommand = " dotty-community-build/update"
158
165
)
159
166
160
- @ Test def fastparse = test (
167
+ @ Test def fastparse = testSbt (
161
168
project = " fastparse" ,
162
169
testCommand = " dotty-community-build/compile;dotty-community-build/test:compile" ,
163
170
updateCommand = " dotty-community-build/update"
164
171
)
165
172
166
173
// TODO: revert to sourcecodeJVM/test
167
- @ Test def sourcecode = test (
174
+ @ Test def sourcecode = testSbt (
168
175
project = " sourcecode" ,
169
176
testCommand = " sourcecode/compile;sourcecode/test:compile" ,
170
177
updateCommand = " sourcecode/update"
171
178
)
172
179
173
- @ Test def stdLib213 = test (
180
+ @ Test def stdLib213 = testSbt (
174
181
project = " stdLib213" ,
175
182
testCommand = " library/compile" ,
176
183
updateCommand = " library/update" ,
177
184
extraSbtArgs = Seq (" -Dscala.build.compileWithDotty=true" )
178
185
)
179
186
180
- @ Test def shapeless = test (
187
+ @ Test def shapeless = testSbt (
181
188
project = " shapeless" ,
182
189
testCommand = " test" ,
183
190
updateCommand = " update"
184
191
)
185
192
186
- @ Test def xmlInterpolator = test (
193
+ @ Test def xmlInterpolator = testSbt (
187
194
project = " xml-interpolator" ,
188
195
testCommand = " test" ,
189
196
updateCommand = " update"
190
197
)
191
198
192
- @ Test def semanticdb = test (
199
+ @ Test def semanticdb = testSbt (
193
200
project = " semanticdb" ,
194
201
testCommand = " test:compile" ,
195
202
updateCommand = " update"
196
203
)
197
204
198
- @ Test def effpi = test (
205
+ @ Test def effpi = testSbt (
199
206
project = " effpi" ,
200
207
// We set `useEffpiPlugin := false` because we don't want to run their
201
208
// compiler plugin since it relies on external binaries (from the model
@@ -225,6 +232,6 @@ class UpdateCategory
225
232
226
233
@ Category (Array (classOf [UpdateCategory ]))
227
234
class CommunityBuildUpdate extends CommunityBuildTest {
228
- override def test (project : String , testCommand : String , updateCommand : String , extraSbtArgs : Seq [String ]): Unit =
229
- super .test (project, updateCommand, null , extraSbtArgs)
235
+ override def testSbt (project : String , testCommand : String , updateCommand : String , extraSbtArgs : Seq [String ]): Unit =
236
+ super .testSbt (project, updateCommand, null , extraSbtArgs)
230
237
}
0 commit comments