MSBuild not supporting multi thread solution build - multithreading

I have a situation to build multiple solution using MSBUILD in multi threading, but during build, always few solution get failed. I have try to build each solution one by one , its working perfectly. but i have try to build 5 solution using multi threading, few build get failed. As I investigated the build log file of both success build and failure build, it seems MSBUILD getting conflict with each build process. For reference I have attached two text file of build log.
[Build start for submission ID 11468 ]
https://i.stack.imgur.com/KbaJb.png
[Build start for submission ID 11468 ]
https://i.stack.imgur.com/K1BOU.png
using (BuildManager objBuildManager = new BuildManager())
{
BuildRequestData BuildRequest = new BuildRequestData(SolutionPath, GlobalProperty, "14.0", new string[]
{ "Build" }, null,
BuildRequestDataFlags.ReplaceExistingProjectInstance);
BuildResult buildResult = objBuildManager.Build(bp, BuildRequest)
if (buildResult.OverallResult == BuildResultCode.Success)
{
buildPath = Convert.ToString(buildResult.ResultsByTarget.FirstOrDefault(x =>
x.Key == "Build").Value.Items[0]);
}
}

Have attached build log for reference.
Success build log
https://github.com/Microsoft/msbuild/files/1115978/11468.success.txt
failure build log
https://github.com/Microsoft/msbuild/files/1115979/11468.failed.txt

Related

Rerunning failed scenarios with Selenide/Cucumber - no rerun.txt file

I writing automation tests with Cucumber/Selenide and I want to rerun failed scenarios.
This is part of my project with only two small tests (one is failing) to demonstrate behavior: https://github.com/mtpx/cucumberRerun
I read how to do it on How to rerun the failed scenarios using Cucumber? and https://medium.com/#belek.bagishbekov/how-to-rerun-failed-test-cases-in-cucumber-b7fe9b1dcf9c
In my application.feature test runner(ApplicationTest) in #CucumberOptions's plugins section I have line: "rerun:rerun/failed_scenarios.txt", according to previous urls it should generate text file with failed scenario, but after test execution with 'mvn clean test' (with failed scenarios) - there's no any rerun.txt file.
Do You know what is wrong here? Why after build i dont have rerun.txt file?
I using Selenide instead of Selenium, maybe problem is here?
Create another scenario file as shown below. Let's say this as FailedScenarios.java. Whenever you notice any failed scenario run this file. This file will use target/rerun.txt as an input for running the scenarios.
This line is require:
features = "#target/rerun.txt",
Full CucumberOptions
#CucumberOptions(
monochrome = true,
features = "#target/rerun.txt", //Cucumber picks the failed scenarios from this file
format = {"pretty", "html:target/site/cucumber-pretty",
"json:target/cucumber.json"}
)
public class FailedScenarios {
}
You can use rerun file path other than target if you need to run failed Scenario also trigger from maven , In that case change the path in both file you main runner and failed test runner
problem solved :)
In pom i had line:
-Dcucumber.options="--plugin io.qameta.allure.cucumberjvm.AllureCucumberJvm"
This line overrides all plugins information in TestRunner

Why is Gradle failing on :linkDebugTestLinux in my Kotlin multiplatform project?

I'm porting a C# library to Kotlin to take advantage of multiplatform. When running the build task, it fails in the subtask linkDebugTestLinux.
For context, I'm using IDEA Ultimate on Manjaro. I'm certain there's nothing wrong with my code as compileKotlinLinux finishes without error.
There are zero DDG results for "linkDebugTestLinux" and nothing helpful for "konan could not find home" or "kotlin native ...". After hours of stitching together incomplete and outdated examples from the official docs, I've given up.
My build.gradle.kts:
plugins {
kotlin("multiplatform") version "1.3.40"
}
repositories {
mavenCentral()
}
dependencies {
commonMainImplementation("org.jetbrains.kotlin:kotlin-stdlib")
commonTestImplementation("org.jetbrains.kotlin:kotlin-test-common")
commonTestImplementation("org.jetbrains.kotlin:kotlin-test-annotations-common")
}
kotlin {
// js() // wasn't the issue
linuxX64("linux")
}
Output of task build without args:
> Configure project :
Kotlin Multiplatform Projects are an experimental feature.
> Task :compileKotlinLinux
[...unused param warnings...]
> Task :compileKotlinMetadata
[...unused param warnings...]
> Task :metadataMainClasses
> Task :metadataJar
> Task :assemble
> Task :linuxProcessResources NO-SOURCE
> Task :linuxMainKlibrary
> Task :linkDebugTestLinux FAILED
e: Could not find "/home/username/" in [/home/username/path/to/the/repo, /home/username/.konan/klib, /home/username/.konan/kotlin-native-linux-1.3/klib/common, /home/username/.konan/kotlin-native-linux-1.3/klib/platform/linux_x64].
[...snip...]
BUILD FAILED in 16s
4 actionable tasks: 4 executed
Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1
In the boilerplate I omitted it suggests to use --debug, so I've uploaded that here.
After some investigation, it was assumed that the problem is in the path. In the debug log, you got the /home/yoshi/,/ fragment. As far as this directory name was unexpected, the compiler interpreted this , as a delimiter between lib names. So, it tried to find library /home/yoshi/, that was obviously unavailable.
For now, I would recommend you to change the directory name to be something trivial.

How to make Android Studio build fail on lint errors

