Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update samples and re-enable sample CI #358

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
# XCode changed naming for the watch simulators, create a simulator that matches what the tests expect (shouldn't need after 1.8)
- name: Create watch simulator
if: matrix.os == 'macOS-latest'
shell: bash
run: xcrun simctl create "Apple Watch Series 5 - 44mm" "Apple Watch Series 5 (44mm)"
- name: Build
env:
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
Expand All @@ -66,16 +61,16 @@ jobs:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
CI: "true"
# - name: script
# if: matrix.os == 'macOS-latest'
# env:
# S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
# S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
# S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
# S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
# CI: "true"
# run: ./ci-test-samples.sh
# shell: bash
- name: script
if: matrix.os == 'macOS-latest'
env:
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
CI: "true"
run: ./ci-test-samples.sh
shell: bash

env:
GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
inputPaths = (
"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}",
"${BUILT_PRODUCTS_DIR}/Bugsnag/Bugsnag.framework.dSYM/Contents/Resources/DWARF/Bugsnag",
);
name = "Upload Bugsnag dSYM";
outputFileListPaths = (
Expand All @@ -208,7 +209,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/usr/bin/env ruby";
shellScript = "api_key = nil # Insert your key here to use it directly from this script\n\n# Attempt to get the API key from an environment variable\nunless api_key\n api_key = ENV[\"BUGSNAG_API_KEY\"]\n\n # If not present, attempt to lookup the value from the Info.plist\n unless api_key\n info_plist_path = \"#{ENV[\"BUILT_PRODUCTS_DIR\"]}/#{ENV[\"INFOPLIST_PATH\"]}\"\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :bugsnag:apiKey\" \"#{info_plist_path}\"`\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :BugsnagAPIKey\" \"#{info_plist_path}\"` if !$?.success?\n api_key = plist_buddy_response if $?.success?\n end\nend\n\nfail(\"No Bugsnag API key detected - add your key to your Info.plist, BUGSNAG_API_KEY environment variable or this Run Script phase\") unless api_key\n\nfork do\n Process.setsid\n STDIN.reopen(\"/dev/null\")\n STDOUT.reopen(\"/dev/null\", \"a\")\n STDERR.reopen(\"/dev/null\", \"a\")\n\n require 'shellwords'\n\n Dir[\"#{ENV[\"DWARF_DSYM_FOLDER_PATH\"]}/*/Contents/Resources/DWARF/*\"].each do |dsym|\n curl_command = \"curl --http1.1 -F dsym=@#{Shellwords.escape(dsym)} -F projectRoot=#{Shellwords.escape(ENV[\"PROJECT_DIR\"])} \"\n curl_command += \"-F apiKey=#{Shellwords.escape(api_key)} \"\n curl_command += \"https://upload.bugsnag.com/\"\n system(curl_command)\n end\nend\n";
shellScript = "# Set DISABLE_COCOAPODS_BUGSNAG=YES via Xcode's Build Settings, xcconfig or xcodebuild to skip upload\nif ENV['DISABLE_COCOAPODS_BUGSNAG'] == 'YES'\n puts 'Skipping dSYM upload'\n return\nend\n\n# Attempt to get the API key from an environment variable (or Xcode build setting)\napi_key = ENV[\"BUGSNAG_API_KEY\"]\n\n# If not present, attempt to lookup the value from the Info.plist\nunless api_key\n info_plist_path = \"#{ENV[\"BUILT_PRODUCTS_DIR\"]}/#{ENV[\"INFOPLIST_PATH\"]}\"\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :bugsnag:apiKey\" \"#{info_plist_path}\"`\n plist_buddy_response = `/usr/libexec/PlistBuddy -c \"print :BugsnagAPIKey\" \"#{info_plist_path}\"` if !$?.success?\n api_key = plist_buddy_response if $?.success?\nend\n\nfail(\"No Bugsnag API key detected - add your key to your Info.plist or BUGSNAG_API_KEY environment variable\") unless api_key\n\nif ENV['ENABLE_USER_SCRIPT_SANDBOXING'] == 'YES'\n count = ENV['SCRIPT_INPUT_FILE_COUNT'].to_i\n abort 'error: dSYMs must be specified as build phase \"Input Files\" because ENABLE_USER_SCRIPT_SANDBOXING is enabled' unless count > 0\n dsyms = []\n for i in 0 .. count - 1\n file = ENV[\"SCRIPT_INPUT_FILE_#{i}\"]\n next if file.end_with? '.plist'\n if File.exist? file\n dsyms.append file\n else\n abort \"error: cannot read #{file}\" unless ENV['DEBUG_INFORMATION_FORMAT'] != 'dwarf-with-dsym'\n end\n end\nelse\n dsyms = Dir[\"#{ENV['DWARF_DSYM_FOLDER_PATH']}/*/Contents/Resources/DWARF/*\"]\nend\n\ndsyms.each do |dsym|\n Process.detach Process.spawn('/usr/bin/curl', '--http1.1',\n '-F', \"apiKey=#{api_key}\",\n '-F', \"dsym=@#{dsym}\",\n '-F', \"projectRoot=#{ENV['PROJECT_DIR']}\",\n 'https://upload.bugsnag.com/',\n %i[err out] => :close\n )\nend\n";
showEnvVarsInLog = 0;
};
749A384B5145F53772918AE6 /* [CP] Check Pods Manifest.lock */ = {
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-production/KermitSampleIOS/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 3c766f7670f4e65f346904ffce262b5028e84071

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
2 changes: 1 addition & 1 deletion samples/sample-production/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ org.gradle.jvmargs=-Xmx3g
kotlin.native.cacheKind.iosX64=none
kotlin.native.cacheKind.iosSimulatorArm64=none

kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.enableCInteropCommonization=true
5 changes: 3 additions & 2 deletions samples/sample-production/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ val KERMIT_VERSION: String by project

kotlin {
version = "0.0.1"
android()
androidTarget()
ios()
// Note: iosSimulatorArm64 target requires that all dependencies have M1 support
iosSimulatorArm64()

sourceSets {
Expand Down Expand Up @@ -66,6 +65,7 @@ kotlin {

val iosMain by sourceSets.getting {
dependencies {
// Only if you want to talk to Kermit from Swift
api("co.touchlab:kermit-simple:${KERMIT_VERSION}")
}
}
Expand All @@ -88,6 +88,7 @@ kotlin {
summary = "Sample for Kermit"
homepage = "https://www.touchlab.co"
framework {
// Only if you want to talk to Kermit from Swift
export("co.touchlab:kermit-simple:${KERMIT_VERSION}")
isStatic = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
95FA4211243F7F7100A0104F /* Sources */,
95FA4212243F7F7100A0104F /* Frameworks */,
95FA4213243F7F7100A0104F /* Resources */,
87FF89B5E52C95D8756AD900 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -194,23 +193,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
87FF89B5E52C95D8756AD900 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-KermitSampleIOS/Pods-KermitSampleIOS-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-KermitSampleIOS/Pods-KermitSampleIOS-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-KermitSampleIOS/Pods-KermitSampleIOS-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ struct ContentView: View {
.foregroundColor(.white)
.font(.title)
}
Button(action: {
// Using kermit-simple module
LoggerKt.i(string: "Hello from Swift")
}){
Text("Log from Swift").padding()
.background(Color.blue)
.foregroundColor(.white)
.font(.title)
}
}
}
}
Expand Down
34 changes: 20 additions & 14 deletions samples/sample/app-browser/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,29 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile

plugins {
kotlin("js")
kotlin("multiplatform")
}

kotlin.target.browser {
runTask {
outputFileName = "app-browser.js"
}
}
val KERMIT_VERSION: String by project

dependencies {
implementation(project(":shared"))
implementation("org.jetbrains.kotlinx:kotlinx-html-js:0.7.3")
}
kotlin {
js {
browser {
runTask {
outputFileName = "app-browser.js"
}
binaries.executable()
}
}
sourceSets {
val jsMain by getting {
dependencies {
implementation(project(":shared"))
implementation("org.jetbrains.kotlinx:kotlinx-html-js:0.7.3")

tasks.withType<KotlinJsCompile> {
kotlinOptions.freeCompilerArgs += "-Xuse-experimental=kotlin.Experimental"
implementation("co.touchlab:kermit-simple:${KERMIT_VERSION}")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import kotlinx.html.button
import kotlinx.html.div
import kotlinx.html.dom.append
import kotlinx.html.js.onClickFunction
import kotlin.browser.document
import kotlinx.browser.document

val common = SampleCommon()

Expand Down
2 changes: 1 addition & 1 deletion samples/sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ allprojects {
}
}
tasks.register("ciTest") {
dependsOn(":app:build", ":shared:build")
dependsOn("kotlinUpgradeYarnLock", ":app:build", ":shared:build")
}
6 changes: 1 addition & 5 deletions samples/sample/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ android.useAndroidX=true

org.gradle.jvmargs=-Xmx3g

kotlin.native.binary.memoryModel=experimental

kotlin.js.compiler=ir
kotlin.native.cacheKind.iosX64=none
kotlin.native.cacheKind.iosSimulatorArm64=none

kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.enableCInteropCommonization=true
Loading
Loading