[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Advice on code sharing

From: BRM <bm_witness_at_yahoo.com>
Date: Tue, 20 Jan 2009 15:03:31 -0800 (PST)

I've got a similar situation where I've broken things out into shared libraries.

I basically solved it by using a script to pull down the shared library into a special folder. This way the shared library can live wherever and it doesn't bother the project. The script is knowledgeable enough to do checks and exports, and to know the difference between a release tag and the trunk. (It's specific to my repo, so while there is some stuff that would be helpful, there wouldn't be a lot).

So my project exists on its own, without the dependencies checked in under its repo path. It knows about the dependencies through a special file (e.g. dependencies.list.txt) that is read by the script which then pulls the dependencies down to a special folder (e.g. dependencies), and then compiles them as appropriate each then puts its output file (e.g. shared.lib) in a special parallel folder (e.g. dependencies/debug). The project can then link against them by using the special parallel folder in its linker path.

My version is specific to my repository layout and is implemented on Windows using batch files (for Visual Studios) and a Windows Scripting Host JavaScript program to do the heavy lifting.

In the past, I have also done this directly in Makefiles for a CVS repository - where the Makefile would checkout a folder if it didn't exist. Not quite as robust, but also worked very well.

My advice:

- Do something similar with a script. The SVN command-line utilities provide a great interface for scripts that is easy to parse and figure things out. I only used 'svn export/checkout/update/status' and 'svnversion' to do everything SVN related.
- Figure out how you want to structure and integrate your scripts with your build environment, and what your requirements are.

Once you work out those, it won't be hard, and it is well worth it.

My biggest issue was that I had to have a script that (a) ran on Windows and (b) would run on any developer's system without requiring them to install anything third-party - so Python, Perl, etc. were all out of question. Windows Scripting Host provided a good system and supports JavaScript and VBScript out of the box, though looking up the latest installed version for the Collabnet SVN command-line utilties was a bit problematic in JavaScript. (Microsoft only documents the VBscript method, and provides no JavaScript examples. I can be done, just a bit harder - namely since I had to query a changing registry path since the version number is in the path.)


From: Kumar Balachandran <kumar.mailinglists_at_gmail.com>
To: users_at_subversion.tigris.org
Sent: Tuesday, January 20, 2009 1:00:23 PM
Subject: Advice on code sharing


We are trying to handle a situation where we have two simulation packages -- call them SIM1 and SIM2. Each of these are set up as separate projects in a svn repository

It turns out that SIM1 and SIM2 today have much code that is common or share functionality and we are attempting to create a common code share in a new project

We know that you can use the externals property to set up a checkout of SHARE as
and repo/SIM2-Rel_s2/SHARE

One problem is the procedure needed to enable the handling of share. I have the following questions:
1. Changes to SHARE should be controlled for check-in purposes. For example, can the checkout of share using the externals setting be automated to create a tag for SHARE as SHARE_SIM1_Rel_s1 so changes to that tag only get checked into that branch (?) or tag. Similarly for SHARE_SIM2_Rel_s2. That way, when changes need to be made into the trunk of SHARE, then they can be done through a formalized merge from the tags to the share.
2. Alternatively, provide some class of users a way to check out read only versions of SHARE that cannot be checked back into the SHARE project.

I figure someone must have dealt with similar problems before, but I was not able to find information beyond use of the externals property. I appreciate any help from folks.



To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-01-21 00:04:45 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.