Skip to content

Commit 047b91e

Browse files
udaij12Ubuntuagunapal
authoredFeb 29, 2024··
Publish to Maven central from plugins (#2970)
* changes to gradle for maven * changes to gradle for maven * changing name * moving repositories * moved publishing * remove execution parameter * filtering files * reverting back * changing username and password * fixed commit * fixed commit * moving all jar files * fixing test * fixed tests * moving publishing * changes to endpoint * adding signing --------- Co-authored-by: Ubuntu <ubuntu@ip-172-31-11-32.us-west-2.compute.internal> Co-authored-by: Ankith Gunapal <agunapal@ischool.Berkeley.edu>
1 parent ca3984a commit 047b91e

File tree

4 files changed

+67
-6
lines changed

4 files changed

+67
-6
lines changed
 

‎plugins/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ allprojects {
5151
}
5252

5353
buildSagemaker.onlyIf {project.hasProperty("sagemaker")}
54+
5455
}
5556

5657
def javaProjects() {
@@ -94,4 +95,3 @@ configure(javaProjects()) {
9495
}
9596
}
9697
}
97-

‎plugins/endpoints/build.gradle

+63
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id 'java'
3+
id 'maven-publish'
4+
id 'signing'
5+
}
6+
17
dependencies {
28
implementation "com.google.code.gson:gson:${gson_version}"
39
implementation "org.pytorch:torchserve-plugins-sdk:${torchserve_sdk_version}"
@@ -16,4 +22,61 @@ jar {
1622
exclude "META-INF/MANIFEST*"
1723
exclude "META-INF//LICENSE*"
1824
exclude "META-INF//NOTICE*"
25+
exclude "org/pytorch/serve/plugins/endpoint/ExecutionParameters*" // Comment out if ExecutionParameter endpoint is needed
26+
exclude "org/pytorch/serve/plugins/endpoint/Ping*" // Comment out if Ping endpoint is needed
27+
}
28+
29+
java {
30+
withJavadocJar()
31+
withSourcesJar()
32+
}
33+
34+
publishing {
35+
publications {
36+
mavenJava(MavenPublication) {
37+
groupId = "org.pytorch"
38+
artifactId = "torchserve-endpoint-plugin"
39+
version = '0.0.1'
40+
from components.java
41+
42+
pom {
43+
name = 'torchserve-endpoint-plugin'
44+
description = 'SDK for PyTorch model server endpoint plugins'
45+
url = 'https://github.com/pytorch/serve'
46+
47+
licenses {
48+
license {
49+
name = 'The Apache Software License, Version 2.0'
50+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
51+
}
52+
}
53+
developers {
54+
developer {
55+
id = 'PyTorch Model Server'
56+
url = 'https://github.com/pytorch/serve'
57+
}
58+
}
59+
scm {
60+
connection = 'scm:git:git://github.com/pytorch/serve.git'
61+
developerConnection = 'scm:git:ssh://github.com:pytorch/serve.git'
62+
url = 'https://github.com/pytorch/serve'
63+
}
64+
}
65+
}
66+
}
67+
68+
repositories {
69+
maven {
70+
name = "OSSRH"
71+
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
72+
credentials {
73+
username = project.properties["mavenCentralRepositoryUsername"]
74+
password = project.properties["mavenCentralRepositoryPassword"]
75+
}
76+
}
77+
}
78+
}
79+
80+
signing {
81+
sign publishing.publications.mavenJava
1982
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
org.pytorch.serve.plugins.endpoint.ExecutionParameters
21
org.pytorch.serve.plugins.endpoint.Token

‎test/pytest/test_token_authorization.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ def get_plugin_jar():
2525
subprocess.run(["./gradlew", "formatJava"])
2626
result = subprocess.run(["./gradlew", "build"])
2727
jar_path = os.path.join(plugin_folder, "endpoints/build/libs")
28-
jar_file = [file for file in os.listdir(jar_path) if file.endswith(".jar")]
29-
if jar_file:
28+
jar_files = [file for file in os.listdir(jar_path) if file.endswith(".jar")]
29+
for jar_file in jar_files:
3030
shutil.move(
31-
os.path.join(jar_path, jar_file[0]),
32-
os.path.join(new_folder_path, jar_file[0]),
31+
os.path.join(jar_path, jar_file), os.path.join(new_folder_path, jar_file)
3332
)
3433
os.chdir(REPO_ROOT)
3534

0 commit comments

Comments
 (0)
Please sign in to comment.