Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 6935cec

Browse files
committed
Renamed keyword parameter to "keep" and set default to false everywhere
1 parent 31efb70 commit 6935cec

File tree

1 file changed

+78
-88
lines changed

1 file changed

+78
-88
lines changed

src/org/rascalmpl/core/library/lang/rascalcore/check/TestConfigs.rsc

Lines changed: 78 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ public PathConfig getRascalProjectTestingPathConfig() {
8787

8888
// ---- generic template for PathConfigs --------------------------------------
8989

90-
public PathConfig makePathConfig(loc repo, list[loc] sources, list[loc] libraries, bool compiler = false) {
91-
COMPILED = compiler ? COMPILED_RASCAL : TMP_COMPILED_RASCAL;
90+
// Given a list of sources and of libraries generate a PathConfig.
91+
// The keep parameter determines whether the generated sources and binaries are kept in a temporary directory or not.
92+
// If keep is true, the generated sources and binaries are stored in a temporary directory, otherwise they are stored in the source directory.
93+
94+
ublic PathConfig makePathConfig(list[loc] sources, list[loc] libraries, bool keep = false) {
95+
COMPILED = keep ? COMPILED_RASCAL : TMP_COMPILED_RASCAL;
9296
return pathConfig(
9397
srcs = sources,
9498
bin = COMPILED + "/target/classes",
@@ -98,96 +102,91 @@ public PathConfig makePathConfig(loc repo, list[loc] sources, list[loc] librarie
98102
testResources = COMPILED_RASCAL + "/src/test/java/",
99103
libs = libraries
100104
// srcs = sources,
101-
// bin = compiler ? COMPILED_RASCAL + "/target/classes" : repo,
102-
// generatedSources = compiler ? COMPILED_RASCAL + "/src/main/java" : |unknown:///|,
103-
// generatedTestSources = compiler ? COMPILED_RASCAL + "/src/test/java/" : |unknown:///|,
104-
// resources = compiler ? COMPILED_RASCAL + "/src/main/java" : repo + "/rascal",
105-
// testResources = compiler ? COMPILED_RASCAL + "/src/test/java/" : repo + "/rascal",
105+
// bin = keep ? COMPILED_RASCAL + "/target/classes" : repo,
106+
// generatedSources = keep ? COMPILED_RASCAL + "/src/main/java" : |unknown:///|,
107+
// generatedTestSources = keep ? COMPILED_RASCAL + "/src/test/java/" : |unknown:///|,
108+
// resources = keep ? COMPILED_RASCAL + "/src/main/java" : repo + "/rascal",
109+
// testResources = keep ? COMPILED_RASCAL + "/src/test/java/" : repo + "/rascal",
106110
// libs = libraries
107111
);
108112
}
109113

110114
// --- all source ------------------------------------------------------------
111115

112-
public PathConfig getAllSrcPathConfig(bool compiler = true) {
113-
return makePathConfig(COMPILED_RASCAL,
114-
[ RASCAL + "org/rascalmpl/library",
116+
public PathConfig getAllSrcPathConfig(bool keep = false) {
117+
return makePathConfig([ RASCAL + "org/rascalmpl/library",
115118
RASCAL + "org/rascalmpl/benchmark/",
116119
RASCAL_CORE + "org/rascalmpl/core/library",
117120
TYPEPAL
118121
],
119122
[ ],
120-
compiler=compiler);
123+
keep=keep);
121124
}
122125

123-
public RascalCompilerConfig getAllSrcCompilerConfig(bool compiler=true){
124-
return rascalCompilerConfig(getAllSrcPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
126+
public RascalCompilerConfig getAllSrcCompilerConfig(bool keep=true){
127+
return rascalCompilerConfig(getAllSrcPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
125128
}
126129

127130
// ----
128-
public PathConfig getAllSrcREPOPathConfig(bool compiler = true) {
129-
return makePathConfig(COMPILED_RASCAL,
130-
[ REPO + "rascal/src/org/rascalmpl/library",
131+
public PathConfig getAllSrcREPOPathConfig(bool keep = false) {
132+
return makePathConfig([ REPO + "rascal/src/org/rascalmpl/library",
131133
REPO + "rascal/test/org/rascalmpl/benchmark/",
132134
REPO + "rascal-core/src/org/rascalmpl/core/library",
133135
REPO + "typepal/src"
134136
],
135137
[ ],
136-
compiler=compiler);
138+
keep=keep);
137139
}
138140

139-
public RascalCompilerConfig getAllSrcREPOCompilerConfig(bool compiler=true){
140-
return rascalCompilerConfig(getAllSrcREPOPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
141+
public RascalCompilerConfig getAllSrcREPOCompilerConfig(bool keep=true){
142+
return rascalCompilerConfig(getAllSrcREPOPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
141143
}
142144
// ----
143-
public PathConfig getAllSrcWritablePathConfig(bool compiler = true) {
145+
public PathConfig getAllSrcWritablePathConfig(bool keep = false) {
144146
TMP_RASCAL = |tmp:///rascal/|;
145147
TMP_RASCAL_CORE = |tmp:///rascal-core/|;
146148
TMP_TYPEPAL = |tmp:///typepal/|;
147149
copy(RASCAL, TMP_RASCAL, recursive=true, overwrite=true);
148150
copy(RASCAL_CORE, TMP_RASCAL_CORE, recursive=true, overwrite=true);
149151
copy(TYPEPAL, TMP_TYPEPAL, recursive=true, overwrite=true);
150-
return makePathConfig(COMPILED_RASCAL,
151-
[ TMP_RASCAL + "org/rascalmpl/library",
152+
return makePathConfig([ TMP_RASCAL + "org/rascalmpl/library",
152153
TMP_RASCAL + "org/rascalmpl/benchmark/",
153154
TMP_RASCAL_CORE + "org/rascalmpl/core/library",
154155
TMP_TYPEPAL
155156
],
156157
[ ],
157-
compiler=compiler);
158+
keep=keep);
158159
}
159160

160-
public RascalCompilerConfig getAllSrcWritableCompilerConfig(bool compiler=true){
161-
return rascalCompilerConfig(getAllSrcWritablePathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
161+
public RascalCompilerConfig getAllSrcWritableCompilerConfig(bool keep=true){
162+
return rascalCompilerConfig(getAllSrcWritablePathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
162163
}
163164

164165
// ---- rascal ----------------------------------------------------------------
165-
public PathConfig getRascalPathConfig(bool compiler = false) {
166-
return makePathConfig(RASCAL,
167-
[ RASCAL + "org/rascalmpl/library"
166+
public PathConfig getRascalPathConfig(bool keep = false) {
167+
return makePathConfig([ RASCAL + "org/rascalmpl/library"
168168
//, RASCAL + "test/org/rascalmpl/benchmark/"
169169
],
170170
[],
171-
compiler=compiler);
171+
keep=keep);
172172
}
173173

174-
public RascalCompilerConfig getRascalCompilerConfig(bool compiler=true){
175-
return rascalCompilerConfig(getRascalPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
174+
public RascalCompilerConfig getRascalCompilerConfig(bool keep=true){
175+
return rascalCompilerConfig(getRascalPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
176176
}
177177

178-
public PathConfig getRascalWritablePathConfig(bool compiler = true) {
178+
public PathConfig getRascalWritablePathConfig(bool keep = false) {
179179
TMP_RASCAL = |tmp:///rascal/|;
180180
copy(RASCAL, TMP_RASCAL, recursive=true, overwrite=true);
181-
return makePathConfig(TMP_RASCAL,
182-
[ TMP_RASCAL + "org/rascalmpl/library"
181+
return makePathConfig([ TMP_RASCAL + "org/rascalmpl/library"
183182
//, RASCAL + "test/org/rascalmpl/benchmark/"
184183
],
185184
[],
186-
compiler=compiler);
185+
keep=keep);
187186
}
188187

189-
public RascalCompilerConfig getRascalWritableCompilerConfig(bool compiler=true){
190-
return rascalCompilerConfig(getRascalWritablePathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
188+
public RascalCompilerConfig getRascalWritableCompilerConfig(bool keep=true){
189+
return rascalCompilerConfig(getRascalWritablePathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
191190
}
192191

193192
// ---- rascal-core -----------------------------------------------------------
@@ -198,15 +197,14 @@ public RascalCompilerConfig getRascalWritableCompilerConfig(bool compiler=true){
198197
* binaries will be stored the target folder of the rascal-core project
199198
* has the standard library and typepal on the library path, in case you accidentally want to test a module in rascal-core which depends on typepal.
200199
}
201-
public PathConfig getRascalCorePathConfig(bool compiler = false) {
202-
return makePathConfig(RASCAL_CORE,
203-
[ RASCAL_CORE + "org/rascalmpl/core/library" ],
200+
public PathConfig getRascalCorePathConfig(bool keep = false) {
201+
return makePathConfig([ RASCAL_CORE + "org/rascalmpl/core/library" ],
204202
[ RASCAL, TYPEPAL ],
205-
compiler=compiler);
203+
keep=keep);
206204
}
207205

208-
public RascalCompilerConfig getRascalCoreCompilerConfig(bool compiler=true){
209-
return rascalCompilerConfig(getRascalCorePathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
206+
public RascalCompilerConfig getRascalCoreCompilerConfig(bool keep=true){
207+
return rascalCompilerConfig(getRascalCorePathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
210208
}
211209

212210
@synopsis{Developers version: PathConfig for type-checking modules in other (named) Rascal projects}
@@ -216,87 +214,80 @@ public RascalCompilerConfig getRascalCoreCompilerConfig(bool compiler=true){
216214
* has the standard library and typepal on the library path, in case you accidentally want to test a module in rascal-core which depends on typepal.
217215
* Included projects: rascal-tutor, flybytes, rascal-lsp
218216
}
219-
public PathConfig getRascalCorePathConfigDev(bool compiler = false) {
220-
return makePathConfig(RASCAL_CORE, [ RASCAL_CORE ], [ RASCAL, TYPEPAL ], compiler=compiler);
217+
public PathConfig getRascalCorePathConfigDev(bool keep = false) {
218+
return makePathConfig([ RASCAL_CORE ], [ RASCAL, TYPEPAL ], keep=keep);
221219
}
222220

223-
public RascalCompilerConfig getRascalCoreCompilerConfigDev(bool compiler=true){
221+
public RascalCompilerConfig getRascalCoreCompilerConfigDev(bool keep=true){
224222
return rascalCompilerConfig(getRascalCorePathConfigDev())[verbose = true][logWrittenFiles=true];
225223
}
226224

227225
// ---- typepal ---------------------------------------------------------------
228226

229-
public PathConfig getTypePalProjectPathConfig(bool compiler = false) {
230-
return makePathConfig(TYPEPAL,
231-
[ TYPEPAL ],
232-
[ RASCAL ],
233-
compiler=compiler);
227+
public PathConfig getTypePalProjectPathConfig(bool keep = false) {
228+
return makePathConfig([ TYPEPAL ], [ RASCAL ], keep=keep);
234229
}
235230

236-
public RascalCompilerConfig getTypePalCompilerConfig(bool compiler=true){
237-
return rascalCompilerConfig(getTypePalProjectPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
231+
public RascalCompilerConfig getTypePalCompilerConfig(bool keep=true){
232+
return rascalCompilerConfig(getTypePalProjectPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
238233
}
239234

240235
// ---- flybytes --------------------------------------------------------------
241236

242-
public PathConfig getFlyBytesProjectPathConfig(bool compiler = false) {
243-
return makePathConfig(FLYBYTES, [ FLYBYTES ], [ RASCAL ], compiler=compiler);
237+
public PathConfig getFlyBytesProjectPathConfig(bool keep = false) {
238+
return makePathConfig([ FLYBYTES ], [ RASCAL ], keep=keep);
244239
}
245240

246-
public RascalCompilerConfig getFlyBytesCompilerConfig(bool compiler=true){
247-
return rascalCompilerConfig(getFlyBytesProjectPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
241+
public RascalCompilerConfig getFlyBytesCompilerConfig(bool keep=true){
242+
return rascalCompilerConfig(getFlyBytesProjectPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
248243
}
249244

250245
// ---- salix -----------------------------------------------------------------
251246

252-
public PathConfig getSalixPathConfig(bool compiler = false) {
253-
return makePathConfig(SALIX_CORE,
254-
[ SALIX_CORE + "src/main/rascal", SALIX_CONTRIB + "src/main/rascal" ],
247+
public PathConfig getSalixPathConfig(bool keep = false) {
248+
return makePathConfig([ SALIX_CORE + "src/main/rascal", SALIX_CONTRIB + "src/main/rascal" ],
255249
[ RASCAL ],
256-
compiler=compiler);
250+
keep=keep);
257251
}
258252

259-
public RascalCompilerConfig getSalixCompilerConfig(bool compiler = true){
260-
return rascalCompilerConfig(getSalixPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
253+
public RascalCompilerConfig getSalixCompilerConfig(bool keep = false){
254+
return rascalCompilerConfig(getSalixPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
261255
}
262256

263257
// ---- drambiguity -----------------------------------------------------------
264258

265-
public PathConfig getDrAmbiguityPathConfig(bool compiler = false) {
266-
return makePathConfig(DRAMBIGUITY,
267-
[ DRAMBIGUITY, SALIX_CORE + "src/main/rascal" ],
259+
public PathConfig getDrAmbiguityPathConfig(bool keep = false) {
260+
return makePathConfig([ DRAMBIGUITY, SALIX_CORE + "src/main/rascal" ],
268261
[ RASCAL ],
269-
compiler=compiler);
262+
keep=keep);
270263
}
271264

272-
public RascalCompilerConfig getDrAmbiguityCompilerConfig(bool compiler = true){
273-
return rascalCompilerConfig(getDrAmbiguityPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
265+
public RascalCompilerConfig getDrAmbiguityCompilerConfig(bool keep = false){
266+
return rascalCompilerConfig(getDrAmbiguityPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
274267
}
275268

276269
// ---- rascal-language-server ------------------------------------------------
277270

278-
public PathConfig getLSPPathConfig(bool compiler = false) {
279-
return makePathConfig(RASCAL_LSP,
280-
[ RASCAL_LSP + "src/main/rascal", RASCAL_LSP + "src/test/rascal"],
271+
public PathConfig getLSPPathConfig(bool keep = false) {
272+
return makePathConfig([ RASCAL_LSP + "src/main/rascal", RASCAL_LSP + "src/test/rascal"],
281273
[ RASCAL ],
282-
compiler=compiler);
274+
keep=keep);
283275
}
284276

285-
public RascalCompilerConfig getLSPCompilerConfig(bool compiler = true){
286-
return rascalCompilerConfig(getLSPPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
277+
public RascalCompilerConfig getLSPCompilerConfig(bool keep = false){
278+
return rascalCompilerConfig(getLSPPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
287279
}
288280

289281
// ---- php-analysis -----------------------------------------------------------
290282

291-
public PathConfig getPHPPathConfig(bool compiler = false) {
292-
return makePathConfig(PHP_ANALYSIS,
293-
[ PHP_ANALYSIS + "src/main/rascal", PHP_ANALYSIS + "src/test/rascal"],
294-
[ RASCAL ],
295-
compiler=compiler);
283+
public PathConfig getPHPPathConfig(bool keep = false) {
284+
return makePathConfig([ PHP_ANALYSIS + "src/main/rascal", PHP_ANALYSIS + "src/test/rascal"],
285+
[ RASCAL ],
286+
keep=keep);
296287
}
297288

298-
public RascalCompilerConfig getPHPCompilerConfig(bool compiler = true){
299-
return rascalCompilerConfig(getPHPPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
289+
public RascalCompilerConfig getPHPCompilerConfig(bool keep = false){
290+
return rascalCompilerConfig(getPHPPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
300291
}
301292

302293
// ---- VSCode-----------------------------------------------------------------
@@ -335,13 +326,12 @@ public RascalCompilerConfig getVSCodeCompilerConfig(){
335326

336327
// ---- Outdated TypePal Usage -----------------------------------------------------------------
337328

338-
public PathConfig getOutdatedTPLPathConfig(bool compiler = true) {
339-
return makePathConfig(RASCAL_CORE,
340-
[RASCAL_CORE + "src/org/rascalmpl/core/library"],
329+
public PathConfig getOutdatedTPLPathConfig(bool keep = false) {
330+
return makePathConfig([RASCAL_CORE + "src/org/rascalmpl/core/library"],
341331
[ RASCAL, OUTDATED_TYPEPAL ],
342-
compiler=compiler);
332+
keep=keep);
343333
}
344334

345-
public RascalCompilerConfig getOutdatedTPLCompilerConfig(bool compiler = true){
346-
return rascalCompilerConfig(getOutdatedTPLPathConfig(compiler=compiler))[verbose = true][logWrittenFiles=true];
335+
public RascalCompilerConfig getOutdatedTPLCompilerConfig(bool keep = false){
336+
return rascalCompilerConfig(getOutdatedTPLPathConfig(keep=keep))[verbose = true][logWrittenFiles=true];
347337
}

0 commit comments

Comments
 (0)