diff --git a/maven-central-publish/build.gradle b/maven-central-publish/build.gradle index de486f9..686a10c 100644 --- a/maven-central-publish/build.gradle +++ b/maven-central-publish/build.gradle @@ -2,11 +2,11 @@ plugins { id 'java-gradle-plugin' id 'com.gradle.plugin-publish' version '1.2.1' id 'signing' - id 'tech.yanand.maven-central-publish' version '1.0.0' + id 'tech.yanand.maven-central-publish' version '1.1.0' } group = 'tech.yanand.gradle' -version = '1.1.0' +version = '1.1.1' repositories { mavenCentral() @@ -38,7 +38,7 @@ gradlePlugin { displayName = 'Maven Central Portal Publish Plugin' description = 'A plugin that allows you to publish repositories to the Maven Central Portal (new publish process)' tags.addAll('maven', 'maven publish', 'maven central', 'maven central portal') - implementationClass = 'tech.yanand.gradle.MavenCentralPublishPlugin' + implementationClass = 'tech.yanand.gradle.mavenpublish.MavenCentralPublishPlugin' } } } diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/PublishingType.java b/maven-central-publish/src/main/java/tech/yanand/gradle/PublishingType.java deleted file mode 100644 index eeebe32..0000000 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/PublishingType.java +++ /dev/null @@ -1,22 +0,0 @@ -package tech.yanand.gradle; - -/** - * Whether or not an upload should be published automatically or manually after successful validation. - */ -final class PublishingType { - private PublishingType() { - // Instantiation is not allowed - } - - /** - * After an upload is successfully validated, the artifact will be published automatically. - * This is the default. - */ - static final String AUTOMATIC = "AUTOMATIC"; - - /** - * After an upload is successfully validated, the artifact will need to be - * published manually. - */ - static final String USER_MANAGED = "USER_MANAGED"; -} \ No newline at end of file diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/CentralPortalService.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/CentralPortalService.java similarity index 76% rename from maven-central-publish/src/main/java/tech/yanand/gradle/CentralPortalService.java rename to maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/CentralPortalService.java index 4c44144..0b6a78d 100644 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/CentralPortalService.java +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/CentralPortalService.java @@ -1,4 +1,20 @@ -package tech.yanand.gradle; +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; import groovy.json.JsonSlurper; import org.gradle.api.logging.Logger; @@ -17,9 +33,9 @@ import static java.net.http.HttpRequest.BodyPublishers.noBody; import static java.nio.charset.StandardCharsets.UTF_8; -import static tech.yanand.gradle.ExceptionFactory.checkApiHttpStatusIsNotOk; -import static tech.yanand.gradle.ExceptionFactory.uploadApiHttpStatusIsNotCreated; -import static tech.yanand.gradle.MultiPartBodyPublisherHelper.getFilePartPublisher; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.checkApiHttpStatusIsNotOk; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.uploadApiHttpStatusIsNotCreated; +import static tech.yanand.gradle.mavenpublish.MultiPartBodyPublisherHelper.getFilePartPublisher; class CentralPortalService { diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/DefaultMavenCentralExtension.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/DefaultMavenCentralExtension.java similarity index 73% rename from maven-central-publish/src/main/java/tech/yanand/gradle/DefaultMavenCentralExtension.java rename to maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/DefaultMavenCentralExtension.java index d99abbc..6312a70 100644 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/DefaultMavenCentralExtension.java +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/DefaultMavenCentralExtension.java @@ -1,4 +1,20 @@ -package tech.yanand.gradle; +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.model.ObjectFactory; diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/ExceptionFactory.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/ExceptionFactory.java similarity index 80% rename from maven-central-publish/src/main/java/tech/yanand/gradle/ExceptionFactory.java rename to maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/ExceptionFactory.java index a87b982..4fd20e6 100644 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/ExceptionFactory.java +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/ExceptionFactory.java @@ -1,4 +1,20 @@ -package tech.yanand.gradle; +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; import org.gradle.api.GradleException; import org.gradle.api.InvalidUserDataException; diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/MavenCentralExtension.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MavenCentralExtension.java similarity index 68% rename from maven-central-publish/src/main/java/tech/yanand/gradle/MavenCentralExtension.java rename to maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MavenCentralExtension.java index ee24c20..9c15748 100644 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/MavenCentralExtension.java +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MavenCentralExtension.java @@ -1,4 +1,20 @@ -package tech.yanand.gradle; +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.provider.Property; diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/MavenCentralPublishPlugin.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MavenCentralPublishPlugin.java similarity index 67% rename from maven-central-publish/src/main/java/tech/yanand/gradle/MavenCentralPublishPlugin.java rename to maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MavenCentralPublishPlugin.java index 072d522..6ae9b0c 100644 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/MavenCentralPublishPlugin.java +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MavenCentralPublishPlugin.java @@ -1,4 +1,20 @@ -package tech.yanand.gradle; +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; import org.gradle.api.Plugin; import org.gradle.api.Project; diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/MultiPartBodyPublisherHelper.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MultiPartBodyPublisherHelper.java similarity index 66% rename from maven-central-publish/src/main/java/tech/yanand/gradle/MultiPartBodyPublisherHelper.java rename to maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MultiPartBodyPublisherHelper.java index 35a8e74..2fa7184 100644 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/MultiPartBodyPublisherHelper.java +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/MultiPartBodyPublisherHelper.java @@ -1,4 +1,20 @@ -package tech.yanand.gradle; +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; import java.io.FileNotFoundException; import java.nio.file.Path; diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/PublishToCentralPortalTask.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/PublishToCentralPortalTask.java similarity index 77% rename from maven-central-publish/src/main/java/tech/yanand/gradle/PublishToCentralPortalTask.java rename to maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/PublishToCentralPortalTask.java index 986506a..b8d8118 100644 --- a/maven-central-publish/src/main/java/tech/yanand/gradle/PublishToCentralPortalTask.java +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/PublishToCentralPortalTask.java @@ -1,4 +1,20 @@ -package tech.yanand.gradle; +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; import org.gradle.api.DefaultTask; import org.gradle.api.file.RegularFileProperty; @@ -13,16 +29,16 @@ import java.io.IOException; import java.util.concurrent.TimeUnit; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.FAILED; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.PUBLISHED; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.PUBLISHING; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.VALIDATED; -import static tech.yanand.gradle.ExceptionFactory.apiNotReturnDeploymentStateField; -import static tech.yanand.gradle.ExceptionFactory.authTokenNotProvided; -import static tech.yanand.gradle.ExceptionFactory.deploymentNotFinished; -import static tech.yanand.gradle.ExceptionFactory.deploymentStatusIsField; -import static tech.yanand.gradle.ExceptionFactory.publishingTypeInvalid; -import static tech.yanand.gradle.ExceptionFactory.uploadFileMustProvided; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.FAILED; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.PUBLISHED; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.PUBLISHING; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.VALIDATED; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.apiNotReturnDeploymentStateField; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.authTokenNotProvided; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.deploymentNotFinished; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.deploymentStatusIsField; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.publishingTypeInvalid; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.uploadFileMustProvided; /** * The task used to upload a bundle to be published to the Maven central portal. diff --git a/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/PublishingType.java b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/PublishingType.java new file mode 100644 index 0000000..92c6167 --- /dev/null +++ b/maven-central-publish/src/main/java/tech/yanand/gradle/mavenpublish/PublishingType.java @@ -0,0 +1,38 @@ +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package tech.yanand.gradle.mavenpublish; + +/** + * Whether or not an upload should be published automatically or manually after successful validation. + */ +final class PublishingType { + private PublishingType() { + // Instantiation is not allowed + } + + /** + * After an upload is successfully validated, the artifact will be published automatically. + * This is the default. + */ + static final String AUTOMATIC = "AUTOMATIC"; + + /** + * After an upload is successfully validated, the artifact will need to be + * published manually. + */ + static final String USER_MANAGED = "USER_MANAGED"; +} \ No newline at end of file diff --git a/maven-central-publish/src/test/java/tech/yanand/gradle/CentralPortalServiceTest.java b/maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/CentralPortalServiceTest.java similarity index 94% rename from maven-central-publish/src/test/java/tech/yanand/gradle/CentralPortalServiceTest.java rename to maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/CentralPortalServiceTest.java index 16bd1a3..097a92d 100644 --- a/maven-central-publish/src/test/java/tech/yanand/gradle/CentralPortalServiceTest.java +++ b/maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/CentralPortalServiceTest.java @@ -1,4 +1,4 @@ -package tech.yanand.gradle; +package tech.yanand.gradle.mavenpublish; import org.gradle.api.GradleException; import org.junit.jupiter.api.BeforeEach; @@ -25,9 +25,9 @@ import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.PUBLISHING; -import static tech.yanand.gradle.ExceptionFactory.CHECK_API_HTTP_STATUS_IS_NOT_OK; -import static tech.yanand.gradle.ExceptionFactory.UPLOAD_API_HTTP_STATUS_IS_NOT_CREATED; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.PUBLISHING; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.CHECK_API_HTTP_STATUS_IS_NOT_OK; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.UPLOAD_API_HTTP_STATUS_IS_NOT_CREATED; @SuppressWarnings("unchecked") @ExtendWith(MockitoExtension.class) diff --git a/maven-central-publish/src/test/java/tech/yanand/gradle/MultiPartBodyPublisherHelperTest.java b/maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/MultiPartBodyPublisherHelperTest.java similarity index 94% rename from maven-central-publish/src/test/java/tech/yanand/gradle/MultiPartBodyPublisherHelperTest.java rename to maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/MultiPartBodyPublisherHelperTest.java index 2b7f1b9..f9be312 100644 --- a/maven-central-publish/src/test/java/tech/yanand/gradle/MultiPartBodyPublisherHelperTest.java +++ b/maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/MultiPartBodyPublisherHelperTest.java @@ -1,4 +1,4 @@ -package tech.yanand.gradle; +package tech.yanand.gradle.mavenpublish; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -15,7 +15,7 @@ import static java.lang.String.format; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -import static tech.yanand.gradle.MultiPartBodyPublisherHelper.CRLF; +import static tech.yanand.gradle.mavenpublish.MultiPartBodyPublisherHelper.CRLF; class MultiPartBodyPublisherHelperTest { diff --git a/maven-central-publish/src/test/java/tech/yanand/gradle/PublishToCentralPortalTaskTest.java b/maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/PublishToCentralPortalTaskTest.java similarity index 86% rename from maven-central-publish/src/test/java/tech/yanand/gradle/PublishToCentralPortalTaskTest.java rename to maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/PublishToCentralPortalTaskTest.java index 914074d..2d95d66 100644 --- a/maven-central-publish/src/test/java/tech/yanand/gradle/PublishToCentralPortalTaskTest.java +++ b/maven-central-publish/src/test/java/tech/yanand/gradle/mavenpublish/PublishToCentralPortalTaskTest.java @@ -1,4 +1,4 @@ -package tech.yanand.gradle; +package tech.yanand.gradle.mavenpublish; import org.gradle.api.GradleException; import org.gradle.api.Project; @@ -23,17 +23,17 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.FAILED; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.PENDING; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.PUBLISHING; -import static tech.yanand.gradle.CentralPortalService.DeploymentStatus.VALIDATED; -import static tech.yanand.gradle.ExceptionFactory.API_NOT_RETURN_DEPLOYMENT_STATE_FIELD; -import static tech.yanand.gradle.ExceptionFactory.AUTH_TOKEN_NOT_PROVIDED; -import static tech.yanand.gradle.ExceptionFactory.CHECKING_URL; -import static tech.yanand.gradle.ExceptionFactory.DEPLOYMENT_NOT_FINISHED; -import static tech.yanand.gradle.ExceptionFactory.DEPLOYMENT_STATUS_IS_FIELD; -import static tech.yanand.gradle.ExceptionFactory.PUBLISHING_TYPE_INVALID; -import static tech.yanand.gradle.ExceptionFactory.UPLOAD_FILE_MUST_PROVIDED; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.FAILED; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.PENDING; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.PUBLISHING; +import static tech.yanand.gradle.mavenpublish.CentralPortalService.DeploymentStatus.VALIDATED; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.API_NOT_RETURN_DEPLOYMENT_STATE_FIELD; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.AUTH_TOKEN_NOT_PROVIDED; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.CHECKING_URL; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.DEPLOYMENT_NOT_FINISHED; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.DEPLOYMENT_STATUS_IS_FIELD; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.PUBLISHING_TYPE_INVALID; +import static tech.yanand.gradle.mavenpublish.ExceptionFactory.UPLOAD_FILE_MUST_PROVIDED; @ExtendWith(MockitoExtension.class) class PublishToCentralPortalTaskTest {