Is it possible to make Android Studio build fail on lint check errors ?
I have problems with ImageViews when I convert icon from .png to vector drawable .xml
Sometimes I forgot to change
android:src="#drawable/ic_minus"
to
app:srcCompat="#drawable/ic_minus"
and the app crashes on older OS devices.
?
If there's a lint check for that you can change the severity to FATAL and then when building the release version of your APK it should fail.
android {
lintOptions {
fatal 'MY_LINT_CHECK_ID'
}
}
Also you can execute the Gradle lint task which will fail. If you also want warnings to let your build fail you can use this.
android {
lintOptions {
warningsAsErrors true
}
}
You can also use the below code inside android block in module/app level build.gradle file
For build.gradle
android {
applicationVariants.all {
// Example lint task, your verification task can be anything
def lintTask = tasks["lint${name.capitalize()}"]
assembleProvider.get().dependsOn(lintTask/*, detekt*/) // add list of all the tasks which should fail the build
}
}
For build.gradle.kts(Kotlin DSL)
android {
applicationVariants.all {
// Example lint task, your verification task can be anything
val lintTask = tasks["lint${name.capitalize()}"]
assembleProvider.get().dependsOn.addAll(listOf(lintTask/*, tasks["detekt"]*/)) // add list of all the tasks which should fail the build
}
}
Above code makes the build assemble task which run when we run build app or run app, depends on the listed verification tasks and hence fails it when those tasks fails
Make sure your verification tasks(in our case lint task) are set to fail the build when they are run and there are some issues found in them. All verification tasks has their own flags to enable this behaviour.
For lint you can enable the build failure on warning as below(build.gradle.kts for Kotlin DSL)
android {
lint {
isWarningsAsErrors = true
}
}

Android Gradle running task before building

I've got this task into build.gradle
apply plugin: 'checkstyle'
task checkstyle(type: Checkstyle) {
// Cleaning the old log because of the creation for the new ones
delete fileTree(dir: "${project.rootDir}/app/build/reports")
source 'src'
include '**/*.java'
exclude '**/gen/**'
// empty classpath
classpath = files()
//Do not fail build
ignoreFailures = false
}
I want this to run automatically when i try to build the app and if finds errors to fail the build. I'm not sure how and where to call the task.
project.afterEvaluate{
assembleAcceptanceDebug.dependsOn("checkstyle")
}
This is what's finally worked. I found the task name when i click to run the app then the problem was that this task does not exists before Evaluate so that was the problem. Now it's working. Thank you and thanks to this https://discuss.gradle.org/t/how-to-define-a-preprocessing-task-for-android-build/6147

Orchestrating Gradle build invocations with custom tasks

I’m trying to define two new Gradle tasks, buildAll and pubLocal, to run other tasks in a specific order.
When gradle buildAll is invoked, I want Gradle to do the same thing as if I had executed gradle clean build writePom (see below for writePom).
When gradle pubLocal is executed, I want Gradle to do the same thing as if gradle buildAll install had been executed.
Here’s my best attempt thus far:
// build.gradle
task writePom << {
pom {
project {
groupId 'mygroup'
artifactId 'mylib'
version version
inceptionYear '2015'
licenses {
license {
name 'Blah'
url 'blah'
distribution 'blah'
}
}
}
}.writeTo("build/libs/pom.xml")
}
task buildAll(dependsOn: clean, build, writePom)
task pubLocal(dependsOn: buildAll, install)
When I run gradle buildAll on this, I get:
myuser#mymachine:~/tmp/myapp$./gradlew buildAll
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/myuser/tmp/myapp/build.gradle' line: 67
* What went wrong:
A problem occurred evaluating root project 'myapp'.
> Could not find method buildAll() for arguments [{dependsOn=task ':clean'}, task ':build', task ':writePom'] on root project 'myapp'.
Any ideas as to where I’m going awry?
This may be a left-over from copy-pasting, but your strings are not quoted consistently using standard single- or double-quotes. Example:
}.writeTo(“build/libs/pom.xml")
does not quote the string properly, as it opens with the “ character instead of ". Same with the single-quotes above it.
You can see from the way your code is highlighted, that everything in red is interpreted as a string. If this is the case in your actual code, the buildAll and pubLocal tasks will not be recognized, as they are part of a string rather than code.
UPDATE:
Since the above answer is irrelevant now, here is another possibility. The error message shows that only the "clean" task is listed in the dependsOn parameter. The buildAll task dependencies should be declared like this:
task buildAll(dependsOn: [clean, build, writePom])
Similar with the pubLocal task.
I'm using Gradle 2.4. The following file includes the Maven plugin, uses a list [] in the dependsOn, and ensures that clean must be executed before build:
apply plugin: 'maven'
task writePom << {
pom {
project {
groupId 'mygroup'
artifactId 'mylib'
version version
inceptionYear '2015'
licenses {
license {
name 'Blah'
url 'blah'
distribution 'blah'
}
}
}
}.writeTo("build/libs/pom.xml")
println "TRACER writePom"
}
task clean << { println "TRACER clean" }
task build << { println "TRACER build" }
build.mustRunAfter clean
task install << { println "TRACER install" }
task buildAll(dependsOn: [clean, build, writePom])
task pubLocal(dependsOn: [buildAll, install])
I get this output (minus Gradle 3 warnings):
bash-3.2$ gradle buildAll
:clean
TRACER clean
:build
TRACER build
:writePom
TRACER writePom
:buildAll
BUILD SUCCESSFUL
and this:
bash-3.2$ gradle pubLocal
:clean
TRACER clean
:build
TRACER build
:writePom
TRACER writePom
:buildAll
:install
TRACER install
:pubLocal
BUILD SUCCESSFUL

Resources