Skip to content

Commit 4860a4e

Browse files
authored
Merge pull request #697 from square/rick/artifacts-check
introduce `artifacts-check` plugin
2 parents 9f6a2d2 + ac9fa98 commit 4860a4e

File tree

10 files changed

+534
-1
lines changed

10 files changed

+534
-1
lines changed

.github/workflows/kotlin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
gradle-dependencies-cache-key : |
7979
gradle/libs.versions.toml
8080
arguments : |
81-
test apiCheck lint ktlintCheck jmhJar --no-daemon --stacktrace --continue
81+
test apiCheck artifactsCheck lint ktlintCheck jmhJar --no-daemon --stacktrace --continue
8282
concurrent : true
8383
gradle-build-scan-report : false
8484
gradle-distribution-sha-256-sum-warning : false

artifacts.json

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
[
2+
{
3+
"gradlePath": ":internal-testing-utils",
4+
"group": "com.squareup.workflow1",
5+
"artifactId": "workflow-internal-testing-utils",
6+
"description": "Workflow internal testing utilities",
7+
"packaging": "jar",
8+
"javaVersion": "1.8"
9+
},
10+
{
11+
"gradlePath": ":trace-encoder",
12+
"group": "com.squareup.workflow1",
13+
"artifactId": "trace-encoder",
14+
"description": "Trace Encoder",
15+
"packaging": "jar",
16+
"javaVersion": "1.8"
17+
},
18+
{
19+
"gradlePath": ":workflow-core",
20+
"group": "com.squareup.workflow1",
21+
"artifactId": "workflow-core-jvm",
22+
"description": "Workflow Core",
23+
"packaging": "jar",
24+
"javaVersion": "1.8"
25+
},
26+
{
27+
"gradlePath": ":workflow-runtime",
28+
"group": "com.squareup.workflow1",
29+
"artifactId": "workflow-runtime-jvm",
30+
"description": "Workflow Runtime",
31+
"packaging": "jar",
32+
"javaVersion": "1.8"
33+
},
34+
{
35+
"gradlePath": ":workflow-rx2",
36+
"group": "com.squareup.workflow1",
37+
"artifactId": "workflow-rx2",
38+
"description": "Workflow RxJava2",
39+
"packaging": "jar",
40+
"javaVersion": "1.8"
41+
},
42+
{
43+
"gradlePath": ":workflow-testing",
44+
"group": "com.squareup.workflow1",
45+
"artifactId": "workflow-testing-jvm",
46+
"description": "Workflow Testing",
47+
"packaging": "jar",
48+
"javaVersion": "1.8"
49+
},
50+
{
51+
"gradlePath": ":workflow-tracing",
52+
"group": "com.squareup.workflow1",
53+
"artifactId": "workflow-tracing",
54+
"description": "Workflow Tracing",
55+
"packaging": "jar",
56+
"javaVersion": "1.8"
57+
},
58+
{
59+
"gradlePath": ":workflow-ui:compose",
60+
"group": "com.squareup.workflow1",
61+
"artifactId": "workflow-ui-compose",
62+
"description": "Workflow UI Compose",
63+
"packaging": "aar",
64+
"javaVersion": "1.8"
65+
},
66+
{
67+
"gradlePath": ":workflow-ui:compose-tooling",
68+
"group": "com.squareup.workflow1",
69+
"artifactId": "workflow-ui-compose-tooling",
70+
"description": "Workflow UI Compose Tooling",
71+
"packaging": "aar",
72+
"javaVersion": "1.8"
73+
},
74+
{
75+
"gradlePath": ":workflow-ui:container-android",
76+
"group": "com.squareup.workflow1",
77+
"artifactId": "workflow-ui-container-android",
78+
"description": "Workflow UI Container Android",
79+
"packaging": "aar",
80+
"javaVersion": "1.8"
81+
},
82+
{
83+
"gradlePath": ":workflow-ui:container-common",
84+
"group": "com.squareup.workflow1",
85+
"artifactId": "workflow-ui-container-common-jvm",
86+
"description": "Workflow UI Container",
87+
"packaging": "jar",
88+
"javaVersion": "1.8"
89+
},
90+
{
91+
"gradlePath": ":workflow-ui:core-android",
92+
"group": "com.squareup.workflow1",
93+
"artifactId": "workflow-ui-core-android",
94+
"description": "Workflow UI Android",
95+
"packaging": "aar",
96+
"javaVersion": "1.8"
97+
},
98+
{
99+
"gradlePath": ":workflow-ui:core-common",
100+
"group": "com.squareup.workflow1",
101+
"artifactId": "workflow-ui-core-common-jvm",
102+
"description": "Workflow UI Core",
103+
"packaging": "jar",
104+
"javaVersion": "1.8"
105+
},
106+
{
107+
"gradlePath": ":workflow-ui:radiography",
108+
"group": "com.squareup.workflow1",
109+
"artifactId": "workflow-ui-radiography",
110+
"description": "Workflow UI Radiography Support",
111+
"packaging": "aar",
112+
"javaVersion": "1.8"
113+
}
114+
]

