diff --git a/repo/gradle-settings-conventions/internal-gradle-setup/src/main/kotlin/InternalGradleSetupSettingsPlugin.kt b/repo/gradle-settings-conventions/internal-gradle-setup/src/main/kotlin/InternalGradleSetupSettingsPlugin.kt index 4d5041ea828..79630016735 100644 --- a/repo/gradle-settings-conventions/internal-gradle-setup/src/main/kotlin/InternalGradleSetupSettingsPlugin.kt +++ b/repo/gradle-settings-conventions/internal-gradle-setup/src/main/kotlin/InternalGradleSetupSettingsPlugin.kt @@ -13,7 +13,6 @@ import org.gradle.kotlin.dsl.extra import java.net.SocketTimeoutException import java.net.URL import java.net.UnknownHostException -import kotlin.concurrent.thread private const val DOMAIN_NAME = "kotlin-build-properties.labs.jb.gg" private const val SETUP_JSON_URL = "https://$DOMAIN_NAME/setup.json" @@ -27,35 +26,30 @@ abstract class InternalGradleSetupSettingsPlugin : Plugin { log.info("TeamCity build detected. Skipping automatic local.properties configuration") return } - val rootDir = target.rootDir - // invoke this logic in a separate thread to not pause the build - // the properties will be configured for the future builds - thread { - try { - val modifier = LocalPropertiesModifier(rootDir.resolve("local.properties")) - val consentManager = ConsentManager(modifier) - val initialDecision = consentManager.getUserDecision() - if (initialDecision == false) { - log.debug("Skipping automatic local.properties configuration as you've opted out") - return@thread - } - val connection = URL(SETUP_JSON_URL).run { openConnection().apply { connectTimeout = 300 } } - val setupFile = connection.getInputStream().buffered().use { - parseSetupFile(it) - } - if (initialDecision == null && !consentManager.askForConsent()) { - log.debug("Skipping automatic local.properties configuration as the consent wasn't given") - return@thread - } - modifier.applySetup(setupFile) - log.info("Automatic local.properties setup has been applied.") - } catch (e: UnknownHostException) { - log.debug("Cannot connect to the internal properties storage", e) - } catch (e: SocketTimeoutException) { - log.debug("Cannot connect to the internal properties storage", e) - } catch (e: Throwable) { - log.warn("Something went wrong during the automatic local.properties setup attempt", e) + try { + val modifier = LocalPropertiesModifier(target.rootDir.resolve("local.properties")) + val consentManager = ConsentManager(modifier) + val initialDecision = consentManager.getUserDecision() + if (initialDecision == false) { + log.debug("Skipping automatic local.properties configuration as you've opted out") + return } + val connection = URL(SETUP_JSON_URL).run { openConnection().apply { connectTimeout = 300 } } + val setupFile = connection.getInputStream().buffered().use { + parseSetupFile(it) + } + if (initialDecision == null && !consentManager.askForConsent()) { + log.debug("Skipping automatic local.properties configuration as the consent wasn't given") + return + } + modifier.applySetup(setupFile) + log.info("Automatic local.properties setup has been applied.") + } catch (e: UnknownHostException) { + log.debug("Cannot connect to the internal properties storage", e) + } catch (e: SocketTimeoutException) { + log.debug("Cannot connect to the internal properties storage", e) + } catch (e: Throwable) { + log.warn("Something went wrong during the automatic local.properties setup attempt", e) } } } \ No newline at end of file