11import com.jetbrains.plugin.structure.base.utils.isFile
22import common.BuildProfiles
33import common.BuildProfiles.greaterThan
4+ import common.DIGMA_NO_INFO_LOGGING
45import common.currentProfile
56import common.withCurrentProfile
7+ import common.withSilenceLogging
68import org.apache.tools.ant.filters.ReplaceTokens
79import org.jetbrains.intellij.platform.gradle.Constants
810import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
@@ -18,7 +20,7 @@ plugins {
1820
1921private val dotnetPluginId = " Digma.Rider.Plugin"
2022private val buildConfiguration = " Debug"
21- private val solutionFile = " $dotnetPluginId / Digma.Rider.Plugin.sln"
23+ private val solutionFile = " Digma.Rider.Plugin.sln"
2224private val dotnetProjectDir = layout.projectDirectory.dir(dotnetPluginId)
2325private val nugetConfigFile = dotnetProjectDir.file(" nuget.config" ).asFile
2426private val pluginPropsFile = dotnetProjectDir.file(" Plugin.props" ).asFile
@@ -71,9 +73,11 @@ val riderSdkTestProjectFile by lazy {
7173}
7274
7375project.afterEvaluate {
74- logger.lifecycle(" Rider Sdk Path: $riderSdkPath " )
75- logger.lifecycle(" Rider Sdk project file: $riderSdkProjectFile " )
76- logger.lifecycle(" Rider Sdk test project file: $riderSdkTestProjectFile " )
76+ withSilenceLogging {
77+ logger.lifecycle(" Rider Sdk Path: $riderSdkPath " )
78+ logger.lifecycle(" Rider Sdk project file: $riderSdkProjectFile " )
79+ logger.lifecycle(" Rider Sdk test project file: $riderSdkTestProjectFile " )
80+ }
7781}
7882
7983
@@ -111,7 +115,9 @@ tasks {
111115 </configuration>
112116 """ .trimIndent()
113117
114- logger.lifecycle(" Writing nuget.config to $path , content $content " )
118+ withSilenceLogging {
119+ logger.lifecycle(" Writing nuget.config to $path , content $content " )
120+ }
115121 val bytes = content.toByteArray()
116122 nugetConfigFile.writeBytes(bytes)
117123 }
@@ -164,9 +170,9 @@ tasks {
164170 val tokens = mutableMapOf<String , String >()
165171
166172 // up to p233 the version should be 4.0.0, and 4.3.0 after p233
167- val traceSourceVersion = if (project.currentProfile().profile.greaterThan(BuildProfiles .Profile .p233)){
173+ val traceSourceVersion = if (project.currentProfile().profile.greaterThan(BuildProfiles .Profile .p233)) {
168174 " 4.3.0"
169- }else {
175+ } else {
170176 " 4.0.0"
171177 }
172178
@@ -188,7 +194,7 @@ tasks {
188194
189195 // call prepare before loading the project to Rider
190196 val prepare by registering {
191- dependsOn(generateNuGetConfig, initPluginProps,initPluginTestProps, rdGen)
197+ dependsOn(generateNuGetConfig, initPluginProps, initPluginTestProps, rdGen)
192198 }
193199
194200
@@ -219,24 +225,38 @@ tasks {
219225 // for diagnostics add argument "/v:diag"
220226
221227 // about /r: in development we sometimes need to build with different profiles, for example 232 and then 241.
222- // sometimes the conpileDotnet task will fail and looks like its using the wrong assemblies. /r(estore) fixes it.
228+ // sometimes the compileDotnet task will fail and looks like its using the wrong assemblies. /r(estore) fixes it.
229+
230+ withSilenceLogging {
231+ logger.lifecycle(" compileDotNet:Plugin.props: ${pluginPropsFile.readText()} " )
232+ logger.lifecycle(" compileDotNet:nuget.config: ${nugetConfigFile.readText()} " )
233+ }
234+
235+ val argsList = mutableListOf (
236+ " msbuild" ,
237+ " /r" ,
238+ " /p:Configuration=$buildConfiguration " ,
239+ " /t:Rebuild" ,
240+ " /nodeReuse:False" ,
241+ " /fl" ,
242+ " /bl:${project.layout.buildDirectory.get().asFile.absolutePath} /dotnet/msbuild.binlog"
243+ )
244+
245+ if (project.hasProperty(DIGMA_NO_INFO_LOGGING )) {
246+ argsList.add(" -noConsoleLogger" )
247+ }
223248
224- logger.lifecycle(" compileDotNet:Plugin.props: ${pluginPropsFile.readText()} " )
225- logger.lifecycle(" compileDotNet:nuget.config: ${nugetConfigFile.readText()} " )
249+ argsList.add(solutionFile)
250+
251+ withSilenceLogging {
252+ logger.lifecycle(" dotnet args: [${argsList.joinToString(" " )} ]" )
253+ }
226254
227255 exec {
228256 executable = " dotnet"
229- args = listOf (
230- " msbuild" ,
231- " /r" ,
232- " /p:Configuration=$buildConfiguration " ,
233- " /t:Clean;Restore;Rebuild" ,
234- " /nodeReuse:False" ,
235- " /fl" ,
236- " /bl:${project.layout.buildDirectory.get().asFile.absolutePath} /dotnet/msbuild.binlog" ,
237- solutionFile
238- )
239- workingDir = projectDir
257+ args = argsList.toList()
258+
259+ workingDir = dotnetProjectDir.asFile
240260 }
241261 }
242262 }
@@ -284,7 +304,10 @@ val riderModel: Configuration by configurations.creating {
284304artifacts {
285305 add(riderModel.name, provider {
286306 intellijPlatform.platformPath.resolve(" lib/rd/rider-model.jar" ).also {
287- logger.lifecycle(" rider-model.jar: $it " )
307+ withSilenceLogging {
308+ logger.lifecycle(" rider-model.jar: $it " )
309+ }
310+
288311 check(it.isFile) {
289312 " rider-model.jar is not found at $it "
290313 }
0 commit comments