Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Kotlin property assignment in the dependency management DSL #385

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ dependencyManagement {
.Kotlin
----
dependencyManagement {
overriddenByDependencies(false)
isOverriddenByDependencies = false
}
----

Expand Down Expand Up @@ -782,7 +782,7 @@ dependencyManagement {
.Kotlin
----
dependencyManagement {
applyMavenExclusions(false)
isApplyMavenExclusions = false
}
----

Expand Down Expand Up @@ -864,7 +864,7 @@ dependencyManagement {
----
dependencyManagement {
generatedPomCustomization {
enabled(false)
isEnabled = false
}
}
----
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,6 +28,7 @@
* Extension that provides the entry point to the dependency management plugin's DSL.
*
* @author Andy Wilkinson
* @author Yanming Zhou
*/
public interface DependencyManagementExtension extends DependencyManagementHandler {

Expand Down Expand Up @@ -68,6 +69,14 @@ public interface DependencyManagementExtension extends DependencyManagementHandl
*/
PomDependencyManagementConfigurer getPomConfigurer();

/**
* Whether or not Maven-style exclusions should be applied during dependency
* resolutions. The default is {@code true}.
* @return whether or not Maven-style exclusions should be applied during dependency
* resolutions.
*/
boolean isApplyMavenExclusions();

/**
* Set whether or not Maven-style exclusions should be applied during dependency
* resolutions. The default is {@code true}.
Expand All @@ -84,6 +93,14 @@ public interface DependencyManagementExtension extends DependencyManagementHandl
*/
void applyMavenExclusions(boolean applyMavenExclusions);

/**
* Whether dependency management should be overridden by versions declared on a
* project's dependencies. The default is {@code true}.
* @return Whether dependency management should be overridden by versions declared on
* a project's dependencies.
*/
boolean isOverriddenByDependencies();

/**
* Set whether dependency management should be overridden by versions declared on a
* project's dependencies. The default is {@code true}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,9 +20,17 @@
* A handler for configuring the customization of generated POMs.
*
* @author Andy Wilkinson
* @author Yanming Zhou
*/
public interface GeneratedPomCustomizationHandler {

/**
* Whether or not customization of generated poms is enabled. Defaults to
* {@code true}.
* @return whether or not customization is enabled
*/
boolean isEnabled();

/**
* Sets whether or not customization of generated poms is enabled. Defaults to
* {@code true}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
* Settings that control dependency management behaviour.
*
* @author Andy Wilkinson
* @author Yanming Zhou
*/
public class DependencyManagementSettings {

Expand All @@ -35,7 +36,7 @@ public class DependencyManagementSettings {
* @return {@code true} if Maven-style exclusions should be applied, otherwise
* {@code false}
*/
boolean isApplyMavenExclusions() {
public boolean isApplyMavenExclusions() {
return this.applyMavenExclusions;
}

Expand All @@ -56,7 +57,7 @@ public void setApplyMavenExclusions(boolean applyMavenExclusions) {
* versions, otherwise {@code
* false}
*/
boolean isOverriddenByDependencies() {
public boolean isOverriddenByDependencies() {
return this.overriddenByDependencies;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,6 +44,7 @@
* Standard implementation of {@link DependencyManagementExtension}.
*
* @author Andy Wilkinson
* @author Yanming Zhou
*/
public class StandardDependencyManagementExtension extends GroovyObjectSupport
implements DependencyManagementExtension {
Expand Down Expand Up @@ -206,6 +207,11 @@ private DependencyManagementHandler handlerForConfiguration(Configuration config
return new StandardDependencyManagementHandler(this.dependencyManagementContainer, configuration);
}

@Override
public boolean isApplyMavenExclusions() {
return this.dependencyManagementSettings.isApplyMavenExclusions();
}

@Override
public void setApplyMavenExclusions(boolean applyMavenExclusions) {
this.dependencyManagementSettings.setApplyMavenExclusions(applyMavenExclusions);
Expand All @@ -216,6 +222,11 @@ public void applyMavenExclusions(boolean applyMavenExclusions) {
this.dependencyManagementSettings.setApplyMavenExclusions(applyMavenExclusions);
}

@Override
public boolean isOverriddenByDependencies() {
return this.dependencyManagementSettings.isOverriddenByDependencies();
}

@Override
public void setOverriddenByDependencies(boolean overriddenByDependencies) {
this.dependencyManagementSettings.setOverriddenByDependencies(overriddenByDependencies);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@
* Standard implementation of {@link GeneratedPomCustomizationHandler}.
*
* @author Andy Wilkinson
* @author Yanming Zhou
*/
class StandardGeneratedPomCustomizationHandler implements GeneratedPomCustomizationHandler {

Expand All @@ -32,6 +33,11 @@ class StandardGeneratedPomCustomizationHandler implements GeneratedPomCustomizat
this.settings = settings;
}

@Override
public boolean isEnabled() {
return this.settings.isEnabled();
}

@Override
public void setEnabled(boolean enabled) {
this.settings.setEnabled(enabled);
Expand Down