Page 2 of 2

Re: Setting version number automatically

Posted: Tue Feb 19, 2008 8:20 pm
by Benjamin
Chris Corbyn wrote:Are svn revision numbers really that useful in public versioning? They're quite monstrous numbers ;)
I was thinking something along the lines of: 1.0.REVISION

So the svn revision would only be minor. A new branch would increment either the 1 or the 0 and REVISION would start over again.

Re: Setting version number automatically

Posted: Wed Feb 20, 2008 9:11 pm
by phaitour
thank you vain!

Re: Setting version number automatically

Posted: Sat Feb 23, 2008 8:02 am
by Chris Corbyn
Here's what I'm doing.

I have a VERSION file which contains the name of my project and version:

Code: Select all

w3style:swiftmailer d11wtq$ cat VERSION 
Swift-4.0.0-dev
I have ant set to read the VERSION from that file:

Code: Select all

<!-- Generate version info from VERSION file -->
  <loadfile property="bundle.name" srcFile="${src.versionfile}">
    <filterchain>
      <striplinebreaks />
    </filterchain>
  </loadfile>
 
And I use that to create the name of the tar.gz file when it all gets bundled up. I'll possibly make use of Ant's <replace> task to convert "@@version@@" on my source code to the actual version during packaging.

A typical package process (including running my test suite) look like this with Ant.

Code: Select all

w3style:swiftmailer d11wtq$ ant test package
Buildfile: build.xml
 
clean:
 
copy-classes:
     [copy] Copying 77 files to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/lib
     [copy] Copying 355 files to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/test-suite
     [copy] Copying 74 files to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/tests
 
