-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamically generate valid xcode project files from json #9
Conversation
I have fixed these issues, please review. |
@BPerlakiH CI still fails! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you ; it's better but I think the priority should go into making it per-app first and then improve the code quality.
src/custom_apps.py
Outdated
def append_to(custom_plist="Custom.plist"): | ||
for cmd in InfoParser.plist_commands(): | ||
os.system("{} {}".format(cmd, custom_plist)) | ||
def create_custom_project_file(self, path=Path()/'custom_project.yml'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not set it here as this is set once at import time. Better to leave it None and in the function set it if it's None
src/generate_and_download.py
Outdated
# create the xcconfig files | ||
custom_apps.create_xcconfigs() | ||
# create the plist files | ||
custom_apps.create_plists(custom_plist=Path()/"Custom.plist") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
custom_apps.create_plists(custom_plist=Path()/"Custom.plist") | |
custom_apps.create_plists(custom_plist=Path("Custom.plist")) |
src/info_parser.py
Outdated
out_path = self._info_plist_path() | ||
# create dir, if doesn't exists yet | ||
if not out_path.parent.exists(): | ||
out_path.parent.mkdir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out_path.parent.mkdir() | |
out_path.parent.mkdir(parents=True, exists_ok=True) |
then you dont need the condition
|
||
def create_plist(self, based_on_plist_file): | ||
with based_on_plist_file.open(mode="rb") as file: | ||
plist = plistlib.load(file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plist = plistlib.load(file) | |
plist = plistlib.load(based_on_plist_file.read_bytes()) |
|
||
|
||
def _info_plist_path(self): | ||
return Path()/self.brand_name/f"{self.brand_name}.plist" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Path()/self.brand_name/f"{self.brand_name}.plist" | |
return Path(self.brand_name) / f"{self.brand_name}.plist" |
.github/workflows/ci.yml
Outdated
| | ||
cd apple | ||
bundle exec fastlane ios beta | ||
# bundle exec fastlane mac beta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Not sure why all these secrets are needed to just build the app and not upload it!
- Why is macOS not tested?
|
||
## At the beginning we have the following: | ||
- custom brand folders, each with an info.json file, and xcassets | ||
- we have the kiwix/apple code (as a seperate repository). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kiwix/apple1
or link.
|
||
## What we need in order to build a custom app? | ||
|
||
### A Zim file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZIM file
This needs to be downloaded from the url given in the `info.json`, and placed under the branded folder, eg: `/custom/dwds` | ||
|
||
### A .plist file | ||
The plist file is a list of settings, that is used by xcode for the given target to be built. It is in a required xml format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Xcode
### A .plist file | ||
The plist file is a list of settings, that is used by xcode for the given target to be built. It is in a required xml format. | ||
|
||
It is created under the folder with the same name, eg.: `dwds/dwds.plist`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is automatically generated and should not be edit manually. This should be clear.
|
||
# A new custom_project.yml file | ||
The main `kiwix/apple` repo contains a `project.yml` file, it describes all the common build and project settings, and all the templates we re-use to create a final xcode project file, which is used to build the custom apps. At the end each custom app will be a separate target we can build. | ||
Therefore we need dynamically create the `custom_project.yml` file, which will import the `project.yml`, and sets up the new targets (one for each brand), it looks more or less, like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dynamically create
@@ -0,0 +1,59 @@ | |||
from pathlib import Path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code should be for only one specific custom app. If we want to make all custom apps at the same time, this will be done at a higher level.
@@ -0,0 +1,13 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make a fake app (not like a real one with real values). We should also avoid to download such a big file. I have prepared here a small test ZIM file https://dev.kiwix.org/apple/custom/test/wikipedia_en_ray_charles_maxi_2023-12.zim
@@ -0,0 +1,80 @@ | |||
# Technical documentation for contributors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually this is called CONTRIBUTING.md
I believe.
The required changes were merged in other PRs. |
Fixes #1
Fixes kiwix/kiwix-apple#603
Fixes kiwix/kiwix-apple#559
Fixes #10
Fixes kiwix/kiwix-apple#615
How it works
next steps
other changes