Skip to content

Commit

Permalink
Mirego-base-setup 1 of X: Base setup (#46)
Browse files Browse the repository at this point in the history
* Trikot + Kword + Koin/KSP

* oups

* Fix CI

* Fix CI by ignoring POST_NOTIFICATIONS warning for picasso

* Fix CI by ignoring POST_NOTIFICATIONS warning for picasso

* Fix CI by ignoring POST_NOTIFICATIONS warning for picasso

---------

Co-authored-by: Steven de Tilly <[email protected]>
  • Loading branch information
OlivierPineau and sdetilly authored Nov 21, 2023
1 parent 0d56f4b commit 652fc2e
Show file tree
Hide file tree
Showing 16 changed files with 219 additions and 22 deletions.
6 changes: 6 additions & 0 deletions androidApp/android_picasso_lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<lint>
<issue id="NotificationPermission">
<ignore regexp="com.squareup.picasso.RemoteViewsAction.NotificationAction" />
</issue>
</lint>
20 changes: 19 additions & 1 deletion androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ android {
namespace = "com.mirego.kmp.boilerplate"
compileSdk = 34
defaultConfig {
minSdk = 21
minSdk = 28
targetSdk = 34

applicationId = "com.mirego.kmp.boilerplate"
versionCode = 1
versionName = "0.1"

val translationFilePath = "${project.rootDir}/shared/src/commonMain/resources/translations/translation.en.json"
buildConfigField("String", "KWORD_TRANSLATION_FILE_PATH", "\"$translationFilePath\"")
}
buildTypes {
debug {
Expand Down Expand Up @@ -46,6 +49,16 @@ android {
// See https://github.com/Kotlin/kotlinx.coroutines#avoiding-including-the-debug-infrastructure-in-the-resulting-apk
resources.excludes += "DebugProbesKt.bin"
}

sourceSets {
getByName("main") {
resources.srcDirs("../shared/src/commonMain/resources")
}
}

lint {
lintConfig = file("$rootDir/androidApp/android_picasso_lint.xml")
}
}

dependencies {
Expand All @@ -58,4 +71,9 @@ dependencies {
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.material)
implementation(libs.koin.android)
implementation(libs.koin.androidx.compose)
implementation(libs.koin.androidx.compose.navigation)
implementation(libs.trikot.viewmodels.databinding)
implementation(libs.trikot.vmd.compose)
}
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
alias(libs.plugins.kotlin.native.cocoapods) apply false
alias(libs.plugins.serialization) apply false
alias(libs.plugins.ktlint) apply false

alias(libs.plugins.owasp.dependencycheck)
}

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"
#Kotlin
kotlin.code.style=official
#Android
android.defaults.buildfeatures.buildconfig=true
android.useAndroidX=true
#MPP
kotlin.mpp.androidSourceSetLayoutVersion=2
Expand Down
26 changes: 25 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ androidGradlePlugin = "8.1.2"
androidxActivityCompose = "1.8.0"
androidxAppcompat = "1.6.1"
androidxComposeBom = "2023.10.01"
koin = "3.5.0"
koin-android = "3.5.0"
koin-androidx-compose = "3.5.0"
koin_ksp = "1.1.0"
ksp = "1.9.10-1.0.13"
kotlin = "1.9.10"
kotlinxCoroutines = "1.7.3"
kotlinxSerialization = "1.6.0"
kword-plugin = "4.0.0"
ktlint = "11.6.1"
owasp = "8.4.2"
trikot = "5.2.0"

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidxActivityCompose" }
Expand All @@ -16,18 +24,34 @@ androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", versi
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-compose-material = { group = "androidx.compose.material", name = "material" }
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-annotations = { module = "io.insert-koin:koin-annotations", version.ref = "koin_ksp" }
ksp-koinCompiler = { module = "io.insert-koin:koin-ksp-compiler", version.ref = "koin_ksp" }
koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin-android" }
koin-androidx-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koin-androidx-compose" }
koin-androidx-compose-navigation = { module = "io.insert-koin:koin-androidx-compose-navigation", version.ref = "koin-androidx-compose" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }

trikot-vmd = { module = "com.mirego.trikot:viewmodels-declarative-flow", version.ref = "trikot" }
trikot-kword = { module = "com.mirego.trikot:kword", version.ref = "trikot" }
trikot-datasources = { module = "com.mirego.trikot:datasources-flow", version.ref = "trikot" }
trikot-viewmodels-databinding = { module = "com.mirego.trikot:viewmodels-databinding", version.ref = "trikot" }
trikot-vmd-compose = { module = "com.mirego.trikot:viewmodels-declarative-compose-flow", version.ref = "trikot" }
trikot-vmd-annotations = { module = "com.mirego.trikot:viewmodels-annotations", version.ref = "trikot" }
trikot-vmd-annotations-compiler = { module = "com.mirego.trikot:viewmodels-declarative-compiler-flow", version.ref = "trikot" }

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kspPlugin = { id = "com.google.devtools.ksp", version.ref = "ksp" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
owasp-dependencycheck = { id = "org.owasp.dependencycheck", version = "8.4.2" }
mirego-kwordPlugin = { id = "mirego.kword", version.ref = "kword-plugin" }
owasp-dependencycheck = { id = "org.owasp.dependencycheck", version.ref = "owasp" }
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

[bundles]
Expand Down
17 changes: 14 additions & 3 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
require_relative './podspec_versions.rb'
install! 'cocoapods', :warn_for_unused_master_specs_repo => false
$deploymentTarget = '15.0'
platform :ios, $deploymentTarget
inhibit_all_warnings!

target 'iosApp' do
use_frameworks!
platform :ios, '15.0'
pod 'Shared', :path => '../shared'
platform :ios, $deploymentTarget
pod 'Shared', :path => '../shared'

ENV['TRIKOT_FRAMEWORK_NAME']='Shared'
properties = load_properties('../gradle/libs.versions.toml')
pod 'Trikot/viewmodels.declarative.SwiftUI.flow', :git => '[email protected]:mirego/trikot.git', :tag => properties['trikot']
pod 'Trikot/kword', :git => '[email protected]:mirego/trikot.git', :tag => properties['trikot']

pod 'SwiftLint'
pod 'SwiftLint'
end

post_install do |installer|
Expand Down
34 changes: 30 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
PODS:
- Kingfisher (7.8.1)
- Shared (0.1)
- SwiftLint (0.52.4)
- SwiftLint (0.53.0)
- SwiftUIIntrospect (1.1.0)
- Trikot/kword (5.2.0):
- Shared
- Trikot/viewmodels.declarative.flow (5.2.0):
- Shared
- Trikot/viewmodels.declarative.SwiftUI.flow (5.2.0):
- Kingfisher (~> 7.8.1)
- Shared
- SwiftUIIntrospect (~> 1.0)
- Trikot/viewmodels.declarative.flow

DEPENDENCIES:
- Shared (from `../shared`)
- SwiftLint
- "Trikot/kword (from `[email protected]:mirego/trikot.git`, tag `5.2.0`)"
- "Trikot/viewmodels.declarative.SwiftUI.flow (from `[email protected]:mirego/trikot.git`, tag `5.2.0`)"

SPEC REPOS:
trunk:
- Kingfisher
- SwiftLint
- SwiftUIIntrospect

EXTERNAL SOURCES:
Shared:
:path: "../shared"
Trikot:
:git: "[email protected]:mirego/trikot.git"
:tag: 5.2.0

CHECKOUT OPTIONS:
Trikot:
:git: "[email protected]:mirego/trikot.git"
:tag: 5.2.0

SPEC CHECKSUMS:
Shared: 9cee99d7ec6f327294a149403bec06a18fc5db29
SwiftLint: 1cc5cd61ba9bacb2194e340aeb47a2a37fda00b3
Kingfisher: 63f677311d36a3473f6b978584f8a3845d023dc5
Shared: 185e58fd174d1d4b955d7581bc1bacb9810272fa
SwiftLint: 5ce4d6a8ff83f1b5fd5ad5dbf30965d35af65e44
SwiftUIIntrospect: 53b6a16734c822804ff82c35d9073d8d8edfb085
Trikot: ca201c8ae67ff21f35a60a0bda6c600fbe51b282

PODFILE CHECKSUM: 83ebf5d7b61ce65029f18160027c7392430ee27f
PODFILE CHECKSUM: b62596630d9100fb9a2c6dce86f50d0bc9944b74

COCOAPODS: 1.13.0
18 changes: 18 additions & 0 deletions ios/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
FA7C6C218E43EC797272100C /* Frameworks */,
AA1E76016DFABDB8F08174B0 /* [CP] Embed Pods Frameworks */,
BCE1AE6C2922BB2E00EBCEC6 /* Run SwiftLint */,
9C1ADF74E9B736E3CC05F753 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -195,6 +196,23 @@
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;
};
9C1ADF74E9B736E3CC05F753 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources.sh\"\n";
showEnvVarsInLog = 0;
};
AA1E76016DFABDB8F08174B0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
2 changes: 1 addition & 1 deletion ios/iosApp/Utils/FlowUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class ObservableFlowWrapper<T: AnyObject>: ObservableObject {

@Published public private(set) var value: T

private var watcher: Closeable?
private var watcher: Closeable_?

public init(_ flow: CFlow<T>, initial value: T) {
self.value = value
Expand Down
17 changes: 17 additions & 0 deletions ios/podspec_versions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def load_properties(properties_filename)
properties = {}
File.open(properties_filename, 'r') do |properties_file|
properties_file.read.each_line do |line|
line.strip!
if (line[0] != ?# and line[0] != ?=)
i = line.index('=')
if (i)
properties[line[0..i - 1].strip] = line[i + 1..-1].strip.delete('\"')
else
properties[line] = ''
end
end
end
end
properties
end
9 changes: 9 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ pluginManagement {
google()
gradlePluginPortal()
mavenCentral()
maven("https://s3.amazonaws.com/mirego-maven/public")
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "mirego") {
useModule("mirego:${requested.id.name}-plugin:${requested.version}")
}
}
}
}
}

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven("https://s3.amazonaws.com/mirego-maven/public")
}
}

Expand Down
9 changes: 6 additions & 3 deletions shared/Shared.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Pod::Spec.new do |spec|
spec.homepage = 'https://github.com/mirego/your-project'
spec.source = { :http=> ''}
spec.authors = ''
spec.license = ''
spec.summary = 'Project summary'
spec.license = 'BSD-3'
spec.summary = 'Shared'
spec.vendored_frameworks = 'build/cocoapods/framework/Shared.framework'
spec.libraries = 'c++'

Expand Down Expand Up @@ -35,5 +35,8 @@ Pod::Spec.new do |spec|
SCRIPT
}
]

spec.resources = "src/commonMain/resources/translations/*"
spec.prepare_command = <<-CMD
../gradlew :shared:generateDummyFramework
CMD
end
Loading

0 comments on commit 652fc2e

Please sign in to comment.