From 2f8655e661326b8947dae64516336831ba44af03 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Tue, 8 Feb 2011 11:19:50 -0600 Subject: [PATCH] HHH-5897 - Upgrade to Gradle 0.9.2 --- build.gradle | 4 +- .../gradle/maven/LocalMavenRepoSniffer.java | 122 ------------------ hibernate-core/hibernate-core.gradle | 2 - 3 files changed, 2 insertions(+), 126 deletions(-) delete mode 100644 buildSrc/src/main/java/org/hibernate/build/gradle/maven/LocalMavenRepoSniffer.java diff --git a/build.gradle b/build.gradle index 7f48aab6f6..7e6f961d8d 100644 --- a/build.gradle +++ b/build.gradle @@ -230,6 +230,6 @@ dependsOnChildren() // 2) /gradlew.bat which is the windows bat script for for executing builds // 3) /wrapper which is a directory named by the "jarPath" config which contains other needed files. task wrapper(type: Wrapper) { - gradleVersion = '0.9-rc-1' - jarPath = 'wrapper' + gradleVersion = '0.9.2' + jarFile = 'wrapper' } diff --git a/buildSrc/src/main/java/org/hibernate/build/gradle/maven/LocalMavenRepoSniffer.java b/buildSrc/src/main/java/org/hibernate/build/gradle/maven/LocalMavenRepoSniffer.java deleted file mode 100644 index b0dff0917b..0000000000 --- a/buildSrc/src/main/java/org/hibernate/build/gradle/maven/LocalMavenRepoSniffer.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by - * third-party contributors as indicated by either @author tags or express - * copyright attribution statements applied by the authors. All - * third-party contributions are distributed under license by Red Hat Inc. - * - * This copyrighted material is made available to anyone wishing to use, modify, - * copy, or redistribute it subject to the terms and conditions of the GNU - * Lesser General Public License, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this distribution; if not, write to: - * Free Software Foundation, Inc. - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301 USA - */ -package org.hibernate.build.gradle.maven; - -import java.io.File; -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.util.Collections; - -import org.apache.maven.settings.DefaultMavenSettingsBuilder; -import org.apache.maven.settings.MavenSettingsBuilder; -import org.apache.maven.settings.Settings; -import org.gradle.api.Plugin; -import org.gradle.api.Project; -import org.gradle.api.internal.artifacts.publish.maven.pombuilder.PlexusLoggerAdapter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * TODO : javadoc - * - * @author Steve Ebersole - */ -public class LocalMavenRepoSniffer implements Plugin { - private static final Logger log = LoggerFactory.getLogger( LocalMavenRepoSniffer.class ); - - private final File userHome = new File( System.getProperty( "user.home" ) ); - - @Override - public void apply(Project project) { - File mavenLocal = new File( new File( userHome, ".m2" ), "repository" ); - - File userSettings = new File( new File( System.getProperty( "user.home" ), ".m2" ), "settings.xml" ); - if ( userSettings.exists() ) { - File overriddenMavenLocal = extractMavenLocal( userSettings ); - if ( overriddenMavenLocal != null ) { - mavenLocal = overriddenMavenLocal; - } - } - - try { - project.getLogger().trace( "Adding local maven repo [" + mavenLocal.toString() + "]" ); -// adam: here is where mavenLocal() would come in... - project.getRepositories().mavenRepo( - Collections.singletonMap( "urls", mavenLocal.toURI().toURL().toExternalForm() ) - ); - } - catch ( MalformedURLException e ) { - project.getLogger().warn( "Unable to process local maven repo url", e ); - } - - } - - private static final String USER_HOME_MARKER = "${user.home}/"; - - private File extractMavenLocal(File userSettings) { - Settings settings = extractSettings( userSettings ); - String override = settings.getLocalRepository(); - if ( override != null ) { - override = override.trim(); - if ( override.length() > 0 ) { - // Nice, it does not even handle the interpolation for us, so we'll handle some common cases... - if ( override.startsWith( USER_HOME_MARKER ) ) { - override = userHome.getAbsolutePath() + '/' + override.substring( USER_HOME_MARKER.length() ); - } - return new File( override ); - } - } - return null; - } - - private Settings extractSettings(File userSettings) { - try { - MavenSettingsBuilder builder = buildSettingsBuilder( userSettings ); - return builder.buildSettings(); - } - catch ( Exception e ) { - log.debug( "Unable to build Maven settings : " + e ); - } - return null; - } - - private MavenSettingsBuilder buildSettingsBuilder(File userSettings) throws Exception { - final String userSettingsPath = userSettings.getAbsolutePath(); - - DefaultMavenSettingsBuilder builder = new DefaultMavenSettingsBuilder(); - builder.enableLogging( new PlexusLoggerAdapter( log ) ); - - Field userSettingsPathField = DefaultMavenSettingsBuilder.class.getDeclaredField( "userSettingsPath" ); - userSettingsPathField.setAccessible( true ); - userSettingsPathField.set( builder, userSettingsPath ); - - Field globalSettingsPathField = DefaultMavenSettingsBuilder.class.getDeclaredField( "globalSettingsPath" ); - globalSettingsPathField.setAccessible( true ); - globalSettingsPathField.set( builder, userSettingsPath ); - - builder.initialize(); - - return builder; - } -} diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index b872a451b8..e6a2ed9b64 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -55,5 +55,3 @@ artifacts { archives sourcesJar, testJar } -// http://jira.codehaus.org/browse/GRADLE-1158 -test.testReport = false