##// END OF EJS Templates
WIP setup pulication tasks to local repository
cin -
r1:e91c2403acf8 default
parent child
Show More
@@ -6,6 +6,9 plugins {
6 6 java {
7 7 withJavadocJar()
8 8 withSourcesJar()
9 toolchain {
10 languageVersion = JavaLanguageVersion.of(17)
11 }
9 12 }
10 13
11 14 dependencies {
@@ -14,7 +17,7 dependencies {
14 17
15 18 task printVersion{
16 19 doLast {
17 println "project: $project.groupId:$project.name:$project.version"
20 println "project: $project.group:$project.name:$project.version"
18 21 println "jar: ${->jar.archiveFileName.get()}"
19 22 }
20 23 }
@@ -25,4 +28,12 publishing {
25 28 url "${System.properties["user.home"]}/ivy-repo"
26 29 }
27 30 }
31 publications {
32 ivy(IvyPublication) {
33 from components.java
34 descriptor.description {
35 text = providers.provider({ description })
36 }
37 }
38 }
28 39 } No newline at end of file
@@ -10,6 +10,7 import org.gradle.api.Task;
10 10 import org.gradle.api.artifacts.Configuration;
11 11 import org.gradle.api.file.Directory;
12 12 import org.gradle.api.tasks.TaskProvider;
13 import org.implab.gradle.common.utils.ExtraProps;
13 14
14 15 /** Project configuration traits */
15 16 public interface ProjectMixin {
@@ -37,6 +38,15 public interface ProjectMixin {
37 38 return getProject().getPlugins().findPlugin(clazz);
38 39 }
39 40
41 /**
42 * @param classes The list of classes to register as extensions
43 */
44 default void exportClasses(Class<?>... classes) {
45 var props = ExtraProps.of(getProject());
46 for (var clazz : classes)
47 props.put(clazz.getSimpleName(), clazz);
48 }
49
40 50 /** Creates and register a new project extension.
41 51 *
42 52 * @param <T> The type of the extension
@@ -7,10 +7,10 import org.gradle.api.plugins.ExtensionA
7 7 public class ExtraProps {
8 8
9 9 public static Map<String, Object> of(Object target) {
10 return switch (target) {
11 case ExtensionAware ext -> ext.getExtensions().getExtraProperties().getProperties();
12 default -> Map.of();
13 };
10 if (target instanceof ExtensionAware ext)
11 return ext.getExtensions().getExtraProperties().getProperties();
12 else
13 return Map.of();
14 14 }
15 15
16 16 }
@@ -1,2 +1,2
1 groupId=org.implab.gradle
1 group=org.implab.gradle
2 2 version=1.0 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now