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

refactor #11

Merged
merged 1 commit into from
Jul 11, 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
16 changes: 10 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/.idea/
/build/
/.gradle/
/convention-plugins/.gradle/
/convention-plugins/build/
.envrc
*.iml
.gradle
.idea
.DS_Store
build
captures
.externalNativeBuild
.cxx
local.properties
xcuserdata
69 changes: 4 additions & 65 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,67 +1,6 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
kotlin("multiplatform") version "1.9.0"
id("com.android.library")
id("convention.publication")
}

group = "com.github.asm0dey"
version = "0.0.1.2"

repositories {
google()
mavenCentral()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
kotlin {
targetHierarchy.default()
jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
android {
publishLibraryVariants("release", "debug")
}
iosArm64 {
binaries {
framework {
baseName = "library"
}
}
}
iosSimulatorArm64() {
binaries {
framework {
baseName = "library"
}
}
}
linuxX64()
sourceSets {
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
}
}

android {
namespace = "com.github.asm0dey.dummylib"
compileSdk = 33
defaultConfig {
minSdk = 24
targetSdk = 33
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
}
}
id("root.publication")
//trick: for the same plugin versions in all sub-modules
alias(libs.plugins.androidLibrary).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
}
8 changes: 2 additions & 6 deletions convention-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
plugins {
`kotlin-dsl` // Is needed to turn our build logic written in Kotlin into the Gradle Plugin
}

repositories {
gradlePluginPortal() // To use 'maven-publish' and 'signing' plugins in our own plugin
`kotlin-dsl`
}

dependencies {
implementation("io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.gradle.plugin:2.0.0-rc-1")
implementation(libs.nexus.publish)
}
21 changes: 21 additions & 0 deletions convention-plugins/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
}

dependencyResolutionManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.`maven-publish`
import org.gradle.kotlin.dsl.signing

plugins {
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin")
}

group = "com.github.asm0dey.dummylib"
version = "0.0.1"

val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}

nexusPublishing {
// Configure maven central repository
repositories {
sonatype()
}


// Configure all publications
}

publishing {
// Configure all publications
publications.withType<MavenPublication> {
// Stub javadoc.jar artifact
artifact(javadocJar.get())
Expand Down Expand Up @@ -55,10 +46,12 @@ publishing {
}
}

val gpgKeyId by extra { System.getenv("secrets.OSSRH_GPG_SECRET_KEY_ID") }
val gpgKey by extra { System.getenv("secrets.OSSRH_GPG_SECRET_KEY") }
val gpgKeyPassword by extra { System.getenv("secrets.OSSRH_GPG_SECRET_KEY_PASSWORD") }
val gpgKeyId by extra { System.getenv("secrets.OSSRH_GPG_SECRET_KEY_ID") ?: "" }
val gpgKey by extra { System.getenv("secrets.OSSRH_GPG_SECRET_KEY") ?: "" }
val gpgKeyPassword by extra { System.getenv("secrets.OSSRH_GPG_SECRET_KEY_PASSWORD") ?: "" }
signing {
useGpgCmd()
sign(publishing.publications)
}
if (gpgKeyId.isNotEmpty()) {
useGpgCmd()
sign(publishing.publications)
}
}
11 changes: 11 additions & 0 deletions convention-plugins/src/main/kotlin/root.publication.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id("io.github.gradle-nexus.publish-plugin")
}

nexusPublishing {
// Configure maven central repository
// https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
repositories {
sonatype()
}
}
18 changes: 13 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
kotlin.code.style=official
kotlin.mpp.androidSourceSetLayoutVersion=2
android.useAndroidX=true
org.gradle.jvmargs=-Xmx4096m
# Improves build time via enabling the gradle build cache
#Gradle
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
org.gradle.caching=true
org.gradle.configuration-cache=true

#Kotlin
kotlin.code.style=official
kotlin.js.compiler=ir

#MPP
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.androidSourceSetLayoutVersion=2

#Android
android.useAndroidX=true
android.nonTransitiveRClass=true
14 changes: 14 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[versions]
agp = "8.0.2"
kotlin = "1.9.0"
nexus-publish = "2.0.0-rc-1"
android-minSdk = "24"
android-compileSdk = "33"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
nexus-publish = { module = "io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.gradle.plugin", version.ref = "nexus-publish" }

[plugins]
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
43 changes: 43 additions & 0 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
id("module.publication")
}

kotlin {
targetHierarchy.default()
jvm()
androidTarget {
publishLibraryVariants("release", "debug")
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
iosX64()
iosArm64()
iosSimulatorArm64()
linuxX64()

sourceSets {
val commonMain by getting {
dependencies {
//put your multiplatform dependencies here
}
}
val commonTest by getting {
dependencies {
implementation(libs.kotlin.test)
}
}
}
}

android {
namespace = "com.github.asm0dey.dummylib"
compileSdk = libs.versions.android.compileSdk.get().toInt()
defaultConfig {
minSdk = libs.versions.android.minSdk.get().toInt()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ class FibiTest {
fun `test 3rd element`(){
assertEquals(7, fibi.take(3).last())
}
}
}
File renamed without changes.
6 changes: 0 additions & 6 deletions renovate.json

This file was deleted.

16 changes: 9 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
pluginManagement {
includeBuild("convention-plugins")
repositories {
google()
gradlePluginPortal()
mavenCentral()
}
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "com.android") {
useModule("com.android.tools.build:gradle:7.4.1")
}
}
}

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}

rootProject.name = "dummylib-multiplatform"
includeBuild("convention-plugins")
include(":library")
Empty file removed src/androidUnitTest/.nop
Empty file.
Empty file removed src/commonTest/.nop
Empty file.
Empty file removed src/iosArm64Test/.nop
Empty file.
9 changes: 0 additions & 9 deletions src/iosArm64Test/kotlin/FibiTest.kt

This file was deleted.

2 changes: 0 additions & 2 deletions src/iosSimulatorArm64Main/kotlin/firstElement.kt

This file was deleted.

Empty file removed src/jvmTest/.nop
Empty file.
3 changes: 0 additions & 3 deletions src/main/AndroidManifest.xml

This file was deleted.