0

Let say I have

Code 1 // for customer A

Code 2  // for Customer B

code 3  // Shared code

I want to modify the source code during build time so that the source code for 1 or 2 is removed completely base on some build-time parameters.

any library out there? I don't want to use a bash script with 'sed'.

Edit: This is for a iOS and Android building

  • This is indicative that you haven't properly modularized your code. All of your shared code should be in a separate library, called upon from the ClientA and ClientB applications. – Alexander Jan 31 '20 at 16:52
  • I think most build tools can do this. For Maven you can for example use different src directories: https://stackoverflow.com/questions/270445/maven-compile-with-multiple-src-directories which you can set the source path dynamically or copy the needed sources into. – axelclk Jan 31 '20 at 16:56

1 Answers1

0

This sounds like an excellent application for a Makefile ...

https://github.com/therealglazou/swift-makefiles

http://www.glazman.org/weblog/dotclear/index.php?post/2016/02/19/A-makefile-based-build-system-for-Swift

As you well know, the Unix/Linux make command is specifically designed for easily specifying features to include or exclude during a build-process.

Mike Robinson
  • 8,490
  • 5
  • 28
  • 41