diff --git a/emoji-facebook/EmojiFacebook.podspec b/emoji-facebook/EmojiFacebook.podspec new file mode 100644 index 0000000000..2261875b09 --- /dev/null +++ b/emoji-facebook/EmojiFacebook.podspec @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = 'EmojiFacebook' + spec.version = '0.18.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++' + + + + 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 \ No newline at end of file diff --git a/emoji-facebook/build.gradle b/emoji-facebook/build.gradle index e877cd4f57..6a51d02fc0 100644 --- a/emoji-facebook/build.gradle +++ b/emoji-facebook/build.gradle @@ -14,7 +14,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") } // CocoaPods requires a version. @@ -26,10 +26,23 @@ kotlin { androidTarget("android") { publishLibraryVariants("release") } -// ios("ios") + ios() jvm() jvmToolchain(11) + cocoapods { + version = VERSION_NAME + summary = "emoji-facebook" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiFacebook" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -52,6 +65,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-facebook/src/iosMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt b/emoji-facebook/src/iosMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt new file mode 100644 index 0000000000..e601c138d1 --- /dev/null +++ b/emoji-facebook/src/iosMain/kotlin/com/vanniktech/emoji/facebook/FacebookEmojiProvider.kt @@ -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 + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-google-compat/EmojiGoogleCompat.podspec b/emoji-google-compat/EmojiGoogleCompat.podspec new file mode 100644 index 0000000000..fdbd639402 --- /dev/null +++ b/emoji-google-compat/EmojiGoogleCompat.podspec @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = 'EmojiGoogleCompat' + spec.version = '0.18.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++' + + + + 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 \ No newline at end of file diff --git a/emoji-google-compat/build.gradle b/emoji-google-compat/build.gradle index 4be76cf27c..09ebf22399 100644 --- a/emoji-google-compat/build.gradle +++ b/emoji-google-compat/build.gradle @@ -14,7 +14,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") } // CocoaPods requires a version. @@ -26,10 +26,23 @@ kotlin { androidTarget("android") { publishLibraryVariants("release") } -// ios("ios") + ios() jvm() jvmToolchain(11) + cocoapods { + version = VERSION_NAME + summary = "emoji-google-compat" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiGoogleCompat" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -53,6 +66,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-google-compat/src/iosMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt b/emoji-google-compat/src/iosMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt new file mode 100644 index 0000000000..7419cbba28 --- /dev/null +++ b/emoji-google-compat/src/iosMain/kotlin/com/vanniktech/emoji/googlecompat/GoogleCompatEmojiProvider.kt @@ -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.googlecompat + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.googlecompat.category.ActivitiesCategory +import com.vanniktech.emoji.googlecompat.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.googlecompat.category.FlagsCategory +import com.vanniktech.emoji.googlecompat.category.FoodAndDrinkCategory +import com.vanniktech.emoji.googlecompat.category.ObjectsCategory +import com.vanniktech.emoji.googlecompat.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.googlecompat.category.SymbolsCategory +import com.vanniktech.emoji.googlecompat.category.TravelAndPlacesCategory + +class GoogleCompatEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-google/EmojiGoogle.podspec b/emoji-google/EmojiGoogle.podspec new file mode 100644 index 0000000000..f2d3db3a99 --- /dev/null +++ b/emoji-google/EmojiGoogle.podspec @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = 'EmojiGoogle' + spec.version = '0.18.0-SNAPSHOT' + spec.homepage = 'https://github.com/vanniktech/Emoji' + spec.source = { :http=> ''} + spec.authors = '' + spec.license = '' + spec.summary = 'emoji-google' + spec.vendored_frameworks = 'build/cocoapods/framework/emoji_google.framework' + spec.libraries = 'c++' + + + + spec.pod_target_xcconfig = { + 'KOTLIN_PROJECT_PATH' => ':emoji-google', + 'PRODUCT_MODULE_NAME' => 'emoji_google', + } + + spec.script_phases = [ + { + :name => 'Build EmojiGoogle', + :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 \ No newline at end of file diff --git a/emoji-google/build.gradle b/emoji-google/build.gradle index 8a95052ae0..e8219b35cc 100644 --- a/emoji-google/build.gradle +++ b/emoji-google/build.gradle @@ -14,7 +14,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") } // CocoaPods requires a version. @@ -26,10 +26,23 @@ kotlin { androidTarget("android") { publishLibraryVariants("release") } -// ios("ios") + ios() jvm() jvmToolchain(11) + cocoapods { + version = VERSION_NAME + summary = "emoji-google" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiGoogle" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -52,6 +65,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-google/src/iosMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt b/emoji-google/src/iosMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt new file mode 100644 index 0000000000..c1f720da84 --- /dev/null +++ b/emoji-google/src/iosMain/kotlin/com/vanniktech/emoji/google/GoogleEmojiProvider.kt @@ -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.google + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.google.category.ActivitiesCategory +import com.vanniktech.emoji.google.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.google.category.FlagsCategory +import com.vanniktech.emoji.google.category.FoodAndDrinkCategory +import com.vanniktech.emoji.google.category.ObjectsCategory +import com.vanniktech.emoji.google.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.google.category.SymbolsCategory +import com.vanniktech.emoji.google.category.TravelAndPlacesCategory + +class GoogleEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-ios/EmojiIos.podspec b/emoji-ios/EmojiIos.podspec new file mode 100644 index 0000000000..c073a856d9 --- /dev/null +++ b/emoji-ios/EmojiIos.podspec @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = 'EmojiIos' + spec.version = '0.18.0-SNAPSHOT' + spec.homepage = 'https://github.com/vanniktech/Emoji' + spec.source = { :http=> ''} + spec.authors = '' + spec.license = '' + spec.summary = 'emoji-ios' + spec.vendored_frameworks = 'build/cocoapods/framework/emoji_ios.framework' + spec.libraries = 'c++' + + + + spec.pod_target_xcconfig = { + 'KOTLIN_PROJECT_PATH' => ':emoji-ios', + 'PRODUCT_MODULE_NAME' => 'emoji_ios', + } + + spec.script_phases = [ + { + :name => 'Build EmojiIos', + :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 \ No newline at end of file diff --git a/emoji-ios/build.gradle b/emoji-ios/build.gradle index fd35a5ef1d..1fbd939352 100644 --- a/emoji-ios/build.gradle +++ b/emoji-ios/build.gradle @@ -14,7 +14,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") } // CocoaPods requires a version. @@ -26,10 +26,23 @@ kotlin { androidTarget("android") { publishLibraryVariants("release") } -// ios("ios") + ios() jvm() jvmToolchain(11) + cocoapods { + version = VERSION_NAME + summary = "emoji-ios" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiIos" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -52,6 +65,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-ios/src/iosMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt b/emoji-ios/src/iosMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt new file mode 100644 index 0000000000..75e8661374 --- /dev/null +++ b/emoji-ios/src/iosMain/kotlin/com/vanniktech/emoji/ios/IosEmojiProvider.kt @@ -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.ios + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.ios.category.ActivitiesCategory +import com.vanniktech.emoji.ios.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.ios.category.FlagsCategory +import com.vanniktech.emoji.ios.category.FoodAndDrinkCategory +import com.vanniktech.emoji.ios.category.ObjectsCategory +import com.vanniktech.emoji.ios.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.ios.category.SymbolsCategory +import com.vanniktech.emoji.ios.category.TravelAndPlacesCategory + +class IosEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji-ios/src/iosTest/kotlin/com/vanniktech/emoji/ios/commonTestEmojiProviderIosApi.kt b/emoji-ios/src/iosTest/kotlin/com/vanniktech/emoji/ios/commonTestEmojiProviderIosApi.kt new file mode 100644 index 0000000000..abc120e32c --- /dev/null +++ b/emoji-ios/src/iosTest/kotlin/com/vanniktech/emoji/ios/commonTestEmojiProviderIosApi.kt @@ -0,0 +1,5 @@ +package com.vanniktech.emoji.ios + +import com.vanniktech.emoji.EmojiProvider + +actual fun emojiProvider(): EmojiProvider = IosEmojiProvider() diff --git a/emoji-material/EmojiMaterial.podspec b/emoji-material/EmojiMaterial.podspec new file mode 100644 index 0000000000..e3ff6f3ed3 --- /dev/null +++ b/emoji-material/EmojiMaterial.podspec @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = 'EmojiMaterial' + spec.version = '0.18.0-SNAPSHOT' + spec.homepage = 'https://github.com/vanniktech/Emoji' + spec.source = { :http=> ''} + spec.authors = '' + spec.license = '' + spec.summary = 'emoji-material' + spec.vendored_frameworks = 'build/cocoapods/framework/emoji_material.framework' + spec.libraries = 'c++' + + + + spec.pod_target_xcconfig = { + 'KOTLIN_PROJECT_PATH' => ':emoji-material', + 'PRODUCT_MODULE_NAME' => 'emoji_material', + } + + spec.script_phases = [ + { + :name => 'Build EmojiMaterial', + :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 \ No newline at end of file diff --git a/emoji-material/build.gradle b/emoji-material/build.gradle index 6190d2fdd7..f6e13de82a 100644 --- a/emoji-material/build.gradle +++ b/emoji-material/build.gradle @@ -26,10 +26,23 @@ kotlin { androidTarget("android") { publishLibraryVariants("release") } -// ios("ios") + ios() jvm() jvmToolchain(11) + cocoapods { + version = VERSION_NAME + summary = "emoji-material" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiMaterial" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -53,6 +66,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-twitter/EmojiTwitter.podspec b/emoji-twitter/EmojiTwitter.podspec new file mode 100644 index 0000000000..b21926585c --- /dev/null +++ b/emoji-twitter/EmojiTwitter.podspec @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = 'EmojiTwitter' + spec.version = '0.18.0-SNAPSHOT' + spec.homepage = 'https://github.com/vanniktech/Emoji' + spec.source = { :http=> ''} + spec.authors = '' + spec.license = '' + spec.summary = 'emoji-twitter' + spec.vendored_frameworks = 'build/cocoapods/framework/emoji_twitter.framework' + spec.libraries = 'c++' + + + + spec.pod_target_xcconfig = { + 'KOTLIN_PROJECT_PATH' => ':emoji-twitter', + 'PRODUCT_MODULE_NAME' => 'emoji_twitter', + } + + spec.script_phases = [ + { + :name => 'Build EmojiTwitter', + :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 \ No newline at end of file diff --git a/emoji-twitter/build.gradle b/emoji-twitter/build.gradle index f2b2dc35e4..a6c1d13592 100644 --- a/emoji-twitter/build.gradle +++ b/emoji-twitter/build.gradle @@ -14,7 +14,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") } // CocoaPods requires a version. @@ -26,10 +26,23 @@ kotlin { androidTarget("android") { publishLibraryVariants("release") } -// ios("ios") + ios() jvm() jvmToolchain(11) + cocoapods { + version = VERSION_NAME + summary = "emoji-twitter" + homepage = "https://github.com/vanniktech/Emoji" + name = "EmojiTwitter" + +// framework { +// isStatic = true +// embedBitcode(BITCODE) +// export(project(":emoji")) +// } + } + sourceSets { commonMain { dependencies { @@ -52,6 +65,12 @@ kotlin { implementation libs.robolectric } + iosMain.dependencies { + } + + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji-twitter/src/iosMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt b/emoji-twitter/src/iosMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt new file mode 100644 index 0000000000..bbb0f83bc1 --- /dev/null +++ b/emoji-twitter/src/iosMain/kotlin/com/vanniktech/emoji/twitter/TwitterEmojiProvider.kt @@ -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.twitter + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +import com.vanniktech.emoji.twitter.category.ActivitiesCategory +import com.vanniktech.emoji.twitter.category.AnimalsAndNatureCategory +import com.vanniktech.emoji.twitter.category.FlagsCategory +import com.vanniktech.emoji.twitter.category.FoodAndDrinkCategory +import com.vanniktech.emoji.twitter.category.ObjectsCategory +import com.vanniktech.emoji.twitter.category.SmileysAndPeopleCategory +import com.vanniktech.emoji.twitter.category.SymbolsCategory +import com.vanniktech.emoji.twitter.category.TravelAndPlacesCategory + +class TwitterEmojiProvider : EmojiProvider { + override val categories: Array + get() = arrayOf( + SmileysAndPeopleCategory(), + AnimalsAndNatureCategory(), + FoodAndDrinkCategory(), + ActivitiesCategory(), + TravelAndPlacesCategory(), + ObjectsCategory(), + SymbolsCategory(), + FlagsCategory(), + ) + + override fun release() = Unit +} diff --git a/emoji/build.gradle b/emoji/build.gradle index d860ccf63b..1b4ca80293 100644 --- a/emoji/build.gradle +++ b/emoji/build.gradle @@ -26,10 +26,22 @@ kotlin { androidTarget("android") { publishLibraryVariants("release") } -// ios("ios") + ios() jvm() jvmToolchain(11) + cocoapods { + version = VERSION_NAME + summary = "emoji" + homepage = "https://github.com/vanniktech/Emoji" + name = "Emoji" + + // framework { + // isStatic = true + // embedBitcode(BITCODE) + // } + } + sourceSets { commonMain { dependencies { @@ -59,6 +71,9 @@ kotlin { } } + iosTest.dependencies { + } + jvmMain.dependencies { } diff --git a/emoji/emoji.podspec b/emoji/emoji.podspec new file mode 100644 index 0000000000..2f4ea931e5 --- /dev/null +++ b/emoji/emoji.podspec @@ -0,0 +1,39 @@ +Pod::Spec.new do |spec| + spec.name = 'Emoji' + spec.version = '0.18.0-SNAPSHOT' + spec.homepage = 'https://github.com/vanniktech/Emoji' + spec.source = { :http=> ''} + spec.authors = '' + spec.license = '' + spec.summary = 'emoji' + spec.vendored_frameworks = 'build/cocoapods/framework/emoji.framework' + spec.libraries = 'c++' + + + + spec.pod_target_xcconfig = { + 'KOTLIN_PROJECT_PATH' => ':emoji', + 'PRODUCT_MODULE_NAME' => 'emoji', + } + + spec.script_phases = [ + { + :name => 'Build Emoji', + :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 \ No newline at end of file diff --git a/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonLockAndroidApi.kt b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonLockAndroidApi.kt new file mode 100644 index 0000000000..acf3e50e7f --- /dev/null +++ b/emoji/src/androidMain/kotlin/com/vanniktech/emoji/commonLockAndroidApi.kt @@ -0,0 +1,10 @@ +package com.vanniktech.emoji + +import java.util.concurrent.locks.ReentrantLock + +internal actual class Lock { + private val mutex = ReentrantLock() + + actual fun lock() = mutex.lock() + actual fun unlock() = mutex.unlock() +} diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt index 3089988ba8..54ac0a4590 100644 --- a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt +++ b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/EmojiManager.kt @@ -16,6 +16,8 @@ package com.vanniktech.emoji +import kotlin.jvm.JvmStatic + /** * EmojiManager where an EmojiProvider can be installed for further usage. */ @@ -29,6 +31,8 @@ object EmojiManager { private var emojiPattern: Regex? = null internal var emojiRepetitivePattern: Regex? = null + private val LOCK = Lock() + internal fun categories(): Array { verifyInstalled() return categories!! @@ -81,7 +85,7 @@ object EmojiManager { * [provider] the provider that should be installed. */ @JvmStatic fun install(provider: EmojiProvider) { - synchronized(EmojiManager::class.java) { + LOCK.use { categories = provider.categories emojiProvider = provider emojiMap.clear() @@ -114,7 +118,7 @@ object EmojiManager { for (i in 0 until unicodesForPatternSize) { patternBuilder.append(Regex.escape(unicodesForPattern[i])).append('|') } - val regex = patternBuilder.deleteCharAt(patternBuilder.length - 1).toString() + val regex = patternBuilder.deleteAt(patternBuilder.length - 1).toString() emojiPattern = Regex(regex, RegexOption.IGNORE_CASE) emojiRepetitivePattern = Regex("($regex)+", RegexOption.IGNORE_CASE) } @@ -125,10 +129,10 @@ object EmojiManager { * all data associated with installed [Emoji]s. For the existing [EmojiProvider]s this * means the memory-heavy emoji sheet. * - * @see .destroy + * @see [destroy] */ @JvmStatic fun destroy() { - synchronized(EmojiManager::class.java) { + LOCK.use { release() emojiMap.clear() emojiProvider = null @@ -145,10 +149,10 @@ object EmojiManager { * In contrast to [destroy], this does **not** destroy the internal * data structures and thus, you do not need to [install] again before using the EmojiManager. * - * @see .destroy + * @see [destroy] */ @JvmStatic fun release() { - synchronized(EmojiManager::class.java) { + LOCK.use { emojiProvider?.release() } } diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonLockApi.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonLockApi.kt new file mode 100644 index 0000000000..8dfc5d1ef8 --- /dev/null +++ b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/commonLockApi.kt @@ -0,0 +1,15 @@ +package com.vanniktech.emoji + +internal expect class Lock() { + fun lock() + fun unlock() +} + +internal inline fun Lock.use(block: () -> R): R { + try { + lock() + return block() + } finally { + unlock() + } +} diff --git a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt index f1405f68a9..0fbf20653f 100644 --- a/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt +++ b/emoji/src/commonMain/kotlin/com/vanniktech/emoji/search/SearchEmojiResult.kt @@ -17,6 +17,7 @@ package com.vanniktech.emoji.search import com.vanniktech.emoji.Emoji +import kotlin.jvm.JvmField data class SearchEmojiResult( @JvmField val emoji: Emoji, diff --git a/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonLockIosApi.kt b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonLockIosApi.kt new file mode 100644 index 0000000000..89214fe313 --- /dev/null +++ b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonLockIosApi.kt @@ -0,0 +1,10 @@ +package com.vanniktech.emoji + +import platform.Foundation.NSLock + +internal actual class Lock { + private val lock = NSLock() + + actual fun lock() = lock.lock() + actual fun unlock() = lock.unlock() +} diff --git a/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonParcelableIosApi.kt b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonParcelableIosApi.kt new file mode 100644 index 0000000000..d193300375 --- /dev/null +++ b/emoji/src/iosMain/kotlin/com/vanniktech/emoji/commonParcelableIosApi.kt @@ -0,0 +1,3 @@ +package com.vanniktech.emoji + +actual interface Parcelable diff --git a/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonLockJvmApi.kt b/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonLockJvmApi.kt new file mode 100644 index 0000000000..acf3e50e7f --- /dev/null +++ b/emoji/src/jvmMain/kotlin/com/vanniktech/emoji/commonLockJvmApi.kt @@ -0,0 +1,10 @@ +package com.vanniktech.emoji + +import java.util.concurrent.locks.ReentrantLock + +internal actual class Lock { + private val mutex = ReentrantLock() + + actual fun lock() = mutex.lock() + actual fun unlock() = mutex.unlock() +} diff --git a/generator/index.js b/generator/index.js index 046c2e2156..bbfa81d856 100644 --- a/generator/index.js +++ b/generator/index.js @@ -374,7 +374,7 @@ async function copyImages(map, targets, shouldOptimize) { } /** - * Generates the relevant java code and saves it to the destinations, specified by the targets. Code generated are the + * Generates the relevant code and saves it to the destinations, specified by the targets. Code generated are the * categories, the provider and the specific emoji class. * @param map The previously created map. * @param targets The targets, providing destination for the code files. @@ -390,24 +390,27 @@ async function generateCode(map, targets) { const emojiProviderAndroid = await fs.readFile("template/EmojiProviderAndroid.kt", "utf-8"); const emojiProviderCompatTemplate = await fs.readFile("template/EmojiProviderCompat.kt", "utf-8"); const emojiProviderJvm = await fs.readFile("template/EmojiProviderJvm.kt", "utf-8"); + const emojiProviderIos = await fs.readFile("template/EmojiProviderIos.kt", "utf-8"); const entries = [...map.entries()].sort((first, second) => { return categoryInfo.findIndex(it => it.name === first[0]) - categoryInfo.findIndex(it => it.name === second[0]); }); for (const target of targets) { - const srcDir = `../emoji-${target.module}/src/androidMain/kotlin/com/vanniktech/emoji/${target.package}`; - const commonSrcDir = `../emoji-${target.module}/src/commonMain/kotlin/com/vanniktech/emoji/${target.package}`; - const jvmSrcDir = `../emoji-${target.module}/src/jvmMain/kotlin/com/vanniktech/emoji/${target.package}`; + const androidMain = `../emoji-${target.module}/src/androidMain/kotlin/com/vanniktech/emoji/${target.package}`; + const commonMain = `../emoji-${target.module}/src/commonMain/kotlin/com/vanniktech/emoji/${target.package}`; + const jvmMain = `../emoji-${target.module}/src/jvmMain/kotlin/com/vanniktech/emoji/${target.package}`; + const iosMain = `../emoji-${target.module}/src/iosMain/kotlin/com/vanniktech/emoji/${target.package}`; if (target.module !== "google-compat") { - await fs.emptyDir(commonSrcDir); - await fs.mkdir(`${commonSrcDir}/category`); + await fs.emptyDir(commonMain); + await fs.mkdir(`${commonMain}/category`); } else { - await fs.emptyDir(`${commonSrcDir}/category`) + await fs.emptyDir(`${commonMain}/category`) } - await fs.emptyDir(jvmSrcDir); + await fs.emptyDir(jvmMain); + await fs.emptyDir(iosMain); let strips = 0; for (const [category, emojis] of entries) { @@ -422,7 +425,7 @@ async function generateCode(map, targets) { chunkClasses.push(chunkClass) - await fs.writeFile(`${commonSrcDir}/category/${chunkClass}.kt`, + await fs.writeFile(`${commonMain}/category/${chunkClass}.kt`, template(categoryChunkTemplate)({ package: target.package, name: target.name, @@ -433,7 +436,7 @@ async function generateCode(map, targets) { ); } - await fs.writeFile(`${commonSrcDir}/category/${category}Category.kt`, + await fs.writeFile(`${commonMain}/category/${category}Category.kt`, template(categoryTemplate)({ package: target.package, name: target.name, @@ -455,7 +458,7 @@ async function generateCode(map, targets) { }) if (target.module !== "google-compat") { - await fs.writeFile(`${srcDir}/${target.name}Provider.kt`, template(emojiProviderAndroid)({ + await fs.writeFile(`${androidMain}/${target.name}Provider.kt`, template(emojiProviderAndroid)({ package: target.package, imports: imports, name: target.name, @@ -463,7 +466,7 @@ async function generateCode(map, targets) { strips: strips, })); } else { - await fs.writeFile(`${srcDir}/${target.name}Provider.kt`, template(emojiProviderCompatTemplate)({ + await fs.writeFile(`${androidMain}/${target.name}Provider.kt`, template(emojiProviderCompatTemplate)({ package: target.package, imports: imports, name: target.name, @@ -471,7 +474,14 @@ async function generateCode(map, targets) { })); } - await fs.writeFile(`${jvmSrcDir}/${target.name}Provider.kt`, template(emojiProviderJvm)({ + await fs.writeFile(`${jvmMain}/${target.name}Provider.kt`, template(emojiProviderJvm)({ + package: target.package, + imports: imports, + name: target.name, + categories: categories, + })); + + await fs.writeFile(`${iosMain}/${target.name}Provider.kt`, template(emojiProviderIos)({ package: target.package, imports: imports, name: target.name, @@ -479,12 +489,12 @@ async function generateCode(map, targets) { })); if (target.module !== "google-compat") { - await fs.writeFile(`${commonSrcDir}/${target.name}.kt`, template(emojiTemplate)({ + await fs.writeFile(`${commonMain}/${target.name}.kt`, template(emojiTemplate)({ package: target.package, name: target.name, })); } else { - await fs.writeFile(`${commonSrcDir}/${target.name}.kt`, template(emojiCompatTemplate)({ + await fs.writeFile(`${commonMain}/${target.name}.kt`, template(emojiCompatTemplate)({ package: target.package, name: target.name, })); diff --git a/generator/template/EmojiProviderIos.kt b/generator/template/EmojiProviderIos.kt new file mode 100644 index 0000000000..f0b8a53c6f --- /dev/null +++ b/generator/template/EmojiProviderIos.kt @@ -0,0 +1,30 @@ +/* + * 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.<%= package %> + +import com.vanniktech.emoji.EmojiCategory +import com.vanniktech.emoji.EmojiProvider +<%= imports %> + +class <%= name %>Provider : EmojiProvider { + override val categories: Array + get() = arrayOf(<% categories.forEach(function(category) { %> + <%= category.name %>(),<% }); %> + ) + + override fun release() = Unit +} diff --git a/gradle.properties b/gradle.properties index f33fb8e39e..ebf0037646 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,5 +36,10 @@ android.defaults.buildfeatures.resvalues=false android.defaults.buildfeatures.shaders=false kotlin.mpp.stability.nowarn=true +kotlin.native.ignoreDisabledTargets=true + +# https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md +kotlin.native.binary.memoryModel=experimental +kotlin.native.binary.freezing=disabled kotlin.mpp.androidSourceSetLayoutVersion=2