build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ buildscript {
2525
}
2626
}
2727

28+
plugins {
29+
base
30+
`artifacts-check`
31+
}
32+
2833
// See https://stackoverflow.com/questions/25324880/detect-ide-environment-with-gradle
2934
val isRunningFromIde get() = project.properties["android.injected.invoked.from.ide"] == "true"
3035

buildSrc/build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1+
@Suppress("UnstableApiUsage")
12
plugins {
23
`kotlin-dsl`
4+
alias(libs.plugins.google.ksp)
35
}
46

57
repositories {
68
mavenCentral()
9+
google()
10+
}
11+
12+
dependencies {
13+
compileOnly(gradleApi())
14+
15+
implementation(libs.squareup.moshi)
16+
implementation(libs.squareup.moshi.adapters)
17+
18+
ksp(libs.squareup.moshi.codegen)
19+
}
20+
21+
java {
22+
sourceCompatibility = JavaVersion.VERSION_1_8
23+
targetCompatibility = JavaVersion.VERSION_1_8
724
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import com.squareup.workflow1.buildsrc.artifacts.ArtifactsCheckTask
2+
import com.squareup.workflow1.buildsrc.artifacts.ArtifactsDumpTask
3+
4+
check(project.rootProject == project) {
5+
"Only apply this plugin to the project root."
6+
}
7+
8+
val artifactsDump by tasks.registering(ArtifactsDumpTask::class)
9+
10+
val artifactsCheck by tasks.registering(ArtifactsCheckTask::class)
11+
12+
// Automatically run `artifactsCheck` when running `check`
13+
tasks.named("check") {
14+
dependsOn(artifactsCheck)
15+
}
16+
17+
// Before any publishing task (local or remote) ensure that the artifacts check is executed.
18+
allprojects {
19+
tasks.withType(AbstractPublishToMaven::class.java) {
20+
dependsOn(artifactsCheck)
21+
}
22+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.squareup.workflow1.buildsrc.artifacts
2+
3+
import com.squareup.moshi.JsonClass
4+
import java.io.Serializable
5+
6+
/**
7+
* Models the module-specific properties of published maven artifacts.
8+
*
9+
* see (Niklas Baudy's
10+
* [gradle-maven-publish-plugin](https://github.com/vanniktech/gradle-maven-publish-plugin))
11+
*
12+
* @param gradlePath the path of the Gradle project, such as `:workflow-core`
13+
* @param group The maven "group", which should always be `com.squareup.workflow1`. This is the
14+
* `GROUP` property in the Gradle plugin.
15+
* @param artifactId The maven "module", such as `workflow-core-jvm`. This is the
16+
* `POM_ARTIFACT_ID` property in the Gradle plugin.
17+
* @param description The description of this specific artifact, such as "Workflow Core". This is
18+
* the `POM_NAME` property in the Gradle plugin.
19+
* @param packaging `aar` or `jar`. This is the `POM_PACKAGING` property in the Gradle plugin.
20+
* @param javaVersion the java version of the artifact (typically 8 or 11). If not set
21+
* explicitly, this defaults to the JDK version used to build the artifact.
22+
*/
23+
@JsonClass(generateAdapter = true)
24+
data class ArtifactConfig(
25+
val gradlePath: String,
26+
val group: String,
27+
val artifactId: String,
28+
val description: String,
29+
val packaging: String,
30+
val javaVersion: String
31+
) : Serializable

0 commit comments

Comments
 (0)