Skip to content

Commit 3dc7f60

Browse files
committed
把passes也作为库发布
1 parent 8e6c4a7 commit 3dc7f60

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = "com.github.luiox"
9-
version = "1.6"
9+
version = "1.8"
1010

1111
subprojects {
1212
apply(plugin = "java")

morpher-api/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ tasks {
4343
publishing {
4444
publications {
4545
create<MavenPublication>("mavenJava") {
46-
groupId = "com.github.luiox"
4746
artifactId = "morpher-api"
48-
version = "1.8"
47+
groupId = project.group.toString()
48+
version = project.version.toString()
4949

5050
artifact(jar)
51-
// from(components["java"])
51+
5252
pom.withXml {
5353
val dependenciesNode = asNode().appendNode("dependencies")
5454

morpher-passes/build.gradle.kts

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
plugins {
22
id("java")
3+
id("maven-publish")
34
}
45

56
description = "some generic passes"
6-
group = "com.github.luiox"
7-
version = "1.0-SNAPSHOT"
87

98
repositories {
109
mavenCentral()
@@ -15,8 +14,20 @@ dependencies {
1514
testImplementation(platform("org.junit:junit-bom:${properties["junit_version"] as String}"))
1615
testImplementation("org.junit.jupiter:junit-jupiter")
1716

18-
implementation("com.github.luiox:morpher-api:v1.6")
19-
// implementation(project(":morpher-api"))
17+
implementation("org.ow2.asm:asm:${properties["asm_version"] as String}")
18+
implementation("org.ow2.asm:asm-tree:${properties["asm_version"] as String}")
19+
implementation("org.ow2.asm:asm-commons:${properties["asm_version"] as String}")
20+
implementation("org.ow2.asm:asm-analysis:${properties["asm_version"] as String}")
21+
implementation("org.ow2.asm:asm-util:${properties["asm_version"] as String}")
22+
23+
implementation("ch.qos.logback:logback-classic:${properties["logback_version"] as String}")
24+
implementation("ch.qos.logback:logback-core:${properties["logback_version"] as String}")
25+
26+
implementation("org.jetbrains:annotations:${properties["jetbrains_annotations_version"] as String}")
27+
28+
// implementation("com.github.luiox:morpher-api:v1.6")
29+
implementation(project(":morpher-api"))
30+
2031
}
2132

2233
tasks{
@@ -26,7 +37,37 @@ tasks{
2637
}
2738
}
2839

40+
jar {
41+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
42+
}
43+
2944
test {
3045
useJUnitPlatform()
3146
}
47+
48+
publishing {
49+
publications {
50+
create<MavenPublication>("mavenJava") {
51+
artifactId = "morpher-passes"
52+
groupId = project.group.toString()
53+
version = project.version.toString()
54+
55+
artifact(jar)
56+
57+
pom.withXml {
58+
val dependenciesNode = asNode().appendNode("dependencies")
59+
60+
// 遍历项目依赖并添加到 POM
61+
project.configurations.implementation.get().allDependencies.forEach { dep ->
62+
if (dep.group != null) { // 过滤掉没有 group 的依赖(如本地项目)
63+
val dependencyNode = dependenciesNode.appendNode("dependency")
64+
dependencyNode.appendNode("groupId", dep.group)
65+
dependencyNode.appendNode("artifactId", dep.name)
66+
dependencyNode.appendNode("version", dep.version ?: "")
67+
}
68+
}
69+
}
70+
}
71+
}
72+
}
3273
}

0 commit comments

Comments
 (0)