Skip to content

Commit fb4d319

Browse files
committed
Added Gradle plugin publishing script. Scripts clean up.
1 parent b5810e1 commit fb4d319

File tree

4 files changed

+57
-15
lines changed

4 files changed

+57
-15
lines changed

build.gradle

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1+
buildscript {
2+
apply from: 'gradle/scripts/gradle_publish_buildscript.gradle', to: buildscript
3+
}
4+
15
apply plugin: 'groovy'
26

7+
ext.group = 'com.alexvasilkov'
8+
ext.artifactId = 'gradle-git-dependencies'
9+
ext.version = '2.0.0'
10+
ext.name = 'Git Dependencies plugin'
11+
ext.description = 'Gradle plugin to add external git repos as project dependencies'
12+
ext.github = 'https://github.com/alexvasilkov/GradleGitDependenciesPlugin'
13+
ext.githubScm = 'scm:[email protected]:alexvasilkov/GradleGitDependenciesPlugin.git'
14+
315
repositories {
416
jcenter()
517
}
618

719
dependencies {
820
compile gradleApi()
921
compile localGroovy()
22+
1023
compile 'org.ajoberstar.grgit:grgit-core:4.0.2'
1124
}
1225

13-
// Build & upload: './gradlew clean build publish'
14-
apply from: "$rootDir/gradle/scripts/publish.gradle"
26+
// Build & upload to maven: './gradlew clean build publish'
27+
apply from: "$rootDir/gradle/scripts/maven_publish.gradle"
28+
29+
// Build & upload to gradle: './gradlew clean build publishPlugins'
30+
apply from: "$rootDir/gradle/scripts/gradle_publish.gradle"

gradle/scripts/gradle_publish.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apply plugin: 'com.gradle.plugin-publish'
2+
3+
pluginBundle {
4+
website = project.ext.github
5+
vcsUrl = project.ext.github
6+
7+
plugins {
8+
gitDependencies {
9+
id = 'com.alexvasilkov.git-dependencies'
10+
version = project.ext.version
11+
displayName = project.ext.name
12+
description = project.ext.description
13+
tags = ['git', 'dependency']
14+
}
15+
}
16+
17+
mavenCoordinates {
18+
groupId = project.ext.group
19+
artifactId = project.ext.artifactId
20+
version = project.ext.version
21+
}
22+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repositories {
2+
maven { url 'https://plugins.gradle.org/m2/' }
3+
}
4+
dependencies {
5+
classpath 'com.gradle.publish:plugin-publish-plugin:0.11.0'
6+
}

gradle/scripts/publish.gradle renamed to gradle/scripts/maven_publish.gradle

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
// id 'java-library'
21
apply plugin: 'maven-publish'
32
apply plugin: 'signing'
43

5-
group = 'com.alexvasilkov'
6-
version = '2.0.0'
7-
84
task pluginGroovydoc(type: Groovydoc) {
95
source = sourceSets.main.groovy.srcDirs
106
classpath = sourceSets.main.compileClasspath
@@ -27,12 +23,15 @@ publishing {
2723
artifact source: pluginGroovydocJar, classifier: 'javadoc'
2824
artifact source: pluginSourcesJar, classifier: 'sources'
2925

30-
artifactId = 'gradle-git-dependencies'
26+
groupId = project.ext.group
27+
artifactId = project.ext.artifactId
28+
version = project.ext.version
29+
3130
pom {
32-
name = 'GradleGitDependenciesPlugin'
31+
name = project.ext.name
32+
description = project.ext.description
3333
packaging = 'jar'
34-
description = 'Gradle plugin to add external git repos as project dependencies'
35-
url = 'https://github.com/alexvasilkov/GradleGitDependenciesPlugin'
34+
url = project.ext.github
3635
licenses {
3736
license {
3837
name = 'The Apache License, Version 2.0'
@@ -46,10 +45,9 @@ publishing {
4645
}
4746
}
4847
scm {
49-
connection = 'scm:[email protected]/alexvasilkov/GradleGitDependenciesPlugin.git'
50-
developerConnection =
51-
'scm:[email protected]:alexvasilkov/GradleGitDependenciesPlugin.git'
52-
url = 'https://github.com/alexvasilkov/GradleGitDependenciesPlugin'
48+
connection = project.ext.githubScm
49+
developerConnection = project.ext.githubScm
50+
url = project.ext.github
5351
}
5452
}
5553
}
@@ -58,7 +56,7 @@ publishing {
5856
maven {
5957
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
6058
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
61-
url = version.contains('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
59+
url = project.ext.version.contains('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
6260
credentials {
6361
username = findProperty('maven.alexvasilkov.username')
6462
password = findProperty('maven.alexvasilkov.password')

0 commit comments

Comments
 (0)