简体   繁体   中英

Project port to android and source management

We are trying to port an existing java application to android and would like to know what the best practices are for managing the source code.

We have exploded our big project into several agnostic projects, but we still have a big monolithic project. For those little frameworks, we shouldn't have to do much work but the big one needs some rewrite.

For the time being, a developer is porting our app to Android, but other developers continue to develop new features on the non-Android project. When the port is complete, we will have to re merge all modifications into the android code base and this will be a real pain. So my question is: how should we manage our code source? Should we create a specific repository for each platform? should we keep the two code bases in the same repository but pointing to different branches so that merging is easier?

It's probably not a source management problem. Try to create an abstract porting layer. It shall abstract all the APIs necessary to make your application running. Then under, say, SWT, implement that porting layer using SWT APIs, under, say, Android implement the same layer using Android APIs.

One can imagine:

public interface ISoundEngine {
void startSound();
void stopSoud();
}

The rest of your app uses startSound/stopSound to operate the engine.

So then under windows you implement

public WindowsSoundEngine implements ISoundEngine {
...
}

under Android you implement

public AndroidSoundEngine implements ISoundEngine {
...
}

using Windows-specific and Android-specific low level APIs in each case.

The only good solution I see is move all common code to library, you can develop independently. Then create projects for Swing UI, Android UI etc. If your logic still need some platform specific services (for data storage, notifications ie) Use Alex's method to pass right library when client calls common lib.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM