Passing custom build options to closure when building with stealjs - rhino

I am using JavascriptMVC to build an app with StealJS build functionality. This is my build.js:
load("steal/rhino/rhino.js");
steal('steal/build').then('steal/build/scripts','steal/build/styles',function(){
steal.build('evi2/scripts/build.html',{to: 'mylovelyapp'});
});
This is working fine. However I would love to use Google Closures #define syntax to change a few variables on build time. While it would be perfectly simple to modify steals steal/build/scripts/scripts.js, I would obviously much prefer to pass the --define flags somewhere in my build-script or in my project files.
Any ideas on how to achieve this would be highly appreciated.

Related

How to deobfuscate code in ios objective C?

I obfuscated my code using pp-ios-rename or ios-class-guard by following the steps in below link
https://github.com/preemptive/PPiOS-Rename
But when I try to deobfuscate my code, I couldnt do it and there is no support for that anywhere. Please help me in deobfuscating the code. Even my storyboard scenes got obfuscated, may be I have done something wrong in the process.
Thanks in Advance.
The repo suggests reverting to a previous commit as it looks like there's no automated way to undo it. You can reference the symbols.map file to see the mappings.
If you still have this file you could try inverting the obfuscated names with the original names then running this command:
ppios-rename --obfuscate-sources --symbols-map symbols.map
However, this kind of source obfuscation is not normally recommended due to these kind of significant trade-offs, unless running it as part of an automated CI/CD pipeline.

What is the right project structure for a Kotlin Multiplatform (KMP) project *without* any platform specific code?

Setting up a full "KMP" / "KMM" project seems like overkill, as only the commonMain/commonTest directories would be filled.
All the other templates seem to be platform-specific.
Is there something like a "pure" Kotlin library template?
It would just be a module with only commonMain and commonTest. You would need at least:
A Gradle module
Kotlin config with multiple targets in that module
Common code folders
Whether you put the app code in the same repo or have the shared code in a separate repo is up to you. I'm not sure how much simpler you can make the config, though.
One issue I think you'll run into is the need for platform-specific code on iOS because there are different interfaces for concurrency than you might want for a Kotlin-friendly (I.E. Android) environment. Same for things like default params.
My-KMP-Library
│ build.gradle.kts
└───src
└───commonMain
└───kotlin
└───mynamespace
What makes it multiplatform are the targets you specify in build.gradle.kts.

Can a custom build phase modify a file before compilation?

I have an iOS app that uses both Objective C and Swift.
Before including Swift code, the app used a logger which uses c macros.
For security reasons, the c macros then implement a mechanism that strips down the logs when building a release version, and that works perfectly fine.
When the Swift code kicked in, a Swift wrapper was made on top of the c macros. So now a log from the Swift code actually calls the swift wrapper which then calls the c macros. And that is not secure, the arguments sent to the swift wrapper should also be hidden otherwise an attacker may still extract some data.
I was thinking about running a custom build phase (shell script) that would delete all the function calls before creating a release build, but am doubtful this is possible.
So my question is:
Can adding a custom build phase (run script phase) or maybe even a build rule modify a file before compiling it? Or will I have to write a script that I will need to run manually each time before releasing?
Thanks.
Yes, it's perfectly acceptable to add a pre-compilation build step to run a script.

XCode Target Duplication via Code

Does anyone know a tried and tested way of duplicating XCode targets programatically?
I've tried this Gist based on the xcodeproj Ruby gem but it doesn't copy all the settings (like it would do if doing it through the XCode UI)
https://gist.github.com/ratazzi/f6d9217654d6605450a0
For anyone reading I've actually taken a different approach with this.
Rather than duplicating targets and changing specific values I've utilised fastlane an in particular the 'set_info_plist' function to change values at build time that are specific to a target.
https://docs.fastlane.tools/actions/#set_info_plist_value
This is useful for things like theming changes as per the build or Free/Paid applications environments where you want one single code base that behaves differently depending on the theme or nature of the application.

Remove unnecessary frameworks in Xcode project

I have been writing iOS applications and completed a project with a lot of frameworks. Now I am using it as a template to start a new project that requires less functionality and hence I should be able to reduce the frameworks required, and hopefully reduce build time and size of project.
Question:
Is there a quick way to check which frameworks are no longer required within the project?
I don't think there is a better way than removing the framework, building, and seeing if there are link errors. You might be able to write a bash script but it's probably more work than it's worth.
Sadly not. The quick way is to remove all the frameworks, look for build errors and add back in the necessary frameworks.
search in the project files(cmd+shift+F).i.e whether you are imported any files related to the frameworks.

Resources