Project

General

Profile

Services » History » Version 8

Alexey Demakov, 12/02/2021 02:32 PM

1 1 Alexey Demakov
h1. Services
2
3 6 Alexey Demakov
* "Jenkins Continuous Integration Server":https://forge.ispras.ru/jenkins/ - internal access only
4 2 Alexey Demakov
5
6 1 Alexey Demakov
* "Sonarube quality management platform, dedicated to continuously analyzing and measuring the technical quality of source code":http://forge.ispras.ru:9000 - internal access only
7 2 Alexey Demakov
8
*build.gradle:*
9
<pre>
10
plugins {
11 6 Alexey Demakov
  id 'org.sonarqube' version '1.0'
12 2 Alexey Demakov
}
13
14
sonarqube {
15
     properties {
16 6 Alexey Demakov
        property 'sonar.host.url', 'http://forge.ispras.ru:9000'
17
        property 'sonar.jdbc.url', 'jdbc:mysql://localhost:3306/sonar'
18
        property 'sonar.jdbc.driverClassName', 'com.mysql.jdbc.Driver'
19
        property 'sonar.jdbc.username', 'sonar'
20
        property 'sonar.jdbc.password', 'sonar'
21 2 Alexey Demakov
    }
22
}
23
</pre>
24
25 8 Alexey Demakov
* "Nexus 3 Repository manager":https://nxs.ispras.ru/ - internal access only
26 4 Alexey Demakov
Mail <demakov@ispras.ru> is you need upload permissions.
27 2 Alexey Demakov
28
*build.gradle:*
29
<pre>
30
plugins {
31 6 Alexey Demakov
  id 'net.saliman.properties' version '1.4.4'
32
  id 'net.researchgate.release' version '2.3.5'
33 2 Alexey Demakov
}
34
35 6 Alexey Demakov
apply plugin: 'maven-publish'
36 2 Alexey Demakov
37 3 Alexey Demakov
repositories {
38
  maven {
39 8 Alexey Demakov
    url 'https://nxs.ispras.ru/repository/snapshots'
40 3 Alexey Demakov
  }
41
  maven {
42 8 Alexey Demakov
    url 'https://nxs.ispras.ru/repository/releases'
43 3 Alexey Demakov
  }
44
  jcenter()
45
}
46
47 2 Alexey Demakov
project.group = projectGroup
48
49
release {
50
  failOnCommitNeeded = false
51
52
  versionPatterns = [
53
    // Increments build number: "0.2.5-alpha-150428" => "0.2.6-alpha-150428"
54
    /(^\d+\.\d+\.)(\d+)(-[^-]*)(-[^-]*$)/: 
55
    { Matcher m, Project p -> m.replaceAll("${ m[0][1] }${ (m[0][2] as int) + 1 }${ m[0][3] }" ) }
56
  ]
57
}
58
59
String getCurrentDateString()  {
60 6 Alexey Demakov
  new SimpleDateFormat( 'yyMMdd' ).format( new Date() )
61 2 Alexey Demakov
}
62
63
task unSnapshotVersion.doLast {
64
  def version = project.version.toString()
65 6 Alexey Demakov
  version += '-' + getCurrentDateString()
66 2 Alexey Demakov
   project.plugins.getPlugin( net.researchgate.release.ReleasePlugin.class )
67
  .updateVersionProperty( version )
68
}
69
70 8 Alexey Demakov
def repoUrlStr = 'https://nxs.ispras.ru/repository/'
71 6 Alexey Demakov
def repoUserStr = hasProperty('repoUser') ? repoUser : ''
72
def repoPasswordStr = hasProperty('repoPassword') ? repoPassword : ''
73 5 Alexey Demakov
74 2 Alexey Demakov
publishing {
75
  publications {
76
    maven(MavenPublication) {
77
      groupId projectGroup
78
      artifactId projectName
79
      version project.version
80
81
      from components.java
82
    }
83
  }
84
  repositories {
85
    maven {
86 6 Alexey Demakov
      if(project.version.endsWith('-SNAPSHOT')) {
87
        url repoUrlStr + 'snapshots'
88 1 Alexey Demakov
      } else {
89 6 Alexey Demakov
        url repoUrlStr + 'releases'
90 2 Alexey Demakov
      }
91
      credentials {
92 5 Alexey Demakov
        username repoUserStr
93
        password repoPasswordStr
94 2 Alexey Demakov
      }
95
      authentication {
96
        basic(BasicAuthentication)
97
      }
98
    }
99
  }
100
}
101
102
afterReleaseBuild.dependsOn publish
103
</pre>
104
105
*gradle.properties:*
106
<pre>
107
projectGroup=...
108
projectName=..
109 6 Alexey Demakov
# gradle-release-plugin restriction: use only '=' as separator
110 2 Alexey Demakov
version=...
111
</pre>
112
113
*gradle-local.properties:*
114
<pre>repoUser=...
115
repoPassword=...
116
</pre>
117
118
*.gitignore:*
119
<pre>
120
gradle-local.properties
121
</pre>
122
123
*settings.gradle:*
124
<pre>
125
rootProject.name = projectName
126
</pre>