Skip to content

Option to select extensions compile-time. Fix #50 #123#125

Closed
TheZ3ro wants to merge 9 commits intodevelopfrom
feature/cmake-fix-#50-#123
Closed

Option to select extensions compile-time. Fix #50 #123#125
TheZ3ro wants to merge 9 commits intodevelopfrom
feature/cmake-fix-#50-#123

Conversation

@TheZ3ro
Copy link
Copy Markdown
Contributor

@TheZ3ro TheZ3ro commented Dec 4, 2016

Description

This PR add Options to select extensions at compile time to let user and distributors to select with component add to KeePassXC.

The extensions/components supported right now are:

You can enable (ON) or disable (OFF) extensions with the following cmake flag:

  • -DWITH_XC_HTTP=ON for KeePassHTTP
  • -DWITH_XC_AUTOTYPE=ON for Autotype
  • -DWITH_XC_YUBIKEY=ON for Yubikey

At the end of the cmake command, enabled and disabled extensions will be listed:

-- Enabled features:
 * Autotype , Auto-type passwords in Input fields

-- Disabled features:
 * KeePassHTTP , KeePassHTTP support for ChromeIPass and PassIFox

Right now, by default no extension is enabled. (We can discuss about this)

Motivation and Context

This fixes #50 and #123

How Has This Been Tested?

Manually tested the enabled and disabled option for HTTP and Autotype.
NEED an update to the travis file to set all the extension to ON so it will test them
(or maybe building a matrix with different ON/OFF combination?)

Types of changes

  • ❎ Bug fix (non-breaking change which fixes an issue)
  • ✅ New feature (non-breaking change which adds functionality)
  • ✅ Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • ✅ I have read the CONTRIBUTING document. [REQUIRED]
  • ✅ My code follows the code style of this project. [REQUIRED]
  • ✅ All new and existing tests passed. [REQUIRED]
  • ✅ My change requires a change to the documentation.
  • ❎ I have updated the documentation accordingly.
  • ❎ I have added tests to cover my changes.

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Dec 4, 2016

Seems that cutting of the autotype cmake don't disable autotype at all.
Fixing.

@droidmonkey
Copy link
Copy Markdown
Member

droidmonkey commented Dec 4, 2016

Excellent, I'll see if I can add the about dialog feature i mentioned.

As for the HTTP build, I think its smart to make it a static link library, perhaps we can make a fresh CMakeLists.txt in the http folder to encapsulate the build. I foresee a future where we have 'src/plugins/[http|autotype|yubikey]' which build either static or dynamic libraries.

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Dec 5, 2016

It's already been build into a static library that it's later linked in the main executable

Implementing the AboutDialog should be easy with the WITH_XC_* ifdef flags

Anyway, the Autotype plugin works even if you cut off the src/autotype/Cmake.
I think it need a static library like the http as well


#define KEEPASSX_TEST_DATA_DIR "${KEEPASSX_TEST_DATA_DIR}"

#cmakedefine WITH_XC_HTTP
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these defines used anywhere or is this just for when we have proper HTTP tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes they are not used rigth now, but I think it's usefull for future development

Copy link
Copy Markdown
Member

@phoerious phoerious Dec 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, seems fair. Code's looking okay to me.

@droidmonkey droidmonkey self-requested a review December 8, 2016 03:40
@droidmonkey droidmonkey added this to the v2.1.0 milestone Dec 8, 2016
@droidmonkey
Copy link
Copy Markdown
Member

I implemented the about dialog extensions view. It's not scalable with #ifdef's, there might be a better way to do it in the future when we define an actual plugin interface (maybe).

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Dec 8, 2016

I think it's the best option we have right now

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Dec 18, 2016

I think this can be merged @droidmonkey what do you think?

@droidmonkey
Copy link
Copy Markdown
Member

droidmonkey commented Dec 19, 2016

I might be able to look at it this week, took some time off from the project recently.

@droidmonkey
Copy link
Copy Markdown
Member

