-
-
Notifications
You must be signed in to change notification settings - Fork 297
maven to maven-publish #635
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e4433a7
core maven to maven-publish
rupeshkumar22 6273182
AR maven to maven-publish
rupeshkumar22 82f915b
VR maven to maven-publish
rupeshkumar22 cd56030
correcting path from core to vr in vr build.gradle
rupeshkumar22 3049181
Correcting vr pom path
rupeshkumar22 cbe1916
Using Version Variables in 'build.gradle' core
rupeshkumar22 9b46630
Using Version Variables in 'build.gradle' AR
rupeshkumar22 eda4196
Using Version Variables in 'build.gradle' VR
rupeshkumar22 16bcc8a
Removed duplicate source block in VR build
rupeshkumar22 1f494d4
Proper naming of variables correction in AR build
rupeshkumar22 1a508f2
Proper naming of variables correction in Core build
rupeshkumar22 440f57f
Proper naming of variables correction in VR build
rupeshkumar22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -2,47 +2,60 @@ import java.nio.file.Files | |
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; | ||
|
||
apply plugin: 'aar' | ||
apply plugin: 'maven' | ||
apply plugin: 'maven-publish' | ||
|
||
dependencies { | ||
compileOnly name: "android" | ||
|
||
compileOnly "org.p5android:processing-core:${modeVersion}" | ||
|
||
implementationAar "com.google.ar:core:${garVersion}" | ||
} | ||
|
||
task createPom { | ||
pom { | ||
project { | ||
groupId "org.p5android" | ||
artifactId "processing-ar" | ||
version "${arLibVersion}" | ||
packaging "jar" | ||
licenses { | ||
license { | ||
name "GNU Lesser General Public License, version 2.1" | ||
url "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt" | ||
distribution "repo" | ||
} | ||
} | ||
dependencies { | ||
dependency { | ||
groupId "org.p5android" | ||
artifactId "processing-core" | ||
version "${modeVersion}" | ||
scope "implementation" | ||
} | ||
task sourceJar(type: Jar) { | ||
from sourceSets.main.allJava | ||
archiveClassifier = "sources" | ||
} | ||
|
||
publishing { | ||
publications { | ||
arPublication(MavenPublication) { | ||
from components.java | ||
artifact sourceJar | ||
pom { | ||
groupId = "org.p5android" | ||
artifactId = "processing-ar" | ||
version = "${arLibVersion}" | ||
packaging = "jar" | ||
// description = "Processing Android Core" | ||
// url = "http://www.example.com/project" | ||
licenses { | ||
license { | ||
name = "GNU Lesser General Public License, version 2.1" | ||
url = "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt" | ||
distribution = "repo" | ||
} | ||
} | ||
} | ||
|
||
pom.withXml { | ||
// inserting the dependencies node | ||
def dependenciesNode = asNode().appendNode('dependencies') | ||
// start adding dependency nodes inside dependencies node | ||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
dependencyNode.appendNode('groupId', 'org.p5android') | ||
dependencyNode.appendNode('artifactId', 'processing-core') | ||
dependencyNode.appendNode('version', "${modeVersion}") | ||
dependencyNode.appendNode('scope', 'implementation') | ||
|
||
def dependencyNode2 = dependenciesNode.appendNode('dependency') | ||
dependencyNode2.appendNode('groupId', 'com.google.ar') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use proper names for the variables ! PS: as mentioned above about the naming of variables. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corrected variable names in AR build.gradle |
||
dependencyNode2.appendNode('artifactId', 'core') | ||
dependencyNode2.appendNode('version', "${garVersion}") | ||
dependencyNode2.appendNode('scope', 'implementation') | ||
} | ||
|
||
|
||
dependency { | ||
groupId "com.google.ar" | ||
artifactId "core" | ||
version "${garVersion}" | ||
scope "implementation" | ||
} | ||
} | ||
} | ||
}.writeTo("dist/processing-ar-${arLibVersion}.pom") | ||
} | ||
} | ||
|
||
sourceSets { | ||
|
@@ -56,11 +69,6 @@ sourceSets { | |
} | ||
} | ||
|
||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = "sources" | ||
from sourceSets.main.allSource | ||
} | ||
|
||
// Does not work because of Processing-specific tags in source code, such as @webref | ||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = "javadoc" | ||
|
@@ -69,7 +77,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) { | |
|
||
artifacts { | ||
// archives javadocJar | ||
archives sourcesJar | ||
archives sourceJar | ||
} | ||
|
||
jar.doLast { task -> | ||
|
@@ -92,13 +100,24 @@ compileJava.doFirst { | |
} | ||
|
||
build.doLast { | ||
// If xml doesn't exist | ||
def pomfile = file("${buildDir}/publications/arPublication/pom-default.xml") | ||
if (!pomfile.exists()) { | ||
println("**********************************************************************************************\n" + | ||
"* *\n" + | ||
"* File not found: root/mode/libraries/ar/build/publications/arPublication/pom-default.xml *\n" + | ||
"* First execute the following command to generate the file: *\n" + | ||
"* gradle generatePomFileForarPublicationPublication *\n" + | ||
"* *\n" + | ||
"**********************************************************************************************" | ||
) | ||
} | ||
// Copying ar jar to library folder | ||
File arJar = file("library/ar.jar") | ||
arJar.mkdirs(); | ||
Files.copy(file("$buildDir/libs/ar.jar").toPath(), | ||
arJar.toPath(), REPLACE_EXISTING); | ||
|
||
// // Copying the files for release on JCentral | ||
arJar.toPath(), REPLACE_EXISTING); | ||
// Copying the files for release on JCentral | ||
File distFolder = file("dist"); | ||
distFolder.mkdirs(); | ||
Files.copy(file("$buildDir/libs/ar.jar").toPath(), | ||
|
@@ -107,4 +126,6 @@ build.doLast { | |
file("dist/processing-ar-${arLibVersion}-sources.jar").toPath(), REPLACE_EXISTING); | ||
Files.copy(file("$buildDir/libs/ar.jar.MD5").toPath(), | ||
file("dist/processing-ar-${arLibVersion}.jar.md5").toPath(), REPLACE_EXISTING); | ||
} | ||
Files.copy(file("${buildDir}/publications/arPublication/pom-default.xml").toPath(), | ||
file("dist/processing-ar-${arLibVersion}.pom").toPath(), REPLACE_EXISTING) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should follow proper naming of variables !
ex - instead of dependencyNode you can use something like androidLegacyDependancyNode
and instead of dependencyNode2 you can use wearableDependencyNode
Proper naming of variables is very important in any OpenSource project !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected variable names in Core build.gradle file, Thanks for providing a clear example!