Skip to content

Commit

Permalink
Move the package from 'tech.yanand.gradle to 'tech.yanand.gradle.mave…
Browse files Browse the repository at this point in the history
…npublish'.
  • Loading branch information
yananhub committed Jul 7, 2024
1 parent aa2d674 commit 3eb83f8
Show file tree
Hide file tree
Showing 13 changed files with 191 additions and 63 deletions.
6 changes: 3 additions & 3 deletions maven-central-publish/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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'
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.yanand.gradle;
package tech.yanand.gradle.mavenpublish;

import org.gradle.api.GradleException;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tech.yanand.gradle;
package tech.yanand.gradle.mavenpublish;

import org.gradle.api.GradleException;
import org.gradle.api.Project;
Expand All @@ -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 {
Expand Down

0 comments on commit 3eb83f8

Please sign in to comment.