Skip to content

Commit

Permalink
Local publication (#12)
Browse files Browse the repository at this point in the history
* Adapted configuration to maven local publication

* Changed library import in examples
  • Loading branch information
tmaxxdd authored Sep 16, 2023
1 parent de08f48 commit a5cc78b
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 14 deletions.
68 changes: 68 additions & 0 deletions .run/androidExample.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="androidExample" type="AndroidRunConfigurationType" factoryName="Android App">
<module name="KodeView.androidExample.main" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="CLEAR_APP_STORAGE" value="false" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Java" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Hybrid>
<Java>
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Java>
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
10 changes: 10 additions & 0 deletions .run/desktopExample.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="desktopExample" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="dev.snipme.desktopexample.MainKt" />
<module name="KodeView.desktopExample.main" />
<shortenClasspath name="NONE" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
7 changes: 7 additions & 0 deletions .run/iosExample.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="iosExample" type="KmmRunConfiguration" factoryName="iOS Application" CONFIG_VERSION="1" EXEC_TARGET_ID="BB27C957-E8E5-4D97-B638-2A8A605B5FF8" XCODE_PROJECT="$PROJECT_DIR$/iosExample/iosExample.xcodeproj" XCODE_CONFIGURATION="Debug" XCODE_SCHEME="iosExample">
<method v="2">
<option name="com.jetbrains.kmm.ios.BuildIOSAppTask" enabled="true" />
</method>
</configuration>
</component>
23 changes: 23 additions & 0 deletions .run/webExample.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="webExample" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="jsBrowserRun" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion androidExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ android {

dependencies {
// Core
implementation(project(path = ":shared"))
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
// Compose
Expand All @@ -58,4 +57,5 @@ dependencies {
implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
implementation("dev.snipme:kodeview:0.4.0")
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ plugins {
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
}
2 changes: 1 addition & 1 deletion desktopExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ plugins {
}

dependencies {
implementation(project(path = ":shared"))
implementation(compose.runtime)
implementation(compose.foundation)
implementation(compose.material)
Expand All @@ -14,6 +13,7 @@ dependencies {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(compose.desktop.currentOs)
implementation("dev.snipme:kodeview:0.4.0")
}

compose.desktop {
Expand Down
10 changes: 5 additions & 5 deletions iosExample/iosExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n";
shellScript = "cd \"$SRCROOT/..\"\n./gradlew kodeview:embedAndSignAppleFrameworkForXcode\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -455,7 +455,7 @@
DEVELOPMENT_TEAM = 6AY68V2B3P;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../kodeview/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GENERATE_INFOPLIST_FILE = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
Expand All @@ -475,7 +475,7 @@
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
shared,
kodeview,
);
PRODUCT_BUNDLE_IDENTIFIER = dev.snipme.iosExample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -499,7 +499,7 @@
DEVELOPMENT_TEAM = 6AY68V2B3P;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../kodeview/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)";
GENERATE_INFOPLIST_FILE = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
Expand All @@ -519,7 +519,7 @@
OTHER_LDFLAGS = (
"$(inherited)",
"-framework",
shared,
kodeview,
);
PRODUCT_BUNDLE_IDENTIFIER = dev.snipme.iosExample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<dict>
<key>SchemeUserState</key>
<dict>
<key>iosExample.xcscheme_^#kodeview#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>iosExample.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
Expand Down
2 changes: 1 addition & 1 deletion iosExample/iosExample/CodeTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import shared
import kodeview

// Omit KMM library prefixing
typealias Highlights = HighlightsHighlights
Expand Down
2 changes: 1 addition & 1 deletion iosExample/iosExample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import shared
import kodeview

typealias SyntaxLanguage = HighlightsSyntaxLanguage
typealias SyntaxTheme = HighlightsSyntaxTheme
Expand Down
57 changes: 55 additions & 2 deletions shared/build.gradle.kts → kodeview/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ plugins {
alias(libs.plugins.multiplatform)
alias(libs.plugins.android.library)
alias(libs.plugins.compose)
id("maven-publish")
}

group = "dev.snipme"
version = "0.3.1"
version = "0.4.0"

android {
namespace = "dev.snipme.kodeview"
Expand Down Expand Up @@ -38,11 +39,63 @@ kotlin {
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "shared"
baseName = "kodeview"
isStatic = true
}
}

publishing {
val emptyJar = tasks.register<Jar>("emptyJar") {
archiveAppendix.set("empty")
}

publications.forEach {
val publication = it as? MavenPublication ?: return@forEach

publication.artifact(emptyJar) {
classifier = "javadoc"
}

publication.pom.withXml {
val root = asNode()
root.appendNode("name", "kodeview")
root.appendNode(
"description",
"Kotlin Multiplatform syntax highlighting views"
)
root.appendNode("url", "https://github.com/SnipMeDev/KodeView")

root.appendNode("licenses").apply {
appendNode("license").apply {
appendNode("name", "The Apache Software License, Version 2.0")
appendNode("url", "https://www.apache.org/licenses/LICENSE-2.0.txt")
appendNode("distribution", "repo")
}
}

root.appendNode("developers").apply {
appendNode("developer").apply {
appendNode("id", "tkadziolka")
appendNode("name", "Tomasz Kądziołka")
appendNode("email", "kontakt@tkadziolka.pl")
}
}

root.appendNode("scm").apply {
appendNode(
"connection",
"scm:git:ssh://git@github.com:SnipMeDev/KodeView.git"
)
appendNode(
"developerConnection",
"scm:git:ssh://git@github.org:SnipMeDev/KodeView.git",
)
appendNode("url", "https://github.com/SnipMeDev/KodeView")
}
}
}
}

sourceSets {
// Common
val commonMain by getting {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencyResolutionManagement {
}

rootProject.name = "KodeView"
include(":shared")
include(":kodeview")
include(":androidExample")
include(":desktopExample")
include(":webExample")
4 changes: 2 additions & 2 deletions webExample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ kotlin {
sourceSets {
val jsMain by getting {
dependencies {
implementation(project(":shared"))
implementation(compose.ui)
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.material3)
implementation("dev.snipme:kodeview:0.4.0")
}
}
}
}

compose.experimental {
web.application {}
}
}

0 comments on commit a5cc78b

Please sign in to comment.