groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cchamp...@apache.org
Subject [2/3] groovy git commit: Add sanity check for dependency resolution at configuration time
Date Sun, 12 Nov 2017 12:05:22 GMT
Add sanity check for dependency resolution at configuration time


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/228dd19c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/228dd19c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/228dd19c

Branch: refs/heads/master
Commit: 228dd19cace4c93f5b11f96b5b41140fd86cbf61
Parents: 3d780dc
Author: Cedric Champeau <cchampeau@apache.org>
Authored: Sun Nov 12 13:03:52 2017 +0100
Committer: Cedric Champeau <cchampeau@apache.org>
Committed: Sun Nov 12 13:03:52 2017 +0100

----------------------------------------------------------------------
 build.gradle                |  1 +
 gradle/bad-practices.gradle | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/228dd19c/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 8ee9b2b..928c0c4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -70,6 +70,7 @@ ext.modules = {
     subprojects.findAll{ !['performance'].contains(it.name) }
 }
 
+apply from: 'gradle/bad-practices.gradle'
 apply from: 'gradle/filter.gradle'
 apply from: 'gradle/indy.gradle'
 apply from: 'gradle/publish.gradle'

http://git-wip-us.apache.org/repos/asf/groovy/blob/228dd19c/gradle/bad-practices.gradle
----------------------------------------------------------------------
diff --git a/gradle/bad-practices.gradle b/gradle/bad-practices.gradle
new file mode 100644
index 0000000..912675b
--- /dev/null
+++ b/gradle/bad-practices.gradle
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+// Check if dependency resolution is happening at configuration time
+allprojects { p ->
+    p.ext.resolvingAllowed  = false
+    afterEvaluate { pj ->
+        pj.ext.resolvingAllowed = true
+    }
+    configurations.all { cnf ->
+        incoming.beforeResolve {
+            if (!p.ext.resolvingAllowed) {
+                throw new IllegalStateException("Configuration $cnf is being resolved at
configuration time. This shouldn't be necessary and usually indicates an error in the build
script.")
+            }
+        }
+    }
+}
\ No newline at end of file


Mime
View raw message