简体   繁体   中英

VSTS Continuous Integration - Change SDK path

I'm looking for a solution for a problem. That is arise during Continuous Integration. To run the build command on my agent I have to give the path of the sdk of my server where build is going to be run. Normally the local.properties files are not part of git change list. I have come to know that there are git hooks for running custom scripts but after reading more, it seems like they are made for some other purpose.

What I want is that after I push the code the sdk directory path in local.properties gets changed to reflect the sdk path of my server and whenever i pull the code from the remote repository, the path automatically changes back to my local sdk path.

Please suggest, should i use the git hooks for this purpose or is there any better solution you guys follow or know.

Regards

Okay, so i changed my approach. I used a powershell script as part of my build. So in the build pipeline before gradle build i added the powershell script task. After the agent copies the source code to the server the script runs and add a local.properties file with the path of the android sdk (server's). This was a more easier approach i believe.

Any one looking for solution. All you have to do is to create a new file with .ps1 extension at the root of your project. Here is the code

param([string] $fileName)
$sdkDir = "sdk.dir=C\:\\Users\\xyz\\AppData\\Local\\Android\\android-sdk" (path to your build server sdk)

Set-Content $fileName $sdkDir

the param will come from the argument section of the PowerShell Script task in build. You simply have to pass local.properties.

This way the local.properties file won't be part of git change list. Hope this helps someone. If you have any more questions regarding this feel free to ask.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM