ctaggart / SourceLink

Source Code On Demand
MIT License
356 stars 55 forks source link

Does this work with onpremise Git server such as Atlassian Stash ? #39

Closed donnib closed 9 years ago

donnib commented 10 years ago

Does this work with onpremise Git server such as Atalssian Stash ?

ctaggart commented 10 years ago

If the on-premise Git servers exposes a raw URL and has compatible authentication, then it should. It would be worth trying out. A quick search shows that it does expose a raw url:

https://jira.atlassian.com/browse/STASH-3082 http://stash_server/projects/TEST/repos/test/browse/images/test.jpg?at=8ae6d97b5e8186cfbb0f514de01e869113b1cb96&raw

So in build.fsx, you would create the srcsrv with something like:

proj.CreateSrcSrv "http://stash_server/projects/TEST/repos/test/browse/%var2%?at={0}&raw" repo.Revision (repo.Paths files)
donnib commented 10 years ago

@ctaggart thank you for your quick response, we will try this out and let you know how it goes but i have some basic questions about SourceLink in general :

ctaggart commented 10 years ago

SourceLink is just a library that helps automate source indexing of pdb files. Source indexing is something that the Microsoft debuggers already support. I recommend including the pdb files with the dll files in the NuGet packages. pdb files include the md5 checksums for the source files. The source index is just a map of how to get the source files used. The debuggers, including Visual Studio, will download the source file on the fly when debugging. The debuggers support several ways to authenticate. I recommend simply trying it out.

donnib commented 10 years ago

thanks for the update.

We have figured out that we can't use your NuGet package because it depends on F Sharp and MSbuild where both cann't be referenced for the projects we use which is Windows Phone 8 and some projects for Xamarin for iOS and Android so we have to make our own changes to PDB and put the GIT info in there. We just don't know how to solve the Authentication problem like how do you make a command that access the Git repo thru an URL and get the authentication details from the user which has to end up in the PDB file, any ideas ? How did you solve this in your solution ?

ctaggart commented 10 years ago

Yes, SourceLink.Fake uses FAKE, the F# Make build system. It does not add any references to your project. Mono doesn't use pdb files. Just create a URL and Windows debuggers support various authentication types. My blog has a SourceLink label. Check out the first post.

donnib commented 10 years ago

Thanks, Not sure what you mean about mono not having PDB files. We have them in Xamarin. And it's in these PDB files we are trying to retrieve the .cs file which corresponds to the PDB file. What i have got to work is to run a powershell command getting the .cs file from our Git server (which can provide source files in raw format) and then use this command in the datastream that pdbstr.exe used to put in the PDB file. At the moment i have not solved the authentication issue. I have just made the repo internally read-only. I don't think the debugger will ask for password /username when i run a powershell command so when you say URL do you actually put an URL in the data stream in the variable SRCSRVTRG ? We followed this article : http://www.codeproject.com/Articles/115125/Source-Indexing-and-Symbol-Servers-A-Guide-to-Easi

ctaggart commented 10 years ago

SourceLink builds on the source indexing HTTP support. srcsrv.dll, just like symsrv.dll can obtain the "source using the logon information provided by the operating system." It "supports HTTPS sites protected by smartcards, certificates, and regular logins and passwords." Using SymSrv

I recommend using the more secure HTTP support than running commands like powershell.

pauldotknopf commented 10 years ago

Atlassian Stash doesn't support raw files. You have to use the HTTP API with basic authentication to get a JSON response of LINES, that you must output to a file on your own.

This is one of the reasons I started this project.

https://github.com/theonlylawislove/SourceIndexingSharp

This will eventually (not yet), support indexing source files from Stash's API.

You can see the code I got to extract a file at an exact commit from the HTTP API here.

https://github.com/theonlylawislove/SourceIndexingSharp/tree/master/src/SourceIndexingSharp/Indexing/Stash

My project (SourceIndexingSharp) will require that a "SourceIndexingSharpExtractor.exe" to be placed in your system's PATH somewhere. Using my own exe to do the extracting, we could extract for a wider array of sources, including custom providers, and even CodePlex.

ctaggart commented 9 years ago

Correct, it work with on-premise git servers that support serving the raw files via http/https. For example, it works with TFS on-premise. I'm surprised Stash doesn't support that. It would be great to request that feature from Atlassian.