Alessandro71 Well-Known Member Licensed User Longtime User May 10, 2025 #1 Scenario: an app manages different customers using symbols like B4X: Copy #if CUSTOMER1 customer-specific code #end if #if CUSTOMER2 customer-specific code #end if now, customer 1 requests source code of the app. you can’t just send the whole source code, because it will expose customer 2 specific code, which is private to each customer. is there a simple way to process all source files and remove CUSTOMER2 specific section? like a preprocessor that will strip #if sections, producing a sanitized copy of the source code. anyone having the same issue out there?
Scenario: an app manages different customers using symbols like B4X: Copy #if CUSTOMER1 customer-specific code #end if #if CUSTOMER2 customer-specific code #end if now, customer 1 requests source code of the app. you can’t just send the whole source code, because it will expose customer 2 specific code, which is private to each customer. is there a simple way to process all source files and remove CUSTOMER2 specific section? like a preprocessor that will strip #if sections, producing a sanitized copy of the source code. anyone having the same issue out there?
Sandman Expert Licensed User Longtime User May 10, 2025 #2 Alessandro71 said: is there a simple way to process all source files and remove CUSTOMER2 specific section? Click to expand... No. Alessandro71 said: anyone having the same issue out there? Click to expand... Not identical, but I have many times longed for a compiler step that happens before the actual compilation, where it would be possible to modify the code using external scripts. As for solving your need, the best I can come up with is to move all customer-specific things into an external b4xlib per customer, and then adjust the code to basically be this: B4X: Copy #if CUSTOMER1 Dim CustomerSpecifics as Customer1Class #end if #if CUSTOMER2 Dim CustomerSpecifics as Customer2Class #end if You would obviously need to have identical structures in the classes so you could avoid messy code outside of them. Upvote 0
Alessandro71 said: is there a simple way to process all source files and remove CUSTOMER2 specific section? Click to expand... No. Alessandro71 said: anyone having the same issue out there? Click to expand... Not identical, but I have many times longed for a compiler step that happens before the actual compilation, where it would be possible to modify the code using external scripts. As for solving your need, the best I can come up with is to move all customer-specific things into an external b4xlib per customer, and then adjust the code to basically be this: B4X: Copy #if CUSTOMER1 Dim CustomerSpecifics as Customer1Class #end if #if CUSTOMER2 Dim CustomerSpecifics as Customer2Class #end if You would obviously need to have identical structures in the classes so you could avoid messy code outside of them.