README.md
author Alejandro Gelos <agp@pep.security>
Tue, 20 Aug 2019 13:52:25 +0200
branchIOS-1740
changeset 9725 efdbdfc23000
parent 9248 1021c1229ad9
child 10685 f01568593b2e
permissions -rw-r--r--
IOS-1740 fix testSavePasswordAfterEndVerification test in AccountSettingsViewModelTest
     1 # How to build
     2 
     3 ## Prerequisites
     4 
     5 ### Package managers
     6 
     7 MacPorts for installing dependencies:
     8 
     9 Install [MacPorts](https://www.macports.org/) for your
    10 [version of OS X/macOS](https://www.macports.org/install.php).
    11 
    12 ### Dependencies of prerequisites
    13 
    14 For building the engine, you need a working python2 environment and all dependencies:
    15 
    16 ```
    17 sudo port install python27
    18 sudo port install asn1c
    19 sudo port install py27-lxml
    20 
    21 sudo port install python_select
    22 
    23 sudo port install mercurial
    24 
    25 sudo port install autoconf
    26 sudo port install libtool
    27 sudo port install automake
    28 
    29 sudo port install gmake
    30 
    31 sudo port install wget
    32 
    33 curl https://sh.rustup.rs -sSf | sh
    34 
    35 # To run the `greenmail` mailserver for tests
    36 sudo port install openjdk11
    37 ```
    38 
    39 add this to ~/.profile (create if it doesn't exist):
    40 
    41 ```
    42 source $HOME/.cargo/env
    43 export PATH="$HOME/.cargo/bin:$PATH"
    44 ```
    45 
    46 Restart your Console!
    47 
    48 ```
    49 sudo port install pkgconfig
    50 rustup update
    51 rustup target add aarch64-apple-ios x86_64-apple-ios armv7-apple-ios i386-apple-ios
    52 ```
    53 
    54 ### Set up Xcode
    55 You need to have an Apple ID configured in Xcode, for code signing. You can add one in the `Accounts` tab of the settings (menu `Xcode > Preferences...`).
    56 
    57 For some things, your Apple ID needs to be part of the pEp team account. Ask `#service`, if you want to be added to the team account. When you are a member of the team, the information on your Apple ID in the Xcode Preferences should have a record `Team: pEp Security SA`, `Role: Member`.
    58 
    59 ### Other dependencies
    60 
    61 #### pEpEngine: [yml2](https://fdik.org/yml/toolchain)
    62 
    63 Clone into your home directory:
    64 
    65 ```
    66 pushd ~
    67 hg clone https://pep.foundation/dev/repos/yml2/
    68 popd
    69 
    70 sudo port install pip
    71 sudo STATIC_DEPS=true pip install lxml
    72 ```
    73 
    74 ## Setup instructions
    75 
    76 ```
    77 mkdir ~/src
    78 cd ~/src
    79 
    80 git clone https://pep-security.lu/gitlab/misc/libetpan.git
    81 git clone https://pep-security.lu/gitlab/iOS/OpenSSL-for-iPhone.git
    82 git clone https://pep-security.lu/gitlab/iOS/SwipeCellKit.git/
    83 git clone https://pep-security.lu/gitlab/iOS/AppAuth-iOS.git
    84 git clone https://pep-security.lu/gitlab/misc/ldns.git
    85 
    86 hg clone https://pep.foundation/dev/repos/pantomime-iOS/
    87 hg clone https://pep.foundation/dev/repos/pEpEngine
    88 hg clone https://pep.foundation/dev/repos/pEpObjCAdapter
    89 hg clone https://pep.foundation/dev/repos/MessageModel/
    90 hg clone https://pep.foundation/dev/repos/libAccountSettings/
    91 
    92 hg clone https://pep-security.ch/dev/repos/pEp_for_iOS/
    93 
    94 git clone http://pep-security.lu/gitlab/iOS/sequoia4ios.git
    95 cd sequoia4ios
    96 sh build.sh
    97 ```
    98 
    99 ### Build Project
   100 
   101 Open pEpForiOS.xcworkspace and build schema "pEp".
   102 
   103 ### Unit Tests
   104 
   105 Out of the box, most tests expect a local test server:
   106 
   107 ```
   108 cd ~/Downloads
   109 wget http://central.maven.org/maven2/com/icegreen/greenmail-standalone/1.5.9/greenmail-standalone-1.5.9.jar
   110 shasum -a 256 greenmail-standalone-1.5.9.jar
   111 8301b89007e986e8d5e93e2504aad866a58b07b53ac06abb87e6e43eb7646261  greenmail-standalone-1.5.9.jar
   112 java -Dgreenmail.setup.test.all -Dgreenmail.users=test001:pwd@localhost,test002:pwd@localhost,test003:pwd@localhost -jar ~/Downloads/greenmail-standalone-1.5.9.jar
   113 ```
   114 
   115 Note: The following section concerning test data is solved for pEp-internal dev members by checking out a private repo, please ask your colleagues. If you don't have access to that repo, you have to create the needed files yourself.
   116 
   117 The non-existing file referenced in the unit test project, pEpForiOSTests/../pEp_for_iOS_intern/SecretTestData.swift, must be
   118 created, with a class named SecretTestData, derived from TestDataBase.
   119 
   120 In `SecretTestData.swift`, you must at least override `populateVerifiableAccounts`, adding servers that are either registered in the LAS database or provide DNS SRV for IMAP and SMTP in order to test the "automatic account login".
   121 
   122 If you want to run the tests against your own servers, override `populateAccounts` accordingly.
   123 
   124 ### UI Tests
   125 
   126 Note: The following section concerning test data is solved for pEp-internal dev members by checking out a private repo, please ask your colleagues. If you don't have access to that repo, you have to create the needed files yourself.
   127 
   128 There is a file referenced in the UI test project, UITestData. You need to create it
   129 (./pEpForiOSUITests/SecretUITestData.swift), and implement it according to the protocol UITestDataProtocol.
   130 
   131 The UI tests will not compile without it.
   132 
   133 ### secret.xcconfig (needed for OAuth2 config secrects and others)
   134 
   135 Create secret.xcconfig @ pEpForiOS/../pEp_for_iOS_intern/secret.xcconfig, with those contents:
   136 
   137 ```
   138 OAUTH2_GMAIL_CLIENT_ID = your_secret_content
   139 OAUTH2_GMAIL_REDIRECT_URL_SCHEME = your_secret_content
   140 
   141 OAUTH2_YAHOO_CLIENT_ID = your_secret_content
   142 OAUTH2_YAHOO_CLIENT_SECRET = some_content
   143 
   144 ```
   145 
   146 # Notes on debugging build problems
   147 Depending on whether you use a distribution of bash from macports or Apple, and the contents of your `PATH` variable, the build might fail. Especially the engine makes many assumptions about the environment on the build machine.
   148 
   149 If you have any build issues, they may also be fixed by changing some of the variables the engine build system uses in `~/src/pEpEngine/local.conf`. This is an example configuration file:
   150 
   151 ~~~
   152 YML2_PROC=/opt/local/bin/python2 $(YML2_PATH)/yml2proc
   153 
   154 ASN1C=/opt/local/bin/asn1c
   155 ASN1C_INC=/opt/local/share/asn1c/
   156 ~~~
   157 
   158 Note that some of these variables may be overridden in the build system elsewhere, for example the variable `YML2_PATH`. Check the build steps in `pEpEngine.xcodeproj` for details.