Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.qodana
build
local.properties
updatePlugins_tmp.xml
6 changes: 5 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ plugins {
id("org.jetbrains.changelog") version "1.3.1"
// Gradle Qodana Plugin
id("org.jetbrains.qodana") version "0.1.13"

id("maven-publish")
}

group = properties("pluginGroup")
version = properties("pluginVersion")

apply(from="./gradle/publish.gradle")

// Configure project's dependencies
repositories {
mavenCentral()
Expand Down Expand Up @@ -121,4 +125,4 @@ tasks {
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }
.split('.').first()))
}
}
}
9 changes: 7 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pluginGroup = com.comuto.androidtemplates
pluginName = Android Templates Plugin
pluginRepositoryUrl = https://github.com/blablacar/android-template-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.0.1
pluginVersion = 0.2.5

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down Expand Up @@ -37,7 +37,12 @@ kotlin.stdlib.default.dependency = false

PROJECT_NAME=Android template plugin
PROJECT_DESCRIPTION=Android template plugin
VERSION_NAME=0.2
GROUP=com.comuto
ARTIFACT_ID=android-template-plugin
LIBRARY_NAME=android-template-plugin
PACKAGING=jar
DEVELOPER_ID=blablacar
DEVELOPER_NAME=BlaBlaCar
DEVELOPER_EMAIL=android-devs@blablacar.com

repository_url = https://maven.pkg.github.com/blablacar/java-packages
70 changes: 51 additions & 19 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
task letsgo(dependsOn: ['lint', 'publish']) {
def versionToDeploy = pluginVersion

task fillTemplate {
// fill the updatePlugins template
String fileContents = new File('updatePlugins_template.xml').text

String fileUrl = "${repository_url}/com/comuto/android-template-plugin/android-template-plugin-${version}.jar"

def binding = [
"plugin_url":fileUrl,
"pluginVersion":pluginVersion,
"pluginSinceBuild":pluginSinceBuild,
"pluginUntilBuild":pluginUntilBuild
]

def engine = new groovy.text.SimpleTemplateEngine()
def filledTemplate = engine.createTemplate(fileContents).make(binding)

def result = filledTemplate
def destFile = new File('updatePlugins_tmp.xml')
destFile.createNewFile()
destFile.text = result
}

tasks.publish.dependsOn(fillTemplate)

task letsgo(dependsOn: ['publish']) {
doFirst {
println 'Let\'s go template plugin !'


}
}

Expand All @@ -15,20 +43,28 @@ artifacts {

publishing {
publications {
def xmlFile = layout.projectDirectory.file('updatePlugins_tmp.xml')
def xmlArtifact = artifacts.add('archives', xmlFile) {
type 'xml'
}

maven(MavenPublication) {
artifact xmlArtifact
groupId = GROUP
artifactId = ARTIFACT_ID
version = "index"
}

mavenJava(MavenPublication) {
groupId = GROUP
artifactId = ARTIFACT_ID
version = isReleaseBuild() ? VERSION_NAME : VERSION_NAME + generateSnapshotSuffix()
version = versionToDeploy

afterEvaluate {
artifact bundleReleaseAar
artifact sourcesJar
}
from components.java

pom {
name = PROJECT_NAME
description = PROJECT_DESCRIPTION
url = WEBSITE_URL
packaging = PACKAGING
groupId = GROUP
artifactId = ARTIFACT_ID
Expand All @@ -44,15 +80,19 @@ publishing {
}

repositories {
/*
mavenLocal()
*/
maven {
name "githubBlablacar"
url "https://maven.pkg.github.com/blablacar/java-packages"
credentials(PasswordCredentials)
}
name "githubBlablacar"
url "{repository_ur}"
credentials(PasswordCredentials)
}
}
}

tasks.withType(AbstractPublishToMaven) {

doLast {
def name = "${publication.groupId}:${publication.artifactId}:${publication.version}"
if (it instanceof PublishToMavenRepository) {
Expand All @@ -61,12 +101,4 @@ tasks.withType(AbstractPublishToMaven) {
println "******************** Published $name to local repository *****************"
}
}
}

static def generateSnapshotSuffix() {
return "-" + new Date().format("yyyyMMddHHmmssSSS", TimeZone.getTimeZone("UTC")) + "-SNAPSHOT"
}

def isReleaseBuild() {
return project.hasProperty('env') && project.property('env') == "RELEASE"
}
33 changes: 0 additions & 33 deletions jenkins/JenkinsfilePublishDebug

This file was deleted.

13 changes: 1 addition & 12 deletions jenkins/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@ final String rootFolder = 'android-jobs/template-plugin'
final String pipelinesFolder = 'jenkins'
final String mainBranch = 'master'

final String debugParameters = '''
parameters {
stringParam('branch', '', 'branch to publish, e.g. feature/BBC-XXXX or bugfix/BBC-XXXX')
}
'''

return [[name : "$rootFolder/template-plugin-publish-debug",
jenkinsfile: "$pipelinesFolder/JenkinsfilePublishDebug",
branch : mainBranch,
extra : debugParameters],

[name : "$rootFolder/template-plugin-publish-release",
return [[name : "$rootFolder/template-plugin-publish-release",
jenkinsfile: "$pipelinesFolder/JenkinsfilePublishRelease",
branch : mainBranch]]
28 changes: 28 additions & 0 deletions updatePlugins_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The <plugins> element (required) contains the description of the plugins
available at this repository.
-->
<plugins>
<!--
Each <plugin> element (required) describes one plugin in the repository.
Attributes:
- "id" (required) - used by JetBrains IDEs to uniquely identify
a plugin. Must match <id> in the plugin.xml file.
- "url" (required) - URL to download the plugin JAR/ZIP file.
Must be HTTPS.
- "version" (required) - version of this plugin. Must match <version>
in the plugin.xml file.
-->
<plugin
id="com.comuto.android-template.plugin"
url="${plugin_url}"
version="${pluginVersion}">
<!--
The <idea-version> element (required) must match the same element
in the plugin.xml file.
-->
<idea-version since-build="${pluginSinceBuild}" until-build="${pluginUntilBuild}"/>
</plugin>

</plugins>