Using Source Code Management with Worklight: SubversionWorklight Studio provides some interesting challenges when it comes to source code management. Getting just the right files checked in takes a bit of planning, and getting it right the first time makes a big difference in how smoothly the overall process will go. The goal is to check in only those files that won't be modified/generated when the application is built. This both saves storage space in your SCM system, and reduces the number of commits needed to keep your workspace in synch with the repository. All the information here is based on tests with Worklight Studio 5.0.5 in Eclipse Juno running on OSX. Why not CVS?CVS isn't the most brilliant SCM system, but it is an old standby for simple SCM with Eclipse. It is the one team provider that is packaged with base Eclipse. Unfortunately, there is a long standing Eclipse bug that results in conflicts when a Worklight Project that is checked into CVS is rebuilt. Eclipse CVS ignores the .cvsignore file when CVS metadata is present in a directory, and the Worklight Build process results in the CVS metadata from some source directories getting copied into generated directories. As simple and convenient as CVS is, trying to use it with Worklight projects will just lead to tears. Using SubversionProbably the easiest next choice for SCM is Subversion. There are 2 leading Subversion team providers for Ecli Unfortunately, I had several problems using Subversive with Worklight projects. It had to be explicitly told to check in some files, and it failed completely with a larger, more complex project. In the end, I took the jump and switched to Subclipse. In addition to succeeding where Subversive failed, it seems to perform much better for the initial check-in of a dojo project. (which is quite time consuming in any case.) When you install Subclipse through the Marketplace, you are presented with the option to install both the Subversion JavaHL Native Library Adapter, and the SVNKit Client Adapter. The later is the pure Java solution and is marked as optional in the feature list. Interestingly, JavaHL is not marked optional, though it is.
You can install either or both client adapters. If you install both, the default configuration that you will get in a new Workspace is to use JavaHL. If you don't have the JavaHL libraries installed, this will fail. You will need to go to Eclipse - > Preferences -> Team -> SVN -> SVN Interface and select SVNKit. While workable, this is a bit annoying, so if you don't intend to use JavaHL, the easiest thing to do is to just not install the JavaHL adapter when you install Subclipse. This is not meant to be a general primer on Subversion. I'm still finding my way around it myself. But when using Subversion (or any SCM system) with Worklight projects, a little bit of planning goes a long way. The key is to _not_ check in files that will be regenerated during the Worklight build and deploy. If this is done right, checking out a project and simply building and testing it should not result in deltas from the repository. The Worklight Infocenter has some notes in this area. Unfortunately, there isn't a way to add files and folders to the Subversion exclude list before the initial check in, so the process is a bit more involved than I wish. The easiest way to get a project checked in correctly is to just to delete the files that should not be checked in before sharing the project. Then, after the project is s The files to exclude from check-in are: Everything in bin In general this means that In an android environment:
In an iOS environment:
The One way to deal with xcuserdata is to add it to Preferences -> Team -> Ignored Resources. This will result in xcuserdata folders being ignored anywhere in the project tree. However that preference needs to be set on every workspace that checks out the project, so as tedious as ignoring that folder individually wherever it pops up, that is probably the safest solution. Unfortunately, in my testing on OSX, in the iOS environment, even though native/CordovaLib, native/Frameworks and native/WorklightSDK get regenerated on the first build after checkout, they (or in the case of native/Frameworks, a subdirectory) get regenerated with the wrong permissions. You may not even notice this until it is time to delete the project from the workspace, and you find that the delete operation fails. Another symptom is that when you open the environment in xcode, it reports that the CordovalLib project is locked, and offeres to unlock it for you. The solution is to right click on native/CordovaLib, nati Mobile Web environments can be checked in as-is. I don't have notes for the other environments. The Infocenter is the best resource for now. If I have occasion to look look into the details of othe Once you have removed the files that should not be added to source control, right click on the project and select Team -> Share Project. Select SVN and click on Next. At this point, if you have already defined the repository location in the SVN Repository view, you can simply select it. Otherwise, you can configure it here. The repository must exist and be initialized. See the Subversion documentation for notes on how to set up a repository and how to address the repository. When I am using a local repository, I tend to just use a file:/// URL. When I am using a remote repository, I tend to just use svn+ssh:// but any access method should work. I've been trying to follow the Subversion naming conventions. This is one area where Subversive is ahead of Subclipse. In Subversive, the standard naming convention is supported by default. In Subclipse, you need to manually manage the name at check in.
Once the folder is specified, click on Finish and the project will be associated with your repository. (but nothing will be checked in yet) The If you are checking in a dojo app, this is a good time to get a cup of coffee. Because there are so many files under the dojo folder, initial check in and check out of dojo apps is quite slow. But since the files in the dojo folder should (almost) never change, subsequent synchronization is just fine. Once the project is checked in, build the app and add the ignores. Subversion manages the ignore list through the svn:ignore property on the containing folder. Once a project is checked in to the repository, a new file in the project can be added to the ignore list by right clicking on it and selecting Team -> Add to svn:ignore. This opens a dialog that gives you the option to ignore the file explicitly by name, by file extension, or using a custom wildcard. This method is handy for ignoring 1 or 2 files or patterns in a directory.
If you are adding several ignore patterns to a folder, You can right click on the folder, and select Team -> Show Properties. This will open the SVN properties view. Here you can right click and select: Add a property. The property name is svn:ignore and the value is a newline delimited list of patterns to ignore.
Once you have set up all the svn:ignore properties, synchronize again. (right-click on project: Team -> Synchronize with Repository) Only the folders containing ignored resources should have changes. The files that you are ignoring should not show up in the Synchronize view. I have seen a problem with Subclipse where files were showing up in the Synchronize view as being added even though I had set the ignore pattern for them. I had to restart Eclipse to get Subclipse to work it out. If you do accidentally get a file that shouldn't be in the repository checked in, adding it to the ignore list won't help. You need to delete the file, synchronize with the repository and then add it to the ignore list.
And that's it. I've used Git with Worklight Studio with very mediocre results. That is probably more to do with my lack of u |