From fa5e7b5c19d187671c2867b6ae62666278f047e0 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 10 May 2023 16:49:09 -0700 Subject: [PATCH 1/2] Allow intellij to load the feature-examples project without GEMFIRE_HOME We added validation to the *configuration* of the checkEnv task. That meant that even parsing the gradle build failed immediately. The validation should happen when the task runs. --- feature-examples/build.gradle | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/feature-examples/build.gradle b/feature-examples/build.gradle index 14271310..6d4f07d2 100644 --- a/feature-examples/build.gradle +++ b/feature-examples/build.gradle @@ -47,18 +47,20 @@ allprojects { def installDir = System.getenv('GEMFIRE_HOME') ?: System.getenv('GEODE_HOME') task checkEnv { - if (installDir==null || installDir.isEmpty()) { - throw new GradleException("Please export GEMFIRE_HOME= (if this message persists, you may also need to ./gradlew --stop)") - } else { - println("GemFire directory is $installDir") - } - - if (project.getProperty('gemfireRepositoryUrl').contains('commercial-repo.pivotal.io')) { - if (!project.hasProperty("gemfireReleaseRepoUser") || gemfireReleaseRepoUser.isEmpty()) { - throw new GradleException("Please set gemfireReleaseRepoUser in gradle.properties to the email address you registered at https://commercial-repo.pivotal.io/") + doLast { + if (installDir == null || installDir.isEmpty()) { + throw new GradleException("Please export GEMFIRE_HOME= (if this message persists, you may also need to ./gradlew --stop)") + } else { + println("GemFire directory is $installDir") } - if (!project.hasProperty("gemfireReleaseRepoPassword") || gemfireReleaseRepoPassword.isEmpty()) { - throw new GradleException("Please set gemfireReleaseRepoPassword in gradle.properties to the https://commercial-repo.pivotal.io/ password for $gemfireReleaseRepoUser") + + if (project.getProperty('gemfireRepositoryUrl').contains('commercial-repo.pivotal.io')) { + if (!project.hasProperty("gemfireReleaseRepoUser") || gemfireReleaseRepoUser.isEmpty()) { + throw new GradleException("Please set gemfireReleaseRepoUser in gradle.properties to the email address you registered at https://commercial-repo.pivotal.io/") + } + if (!project.hasProperty("gemfireReleaseRepoPassword") || gemfireReleaseRepoPassword.isEmpty()) { + throw new GradleException("Please set gemfireReleaseRepoPassword in gradle.properties to the https://commercial-repo.pivotal.io/ password for $gemfireReleaseRepoUser") + } } } } @@ -184,4 +186,4 @@ subprojects { apply from: "gradle/spotless.gradle" apply from: "gradle/ide.gradle" -apply from: "gradle/rat.gradle" \ No newline at end of file +apply from: "gradle/rat.gradle" From d73e7c54458609347af30abc81b7dd5362c76142 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 14 Jun 2024 12:56:36 -0700 Subject: [PATCH 2/2] Check the gradle properties for the repo first These properties should be checked before configuring the project to give a nicer error message. GEMFIRE_HOME can be checked later in the doLast. --- feature-examples/build.gradle | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/feature-examples/build.gradle b/feature-examples/build.gradle index 7bb198b2..b8462609 100644 --- a/feature-examples/build.gradle +++ b/feature-examples/build.gradle @@ -21,6 +21,15 @@ plugins { id "de.undercouch.download" version "4.0.4" } +if (project.getProperty('gemfireRepositoryUrl').contains('commercial-repo.pivotal.io')) { + if (!project.hasProperty("gemfireReleaseRepoUser") || gemfireReleaseRepoUser.isEmpty()) { + throw new GradleException("Please set gemfireReleaseRepoUser in gradle.properties to the email address you registered at https://commercial-repo.pivotal.io/") + } + if (!project.hasProperty("gemfireReleaseRepoPassword") || gemfireReleaseRepoPassword.isEmpty()) { + throw new GradleException("Please set gemfireReleaseRepoPassword in gradle.properties to the https://commercial-repo.pivotal.io/ password for $gemfireReleaseRepoUser") + } +} + allprojects { repositories { if (!gradle.usingGeodeCompositeBuild) { @@ -54,14 +63,6 @@ task checkEnv { println("GemFire directory is $installDir") } - if (project.getProperty('gemfireRepositoryUrl').contains('commercial-repo.pivotal.io')) { - if (!project.hasProperty("gemfireReleaseRepoUser") || gemfireReleaseRepoUser.isEmpty()) { - throw new GradleException("Please set gemfireReleaseRepoUser in gradle.properties to the email address you registered at https://commercial-repo.pivotal.io/") - } - if (!project.hasProperty("gemfireReleaseRepoPassword") || gemfireReleaseRepoPassword.isEmpty()) { - throw new GradleException("Please set gemfireReleaseRepoPassword in gradle.properties to the https://commercial-repo.pivotal.io/ password for $gemfireReleaseRepoUser") - } - } } }