Skip to content

Commit

Permalink
Multiplatform: Add iOS target. (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech committed Jun 26, 2024
1 parent 6926f38 commit 4fb3246
Show file tree
Hide file tree
Showing 43 changed files with 926 additions and 47 deletions.
54 changes: 54 additions & 0 deletions emoji-androidx-emoji2/EmojiAndroidxEmoji2.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Pod::Spec.new do |spec|
spec.name = 'EmojiAndroidxEmoji2'
spec.version = '0.21.0-SNAPSHOT'
spec.homepage = 'https://github.com/vanniktech/Emoji'
spec.source = { :http=> ''}
spec.authors = ''
spec.license = ''
spec.summary = 'emoji-androidx-emoji2'
spec.vendored_frameworks = 'build/cocoapods/framework/emoji_androidx_emoji2.framework'
spec.libraries = 'c++'



if !Dir.exist?('build/cocoapods/framework/emoji_androidx_emoji2.framework') || Dir.empty?('build/cocoapods/framework/emoji_androidx_emoji2.framework')
raise "
Kotlin framework 'emoji_androidx_emoji2' doesn't exist yet, so a proper Xcode project can't be generated.
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
./gradlew :emoji-androidx-emoji2:generateDummyFramework
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
end

spec.xcconfig = {
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
}

spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':emoji-androidx-emoji2',
'PRODUCT_MODULE_NAME' => 'emoji_androidx_emoji2',
}

spec.script_phases = [
{
:name => 'Build EmojiAndroidxEmoji2',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
exit 0
fi
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
-Pkotlin.native.cocoapods.archs="$ARCHS" \
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
SCRIPT
}
]

end
19 changes: 18 additions & 1 deletion emoji-androidx-emoji2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode

plugins {
id("org.jetbrains.dokka")
id("org.jetbrains.kotlin.multiplatform")
id("org.jetbrains.kotlin.native.cocoapods")
id("com.android.library")
id("org.jetbrains.kotlin.plugin.parcelize")
id("me.tylerbwong.gradle.metalava")
Expand All @@ -23,7 +26,9 @@ kotlin {
androidTarget {
publishLibraryVariants("release")
}
// ios("ios")
iosX64()
iosArm64()
iosSimulatorArm64()
jvm()
jvmToolchain(11)

Expand Down Expand Up @@ -58,6 +63,18 @@ kotlin {
}
}
}

cocoapods {
version = project.property("VERSION_NAME").toString()
summary = "emoji-androidx-emoji2"
homepage = "https://github.com/vanniktech/Emoji"
name = "EmojiAndroidxEmoji2"

framework {
isStatic = true
embedBitcode(if ("YES" == System.getenv("ENABLE_BITCODE")) BitcodeEmbeddingMode.BITCODE else BitcodeEmbeddingMode.DISABLE)
}
}
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal class AndroidxEmoji2 internal constructor(

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
if (other == null || this::class != other::class) return false

other as AndroidxEmoji2

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.vanniktech.emoji.androidxemoji2

import com.vanniktech.emoji.EmojiCategory
import com.vanniktech.emoji.EmojiProvider
import com.vanniktech.emoji.androidxemoji2.category.ActivitiesCategory
import com.vanniktech.emoji.androidxemoji2.category.AnimalsAndNatureCategory
import com.vanniktech.emoji.androidxemoji2.category.FlagsCategory
import com.vanniktech.emoji.androidxemoji2.category.FoodAndDrinkCategory
import com.vanniktech.emoji.androidxemoji2.category.ObjectsCategory
import com.vanniktech.emoji.androidxemoji2.category.SmileysAndPeopleCategory
import com.vanniktech.emoji.androidxemoji2.category.SymbolsCategory
import com.vanniktech.emoji.androidxemoji2.category.TravelAndPlacesCategory

class AndroidxEmoji2Provider : EmojiProvider {
override val categories: Array<EmojiCategory>
get() = arrayOf(
SmileysAndPeopleCategory(),
AnimalsAndNatureCategory(),
FoodAndDrinkCategory(),
ActivitiesCategory(),
TravelAndPlacesCategory(),
ObjectsCategory(),
SymbolsCategory(),
FlagsCategory(),
)

override fun release() = Unit
}
54 changes: 54 additions & 0 deletions emoji-facebook/EmojiFacebook.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Pod::Spec.new do |spec|
spec.name = 'EmojiFacebook'
spec.version = '0.21.0-SNAPSHOT'
spec.homepage = 'https://github.com/vanniktech/Emoji'
spec.source = { :http=> ''}
spec.authors = ''
spec.license = ''
spec.summary = 'emoji-facebook'
spec.vendored_frameworks = 'build/cocoapods/framework/emoji_facebook.framework'
spec.libraries = 'c++'



if !Dir.exist?('build/cocoapods/framework/emoji_facebook.framework') || Dir.empty?('build/cocoapods/framework/emoji_facebook.framework')
raise "
Kotlin framework 'emoji_facebook' doesn't exist yet, so a proper Xcode project can't be generated.
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
./gradlew :emoji-facebook:generateDummyFramework
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
end

spec.xcconfig = {
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
}

spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':emoji-facebook',
'PRODUCT_MODULE_NAME' => 'emoji_facebook',
}

