Skip to content

Commit

Permalink
Merge pull request #99 from 417-72KI/demo-package
Browse files Browse the repository at this point in the history
Demo app with Swift Package
  • Loading branch information
417-72KI authored Jul 2, 2024
2 parents 86ba1f7 + 47f4b88 commit f991bf2
Show file tree
Hide file tree
Showing 43 changed files with 1,029 additions and 7 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,51 @@ jobs:
with:
name: BuildConfigDemo.xcresult
path: test_output/BuildConfigDemo.xcresult
test_demo_with_package:
name: Test package based demo app
needs: generate-matrix
runs-on: macOS-14
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- name: Cache SPM build directory
uses: actions/cache@v4
env:
cache-name: swiftpm
with:
path: |
DemoWithPackage/.build
DemoWithPackage/Tools/.build
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
- name: Cache DerivedData
uses: actions/cache@v4
env:
cache-name: derived-data
with:
path: DemoWithPackage/DerivedData
key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
- name: Disable SwiftLint Plugin
run: sed -i -e 's/.*SwiftLint.*//g' Package.swift
- name: test
run: ./scripts/test_demo_package.sh
- name: upload test results
if: ${{ matrix.xcode_version == fromJson(needs.generate-matrix.outputs.matrix).xcode_version[0] && (success() || failure()) }}
uses: actions/upload-artifact@v4
with:
name: BuildConfigDemoPackage.xcresult
path: test_output/BuildConfigDemoPackage.xcresult
report:
name: Report
needs: [test, test_demo]
Expand Down
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
included:
- Sources
- Plugins
excluded:
- Demo
- DemoWithPackage
- Tests
- Package.swift
- Dangerfile.swift
Expand All @@ -22,6 +24,7 @@ disabled_rules:
- indentation_width # https://github.com/realm/SwiftLint/issues/3046
- let_var_whitespace # https://github.com/realm/SwiftLint/issues/2980
- missing_docs
- multiline_arguments_brackets
- no_extension_access_modifier
- no_grouping_extension
- one_declaration_per_file
Expand Down
107 changes: 107 additions & 0 deletions DemoWithPackage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Created by https://www.gitignore.io/api/xcode,swift

### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
.swiftpm

.build/

# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
*.xcworkspace

# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

### Xcode ###

## Xcode 8 and earlier

### Xcode Patch ###
*.xcodeproj/*
# !*.xcodeproj/project.pbxproj
# !*.xcodeproj/xcshareddata/
# !*.xcworkspace/contents.xcworkspacedata
# /*.gcno
# **/xcshareddata/WorkspaceSettings.xcsettings

# End of https://www.gitignore.io/api/xcode,swift