test:
     [exec] All Tests
     [exec]   >> Swift_MailerTest OK
     [exec]   >> Swift_MimeFactoryAcceptanceTest OK
     [exec]   >> Swift_TransportFactoryAcceptanceTest OK
     [exec]   >> Swift_ByteStream_ArrayByteStreamTest OK
     [exec]   >> Swift_ByteStream_FileByteStreamAcceptanceTest OK
     [exec]   >> Swift_CharacterReader_GenericFixedWidthReaderTest OK
     [exec]   >> Swift_CharacterReader_UsAsciiReaderTest OK
     [exec]   >> Swift_CharacterReader_Utf8ReaderTest OK
     [exec]   >> Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest OK
     [exec]   >> Swift_CharacterStream_ArrayCharacterStreamTest OK
     [exec]   >> Swift_Encoder_Base64EncoderAcceptanceTest OK
     [exec]   >> Swift_Encoder_Base64EncoderTest OK
     [exec]   >> Swift_Encoder_QpEncoderAcceptanceTest OK
     [exec]   >> Swift_Encoder_QpEncoderTest OK
     [exec]   >> Swift_Encoder_Rfc2231EncoderAcceptanceTest OK
     [exec]   >> Swift_Encoder_Rfc2231EncoderTest OK
     [exec]   >> Swift_KeyCache_ArrayKeyCacheAcceptanceTest OK
     [exec]   >> Swift_KeyCache_ArrayKeyCacheTest OK
     [exec]   >> Swift_KeyCache_DiskKeyCacheAcceptanceTest OK
     [exec]   >> Swift_KeyCache_SimpleKeyCacheInputStreamTest OK
     [exec]   >> Swift_Mime_AttachmentAcceptanceTest OK
     [exec]   >> Swift_Mime_AttachmentTest OK
     [exec]   >> Swift_Mime_EmbeddedFileAcceptanceTest OK
     [exec]   >> Swift_Mime_EmbeddedFileTest OK
     [exec]   >> Swift_Mime_MimePartAcceptanceTest OK
     [exec]   >> Swift_Mime_MimePartTest OK
     [exec]   >> Swift_Mime_SimpleMessageAcceptanceTest OK
     [exec]   >> Swift_Mime_SimpleMessageTest OK
     [exec]   >> Swift_Mime_SimpleMimeEntityAcceptanceTest OK
     [exec]   >> Swift_Mime_SimpleMimeEntityTest OK
     [exec]   >> Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest OK
     [exec]   >> Swift_Mime_ContentEncoder_Base64ContentEncoderTest OK
     [exec]   >> Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest OK
     [exec]   >> Swift_Mime_ContentEncoder_PlainContentEncoderTest OK
     [exec]   >> Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest OK
     [exec]   >> Swift_Mime_ContentEncoder_QpContentEncoderTest OK
     [exec]   >> Swift_Mime_Header_AddressHeaderTest OK
     [exec]   >> Swift_Mime_Header_DateHeaderTest OK
     [exec]   >> Swift_Mime_Header_IdentificationHeaderTest OK
     [exec]   >> Swift_Mime_Header_ListHeaderTest OK
     [exec]   >> Swift_Mime_Header_MailboxHeaderTest OK
     [exec]   >> Swift_Mime_Header_ParameterizedHeaderTest OK
     [exec]   >> Swift_Mime_Header_PathHeaderTest OK
     [exec]   >> Swift_Mime_Header_ReceivedHeaderTest OK
     [exec]   >> Swift_Mime_Header_StructuredHeaderTest OK
     [exec]   >> Swift_Mime_Header_UnstructuredHeaderTest OK
     [exec]   >> Swift_Mime_Header_VersionHeaderTest OK
     [exec]   >> Swift_Mime_HeaderEncoder_Base64HeaderEncoderTest OK
     [exec]   >> Swift_Mime_HeaderEncoder_QpHeaderEncoderTest OK
     [exec]   Smoke Test
     [exec]   Compare email sent with image @ http://swiftmailer.org/smoke/4.0.0/attachment.jpg
     [exec]   >> Swift_Smoke_AttachmentSmokeTest OK
     [exec]   Smoke Test
     [exec]   Compare email sent with image @ http://swiftmailer.org/smoke/4.0.0/basic.jpg
     [exec]   >> Swift_Smoke_BasicSmokeTest OK
     [exec]   Smoke Test
     [exec]   Compare email sent with image @ http://swiftmailer.org/smoke/4.0.0/international.jpg
     [exec]   >> Swift_Smoke_InternationalSmokeTest OK
     [exec]   >> Swift_Transport_EsmtpTransportTest OK
     [exec]   >> Swift_Transport_LoadBalancedTransportTest OK
     [exec]   >> Swift_Transport_SendmailTransportTest OK
     [exec]   >> Swift_Transport_Esmtp_AuthHandlerTest OK
     [exec]   >> Swift_Transport_Esmtp_Auth_CramMd5AuthenticatorTest OK
     [exec]   >> Swift_Transport_Esmtp_Auth_LoginAuthenticatorTest OK
     [exec]   >> Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest OK
     [exec]   >> Swift_Transport_Log_ArrayLogTest OK
     [exec]   >> Swift_Transport_PolymorphicBuffer_BasicSocketAcceptanceTest OK
     [exec]   >> Swift_Transport_PolymorphicBuffer_ProcessAcceptanceTest OK
     [exec]   Skip:  Cannot run test without an SSL enabled SMTP host to connect to (define
     [exec]   SWIFT_SSL_HOST in tests/acceptance.conf.php if you wish to run this test)
     [exec]   at
     [exec]   [/Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/tests/acceptance/Swift/Transport/PolymorphicBuffer/SslSocketAcceptanceTest.php
     [exec]   line 21]
     [exec]     in: Swift_Transport_PolymorphicBuffer_SslSocketAcceptanceTest
     [exec]   >> Swift_Transport_PolymorphicBuffer_SslSocketAcceptanceTest OK
     [exec]   >> Swift_Transport_PolymorphicBuffer_TlsSocketAcceptanceTest OK
     [exec] OK
     [exec] Test cases run: 64/64, Passes: 7405, Failures: 0, Exceptions: 0
 
clean:
 
copy-classes:
     [copy] Copying 77 files to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/lib
     [copy] Copying 355 files to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/test-suite
     [copy] Copying 74 files to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/tests
 
bundle:
     [copy] Copying 1 file to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev
     [copy] Copying 12 files to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/examples
     [move] Moving 1 file to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/tests
     [move] Moving 1 file to /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev/tests
 
package:
      [tar] Building tar: /Users/d11wtq/Sites/swiftmailer/build/Swift-4.0.0-dev.tar.gz
 
BUILD SUCCESSFUL
Total time: 27 seconds
w3style:swiftmailer d11wtq$
(Only with some ANSI color in my terminal ;))

It's the first time I've bothered with Ant for anything outside Java but it's handy. Just about to go and have a look at how Phing compares now....

Re: Setting version number automatically

Posted: Sun Feb 24, 2008 6:40 am
by phaitour
Thanks Chris. I'm going to have to take notes on what you did in ANT because that's exactly what I'm looking to do. Unfortunately, I'm doing a php project so it looks like phing is what I'm looking for.

Vain, outside of http://phing.info/docs/guide/current/, are there any good resources I should be looking at for phing? Are there any good examples for phing config xml files?

Re: Setting version number automatically

Posted: Wed Feb 27, 2008 1:44 am
by vain
Well, the manual is a good start and other resources for Phing are hard to find.
For usage examples, i would advise you to check out some build.xml files of various framework and cms projects. While you compare several of them, you'll get a clue how things work out for you.
You can easily find them with CodeSearchEngines like Google/Krugle/Koders.