Revert "Revert "Disallow multiple build executions in parallel""

Bug: 36698966
Test: m -j & m -j # (run two builds at once)

This reverts commit be9cd1192bf8774f529a1ca6d2b8ee3876a80d02.

Change-Id: Ia15c0bf156a6de54da054eab8134f36bae0823ca
diff --git a/ui/build/build.go b/ui/build/build.go
index 51dce05..83dbcb6 100644
--- a/ui/build/build.go
+++ b/ui/build/build.go
@@ -117,6 +117,10 @@
 	// Start getting java version as early as possible
 	getJavaVersions(ctx, config)
 
+	// Make sure that no other Soong process is running with the same output directory
+	buildLock := BecomeSingletonOrFail(ctx, config)
+	defer buildLock.Unlock()
+
 	SetupOutDir(ctx, config)
 
 	checkCaseSensitivity(ctx, config)