I made a bunch of changes to the autotype lib building. It did not work at all on Windows, a bunch of dual definitions and the EXPORT/IMPORT was backwards (this was an error from many moons ago). I tested on Fedora and everything seemed ok, this needs to be tested on OpenSuse and Apple.

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Dec 30, 2016

Tested on macOS Sierra, compile fine and works fine but testgui give some error (maybe unrelated)

********* Start testing of TestGui *********
Config: Using QtTest library 5.7.0, Qt 5.7.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 8.0.0 (clang-800.0.38) (Apple))
QWARN  : TestGui::initTestCase() FilePath::DataPath: can't find data dir
QWARN  : TestGui::initTestCase() Unable to load auto-type plugin:
Cannot load library /Applications/KeePassXC.app/Contents/PlugIns/libkeepassx-autotype-cocoa.so: (dlopen(/Applications/KeePassXC.app/Contents/PlugIns/libkeepassx-autotype-cocoa.so, 6): Library not loaded: @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui
  Referenced from: /Applications/KeePassXC.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
  Reason: image not found)
PASS   : TestGui::initTestCase()
QWARN  : TestGui::testMergeDatabase() QSignalSpy: Unable to handle parameter 'mergedDb' of type 'Database*' of method 'databaseMerged', use qRegisterMetaType to register it.
PASS   : TestGui::testMergeDatabase()
FAIL!  : TestGui::testAutoreloadDatabase() Compared values are not the same
   Actual   (m_db->rootGroup()->findChildByName("General")->entries().size()): 0
   Expected (1)                                                              : 1
   Loc: [/Users/thezero/keepassxc/tests/gui/TestGui.cpp(166)]
PASS   : TestGui::testTabs()
PASS   : TestGui::testEditEntry()
PASS   : TestGui::testAddEntry()
PASS   : TestGui::testEntryEntropy()
PASS   : TestGui::testSearch()
PASS   : TestGui::testDeleteEntry()
PASS   : TestGui::testCloneEntry()
PASS   : TestGui::testDragAndDropEntry()
PASS   : TestGui::testDragAndDropGroup()
PASS   : TestGui::testSaveAs()
PASS   : TestGui::testSave()
PASS   : TestGui::testDatabaseSettings()
PASS   : TestGui::testKeePass1Import()
PASS   : TestGui::testDatabaseLocking()
PASS   : TestGui::cleanupTestCase()
Totals: 17 passed, 1 failed, 0 skipped, 0 blacklisted, 11150ms
********* Finished testing of TestGui *********

@droidmonkey
Copy link
Copy Markdown
Member

droidmonkey commented Dec 30, 2016

The autoreload tests are susceptible to timing issues since they wait an arbitrary 1.5 seconds for the auto-detection of the file change to work. This can likely be enhanced in the future, but it is definitely unrelated to this PR.

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Dec 30, 2016

Really it's the autoreload that fails

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Jan 2, 2017

Ping @droidmonkey

@droidmonkey
Copy link
Copy Markdown
Member

Thanks. This pull request has been integrated manually.

@droidmonkey droidmonkey closed this Jan 3, 2017
@droidmonkey droidmonkey deleted the feature/cmake-fix-#50-#123 branch January 3, 2017 03:34
@droidmonkey
Copy link
Copy Markdown
Member

Merged using multiple squash commits to preserve authorship.

@dannysu
Copy link
Copy Markdown
Contributor

dannysu commented Jan 4, 2017

I think it'd also be good to update the Wiki to reflect the additional flags.
Or how about in the message that shows up, give instruction on how to do so?

E.g.

-- Disabled features:
 * KeePassHTTP , KeePassHTTP support for ChromeIPass and PassIFox (Enable by -DWITH_XC_HTTP=ON)

@TheZ3ro
Copy link
Copy Markdown
Contributor Author

TheZ3ro commented Jan 4, 2017

I like the idea of showing up in the Cmake message, but it will show up also when enabled.

I will update the wiki asap (now)
Edit: done wiki/Install-Instruction-from-Source#building-extension tell me if it's good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compile two separate binaries, one with http plugin and one without

4 participants