*.lock
*.generated.swift
*.plist
!**/Settings.bundle/Root.plist
!**/com.mono0926.LicensePlist.plist
!**/com.mono0926.LicensePlist/*.plist
.swiftlint.yml
29 changes: 29 additions & 0 deletions DemoWithPackage/App/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
34 changes: 34 additions & 0 deletions DemoWithPackage/App/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</dict>
</plist>
11 changes: 11 additions & 0 deletions DemoWithPackage/App/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// main.swift
// App
//
// Created by 417.72KI on 2023/10/09.
// Copyright © 2023 417.72KI. All rights reserved.
//

import BuildConfigSwiftDemo

DemoApp.main()
137 changes: 137 additions & 0 deletions DemoWithPackage/App/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: BuildConfigSwiftDemoApp
attributes:
ORGANIZATIONNAME: 417.72KI
configs:
Debug: debug
Release: release
settings:
base:
IPHONEOS_DEPLOYMENT_TARGET: 15.0
SWIFT_VERSION: 5.0
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: ${inherited}
ALWAYS_SEARCH_USER_PATHS: false
CLANG_ENABLE_OBJC_ARC: true
CODE_SIGN_STYLE: Manual
TARGETED_DEVICE_FAMILY: 1
DEVELOPMENT_TEAM: ""
LIBRARY_SEARCH_PATHS: $(inherited)
CURRENT_PROJECT_VERSION: 1
MARKETING_VERSION: 1.0.0
options:
xcodeVersion: 10.2
bundleIdPrefix: io.github.417-72KI
packages:
BuildConfigSwiftDemo:
path: ../
targets:
Development:
type: application
platform: iOS
sources:
- main.swift
- Base.lproj
info:
path: Info.plist
properties:
CFBundleDevelopmentRegion: $(DEVELOPMENT_LANGUAGE)
CFBundleExecutable: $(EXECUTABLE_NAME)
CFBundleIdentifier: $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion: '6.0'
CFBundleName: $(PRODUCT_NAME)
CFBundlePackageType: APPL
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
LSRequiresIPhoneOS: true
UILaunchStoryboardName: LaunchScreen
UIRequiredDeviceCapabilities:
- arm64
UISupportedInterfaceOrientations:
- UIInterfaceOrientationPortrait
settings:
base:
PRODUCT_NAME: BuildConfigSwiftDemoDev
PRODUCT_BUNDLE_IDENTIFIER: io.github.417-72KI.BuildConfigSwiftDemo.dev
configs:
debug:
CODE_SIGN_IDENTITY: iPhone Developer
PROVISIONING_PROFILE_SPECIFIER: ""
release:
CODE_SIGN_IDENTITY: iPhone Distribution
PROVISIONING_PROFILE_SPECIFIER: ""
EXCLUDED_SOURCE_FILE_NAMES: Mock*
dependencies:
- package: BuildConfigSwiftDemo
Staging:
type: application
platform: iOS
sources:
- main.swift
- Base.lproj
info:
path: Info.plist
properties:
CFBundleDevelopmentRegion: $(DEVELOPMENT_LANGUAGE)
CFBundleExecutable: $(EXECUTABLE_NAME)
CFBundleIdentifier: $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion: '6.0'
CFBundleName: $(PRODUCT_NAME)
CFBundlePackageType: APPL
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
LSRequiresIPhoneOS: true
UILaunchStoryboardName: LaunchScreen
UIRequiredDeviceCapabilities:
- arm64
UISupportedInterfaceOrientations:
- UIInterfaceOrientationPortrait
settings:
base:
PRODUCT_NAME: BuildConfigSwiftDemoStg
PRODUCT_BUNDLE_IDENTIFIER: io.github.417-72KI.BuildConfigSwiftDemo.stg
configs:
debug:
CODE_SIGN_IDENTITY: iPhone Developer
PROVISIONING_PROFILE_SPECIFIER: ""
release:
CODE_SIGN_IDENTITY: iPhone Distribution
PROVISIONING_PROFILE_SPECIFIER: ""
EXCLUDED_SOURCE_FILE_NAMES: Mock*
dependencies:
- package: BuildConfigSwiftDemo
Production:
type: application
platform: iOS
sources:
- main.swift
- Base.lproj
info:
path: Info.plist
properties:
CFBundleDevelopmentRegion: $(DEVELOPMENT_LANGUAGE)
CFBundleExecutable: $(EXECUTABLE_NAME)
CFBundleIdentifier: $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion: '6.0'
CFBundleName: $(PRODUCT_NAME)
CFBundlePackageType: APPL
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
LSRequiresIPhoneOS: true
UILaunchStoryboardName: LaunchScreen
UIRequiredDeviceCapabilities:
- arm64
UISupportedInterfaceOrientations:
- UIInterfaceOrientationPortrait
settings:
base:
PRODUCT_NAME: BuildConfigSwiftDemoProduction
PRODUCT_BUNDLE_IDENTIFIER: io.github.417-72KI.BuildConfigSwiftDemo
configs:
debug:
CODE_SIGN_IDENTITY: iPhone Developer
PROVISIONING_PROFILE_SPECIFIER: ""
release:
CODE_SIGN_IDENTITY: iPhone Distribution
PROVISIONING_PROFILE_SPECIFIER: ""
EXCLUDED_SOURCE_FILE_NAMES: Mock*
dependencies:
- package: BuildConfigSwiftDemo
Loading

0 comments on commit f991bf2

Please sign in to comment.