Skip to content

Commit 50f70e9

Browse files
authored
Merge pull request #27 from Konyaco/refactor_project
Refactor Project
2 parents 7f53647 + 4a346b9 commit 50f70e9

File tree

51 files changed

+349
-408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+349
-408
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fun App() {
4545
}
4646
}
4747
```
48-
See [`example`](example) module for more details.
48+
See [`gallery`](gallery) module for more details.
4949

5050
- `FluentTheme()` is the context and entry point of the application, just like `MaterialTheme`
5151
- Components are under `component` package

build-plugin/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build/
2+
/.gradle/

build-plugin/build.gradle.kts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
plugins {
2+
`kotlin-dsl`
3+
`java-gradle-plugin`
4+
}
5+
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
dependencies {
11+
implementation(gradleApi())
12+
implementation(kotlin("gradle-plugin"))
13+
}
14+
15+
kotlin {
16+
java {
17+
toolchain {
18+
languageVersion.set(JavaLanguageVersion.of(17))
19+
}
20+
}
21+
}
22+
23+
gradlePlugin {
24+
plugins {
25+
create("BuildPlugin") {
26+
id = "com.konyaco.fluent.plugin.build"
27+
implementationClass = "com.konyaco.fluent.plugin.build.BuildPlugin"
28+
}
29+
}
30+
}

build-plugin/settings.gradle.kts

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.konyaco.fluent.plugin.build
2+
3+
import org.gradle.api.JavaVersion
4+
5+
object BuildConfig {
6+
7+
const val group = "com.konyaco"
8+
9+
const val packageName = "$group.fluent"
10+
11+
const val libraryVersion = "0.0.1-dev.6"
12+
13+
object Android {
14+
const val compileSdkVersion = 34
15+
16+
const val minSdkVersion = 24
17+
}
18+
19+
object Jvm {
20+
const val jvmToolchainVersion = 11
21+
val javaVersion = JavaVersion.VERSION_11
22+
}
23+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.konyaco.fluent.plugin.build
2+
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.api.publish.PublishingExtension
6+
import org.gradle.api.publish.maven.MavenPublication
7+
import org.gradle.api.tasks.bundling.Jar
8+
import org.gradle.kotlin.dsl.create
9+
import org.gradle.kotlin.dsl.findByType
10+
import org.gradle.kotlin.dsl.withType
11+
import org.gradle.plugins.signing.SigningExtension
12+
13+
class BuildPlugin : Plugin<Project> {
14+
override fun apply(target: Project) {
15+
target.allprojects.forEach {
16+
it.afterEvaluate {
17+
18+
it.extensions.findByType<PublishingExtension>()?.apply {
19+
setupMavenPublishing(it)
20+
it.extensions.findByType<SigningExtension>()?.setupSigning(this)
21+
}
22+
}
23+
}
24+
}
25+
26+
private fun SigningExtension.setupSigning(publishing: PublishingExtension) {
27+
useInMemoryPgpKeys(
28+
System.getenv("SIGNING_KEY_ID"),
29+
System.getenv("SIGNING_KEY"),
30+
System.getenv("SIGNING_PASSWORD")
31+
)
32+
sign(publishing.publications)
33+
}
34+
35+
private fun PublishingExtension.setupMavenPublishing(target: Project) {
36+
val javadocJar = target.tasks.findByName("javadocJar") ?: target.tasks.create("javadocJar", Jar::class) {
37+
archiveClassifier.set("javadoc")
38+
}
39+
publications.withType<MavenPublication> {
40+
artifact(javadocJar)
41+
pom {
42+
name.set("compose-fluent-ui")
43+
description.set("A Fluent Design UI library for compose-multiplatform.")
44+
url.set("https://github.com/Konyaco/compose-fluent-ui")
45+
46+
licenses {
47+
license {
48+
name.set("The Apache License, Version 2.0")
49+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
50+
}
51+
}
52+
53+
developers {
54+
developer {
55+
name.set("Kon Yaco")
56+
email.set("[email protected]")
57+
url.set("https://github.com/Konyaco")
58+
}
59+
}
60+
61+
scm {
62+
url.set("https://github.com/Konyaco/compose-fluent-ui")
63+
connection.set("scm:git:git://github.com/Konyaco/compose-fluent-ui.git")
64+
developerConnection.set("scm:git:ssh://github.com/Konyaco/compose-fluent-ui.git")
65+
}
66+
}
67+
}
68+
repositories {
69+
maven {
70+
val releasesUrl ="https://s01.oss.sonatype.org/content/repositories/snapshots/"
71+
val snapshotsUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
72+
name = "OSSRH"
73+
url = target.uri(
74+
if (target.version.toString().endsWith("SNAPSHOT")) releasesUrl
75+
else snapshotsUrl
76+
)
77+
credentials {
78+
username = System.getenv("OSSRH_USERNAME")
79+
password = System.getenv("OSSRH_PASSWORD")
80+
}
81+
}
82+
}
83+
}
84+
}

build.gradle.kts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
import com.konyaco.fluent.plugin.build.BuildConfig
2+
13
plugins {
2-
kotlin("multiplatform") version "1.9.0" apply false
3-
id("org.jetbrains.compose") version "1.5.0" apply false
4-
id("com.android.library") version "7.4.2" apply false
5-
id("org.jetbrains.kotlin.android") version "1.9.0" apply false
4+
alias(libs.plugins.kotlin.multiplatform) apply false
5+
alias(libs.plugins.compose) apply false
6+
alias(libs.plugins.android.library) apply false
7+
alias(libs.plugins.android.application) apply false
8+
alias(libs.plugins.kotlin.android) apply false
9+
id("com.konyaco.fluent.plugin.build")
610
}
711

8-
group = "com.konyaco"
12+
group = BuildConfig.group
913

1014
allprojects {
1115
repositories {

example/android/.gitignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/android/build.gradle.kts

Lines changed: 0 additions & 56 deletions
This file was deleted.

example/android/src/main/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

example/android/src/main/res/values/themes.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.

example/common/build.gradle.kts

Lines changed: 0 additions & 38 deletions
This file was deleted.

example/common/src/androidMain/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
This file was deleted.

example/desktop/build.gradle.kts

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)