Skip to content
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

Publish to Maven central from plugins #2970

Merged
merged 22 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ allprojects {
}

buildSagemaker.onlyIf {project.hasProperty("sagemaker")}

}

def javaProjects() {
Expand Down Expand Up @@ -94,4 +95,3 @@ configure(javaProjects()) {
}
}
}

59 changes: 59 additions & 0 deletions plugins/endpoints/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id 'java'
id 'maven-publish'
id 'signing'
}

dependencies {
implementation "com.google.code.gson:gson:${gson_version}"
implementation "org.pytorch:torchserve-plugins-sdk:${torchserve_sdk_version}"
Expand All @@ -16,4 +22,57 @@ jar {
exclude "META-INF/MANIFEST*"
exclude "META-INF//LICENSE*"
exclude "META-INF//NOTICE*"
exclude "org/pytorch/serve/plugins/endpoint/ExecutionParameters*" // Comment out if ExecutionParameter endpoint is needed
exclude "org/pytorch/serve/plugins/endpoint/Ping*" // Comment out if Ping endpoint is needed
}

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId = "org.pytorch"
artifactId = "torchserve-endpoint-plugin"
version = '0.0.1'
from components.java

pom {
name = 'torchserve-endpoint-plugin'
description = 'SDK for PyTorch model server endpoint plugins'
url = 'https://github.com/pytorch/serve'

licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'PyTorch Model Server'
url = 'https://github.com/pytorch/serve'
}
}
scm {
connection = 'scm:git:git://github.com/pytorch/serve.git'
developerConnection = 'scm:git:ssh://github.com:pytorch/serve.git'
url = 'https://github.com/pytorch/serve'
}
}
}
}

repositories {
maven {
name = "OSSRH"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = project.properties["mavenCentralRepositoryUsername"]
password = project.properties["mavenCentralRepositoryPassword"]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
org.pytorch.serve.plugins.endpoint.ExecutionParameters
org.pytorch.serve.plugins.endpoint.Token
7 changes: 3 additions & 4 deletions test/pytest/test_token_authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ def get_plugin_jar():
subprocess.run(["./gradlew", "formatJava"])
result = subprocess.run(["./gradlew", "build"])
jar_path = os.path.join(plugin_folder, "endpoints/build/libs")
jar_file = [file for file in os.listdir(jar_path) if file.endswith(".jar")]
if jar_file:
jar_files = [file for file in os.listdir(jar_path) if file.endswith(".jar")]
for jar_file in jar_files:
shutil.move(
os.path.join(jar_path, jar_file[0]),
os.path.join(new_folder_path, jar_file[0]),
os.path.join(jar_path, jar_file), os.path.join(new_folder_path, jar_file)
)
os.chdir(REPO_ROOT)

Expand Down
Loading