@@ -31,7 +31,7 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
31
31
compositeSearchPath = compositeSearchPath.resolve(" .." )
32
32
}
33
33
compositeSearchPath = compositeSearchPath.toRealPath()
34
- LogTools .info(" Repository group path: " + compositeSearchPath)
34
+ LogTools .info(" Repository group path: $ compositeSearchPath" )
35
35
}
36
36
37
37
/* *
@@ -48,15 +48,15 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
48
48
for (transitiveBuild in transitiveIncludedBuilds)
49
49
{
50
50
val relativizedPathName: String = buildRootPath.relativize(transitiveBuild.projectPath).toString()
51
- if (! relativizedPathName.isEmpty ()) // Including itself
51
+ if (relativizedPathName.isNotEmpty ()) // Including itself
52
52
{
53
53
buildsToInclude.add(relativizedPathName)
54
54
}
55
55
}
56
56
57
57
for (buildToInclude in buildsToInclude)
58
58
{
59
- LogTools .quiet(" Including build: " + buildToInclude)
59
+ LogTools .quiet(" Including build: $ buildToInclude" )
60
60
}
61
61
62
62
return buildsToInclude
@@ -81,7 +81,7 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
81
81
if (properties.isProjectGroup)
82
82
{
83
83
val projectFile = properties.projectPath.toFile()
84
- for (childDir in projectFile.listFiles { f -> f.isDirectory })
84
+ for (childDir in projectFile.listFiles { f -> f.isDirectory }!! )
85
85
{
86
86
val childPath = childDir.toPath()
87
87
if (pathToPropertiesMap.containsKey(childPath))
@@ -111,7 +111,7 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
111
111
LogTools .debug(" Found dependency: $declaredDependency " )
112
112
}
113
113
114
- for (declaredDependency in declaredDependencies!! )
114
+ for (declaredDependency in declaredDependencies)
115
115
{
116
116
if (kebabCasedNameToPropertiesMap.containsKey(declaredDependency))
117
117
{
@@ -133,7 +133,7 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
133
133
// Make sure the names match up. See {@link #matchNames}
134
134
if (! transitiveIncludedBuilds.contains(propertiesFromKebabCasedName(artifactName)) && matchNames(artifactName, kebabCasedDependency))
135
135
{
136
- LogTools .info(" Matched: " + kebabCasedDependency + " to " + artifactName)
136
+ LogTools .info(" Matched: $ kebabCasedDependency to $ artifactName" )
137
137
transitiveIncludedBuilds.add(propertiesFromKebabCasedName(artifactName))
138
138
matched.add(propertiesFromKebabCasedName(artifactName))
139
139
}
@@ -155,8 +155,8 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
155
155
{
156
156
for (artifactName in includedBuildProperties.allArtifacts) // map test, etc. source set projects
157
157
{
158
- kebabCasedNameToPropertiesMap.put( artifactName, includedBuildProperties)
159
- LogTools .info(" Found: " + artifactName + " : " + directory)
158
+ kebabCasedNameToPropertiesMap[ artifactName] = includedBuildProperties
159
+ LogTools .info(" Found: $ artifactName: $ directory" )
160
160
}
161
161
pathToPropertiesMap.put(directory, includedBuildProperties)
162
162
}
@@ -192,10 +192,7 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
192
192
return true
193
193
194
194
// Always include the composite search root
195
- if (compositeRootKebabCasedName != " NotYetEvaluated" && kebabCasedName == compositeRootKebabCasedName)
196
- return true
197
-
198
- return false
195
+ return compositeRootKebabCasedName != " NotYetEvaluated" && kebabCasedName == compositeRootKebabCasedName
199
196
}
200
197
201
198
/* * Here, we could make the project more friendly by not having such harsh requirements. */
@@ -236,7 +233,7 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
236
233
{
237
234
val builder = AstBuilder ()
238
235
val bytesInFile = String (Files .readAllBytes(buildFile))
239
- LogTools .info(" Parsing for dependencies: " + buildFile)
236
+ LogTools .info(" Parsing for dependencies: $ buildFile" )
240
237
241
238
// Handle empty build.gradle
242
239
if (bytesInFile.trim().isEmpty())
@@ -278,15 +275,15 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
278
275
return dependencySet
279
276
}
280
277
281
- class ExternalGradleFileCodeVisitor (val dependencies : ArrayList <Array <String >>) : CodeVisitorSupport()
278
+ class ExternalGradleFileCodeVisitor (private val dependencies : ArrayList <Array <String >>) : CodeVisitorSupport()
282
279
{
283
280
override fun visitArgumentlistExpression (ale : ArgumentListExpression )
284
281
{
285
- val expressions: List <Expression > = ale.getExpressions()
282
+ val expressions: List <Expression > = ale.expressions
286
283
287
- if (expressions.size == 1 && expressions.get( 0 ) is ConstantExpression )
284
+ if (expressions.size == 1 && expressions[ 0 ] is ConstantExpression )
288
285
{
289
- val dependencyString = expressions.get( 0 ).getText()
286
+ val dependencyString = expressions[ 0 ].text
290
287
if (dependencyString.contains(" :" ))
291
288
{
292
289
val split = dependencyString.split(" :" )
@@ -303,17 +300,17 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
303
300
304
301
override fun visitMapExpression (expression : MapExpression )
305
302
{
306
- LogTools .debug(" Found map entry: " + expression.getText() )
307
- val mapEntryExpressions: List <MapEntryExpression > = expression.getMapEntryExpressions()
303
+ LogTools .debug(" Found map entry: " + expression.text )
304
+ val mapEntryExpressions: List <MapEntryExpression > = expression.mapEntryExpressions
308
305
if (mapEntryExpressions.size >= 3 )
309
306
{
310
307
val dependencyMap = HashMap <String , String >()
311
308
312
309
for (mapEntryExpression in mapEntryExpressions)
313
310
{
314
- val key = mapEntryExpression.getKeyExpression().getText()
315
- val value = mapEntryExpression.getValueExpression().getText()
316
- dependencyMap.put( key, value)
311
+ val key = mapEntryExpression.keyExpression.text
312
+ val value = mapEntryExpression.valueExpression.text
313
+ dependencyMap[ key] = value
317
314
}
318
315
319
316
if (dependencyMap.containsKey(" group" ) && dependencyMap.containsKey(" name" ) && dependencyMap.containsKey(" version" ))
@@ -332,7 +329,7 @@ class IHMCCompositeBuildAssembler(val configurator: IHMCSettingsConfigurator)
332
329
{
333
330
throw GradleException (" Something went wrong. $kebabCasedName has not been mapped." )
334
331
}
335
- return kebabCasedNameToPropertiesMap.get( kebabCasedName) !!
332
+ return kebabCasedNameToPropertiesMap[ kebabCasedName] !!
336
333
}
337
334
338
335
private fun propertiesFromPath (path : Path ): IHMCBuildProperties
0 commit comments