Skip to content

Commit

Permalink
conan 2 (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored Jun 23, 2024
1 parent fafdc22 commit 51e7374
Show file tree
Hide file tree
Showing 22 changed files with 194 additions and 210 deletions.
78 changes: 56 additions & 22 deletions .github/workflows/ios_main.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,72 @@
name: OpenDocumentReader-iOS
on: [push]

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
name: test
runs-on: macos-11
runs-on: macos-14
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: pods
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "15.4"

- name: install pods
run: pod install

# https://stackoverflow.com/a/57758679/198996
- name: bundler
- name: install bundler
run: gem install bundler:1.17.3
- name: fastlane
- name: install fastlane
run: bundle install

- name: pip
run: python3 -m ensurepip
- name: conan
run: pip3 install conan==1.64.1
- name: conan repo
run: |
conan remote clean
conan remote add odr https://artifactory.opendocument.app/artifactory/api/conan/conan
conan remote add conancenter https://center.conan.io
- name: install conan
run: pip3 install conan

- name: conan remote
run: conan remote add --index 0 odr https://artifactory.opendocument.app/artifactory/api/conan/conan
- name: conan login
run: conan remote login odr admin --password ${{ secrets.ARTIFACTORY }}

- name: conan profile
run: conan profile detect

- name: conan install
run: >
conan install conan/
--output-folder=conan-output
--build=missing
--profile:host=conan/profiles/ios-simulator-arm64
-s build_type=Release
-s "&:build_type=RelWithDebInfo"
-s "odrcore/*:build_type=RelWithDebInfo"
- name: conan patch
run: bash conan/patch.sh

- name: run tests
run: bundle exec fastlane tests
# - uses: actions/upload-artifact@v2
# if: ${{ always() }}
# with:
# name: logs
# path: |
# /Users/runner/Library/Developer/Xcode/DerivedData/OpenDocumentReader-*/

- uses: actions/upload-artifact@v4
if: always()
with:
name: logs
path: |
/Users/runner/Library/Developer/Xcode/DerivedData/OpenDocumentReader-*/
- name: upload binaries to conan repo
run: conan upload "*" --check --confirm --remote odr
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,5 @@ fastlane/test_output

fastlane/report.xml

conanbuildinfo.*
conaninfo.txt
conan.lock
conan-output/
graph_info.json
157 changes: 35 additions & 122 deletions OpenDocumentReader.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1540"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1540"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
9 changes: 5 additions & 4 deletions OpenDocumentReader/CoreWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@

#import "CoreWrapper.h"

#include <string>
#include <optional>
#include <string>
#include <optional>
#include <odr/document.hpp>
#include <odr/document_element.hpp>
#include <odr/file.hpp>
#include <odr/html.hpp>
#include <odr/open_document_reader.hpp>
#include <odr/exceptions.hpp>

#include <string>
#include <optional>
#include <string>
#include <optional>

@implementation CoreWrapper {
std::optional<odr::Html> html;
}
Expand Down
7 changes: 0 additions & 7 deletions build-device.sh

This file was deleted.

7 changes: 0 additions & 7 deletions build-simulator.sh

This file was deleted.

17 changes: 17 additions & 0 deletions conan/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conan import ConanFile
from conan.tools.apple import XcodeDeps, XcodeToolchain

class Pkg(ConanFile):
settings = "os", "compiler", "arch", "build_type"
options = {"configuration": ["Debug", "Debug Lite", "Release", "Release Lite"]}
default_options = {"configuration": "Debug"}
requires = "odrcore/3.0.0"

def generate(self):
xcode = XcodeDeps(self)
xcode.configuration = self.options.configuration
xcode.generate()

tc = XcodeToolchain(self)
tc.configuration = self.options.configuration
tc.generate()
11 changes: 11 additions & 0 deletions conan/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e

echo "patch conan generated xcconfig files"

# patch xcconfig - see https://github.com/conan-io/conan/issues/16526
sed -i '' -E 's/\]\[arch=arm64\]\[/][/g;t' conan-output/*.xcconfig
sed -i '' -E 's/\]\[arch=x86_64\]\[/][/g;t' conan-output/*.xcconfig

echo "done"
9 changes: 9 additions & 0 deletions conan/profiles/ios
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(default)

[settings]
os=iOS
os.sdk=iphone
os.version=14.0
os.sdk=iphoneos
arch=armv8
build_type=Release
8 changes: 8 additions & 0 deletions conan/profiles/ios-simulator-arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include(default)

[settings]
os=iOS
os.version=14.0
os.sdk=iphonesimulator
arch=armv8
build_type=Release
9 changes: 9 additions & 0 deletions conan/profiles/ios-simulator-x64
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include(default)

[settings]
os=iOS
os.sdk=iphonesimulator
os.version=14.0
os.sdk=iphonesimulator
arch=x86_64
build_type=Release
33 changes: 33 additions & 0 deletions conan/setup-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

# https://stackoverflow.com/a/246128/198996
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR/..

# device
for configuration in "Debug" "Debug Lite" "Release" "Release Lite"; do
conan install conan/ \
--output-folder=conan-output \
--build=missing \
--profile:host=conan/profiles/ios \
-s build_type=Release \
-s "&:build_type=Release" \
-s "odrcore/*:build_type=RelWithDebInfo" \
-o "configuration=${configuration}"
done

# simulator
for arch in "arm64" "x64"; do
for configuration in "Debug" "Debug Lite" "Release" "Release Lite"; do
conan install conan/ \
--output-folder=conan-output \
--build=missing \
--profile:host=conan/profiles/ios-simulator-${arch} \
-s build_type=Release \
-s "&:build_type=Release" \
-s "odrcore/*:build_type=RelWithDebInfo" \
-o "configuration=${configuration}"
done
done

bash conan/patch.sh
6 changes: 0 additions & 6 deletions conanfile.txt

This file was deleted.

3 changes: 2 additions & 1 deletion debug-lite.xcconfig → configs/debug-lite.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include "Pods/Target Support Files/Pods-OpenDocumentReader/Pods-OpenDocumentReader.debug lite.xcconfig"
#include "conanbuildinfo.xcconfig"

#include "conan-output/conan_config.xcconfig"
3 changes: 2 additions & 1 deletion debug.xcconfig → configs/debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include "Pods/Target Support Files/Pods-OpenDocumentReader/Pods-OpenDocumentReader.debug.xcconfig"
#include "conanbuildinfo.xcconfig"

#include "conan-output/conan_config.xcconfig"
3 changes: 2 additions & 1 deletion release-lite.xcconfig → configs/release-lite.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include "Pods/Target Support Files/Pods-OpenDocumentReader/Pods-OpenDocumentReader.release lite.xcconfig"
#include "conanbuildinfo.xcconfig"

#include "conan-output/conan_config.xcconfig"
3 changes: 2 additions & 1 deletion release.xcconfig → configs/release.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include "Pods/Target Support Files/Pods-OpenDocumentReader/Pods-OpenDocumentReader.release.xcconfig"
#include "conanbuildinfo.xcconfig"

#include "conan-output/conan_config.xcconfig"
5 changes: 0 additions & 5 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,29 @@ default_platform(:ios)
platform :ios do
desc "Push a new release build to the App Store"
lane :deployPro do
sh("bash", "../build-device.sh")
clear_derived_data
build_app(workspace: "OpenDocumentReader.xcworkspace", scheme: "ODR Full", xcargs: "-allowProvisioningUpdates")
upload_to_app_store(
app_identifier: "at.tomtasche.reader",
skip_screenshots: true,
skip_metadata: true
)
sh("bash", "../build-simulator.sh")
clear_derived_data
end

desc "Push a new release build to the App Store"
lane :deployLite do
sh("bash", "../build-device.sh")
clear_derived_data
build_app(workspace: "OpenDocumentReader.xcworkspace", scheme: "ODR Lite", xcargs: "-allowProvisioningUpdates")
upload_to_app_store(
app_identifier: "at.tomtasche.reader.lite1",
skip_screenshots: true,
skip_metadata: true
)
sh("bash", "../build-simulator.sh")
clear_derived_data
end

lane :tests do
sh("bash", "../build-simulator.sh")
clear_derived_data
run_tests(
workspace: "OpenDocumentReader.xcworkspace",
Expand Down
14 changes: 0 additions & 14 deletions ios

This file was deleted.

14 changes: 0 additions & 14 deletions ios-simulator

This file was deleted.

0 comments on commit 51e7374

Please sign in to comment.