@@ -167,6 +167,21 @@ if (GradleVersion.current() < GradleVersion.version('6.0')) {
167167 }
168168}
169169
170+ void applyPluginExternally (PluginManager pluginManager , String pluginClassName ) {
171+ def externallyApplied = ' gradle.enterprise.externally-applied'
172+ def oldValue = System . getProperty(externallyApplied)
173+ System . setProperty(externallyApplied, ' true' )
174+ try {
175+ pluginManager. apply(initscript. classLoader. loadClass(pluginClassName))
176+ } finally {
177+ if (oldValue == null ) {
178+ System . clearProperty(externallyApplied)
179+ } else {
180+ System . setProperty(externallyApplied, oldValue)
181+ }
182+ }
183+ }
184+
170185static def extensionsWithPublicType (def container , String publicType ) {
171186 container. extensions. extensionsSchema. elements. findAll { it. publicType. concreteClass. name == publicType }
172187}
@@ -191,17 +206,3 @@ static String escapeChar(char ch) {
191206static boolean isNotAtLeast (String versionUnderTest , String referenceVersion ) {
192207 GradleVersion . version(versionUnderTest) < GradleVersion . version(referenceVersion)
193208}
194-
195- void applyPluginExternally (PluginManager pluginManager , String pluginClassName ) {
196- def oldValue = System . getProperty(' gradle.enterprise.externally-applied' )
197- System . setProperty(' gradle.enterprise.externally-applied' , ' true' )
198- try {
199- pluginManager. apply(initscript. classLoader. loadClass(pluginClassName))
200- } finally {
201- if (oldValue == null ) {
202- System . clearProperty(' gradle.enterprise.externally-applied' )
203- } else {
204- System . setProperty(' gradle.enterprise.externally-applied' , oldValue)
205- }
206- }
207- }
0 commit comments