Skip to content

Commit

Permalink
apply the same version mechanism as used in other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
fs111 committed Oct 9, 2014
1 parent 813ec48 commit b4addd6
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 25 deletions.
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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() )

Expand Down
62 changes: 62 additions & 0 deletions etc/version.gradle
Original file line number Diff line number Diff line change
@@ -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}"
23 changes: 2 additions & 21 deletions version.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b4addd6

Please sign in to comment.