@@ -2,7 +2,7 @@ import java.nio.file.Files
2
2
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
3
3
4
4
apply plugin : ' aar'
5
- apply plugin : ' maven'
5
+ apply plugin : ' maven-publish '
6
6
7
7
dependencies {
8
8
compileOnly name : " android"
@@ -13,6 +13,7 @@ dependencies {
13
13
implementationAar " com.google.vr:sdk-base:${ gvrVersion} "
14
14
}
15
15
16
+ /*
16
17
task createPom {
17
18
pom {
18
19
project {
@@ -52,6 +53,59 @@ task createPom {
52
53
}.writeTo("dist/processing-vr-${vrLibVersion}.pom")
53
54
}
54
55
56
+
57
+ */
58
+
59
+ task sourceJar (type : Jar , dependsOn : classes) {
60
+ classifier = " sources"
61
+ from sourceSets. main. allSource
62
+ }
63
+
64
+ publishing {
65
+ publications {
66
+ vrPublication(MavenPublication ) {
67
+ from components. java
68
+ artifact sourceJar
69
+ pom {
70
+ groupId = " org.p5android"
71
+ artifactId = " processing-vr"
72
+ version = " ${ vrLibVersion} "
73
+ packaging = " jar"
74
+ licenses {
75
+ license {
76
+ name = " GNU Lesser General Public License, version 2.1"
77
+ url = " https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt"
78
+ distribution = " repo"
79
+ }
80
+ }
81
+ }
82
+
83
+ pom. withXml {
84
+ // inserting the dependencies node
85
+ def dependenciesNode = asNode(). appendNode(' dependencies' )
86
+ // start adding dependency nodes inside dependencies node
87
+ def dependencyNode = dependenciesNode. appendNode(' dependency' )
88
+ dependencyNode. appendNode(' groupId' , ' org.p5android' )
89
+ dependencyNode. appendNode(' artifactId' , ' processing-core' )
90
+ dependencyNode. appendNode(' version' , ' 4.2.0' )
91
+ dependencyNode. appendNode(' scope' , ' implementation' )
92
+
93
+ def dependencyNode2 = dependenciesNode. appendNode(' dependency' )
94
+ dependencyNode2. appendNode(' groupId' , ' com.google.vr' )
95
+ dependencyNode2. appendNode(' artifactId' , ' sdk-base' )
96
+ dependencyNode2. appendNode(' version' , ' 1.180.0' )
97
+ dependencyNode2. appendNode(' scope' , ' implementation' )
98
+
99
+ def dependencyNode3 = dependenciesNode. appendNode(' dependency' )
100
+ dependencyNode3. appendNode(' groupId' , ' com.google.vr' )
101
+ dependencyNode3. appendNode(' artifactId' , ' sdk-audio' )
102
+ dependencyNode3. appendNode(' version' , ' 1.180.0' )
103
+ dependencyNode3. appendNode(' scope' , ' implementation' )
104
+ }
105
+ }
106
+ }
107
+ }
108
+
55
109
sourceSets {
56
110
main {
57
111
java {
@@ -60,10 +114,6 @@ sourceSets {
60
114
}
61
115
}
62
116
63
- task sourcesJar (type : Jar , dependsOn : classes) {
64
- classifier = " sources"
65
- from sourceSets. main. allSource
66
- }
67
117
68
118
// Does not work because of Processing-specific tags in source code, such as @webref
69
119
task javadocJar (type : Jar , dependsOn : javadoc) {
@@ -73,7 +123,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
73
123
74
124
artifacts {
75
125
// archives javadocJar
76
- archives sourcesJar
126
+ archives sourceJar
77
127
}
78
128
79
129
jar. doLast { task ->
@@ -100,6 +150,18 @@ compileJava.doFirst {
100
150
101
151
102
152
build. doLast {
153
+ // If xml doesn't exist
154
+ def pomfile = file(" ${ buildDir} /publications/corePublication/pom-default.xml" )
155
+ if (! pomfile. exists()) {
156
+ println (" ************************************************************************************************\n " +
157
+ " * *\n " +
158
+ " * File not found: root/mode/libraries/vr/build/publications/corePublication/pom-default.xml *\n " +
159
+ " * First execute the following command to generate the file: *\n " +
160
+ " * gradle generatePomFileForvrPublicationPublication *\n " +
161
+ " * *\n " +
162
+ " ************************************************************************************************"
163
+ )
164
+ }
103
165
// // Copying vr jar to library folder
104
166
File vrJar = file(" library/vr.jar" )
105
167
vrJar. mkdirs();
@@ -115,4 +177,6 @@ build.doLast {
115
177
file(" dist/processing-vr-${ vrLibVersion} -sources.jar" ). toPath(), REPLACE_EXISTING );
116
178
Files . copy(file(" $buildDir /libs/vr.jar.MD5" ). toPath(),
117
179
file(" dist/processing-vr-${ vrLibVersion} .jar.md5" ). toPath(), REPLACE_EXISTING );
118
- }
180
+ Files . copy(file(" $buildDir /publications/corePublication/pom-default.xml" ). toPath(),
181
+ file(" dist/processing-vr-${ vrLibVersion} .pom" ). toPath(), REPLACE_EXISTING );
182
+ }
0 commit comments