@@ -32,16 +32,16 @@ nuget {
3232
3333msbuild. dependsOn nugetRestore
3434msbuild {
35- solutionFile = ' callfire-api-client-csharp.sln'
36- configuration = buildReleaseConfiguration
37- projectName = ' CallfireApiClient'
38- generateDoc = true
35+ solutionFile = ' callfire-api-client-csharp.sln'
36+ configuration = buildReleaseConfiguration
37+ projectName = ' CallfireApiClient'
38+ generateDoc = true
3939}
4040
4141task msbuildDebug (type : com.ullink.Msbuild ) {
42- solutionFile = ' callfire-api-client-csharp.sln'
43- configuration = buildDebugConfiguration
44- projectName = ' CallfireApiClient'
42+ solutionFile = ' callfire-api-client-csharp.sln'
43+ configuration = buildDebugConfiguration
44+ projectName = ' CallfireApiClient'
4545}
4646msbuildDebug. dependsOn nunit
4747
@@ -60,25 +60,25 @@ task updateNuspecFile << {
6060 // cleanup previous lib/ and src/ files since they depend on build configuration
6161 spec. files. file. findAll { it. @target == ' lib' || it. @target == ' src' }. each { it. replaceNode {} }
6262
63- def isWindowsOs = Os . isFamily(Os . FAMILY_WINDOWS )
64- def monoInstallation = " $System . env . MONO_HOME "
65- def pdbToMdbConverter
66- if (isWindowsOs) {
67- if (monoInstallation != ' null' ) {
68- pdbToMdbConverter = " $System . env . MONO_HOME " + " \\ bin\\ pdb2mdb.bat"
69- exec { commandLine = [pdbToMdbConverter, " $assemblyBinDebugDir /${ archivesBaseName} .dll" ] }
70- }
71- }
72-
63+ def isWindowsOs = Os . isFamily(Os . FAMILY_WINDOWS )
64+ def monoInstallation = " $System . env . MONO_HOME "
65+ def pdbToMdbConverter
66+ if (isWindowsOs) {
67+ if (monoInstallation != ' null' ) {
68+ pdbToMdbConverter = " $System . env . MONO_HOME " + " \\ bin\\ pdb2mdb.bat"
69+ exec { commandLine = [pdbToMdbConverter, " $assemblyBinDebugDir /${ archivesBaseName} .dll" ] }
70+ }
71+ }
72+
7373 spec. files. appendNode {
74- file(src : " src/**/*.cs" , target : ' src' ) {}
74+ file(src : " src/**/*.cs" , target : ' src' ) {}
7575 file(src : " $assemblyBinDebugDir /${ archivesBaseName} .dll" , target : ' lib' ) {}
7676 file(src : " $assemblyBinReleaseDir /${ archivesBaseName} .dll.config" , target : ' lib' ) {}
7777 file(src : " $assemblyBinReleaseDir /${ archivesBaseName} .xml" , target : ' lib' ) {}
78- if (isWindowsOs) {
79- file(src : " $assemblyBinDebugDir /${ archivesBaseName} .pdb" , target : ' lib' ) {}
80- }
81- file(src : " $assemblyBinDebugDir /${ archivesBaseName} .dll.mdb" , target : ' lib' ) {}
78+ if (isWindowsOs) {
79+ file(src : " $assemblyBinDebugDir /${ archivesBaseName} .pdb" , target : ' lib' ) {}
80+ }
81+ file(src : " $assemblyBinDebugDir /${ archivesBaseName} .dll.mdb" , target : ' lib' ) {}
8282 }
8383
8484 def fw = new FileWriter (' CallfireApiClient.nuspec' )
@@ -123,71 +123,71 @@ nugetPack {
123123nugetPack. dependsOn zipBinaries
124124
125125task prepareTestData () << {
126- def inFile = file(' src/CallfireApiClient.IntegrationTests/App.config' )
127- def xml = new XmlSlurper (). parse(inFile)
128-
129- def apiLogin
130- def apiPassword
131-
132- try {
133- apiLogin = " ${ testApiUsername} "
134- apiPassword = " ${ testApiPassword} "
135- println ([ msbuild. projects[' CallfireApiClient.IntegrationTests' ]. properties.TargetPath ])
136- } catch (Exception ex) {
137- println (" Api Username and/or Password are empty, you can't run integrationTests task, set them with -PtestApiUsername/-PtestApiPassword options" )
138- apiLogin = " login"
139- apiPassword = " password"
140- }
141-
142- if (apiLogin != ' null' && apiPassword != ' null' ) {
143- xml. appSettings. add. findAll { it. @key == ' testLogin' || it. @key == ' testPassword' }. each { it. replaceNode {} }
144- xml. appSettings. appendNode {
145- add(key : " testLogin" , value : apiLogin) {}
146- add(key : " testPassword" , value : apiPassword) {}
147- }
148- }
149- def fw = new FileWriter (' src/CallfireApiClient.IntegrationTests/App.config' )
126+ def inFile = file(' src/CallfireApiClient.IntegrationTests/App.config' )
127+ def xml = new XmlSlurper (). parse(inFile)
128+
129+ def apiLogin
130+ def apiPassword
131+
132+ try {
133+ apiLogin = " ${ testApiUsername} "
134+ apiPassword = " ${ testApiPassword} "
135+ println ([ msbuild. projects[' CallfireApiClient.IntegrationTests' ]. properties.TargetPath ])
136+ } catch (Exception ex) {
137+ println (" Api Username and/or Password are empty, you can't run integrationTests task, set them with -PtestApiUsername/-PtestApiPassword options" )
138+ apiLogin = " login"
139+ apiPassword = " password"
140+ }
141+
142+ if (apiLogin != ' null' && apiPassword != ' null' ) {
143+ xml. appSettings. add. findAll { it. @key == ' testLogin' || it. @key == ' testPassword' }. each { it. replaceNode {} }
144+ xml. appSettings. appendNode {
145+ add(key : " testLogin" , value : apiLogin) {}
146+ add(key : " testPassword" , value : apiPassword) {}
147+ }
148+ }
149+ def fw = new FileWriter (' src/CallfireApiClient.IntegrationTests/App.config' )
150150 XmlUtil . serialize(xml, fw)
151151 // have to close manually because on windows file remains locked
152152 fw. close()
153153}
154154
155155task msbuildForIntegrationTests (type : com.ullink.Msbuild ) {
156- solutionFile = ' callfire-api-client-csharp.sln'
157- configuration = buildReleaseConfiguration
158- projectName = ' CallfireApiClient'
156+ solutionFile = ' callfire-api-client-csharp.sln'
157+ configuration = buildReleaseConfiguration
158+ projectName = ' CallfireApiClient'
159159}
160160msbuildForIntegrationTests. dependsOn prepareTestData
161161
162162task integrationTests (type : com.ullink.gradle.nunit.NUnit ) {
163- testAssemblies = [ msbuild. projects[' CallfireApiClient.IntegrationTests' ]. properties.TargetPath ]
163+ testAssemblies = [ msbuild. projects[' CallfireApiClient.IntegrationTests' ]. properties.TargetPath ]
164164}
165165integrationTests. dependsOn msbuildForIntegrationTests
166166
167167task prepareReleaseData () << {
168- try {
169- println (" ${ gitHubOwner} " )
170- println (" ${ gitHubToken} " )
171- } catch (Exception ex) {
172- println (" GitHub Owner and/or Token are empty, you can't run github release task, set them with -PgitHubOwner/-PgitHubToken options" )
173- }
168+ try {
169+ println (" ${ gitHubOwner} " )
170+ println (" ${ gitHubToken} " )
171+ } catch (Exception ex) {
172+ println (" GitHub Owner and/or Token are empty, you can't run github release task, set them with -PgitHubOwner/-PgitHubToken options" )
173+ }
174174}
175175prepareReleaseData. dependsOn nugetPack
176176
177177task configureCustomGitHubRelease () << {
178- github {
179- owner = " ${ gitHubOwner} "
180- repo = ' callfire-api-client-csharp'
181- token = " ${ gitHubToken} "
182- tagName = project. version
183- targetCommitish = ' master'
184- name = project. version
185- body = file( ' CurrentReleaseChanges.txt ' ) . text
186- assets = [
187- ' build/dist/CallfireApiClient-' + project. version + ' .zip' ,
188- ' build/dist/CallfireApiClient.' + project. version + ' .nupkg'
189- ]
190- }
178+ github {
179+ owner = " ${ gitHubOwner} "
180+ repo = ' callfire-api-client-csharp'
181+ token = " ${ gitHubToken} "
182+ tagName = project. version
183+ targetCommitish = ' master'
184+ name = project. version
185+ body = releaseDescription()
186+ assets = [
187+ ' build/dist/CallfireApiClient-' + project. version + ' .zip' ,
188+ ' build/dist/CallfireApiClient.' + project. version + ' .nupkg'
189+ ]
190+ }
191191}
192192configureCustomGitHubRelease. dependsOn prepareReleaseData
193193githubRelease. dependsOn configureCustomGitHubRelease
@@ -196,4 +196,12 @@ githubRelease.dependsOn configureCustomGitHubRelease
196196nugetPush {
197197 apiKey = System . properties[ ' NUGET_API_KEY' ] ?: " key not set"
198198 nupkgFile = nugetPack. packageFile
199+ }
200+
201+ def releaseDescription () {
202+ String releaseNotes = file(" Changelog.txt" ). text
203+ Integer start = releaseNotes. indexOf(" Version" ) + 28 ;
204+ Integer end = releaseNotes. indexOf(" Version" , start);
205+ String currentReleaseChanges = releaseNotes. substring(start, end). trim()
206+ " $currentReleaseChanges "
199207}
0 commit comments