diff --git a/build.gradle b/build.gradle index 9d132e7..1d217e7 100644 --- a/build.gradle +++ b/build.gradle @@ -33,12 +33,10 @@ apply plugin: 'propdeps-maven' ext.cascadingVersion = '2.6.0-+' apply from: "etc/properties.gradle" - -def versionProperties = new Properties() -file( 'version.properties' ).withInputStream { versionProperties.load( it ) } +apply from: "etc/version.gradle" group = 'cascading' -version = versionProperties[ 'cascading.memcached.version' ] +version = releaseVersion ext.timestamp = new SimpleDateFormat( "yyyyMMdd" ).format( new Date() ) diff --git a/etc/version.gradle b/etc/version.gradle new file mode 100644 index 0000000..74a6f84 --- /dev/null +++ b/etc/version.gradle @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007-2014 Concurrent, Inc. All Rights Reserved. + * + * Project and contact information: http://www.cascading.org/ + * + * This file is part of the Cascading project. + * + * Licensed 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. + */ + +apply from: './etc/properties.gradle' + +project.ext.currentCommit = System.properties[ 'build.vcs.number' ]; + +if( !currentCommit ) +{ + def commitPath = File.createTempFile( "commit", "tmp" ) + + ant.exec( dir: '.', executable: "git", output: commitPath ) { + arg( line: 'rev-parse HEAD' ) + } + + currentCommit = commitPath.readLines().get( 0 ) + + commitPath.delete() +} + +def versionProperties = new Properties() +file( 'version.properties' ).withInputStream { versionProperties.load( it ) } + +ext.majorVersion = versionProperties[ 'cascading.memcached.release.major' ] +ext.minorVersion = versionProperties[ 'cascading.memcached.release.minor' ] + +ext.buildNumber = System.getProperty( 'build.number', 'dev' ) + +if( System.properties[ 'cascading.memcached.release.private' ] ) + buildNumber = "priv-${buildNumber}" +else if( !System.properties[ 'cascading.memcached.release.final' ] ) + buildNumber = "wip-${buildNumber}" + +ext.releaseTag = "${majorVersion}-${buildNumber}" + +if( !System.properties[ 'build.number' ] ) + releaseTag = "wip-${majorVersion}" + +ext.releaseVersion = majorVersion + +if( minorVersion ) + releaseVersion = "${releaseVersion}.${minorVersion}" + +if( !System.properties[ 'cascading.memcached.release.final' ] ) + releaseVersion = "${releaseVersion}-${buildNumber}" diff --git a/version.properties b/version.properties index 10b302e..7105af3 100644 --- a/version.properties +++ b/version.properties @@ -1,21 +1,2 @@ -# -# Copyright (c) 2007-2013 Concurrent, Inc. All Rights Reserved. -# -# Project and contact information: http://www.cascading.org/ -# -# This file is part of the Cascading project. -# -# Licensed 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. -# - -cascading.memcached.version=0.3.0 +cascading.memcached.release.major=2.6 +cascading.memcached.release.minor=0