Project

General

Profile

Services » History » Version 9

Denis Kildishev, 12/10/2021 08:15 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 9 Denis Kildishev
* There are publically readable repositories that can be used in a build scripts
29
https://nxs.ispras.ru/repository/public-snapshots/
30
https://nxs.ispras.ru/repository/public-releases/ 
31
https://nxs.ispras.ru/repository/public-maven-snapshots/
32
https://nxs.ispras.ru/repository/public-maven-releases/
33
As an example, 
34
<pre>
35
buildscript {
36
	repositories {
37
		maven {
38
		    url "https://nxs.ispras.ru/repository/public-releases/"
39
		}
40
	}
41
}
42
</pre>
43
or
44
<pre>
45
repositories {
46
	maven {
47
	    url "https://nxs.ispras.ru/repository/public-releases/"
48
	}
49
}
50
</pre>
51
52 2 Alexey Demakov
*build.gradle:*
53
<pre>
54
plugins {
55 6 Alexey Demakov
  id 'net.saliman.properties' version '1.4.4'
56
  id 'net.researchgate.release' version '2.3.5'
57 2 Alexey Demakov
}
58
59 6 Alexey Demakov
apply plugin: 'maven-publish'
60 2 Alexey Demakov
61 3 Alexey Demakov
repositories {
62
  maven {
63 8 Alexey Demakov
    url 'https://nxs.ispras.ru/repository/snapshots'
64 3 Alexey Demakov
  }
65
  maven {
66 8 Alexey Demakov
    url 'https://nxs.ispras.ru/repository/releases'
67 3 Alexey Demakov
  }
68
  jcenter()
69
}
70
71 2 Alexey Demakov
project.group = projectGroup
72
73
release {
74
  failOnCommitNeeded = false
75
76
  versionPatterns = [
77
    // Increments build number: "0.2.5-alpha-150428" => "0.2.6-alpha-150428"
78
    /(^\d+\.\d+\.)(\d+)(-[^-]*)(-[^-]*$)/: 
79
    { Matcher m, Project p -> m.replaceAll("${ m[0][1] }${ (m[0][2] as int) + 1 }${ m[0][3] }" ) }
80
  ]
81
}
82
83
String getCurrentDateString()  {
84 6 Alexey Demakov
  new SimpleDateFormat( 'yyMMdd' ).format( new Date() )
85 2 Alexey Demakov
}
86
87
task unSnapshotVersion.doLast {
88
  def version = project.version.toString()
89 6 Alexey Demakov
  version += '-' + getCurrentDateString()
90 2 Alexey Demakov
   project.plugins.getPlugin( net.researchgate.release.ReleasePlugin.class )
91
  .updateVersionProperty( version )
92
}
93
94 8 Alexey Demakov
def repoUrlStr = 'https://nxs.ispras.ru/repository/'
95 6 Alexey Demakov
def repoUserStr = hasProperty('repoUser') ? repoUser : ''
96
def repoPasswordStr = hasProperty('repoPassword') ? repoPassword : ''
97 5 Alexey Demakov
98 2 Alexey Demakov
publishing {
99
  publications {
100
    maven(MavenPublication) {
101
      groupId projectGroup
102
      artifactId projectName
103
      version project.version
104
105
      from components.java
106
    }
107
  }
108
  repositories {
109
    maven {
110 6 Alexey Demakov
      if(project.version.endsWith('-SNAPSHOT')) {
111
        url repoUrlStr + 'snapshots'
112 1 Alexey Demakov
      } else {
113 6 Alexey Demakov
        url repoUrlStr + 'releases'
114 2 Alexey Demakov
      }
115
      credentials {
116 5 Alexey Demakov
        username repoUserStr
117
        password repoPasswordStr
118 2 Alexey Demakov
      }
119
      authentication {
120
        basic(BasicAuthentication)
121
      }
122
    }
123
  }
124
}
125
126
afterReleaseBuild.dependsOn publish
127
</pre>
128
129
*gradle.properties:*
130
<pre>
131
projectGroup=...
132
projectName=..
133 6 Alexey Demakov
# gradle-release-plugin restriction: use only '=' as separator
134 2 Alexey Demakov
version=...
135
</pre>
136
137
*gradle-local.properties:*
138
<pre>repoUser=...
139
repoPassword=...
140
</pre>
141
142
*.gitignore:*
143
<pre>
144
gradle-local.properties
145
</pre>
146
147
*settings.gradle:*
148
<pre>
149
rootProject.name = projectName
150
</pre>