Skip to content

Commit 8d22eed

Browse files
authored
[xaprepare] Generate omnisharp.json for the current branch (#7166)
Context: https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options Update `xaprepare` to generate an `omnisharp.json` file in the top- level directory. The generated `omnisharp.json` should allow any editor using [OmniSharp][0] to open samples, solutions, projects, and tests in the xamarin-android tree which use .NET 7, allowing such projects to have full code completion/etc. Note that `omnisharp.json` will affect only the xamarin-android checkout. If you want to be able to open projects outside the xamarin-android source tree, the generated file needs to be copied (or symlinked) into `$HOME/.omnisharp/` or to the root of the project being opened. [0]: https://www.omnisharp.net/
1 parent e4e9153 commit 8d22eed

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ tests/api-compatibility/reference/*.cs
2828
Novell
2929
*.patch
3030
*.keystore
31+
/omnisharp.json
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"msbuild": {
3+
"loadProjectsOnDemand": true,
4+
"Configuration": "@CONFIGURATION@"
5+
},
6+
7+
"RenameOptions": {
8+
"RenameInComments": false,
9+
"RenameOverloads": true,
10+
"RenameInStrings": false
11+
},
12+
13+
"sdk": {
14+
"IncludePreleases": true,
15+
"Path": "@DOTNET_SDK_PATH@"
16+
}
17+
}

build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ protected override async Task<bool> Execute (Context context)
6262
Get_mingw_32_cmake (context),
6363
Get_mingw_64_cmake (context),
6464
Get_MonoGitHash_props (context),
65+
Get_Omnisharp_Json (context),
6566
};
6667
}
6768
}
@@ -237,5 +238,21 @@ public GeneratedFile Get_MonoGitHash_props (Context context)
237238
Path.Combine (Configurables.Paths.BuildBinDir, OutputFileName)
238239
);
239240
}
241+
242+
public GeneratedFile Get_Omnisharp_Json (Context context)
243+
{
244+
const string OutputFileName = "omnisharp.json";
245+
246+
var replacements = new Dictionary<string, string> (StringComparer.Ordinal) {
247+
{ "@CONFIGURATION@", context.Configuration },
248+
{ "@DOTNET_SDK_PATH@", Path.Combine (Configurables.Paths.DotNetPreviewPath, "sdk", context.Properties.GetRequiredValue (KnownProperties.MicrosoftDotnetSdkInternalPackageVersion)) },
249+
};
250+
251+
return new GeneratedPlaceholdersFile (
252+
replacements,
253+
Path.Combine (Configurables.Paths.BuildToolsScriptsDir, $"{OutputFileName}.in"),
254+
Path.Combine (BuildPaths.XamarinAndroidSourceRoot, OutputFileName)
255+
);
256+
}
240257
}
241258
}

0 commit comments

Comments
 (0)