Skip to content

Commit 8b4ff1c

Browse files
committed
Brush up deployment tasks so that no dependencies get lost
A dependent task for bintrayUpload will overwrite the copied POM, which has missing runtime dependencies.
1 parent bbc8c5b commit 8b4ff1c

File tree

2 files changed

+17
-57
lines changed

2 files changed

+17
-57
lines changed

.circleci/config.yml

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -102,100 +102,53 @@ jobs:
102102
path: instrumentation/runner/build/reports
103103
destination: instrumentation-runner
104104

105-
deploy_plugin_snapshots:
105+
deploy_plugin:
106106
<<: *defaults
107107
steps:
108108
- attach_workspace:
109109
at: ~/root
110110
- restore_cache:
111111
<<: *cache_key
112112
- run:
113-
name: (Plugin) Deploy SNAPSHOTs
114-
command: cd plugin && ./gradlew publishLibraryPublicationToSnapshotRepository --stacktrace --no-daemon
113+
name: (Plugin) Deploy
114+
command: cd plugin && ./gradlew deploy --stacktrace --no-daemon
115115
- store_artifacts:
116116
path: plugin/android-junit5/build/publications
117117
destination: plugin/publications/snapshots
118118

119-
deploy_instrumentation_snapshots:
119+
deploy_instrumentation:
120120
<<: *defaults
121121
steps:
122122
- attach_workspace:
123123
at: ~/root
124124
- restore_cache:
125125
<<: *cache_key
126126
- run:
127-
name: (Instrumentation) Deploy SNAPSHOTs
128-
command: cd instrumentation && ./gradlew publishLibraryPublicationToSnapshotRepository --stacktrace --no-daemon
127+
name: (Instrumentation) Deploy
128+
command: cd instrumentation && ./gradlew deploy --stacktrace --no-daemon
129129
- store_artifacts:
130130
path: instrumentation/core/build/publications
131131
destination: instrumentation-core/publications/snapshots
132132
- store_artifacts:
133133
path: instrumentation/runner/build/publications
134134
destination: instrumentation-runner/publications/snapshots
135135

136-
deploy_plugin_release:
137-
<<: *defaults
138-
steps:
139-
- attach_workspace:
140-
at: ~/root
141-
- restore_cache:
142-
<<: *cache_key
143-
- run:
144-
name: (Plugin) Deploy
145-
command: cd plugin && ./gradlew generatePomFileForLibraryPublication publish :android-junit5:bintrayUpload --stacktrace --no-daemon
146-
- store_artifacts:
147-
path: plugin/android-junit5/build/publications
148-
destination: plugin/publications/releases
149-
150-
deploy_instrumentation_release:
151-
<<: *defaults
152-
steps:
153-
- attach_workspace:
154-
at: ~/root
155-
- restore_cache:
156-
<<: *cache_key
157-
- run:
158-
name: (Instrumentation) Deploy
159-
command: cd instrumentation && ./gradlew generatePomFileForLibraryPublication publish :api:bintrayUpload :core:bintrayUpload :runner:bintrayUpload --stacktrace --no-daemon
160-
- store_artifacts:
161-
path: instrumentation/core/build/publications
162-
destination: instrumentation-core/publications/releases
163-
- store_artifacts:
164-
path: instrumentation/runner/build/publications
165-
destination: instrumentation-runner/publications/releases
166-
167136
workflows:
168137
version: 2
169138

170139
build_deploy:
171140
jobs:
172141
- build_plugin
173142
- build_instrumentation
174-
- deploy_plugin_snapshots:
175-
requires:
176-
- build_plugin
177-
filters:
178-
branches:
179-
only: master
180-
- deploy_instrumentation_snapshots:
181-
requires:
182-
- build_instrumentation
183-
filters:
184-
branches:
185-
only: master
186-
- deploy_plugin_release:
143+
- deploy_plugin:
187144
requires:
188145
- build_plugin
189146
filters:
190147
branches:
191148
only: master
192-
tags:
193-
only: plugin-*
194-
- deploy_instrumentation_release:
149+
- deploy_instrumentation:
195150
requires:
196151
- build_instrumentation
197152
filters:
198153
branches:
199154
only: master
200-
tags:
201-
only: instrumentation-*

gradle/deployment.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ task copyPom(type: Copy) {
100100
include "pom-default.xml"
101101
}
102102

103-
publish.dependsOn copyPom
104-
105103
// ------------------------------------------------------------------------------------------------
106104
// Target Configuration
107105
// ------------------------------------------------------------------------------------------------
108106

107+
// Unified task for snapshots & releases
108+
task deploy() {
109+
}
110+
109111
project.configure(project) {
110112
if (project.version.endsWith("-SNAPSHOT")) {
111113
// Configure deployment of snapshot versions to Sonatype OSS
@@ -122,6 +124,8 @@ project.configure(project) {
122124
}
123125
}
124126
project.tasks.getByName("bintrayUpload").enabled = false
127+
publish.dependsOn copyPom
128+
deploy.finalizedBy "publishLibraryPublicationToSnapshotRepository"
125129

126130
} else {
127131
// Configure deployment of release versions to Bintray
@@ -152,5 +156,8 @@ project.configure(project) {
152156
}
153157
}
154158
}
159+
// Very important! Otherwise, the POM will be overwritten & have missing dependencies
160+
project.tasks.getByName("install").finalizedBy copyPom
161+
deploy.finalizedBy "generatePomFileForLibraryPublication", "publish", "bintrayUpload"
155162
}
156163
}

0 commit comments

Comments
 (0)