From 252cbcc4f9a9242dfc48c1b0596578f497ab0f3f Mon Sep 17 00:00:00 2001 From: Patrick Goldinger Date: Tue, 23 May 2023 02:29:33 +0200 Subject: [PATCH] Setup plugin library build system and manifest --- build.gradle.kts | 1 + gradle/libs.versions.toml | 1 + plugin/build.gradle.kts | 68 +++++++++++++++++++ plugin/src/main/AndroidManifest.xml | 17 +++++ .../florisboard/plugin/FlorisPluginService.kt | 21 ++++++ settings.gradle.kts | 1 + 6 files changed, 109 insertions(+) create mode 100644 plugin/build.gradle.kts create mode 100644 plugin/src/main/AndroidManifest.xml create mode 100644 plugin/src/main/kotlin/dev/patrickgold/florisboard/plugin/FlorisPluginService.kt diff --git a/build.gradle.kts b/build.gradle.kts index 75d82aa8..e38e8b70 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,7 @@ plugins { alias(libs.plugins.agp.application) apply false + alias(libs.plugins.agp.library) apply false alias(libs.plugins.agp.test) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.serialization) apply false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2bb4a4a1..42d8ccd7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -78,6 +78,7 @@ kotest-runner-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref [plugins] # Main agp-application = { id = "com.android.application", version.ref = "android-gradle-plugin" } +agp-library = { id = "com.android.library", version.ref = "android-gradle-plugin" } agp-test = { id = "com.android.test", version.ref = "android-gradle-plugin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts new file mode 100644 index 00000000..a38aa7a0 --- /dev/null +++ b/plugin/build.gradle.kts @@ -0,0 +1,68 @@ +/* + * Copyright 2023 Patrick Goldinger + * + * 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. + */ + +// Suppress needed until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed +@file:Suppress("DSL_SCOPE_VIOLATION") + +plugins { + alias(libs.plugins.agp.library) + alias(libs.plugins.kotlin.android) +} + +val projectCompileSdk: String by project +val projectMinSdk: String by project +val projectVersionName: String by project +val projectVersionNameSuffix: String by project + +android { + namespace = "dev.patrickgold.florisboard.plugin" + compileSdk = projectCompileSdk.toInt() + + defaultConfig { + minSdk = projectMinSdk.toInt() + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } + + sourceSets { + maybeCreate("main").apply { + java.srcDir("src/main/kotlin") + } + } +} + +dependencies { + // +} + +tasks.withType { + useJUnitPlatform() +} + +/*val sourcesJar = tasks.register("sourcesJar") { + archiveClassifier.set("sources") + from(android.sourceSets.getByName("main").java.srcDirs) +} + +mavenPublishing { + coordinates(projectGroupId, artifactId, projectVersion) +}*/ diff --git a/plugin/src/main/AndroidManifest.xml b/plugin/src/main/AndroidManifest.xml new file mode 100644 index 00000000..36b8eab3 --- /dev/null +++ b/plugin/src/main/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + diff --git a/plugin/src/main/kotlin/dev/patrickgold/florisboard/plugin/FlorisPluginService.kt b/plugin/src/main/kotlin/dev/patrickgold/florisboard/plugin/FlorisPluginService.kt new file mode 100644 index 00000000..5346d968 --- /dev/null +++ b/plugin/src/main/kotlin/dev/patrickgold/florisboard/plugin/FlorisPluginService.kt @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2023 Patrick Goldinger + * + * 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 dev.patrickgold.florisboard.plugin + +class FlorisPluginService { + // TODO +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 3cca8856..986db698 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -35,3 +35,4 @@ dependencyResolutionManagement { include(":app") include(":benchmark") +include(":plugin")