Merge lp:~mardy/ubuntuone-credentials/library-symbols into lp:ubuntuone-credentials

Proposed by Alberto Mardegan
Status: Merged
Approved by: dobey
Approved revision: 238
Merged at revision: 237
Proposed branch: lp:~mardy/ubuntuone-credentials/library-symbols
Merge into: lp:ubuntuone-credentials
Diff against target: 43 lines (+13/-3)
1 file modified
libubuntuoneauth/CMakeLists.txt (+13/-3)
To merge this branch: bzr merge lp:~mardy/ubuntuone-credentials/library-symbols
Reviewer Review Type Date Requested Status
dobey (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+292285@code.launchpad.net

Commit message

Be more explicit about which headers are installed.
Move the symbol export map to LINK_FLAGS on the target.

Description of the change

Be explicit about exported classes and public headers

Set hidden visibility on all internal symbols (none, currently) and explicitly mark as exported those classes which should be public.
Similarly, don't install all headers (we might be adding some internal ones in the future) but explicitly list those which should be installed.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) wrote :

I am not fond of the conditional exporting of symbols and the addition of a #define for that. Why do we need that? We are already controlling symbol exports through the version script.

review: Needs Information
Revision history for this message
Alberto Mardegan (mardy) wrote :

I find it easier, when the information is in the class declaration itself. At least, I though that this is the explanation why some obviously internal class (like UbuntuOne::Network) is exported in the first place: because the version symbols is kind of "hidden".

But if you prefer to continue with the version script, that's fine, I'll drop the relevant changes.

And did you ever think about using PIMPL? Right now we are exporting a lot of private methods and member variables, which makes it rather difficult to modify the library without breaking ABI.

Revision history for this message
Alberto Mardegan (mardy) wrote :

BTW, the line changing the way the --version-script is passed to the linker is the fix for the bug you reported here:
https://bugs.launchpad.net/ubuntu/+source/cmake/+bug/1203786

Revision history for this message
dobey (dobey) wrote :

> I find it easier, when the information is in the class declaration itself. At
> least, I though that this is the explanation why some obviously internal class
> (like UbuntuOne::Network) is exported in the first place: because the version
> symbols is kind of "hidden".
>
> But if you prefer to continue with the version script, that's fine, I'll drop
> the relevant changes.
>
> And did you ever think about using PIMPL? Right now we are exporting a lot of
> private methods and member variables, which makes it rather difficult to
> modify the library without breaking ABI.

Perhaps explicit export flags in declarations is easier, but certainly not when it is conditional. "Internal" bits are leaked because the code was not well designed for ABI/API exposure to start with. That's what happens when you make developers who primarily write Python, suddenly have to write a Qt/C++ API though.

Yes, PIMPL makes sense, but due to the aforementioned issues it would indeed break the API/ABI, and to get it right, would basically be a rewrite. If we were going to do a rewrite, I think I would go about redoing the API entirely anyway, so just trying to make the existing stuff use PIMPL won't help much.

Perhaps when we finish up getting the signon plug-in working and we use it everywhere, we can then change the components which use the U1 account to use the more traditional/standard methods of getting the data from online-accounts, and possibly get rid of the library.

So, I'm not quite sure what to do with this branch yet. But as I am definitely averse to the idea of conditional export flags adding a #define for that, there isn't a specific bug being fixed by these changes, and they don't seem to be required for the signon-plugin branches, I'm inclined to reject this one, in favor of further discussion and examination of what we can gain from the signon-plugin work.

238. By Alberto Mardegan

Partial revert

Revision history for this message
Alberto Mardegan (mardy) wrote :

OK, I removed all the conditional exports.

Now the MP consists only of the header files install list (which we'll need, as I'm later going to add a couple of internal classes to the library) and the version-script move so that it doesn't get applied to the other targets of the project (otherwise the signon plugin cannot be linked, as its external symbols get stripped off).

I agree with you, that we should aim at not changing the library API and ABI if possible, and eventually have clients authenticate only via the OA APIs.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntuoneauth/CMakeLists.txt'
2--- libubuntuoneauth/CMakeLists.txt 2013-11-22 19:17:04 +0000
3+++ libubuntuoneauth/CMakeLists.txt 2016-04-21 09:28:24 +0000
4@@ -16,7 +16,17 @@
5 # The sources for building the library
6 FILE (GLOB SOURCES *.cpp)
7 # HEADERS only includes the public headers for installation.
8-FILE (GLOB HEADERS *.h)
9+FILE (GLOB HEADERS
10+ errormessages.h
11+ identityprovider.h
12+ keyring.h
13+ logging.h
14+ network.h
15+ requests.h
16+ responses.h
17+ ssoservice.h
18+ token.h
19+)
20
21 pkg_check_modules(OAUTH REQUIRED oauth)
22 add_definitions(${OAUTH_CFLAGS} ${OAUTH_CFLAGS_OTHER})
23@@ -29,12 +39,12 @@
24 target_link_libraries (${AUTH_LIB_NAME}
25 ${LIBSIGNON_LDFLAGS}
26 ${OAUTH_LDFLAGS}
27- -Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/libubuntuoneauth.symbols
28 )
29
30 SET_TARGET_PROPERTIES(${AUTH_LIB_NAME} PROPERTIES
31 VERSION ${AUTH_LIB_VERSION}
32 SOVERSION ${AUTH_LIB_SOVERSION}
33+ LINK_FLAGS "-Wl,--version-script -Wl,\"${CMAKE_CURRENT_SOURCE_DIR}/libubuntuoneauth.symbols\""
34 )
35
36 INSTALL (
37@@ -64,4 +74,4 @@
38 )
39
40 add_subdirectory(tests)
41-add_subdirectory(examples)
42\ No newline at end of file
43+add_subdirectory(examples)

Subscribers

People subscribed via source and target branches