-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a marker task for writing just product dependencies locks (#1178)
* Add a marker task for writing just product dependencies locks In some circumstances, it is useful to do just one type of lock writing at a time, without running everything that keys off of --write-locks. This is less common for product-dependencies.lock updates, which are now usually slower than other types, but this still comes in useful in certain situations. Adds a marker task named `writeProductDependenciesLocks`, matching the convention of `writeVersionsLocks` in gradle-consistent-versions. This modifies the behavior of the existing createManifest tasks. Co-authored-by: Alex Landau <[email protected]> Co-authored-by: svc-changelog <[email protected]> Co-authored-by: Eric Sword <[email protected]>
- Loading branch information
1 parent
80d1287
commit 9e5f82c
Showing
6 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: improvement | ||
improvement: | ||
description: Add a new `writeProductDependenciesLocks` task that allows writing | ||
out the `product-dependencies.lock` files without running `--write-locks` and | ||
possibly triggering undesirable code paths from other gradle plugins. | ||
links: | ||
- https://github.com/palantir/sls-packaging/pull/1178 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...src/main/java/com/palantir/gradle/dist/tasks/WriteProductDependenciesLocksMarkerTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* (c) Copyright 2021 Palantir Technologies Inc. All rights reserved. | ||
* | ||
* 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 com.palantir.gradle.dist.tasks; | ||
|
||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.GradleException; | ||
import org.gradle.api.tasks.TaskAction; | ||
|
||
public class WriteProductDependenciesLocksMarkerTask extends DefaultTask { | ||
@TaskAction | ||
public final void checkWriteLocksShouldBeRunning() { | ||
// Check that our task name matcher for writeProductDependenciesLocks is actually matching up the Gradle one; | ||
// if this task is running but we didn't actually write locks, error out. | ||
if (!CreateManifestTask.shouldWriteLocks(getProject())) { | ||
throw new GradleException("This `writeProductDependenciesLocks` marker task has been run, but the " | ||
+ "product-dependencies.lock files did not actually get written out at configuration time. Either " | ||
+ "there is another task dependency on this task, which is not supported " | ||
+ "(`writeProductDependenciesLocks` must be run as a gradle task from the command line - not as a " | ||
+ "dependent task), or this is a bug and should be reported to the owners of the " | ||
+ "gradle-sls-packaging plugin."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters