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

feat: make edc-build register printClasspath plugin #232

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import static org.eclipse.edc.plugins.edcbuild.conventions.Conventions.mavenPublication;
import static org.eclipse.edc.plugins.edcbuild.conventions.Conventions.mavenPublishing;
import static org.eclipse.edc.plugins.edcbuild.conventions.Conventions.nexusPublishing;
import static org.eclipse.edc.plugins.edcbuild.conventions.Conventions.printClasspath;
import static org.eclipse.edc.plugins.edcbuild.conventions.Conventions.repositories;
import static org.eclipse.edc.plugins.edcbuild.conventions.Conventions.rootBuildScript;
import static org.eclipse.edc.plugins.edcbuild.conventions.Conventions.signing;
Expand Down Expand Up @@ -74,7 +75,8 @@ public void apply(Project target) {
allDependencies(),
tests(),
jar(),
swagger()
swagger(),
printClasspath()
).forEach(c -> c.apply(project));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public static EdcConvention checkstyle() {
return new CheckstyleConvention();
}


public static EdcConvention mavenPublishing() {
return new MavenPublishingConvention();
}
Expand Down Expand Up @@ -87,4 +86,8 @@ public static EdcConvention openApiMerger() {
public static EdcConvention mavenPublication() {
return new MavenPublicationConvention();
}

public static EdcConvention printClasspath() {
return new PrintClasspathConvention();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
*
*/

package org.eclipse.edc.plugins.edcbuild.conventions;

import org.eclipse.edc.plugins.edcbuild.tasks.PrintClasspathTask;
import org.gradle.api.Project;

public class PrintClasspathConvention implements EdcConvention {
@Override
public void apply(Project target) {
target.getTasks().register("printClasspath", PrintClasspathTask.class)
.configure(t -> t.dependsOn("compileJava"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
*
*/

package org.eclipse.edc.plugins.edcbuild.tasks;

import org.gradle.api.DefaultTask;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.TaskAction;

import static org.eclipse.edc.plugins.edcbuild.conventions.ConventionFunctions.requireExtension;


public class PrintClasspathTask extends DefaultTask {

@TaskAction
public void printClasspath() {
var classpath = requireExtension(getProject(), JavaPluginExtension.class)
.getSourceSets()
.getByName("main")
.getRuntimeClasspath()
.getAsPath();

System.out.println(classpath);
}

}