Browse Source

Merge pull request 'IOSAD-232: Tell xcode the generated files (engine, asn.1) so it doesn't expect them from the start' (#76) from dirk/pEpEngine:IOSAD-232 into master

Reviewed-on: https://gitea.pep.foundation/pEp.foundation/pEpEngine/pulls/76
master
Luca Saiu 4 months ago
parent
commit
abbf677a20
5 changed files with 163 additions and 2 deletions
  1. +56
    -0
      build-mac/Subprojects/pEpASN1/generated-files.txt
  2. +1
    -1
      build-mac/Subprojects/pEpASN1/pEpASN1.xcodeproj/project.pbxproj
  3. +6
    -0
      build-mac/generated-files.txt
  4. +16
    -1
      build-mac/pEpEngine.xcodeproj/project.pbxproj
  5. +84
    -0
      build-mac/scripts/python/update_engine_generated_files.py

build-mac/Subprojects/pEpASN1/generated-files-asn1.txt → build-mac/Subprojects/pEpASN1/generated-files.txt View File


+ 1
- 1
build-mac/Subprojects/pEpASN1/pEpASN1.xcodeproj/project.pbxproj View File

@ -1201,7 +1201,7 @@
);
name = "Generate Code";
outputFileListPaths = (
"$(SRCROOT)/generated-files-asn1.txt",
"$(SRCROOT)/generated-files.txt",
);
outputPaths = (
);


build-mac/generated-files-sync.txt → build-mac/generated-files.txt View File


+ 16
- 1
build-mac/pEpEngine.xcodeproj/project.pbxproj View File

@ -335,6 +335,13 @@
remoteGlobalIDString = 150845DE25F13CE700D46DA6;
remoteInfo = generate_code;
};
437D471727DF9933006CB916 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4309FF0327315E560055C6C9 /* pEpTransport.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 43C24DE327A15C81000E90FF;
remoteInfo = pEpTransportTests;
};
4399C9E32747C70700F52599 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4309FF0327315E560055C6C9 /* pEpTransport.xcodeproj */;
@ -634,6 +641,7 @@
children = (
4399C9E42747C70700F52599 /* libpEpTransport_macOS.a */,
4399C9E62747C70700F52599 /* libpEpTransport_iOS.a */,
437D471827DF9933006CB916 /* pEpTransportTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@ -1087,6 +1095,13 @@
remoteRef = 15A322F6260E0B75009D07EB /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
437D471827DF9933006CB916 /* pEpTransportTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = pEpTransportTests.xctest;
remoteRef = 437D471727DF9933006CB916 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
4399C9E42747C70700F52599 /* libpEpTransport_macOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1177,7 +1192,7 @@
inputPaths = (
);
outputFileListPaths = (
"$(SRCROOT)/generated-files-sync.txt",
"$(SRCROOT)/generated-files.txt",
);
outputPaths = (
);


+ 84
- 0
build-mac/scripts/python/update_engine_generated_files.py View File

@ -0,0 +1,84 @@
#!/usr/bin/env python3
#
# Updates the list of engine-generated files.
#
# Usage (from the top of the checked out engine):
# python3 build-mac/scripts/python/update_engine_generated_files.py
#
import os
import subprocess
from os.path import isfile, join, splitext
# The engine source directory
ENGINE_BASE_DIR = '.'
SYNC_DIR_GENERATED = join(ENGINE_BASE_DIR, 'codegen/generated')
ASN_DIR_GENERATED = join(ENGINE_BASE_DIR, 'asn.1')
DES_DIR = join(ENGINE_BASE_DIR, 'build-mac')
DES_DIR_ASN = join(ENGINE_BASE_DIR, 'build-mac', 'Subprojects', 'pEpASN1')
DEST_ASN_LIST = join(DES_DIR_ASN, 'generated-files.txt')
DEST_SYNC_LIST = join(DES_DIR, 'generated-files.txt')
class Pushd:
"""Context manager for changing the current working directory"""
def __init__(self, new_path):
self.new_path = os.path.expanduser(new_path)
def __enter__(self):
self.saved_path = os.getcwd()
os.chdir(self.new_path)
def __exit__(self, etype, value, traceback):
os.chdir(self.saved_path)
def cfiles(path):
"""Returns an array of .c and .h files under the given directory"""
return [f for f in os.listdir(path)
if isfile(join(path, f))
and splitext(f)[1] in ['.c', '.h']]
def clean_engine():
"""Cleans the engine"""
with Pushd(ENGINE_BASE_DIR):
subprocess.run(['gmake', 'clean'], check=True)
def generate_files():
"""Generates the engine's sync files"""
with Pushd(ENGINE_BASE_DIR):
commands = [
['gmake', 'codegen'],
['gmake', '-C', 'asn.1', 'Sync.c', 'Distribution.c', 'Storage.c', 'ASN1Message.c'],
]
for cmd in commands:
subprocess.run(cmd, check=True)
clean_engine()
asn_files_before_set = set(cfiles(ASN_DIR_GENERATED))
generate_files()
asn_files_after_set = set(sorted(cfiles(ASN_DIR_GENERATED)))
asn_diff = asn_files_after_set.difference(asn_files_before_set)
asn_files = sorted(asn_files_after_set)
with open(DEST_ASN_LIST, 'w') as asn_target_file:
for asn_file in asn_files:
item = '$(SRCROOT)/../../../asn.1/' + asn_file
asn_target_file.write(item + '\n')
sync_files_after = sorted(cfiles(SYNC_DIR_GENERATED))
with open(DEST_SYNC_LIST, 'w') as sync_target_file:
for sync_file in sync_files_after:
item = '$(SRCROOT)/../src/' + sync_file
sync_target_file.write(item + '\n')

Loading…
Cancel
Save