spec.script_phases = [
{
:name => 'Build EmojiFacebook',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
exit 0
fi
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
-Pkotlin.native.cocoapods.archs="$ARCHS" \
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
SCRIPT
}
]

end
7 changes: 7 additions & 0 deletions emoji-facebook/api/current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@ package com.vanniktech.emoji.facebook {
property public com.vanniktech.emoji.EmojiCategory![] categories;
}

public final class FacebookEmojiProvider implements com.vanniktech.emoji.EmojiProvider {
ctor public FacebookEmojiProvider();
method public com.vanniktech.emoji.EmojiCategory![] getCategories();
method public void release();
property public com.vanniktech.emoji.EmojiCategory![] categories;
}

}

21 changes: 19 additions & 2 deletions emoji-facebook/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode

plugins {
id("org.jetbrains.dokka")
id("org.jetbrains.kotlin.multiplatform")
id("org.jetbrains.kotlin.native.cocoapods")
id("com.android.library")
id("org.jetbrains.kotlin.plugin.parcelize")
id("me.tylerbwong.gradle.metalava")
Expand All @@ -14,7 +17,7 @@ licensee {

metalava {
filename.set("api/current.txt")
sourcePaths.setFrom("src/commonMain", "src/androidMain", "src/jvmMain")
sourcePaths.setFrom("src/commonMain", "src/androidMain", "src/jvmMain", "src/iosMain")
}

kotlin {
Expand All @@ -23,7 +26,9 @@ kotlin {
androidTarget {
publishLibraryVariants("release")
}
// ios("ios")
iosX64()
iosArm64()
iosSimulatorArm64()
jvm()
jvmToolchain(11)

Expand Down Expand Up @@ -52,6 +57,18 @@ kotlin {
}
}
}

cocoapods {
version = project.property("VERSION_NAME").toString()
summary = "emoji-facebook"
homepage = "https://github.com/vanniktech/Emoji"
name = "EmojiFacebook"

framework {
isStatic = true
embedBitcode(if ("YES" == System.getenv("ENABLE_BITCODE")) BitcodeEmbeddingMode.BITCODE else BitcodeEmbeddingMode.DISABLE)
}
}
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ internal class FacebookEmoji internal constructor(

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
if (other == null || this::class != other::class) return false

other as FacebookEmoji

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

package com.vanniktech.emoji.facebook

import com.vanniktech.emoji.EmojiCategory
import com.vanniktech.emoji.EmojiProvider
import com.vanniktech.emoji.facebook.category.ActivitiesCategory
import com.vanniktech.emoji.facebook.category.AnimalsAndNatureCategory
import com.vanniktech.emoji.facebook.category.FlagsCategory
import com.vanniktech.emoji.facebook.category.FoodAndDrinkCategory
import com.vanniktech.emoji.facebook.category.ObjectsCategory
import com.vanniktech.emoji.facebook.category.SmileysAndPeopleCategory
import com.vanniktech.emoji.facebook.category.SymbolsCategory
import com.vanniktech.emoji.facebook.category.TravelAndPlacesCategory

class FacebookEmojiProvider : EmojiProvider {
override val categories: Array<EmojiCategory>
get() = arrayOf(
SmileysAndPeopleCategory(),
AnimalsAndNatureCategory(),
FoodAndDrinkCategory(),
ActivitiesCategory(),
TravelAndPlacesCategory(),
ObjectsCategory(),
SymbolsCategory(),
FlagsCategory(),
)

override fun release() = Unit
}
54 changes: 54 additions & 0 deletions emoji-google-compat/EmojiGoogleCompat.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Pod::Spec.new do |spec|
spec.name = 'EmojiGoogleCompat'
spec.version = '0.21.0-SNAPSHOT'
spec.homepage = 'https://github.com/vanniktech/Emoji'
spec.source = { :http=> ''}
spec.authors = ''
spec.license = ''
spec.summary = 'emoji-google-compat'
spec.vendored_frameworks = 'build/cocoapods/framework/emoji_google_compat.framework'
spec.libraries = 'c++'



if !Dir.exist?('build/cocoapods/framework/emoji_google_compat.framework') || Dir.empty?('build/cocoapods/framework/emoji_google_compat.framework')
raise "
Kotlin framework 'emoji_google_compat' doesn't exist yet, so a proper Xcode project can't be generated.
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
./gradlew :emoji-google-compat:generateDummyFramework
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
end

spec.xcconfig = {
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
}

spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':emoji-google-compat',
'PRODUCT_MODULE_NAME' => 'emoji_google_compat',
}

spec.script_phases = [
{
:name => 'Build EmojiGoogleCompat',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
exit 0
fi
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
-Pkotlin.native.cocoapods.archs="$ARCHS" \
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
SCRIPT
}
]

end
Loading

0 comments on commit 4fb3246

Please sign in to comment.