-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make edc-build register printClasspath plugin (#232)
- Loading branch information
Showing
4 changed files
with
70 additions
and
2 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
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
26 changes: 26 additions & 0 deletions
26
.../src/main/java/org/eclipse/edc/plugins/edcbuild/conventions/PrintClasspathConvention.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,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")); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...ns/edc-build/src/main/java/org/eclipse/edc/plugins/edcbuild/tasks/PrintClasspathTask.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 @@ | ||
/* | ||
* 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); | ||
} | ||
|
||
} |