Skip to content

Combined configuration and task creation for targets#25

Merged
gabrielittner merged 6 commits into
vanniktech:multiple-reposfrom
gabrielittner:reuse2
Sep 26, 2018
Merged

Combined configuration and task creation for targets#25
gabrielittner merged 6 commits into
vanniktech:multiple-reposfrom
gabrielittner:reuse2

Conversation

@gabrielittner

@gabrielittner gabrielittner commented Sep 25, 2018

Copy link
Copy Markdown
Collaborator

The configuration looks like this:

mavenPublish {
  // these 4 are equivalent to configuring `targets.upload` below
  releaseRepositoryUrl = "..." 
  snapshotRepositoryUrl = "..."
  repositoryUsername = "..."
  repositoryPassword = "..."
            
  targets {
	upload {
	  // configures the default uploadArchives
      releaseRepositoryUrl = "..." 
	}

	install {
	  // configures the default installArchives
	}

    otherRepo {
      // creates new upload task called `uploadArchivesOtherRepo`
    }
  }
}

@codecov

codecov Bot commented Sep 25, 2018

Copy link
Copy Markdown

Codecov Report

Merging #25 into multiple-repos will increase coverage by 7.99%.
The diff coverage is 79.31%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##             multiple-repos      #25      +/-   ##
====================================================
+ Coverage             82.17%   90.16%   +7.99%     
+ Complexity               16       13       -3     
====================================================
  Files                     4        3       -1     
  Lines                   129      122       -7     
  Branches                 12       15       +3     
====================================================
+ Hits                    106      110       +4     
+ Misses                   18        5      -13     
- Partials                  5        7       +2
Impacted Files Coverage Δ Complexity Δ
...com/vanniktech/maven/publish/MavenPublishTarget.kt 85.71% <50%> (-14.29%) 3 <0> (ø)
...vanniktech/maven/publish/MavenPublishPlugin.groovy 93.87% <76.47%> (+4.98%) 6 <3> (+3) ⬆️
...ktech/maven/publish/MavenPublishPluginExtension.kt 70.58% <90%> (+5.88%) 4 <1> (-5) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update acebcad...056600a. Read the comment docs.

@vanniktech vanniktech left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it

set(value) { defaultTarget.repositoryPassword = value }

/**
* Allows to add additional [MavenPublishTargets][MavenPublishTarget] to publish to multiple repositories.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MavenPublishTargets][MavenPublishTarget] isn't one enough?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first one is what you see in when the markdown is rendered the second is the link to the class. I personally prefer that over writing [MavenPublishTarget]s

* @since 0.7.0
*/
val targets: NamedDomainObjectContainer<MavenPublishTarget> =
project.container(MavenPublishTarget::class.java) { MavenPublishTarget(it, "") }.apply {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to specify the second parameter of MavenPublishTarget?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to make releaseRepositoryUrl nullable so it's needs something when initializing it. Nullable and then throwing later during configuration is probably better though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed d519b32

@vanniktech

vanniktech commented Sep 25, 2018

Copy link
Copy Markdown
Owner

Should we rename upload to uploadArchives and uploadArchives to installArchives to have symmetry and matching names?

Probably also worth nuking the previous configuration parameters:

  releaseRepositoryUrl = "..." 
  snapshotRepositoryUrl = "..."
  repositoryUsername = "..."
  repositoryPassword = "..."

I doubt much people used them anyways.

@gabrielittner

Copy link
Copy Markdown
Collaborator Author

If we rename those two, should we also use the name of additional targets directly as task name?

@vanniktech

Copy link
Copy Markdown
Owner

Had a typo above that I corrected.

should we also use the name of additional targets directly as task name?

I don't quite understand what you mean. Do you have an example?

@gabrielittner

Copy link
Copy Markdown
Collaborator Author

The sample configuration above would result in these tasks uploadArchives, installArchives and uploadArchivesOtherRepo, because currently new targets are named "uploadArchives" + target.name. When we use the task names of the first two directly it would make sense to use target.name directly as task name.

@gabrielittner

Copy link
Copy Markdown
Collaborator Author

I've renamed install and upload. The task name for additional targets should be fine as it is. I think we're good to go now.

@vanniktech vanniktech left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup looking good. Can be merged.

Before merging this feature into master itself, I'll mull over it a bit though. (I assume everything will go back to #23 right? Can also be a different PR though. Not strongly opinionated.)

@gabrielittner gabrielittner merged commit 3bdc38e into vanniktech:multiple-repos Sep 26, 2018
@gabrielittner gabrielittner deleted the reuse2 branch September 26, 2018 08:14
@gabrielittner

Copy link
Copy Markdown
Collaborator Author

Either @budius merges the multiple-repos branch into his to update the existing PR or we create a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants