Commit ea973e88 authored by Sandro Knauß's avatar Sandro Knauß Committed by Ben Cooksley

Fix create-abi for more repositories.

Specifically:
- kpeople uses KPeople instead of KF5People in filenames for cmake: fixes the search path.
- use Sets instead of Lists, as we don't want multiple entries anyways.
- no general include direcory is allowed to enter the header section, as those are not part of public API.
- add more known cmake parameters (purpose, kpeople).

Differential Revision: https://phabricator.kde.org/D17534
parent e8890e5e
......@@ -8,7 +8,7 @@ import tempfile
import subprocess
import sys
from collections import defaultdict
from typing import Dict, List, Union
from typing import Dict, List, Union, Set
from helperslib import Packages, EnvironmentHandler
......@@ -73,6 +73,8 @@ def cmake_parser(lines: List) -> Dict:
"INTERFACE_COMPILE_OPTIONS",
"INTERFACE_COMPILE_DEFINITIONS",
"IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG",
"IMPORTED_CONFIGURATIONS",
"DOXYGEN_TAGFILE",
]
tmpKeyword = None
......@@ -131,7 +133,7 @@ class Library:
proc = subprocess.Popen(['cmake', '.', '--trace-expand'], cwd=d, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, env=runtimeEnvironment)
# cmake prefixes outout with the name of the file, filter only lines with interessting files
retarget = re.compile( '.*/{self.name}(Targets[^/]*|Config[^/]*)\.cmake\(\d+\):\s*(.*)$'.format(self=self) ) # replace with f-String in python 3.6
retarget = re.compile( '.*/{self.name}/[^/]*(Targets[^/]*|Config[^/]*)\.cmake\(\d+\):\s*(.*)$'.format(self=self) ) # replace with f-String in python 3.6
# Start processing the output of CMake, one line at a time
for line in proc.stderr:
......@@ -204,9 +206,13 @@ class Library:
# Start preparations to run abi-compliance-checker
# Gather the information we'll need to write the XML configuration file it uses
version = self.version
headers = [] # type: List[str]
libs = [] # type: List[str]
additionalIncludes = [] # type: List[str]
headers = set() # type: Set[str]
libs = set() # type: Set[str]
additionalIncludes = set() # type: Set[str]
# list of general include directories
noHeaders = set(buildEnvironment.get('CMAKE_PREFIX_PATH').split(":"))
noHeaders |= set([i+"/include" for i in buildEnvironment.get('CMAKE_PREFIX_PATH').split(":")])
# From the target information we previously collected...
# Grab the list of libraries and include headers for abi-compliance-checker
......@@ -214,18 +220,15 @@ class Library:
# Check each include directory to see if we need to add it....
for i in target['include_dirs']:
# ignore general folders, as there are no lib specific headers are placed
if i == '/usr/include' or i.endswith("/KF5"):
if not i in additionalIncludes:
additionalIncludes.append(i)
if i in noHeaders or i.endswith("/KF5"):
additionalIncludes.add(i)
continue
# Otherwise, if we don't already have it - add it to the list!
if not i in headers:
headers.append(i)
headers.add(i)
# If the library path isn't in the list, then we should add it to the list
if not target['path'] in libs:
libs.append(target['path'])
libs.add(target['path'])
# Now we can go ahead and generate the XML file for abi-compliance-checker
xml = """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment