Created
September 27, 2022 19:33
-
-
Save ghale/8ffdff4756ac4e48e5fe414c86dfcad0 to your computer and use it in GitHub Desktop.
Custom metadata rule to select a specific minor version of a library
This file contains hidden or 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
repositories { | |
mavenCentral() | |
} | |
configurations { | |
foo | |
} | |
dependencies { | |
foo 'org.scala-lang:scala-library:latest.2_12' | |
foo 'org.scala-lang:scala-reflect:2.12.8' | |
} | |
@CacheableRule | |
abstract class CustomStatusRule implements ComponentMetadataRule { | |
void execute(ComponentMetadataContext context) { | |
if (context.details.id.name == 'scala-library' | |
&& context.details.id.version.startsWith('2.12.')) { | |
context.details.statusScheme = ["release", "2_12"] | |
context.details.status = "2_12" | |
} | |
} | |
} | |
dependencies { | |
components { | |
all(CustomStatusRule) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment