Update HotReload
This commit is contained in:
-7
@@ -9,10 +9,3 @@ MonoImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/FileIOProvider.cs
|
||||
uploadId: 870414
|
||||
|
||||
@@ -9,10 +9,3 @@ MonoImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/GUIDProvider.cs
|
||||
uploadId: 870414
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e856fe8c0b7d3c45a06140d120fdd87
|
||||
timeCreated: 1580717666
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/IFileIO.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1580717666
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27fd74267707df04ab2cfac0e8abd782
|
||||
timeCreated: 1580717700
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/IGUIDGenerator.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1580717700
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff65ad426f484ad5bbd34fb8f9204c4d
|
||||
timeCreated: 1676637309
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/IHotReloadProjectGenerationPostProcessor.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1676637309
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d58a4838109c4b31ac7f221547ad82e8
|
||||
timeCreated: 1676527868
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/ProjectGenenerationPostProcessor.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1676527868
|
||||
+61
-37
@@ -401,7 +401,7 @@ namespace SingularityGroup.HotReload.Editor.ProjectGeneration {
|
||||
List<ResponseFileData> responseFilesData,
|
||||
Config config
|
||||
) {
|
||||
var otherResponseFilesData = GetOtherArgumentsFromResponseFilesData(responseFilesData);
|
||||
var otherData = GetOtherArguments(responseFilesData, assembly.Assembly.compilerOptions);
|
||||
var arguments = new object[] {
|
||||
k_ToolsVersion,
|
||||
k_ProductVersion,
|
||||
@@ -414,18 +414,18 @@ namespace SingularityGroup.HotReload.Editor.ProjectGeneration {
|
||||
assembly.OutputPath,
|
||||
assembly.RootNamespace,
|
||||
"",
|
||||
GenerateLangVersion(otherResponseFilesData["langversion"], assembly),
|
||||
GenerateLangVersion(otherData["langversion"], assembly),
|
||||
k_BaseDirectory,
|
||||
assembly.CompilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe),
|
||||
GenerateNoWarn(otherResponseFilesData["nowarn"].Distinct().ToList()),
|
||||
config.excludeAllAnalyzers ? "" : GenerateAnalyserItemGroup(RetrieveRoslynAnalyzers(assembly, otherResponseFilesData)),
|
||||
config.excludeAllAnalyzers ? "" : GenerateAnalyserAdditionalFiles(otherResponseFilesData["additionalfile"].SelectMany(x=>x.Split(';')).Distinct().ToArray()),
|
||||
config.excludeAllAnalyzers ? "" : GenerateRoslynAnalyzerRulesetPath(assembly, otherResponseFilesData),
|
||||
GenerateWarningLevel(otherResponseFilesData["warn"].Concat(otherResponseFilesData["w"]).Distinct()),
|
||||
GenerateWarningAsError(otherResponseFilesData["warnaserror"], otherResponseFilesData["warnaserror-"],
|
||||
otherResponseFilesData["warnaserror+"]),
|
||||
GenerateDocumentationFile(otherResponseFilesData["doc"].ToArray()),
|
||||
GenerateNullable(otherResponseFilesData["nullable"])
|
||||
GenerateNoWarn(otherData["nowarn"].Distinct().ToList()),
|
||||
config.excludeAllAnalyzers ? "" : GenerateAnalyserItemGroup(RetrieveRoslynAnalyzers(assembly, otherData)),
|
||||
config.excludeAllAnalyzers ? "" : GenerateAnalyserAdditionalFiles(RetrieveRoslynAdditionalFiles(assembly, otherData)),
|
||||
config.excludeAllAnalyzers ? "" : GenerateRoslynAnalyzerRulesetPath(assembly, otherData),
|
||||
GenerateWarningLevel(otherData["warn"].Concat(otherData["w"]).Distinct()),
|
||||
GenerateWarningAsError(otherData["warnaserror"], otherData["warnaserror-"],
|
||||
otherData["warnaserror+"]),
|
||||
GenerateDocumentationFile(otherData["doc"].ToArray()),
|
||||
GenerateNullable(otherData["nullable"])
|
||||
};
|
||||
|
||||
try {
|
||||
@@ -436,6 +436,30 @@ namespace SingularityGroup.HotReload.Editor.ProjectGeneration {
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] RetrieveRoslynAdditionalFiles(ProjectPart assembly, ILookup<string, string> otherResponseFilesData) {
|
||||
// return otherResponseFilesData["additionalfile"].SelectMany(x => x.Split(';')).Distinct().ToArray();
|
||||
string[] additionalFilePathsFromCompilationPipeline;
|
||||
#if UNITY_2021_3 // https://github.com/JetBrains/resharper-unity/issues/2401
|
||||
var type = assembly.CompilerOptions.GetType();
|
||||
var propertyInfo = type.GetProperty("RoslynAdditionalFilePaths");
|
||||
if (propertyInfo != null && propertyInfo.GetValue(assembly.CompilerOptions) is string[] value)
|
||||
{
|
||||
additionalFilePathsFromCompilationPipeline = value;
|
||||
} else {
|
||||
additionalFilePathsFromCompilationPipeline = Array.Empty<string>();
|
||||
}
|
||||
#elif UNITY_2022_2_OR_NEWER // https://docs.unity3d.com/2021.3/Documentation/ScriptReference/Compilation.ScriptCompilerOptions.RoslynAdditionalFilePaths.html
|
||||
additionalFilePathsFromCompilationPipeline = assembly.CompilerOptions.RoslynAdditionalFilePaths;
|
||||
#else
|
||||
additionalFilePathsFromCompilationPipeline = Array.Empty<string>();
|
||||
#endif
|
||||
return otherResponseFilesData["additionalfile"]
|
||||
.SelectMany(x => x.Split(';'))
|
||||
.Concat(additionalFilePathsFromCompilationPipeline)
|
||||
.Select(MakeAbsolutePath)
|
||||
.Distinct().ToArray();
|
||||
}
|
||||
|
||||
string[] RetrieveRoslynAnalyzers(ProjectPart assembly, ILookup<string, string> otherResponseFilesData) {
|
||||
var otherAnalyzers = otherResponseFilesData["a"] ?? Array.Empty<string>();
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
@@ -653,38 +677,38 @@ namespace SingularityGroup.HotReload.Editor.ProjectGeneration {
|
||||
return string.Format(GetSolutionText(), fileversion, vsversion, projectEntries, projectConfigurations);
|
||||
}
|
||||
|
||||
private static ILookup<string, string> GetOtherArgumentsFromResponseFilesData(List<ResponseFileData> responseFilesData) {
|
||||
var paths = responseFilesData.SelectMany(x => {
|
||||
return x.OtherArguments
|
||||
.Where(a => a.StartsWith("/", StringComparison.Ordinal) || a.StartsWith("-", StringComparison.Ordinal))
|
||||
.Select(b => {
|
||||
var index = b.IndexOf(":", StringComparison.Ordinal);
|
||||
if (index > 0 && b.Length > index) {
|
||||
var key = b.Substring(1, index - 1);
|
||||
return new KeyValuePair<string, string>(key.ToLowerInvariant(), b.Substring(index + 1));
|
||||
}
|
||||
private static ILookup<string, string> GetOtherArguments(List<ResponseFileData> responseFilesData, ScriptCompilerOptions compilationOptions) {
|
||||
return responseFilesData.SelectMany(x => x.OtherArguments)
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
.Concat((compilationOptions.AdditionalCompilerArguments ?? Enumerable.Empty<string>()))
|
||||
#endif
|
||||
.Where(a => a.StartsWith("/", StringComparison.Ordinal) || a.StartsWith("-", StringComparison.Ordinal))
|
||||
.Select(b => {
|
||||
var index = b.IndexOf(":", StringComparison.Ordinal);
|
||||
if (index > 0 && b.Length > index) {
|
||||
var key = b.Substring(1, index - 1);
|
||||
return new KeyValuePair<string, string>(key.ToLowerInvariant(), b.Substring(index + 1));
|
||||
}
|
||||
|
||||
const string warnaserror = "warnaserror";
|
||||
if (b.Substring(1).StartsWith(warnaserror, StringComparison.Ordinal)) {
|
||||
return new KeyValuePair<string, string>(warnaserror, b.Substring(warnaserror.Length + 1));
|
||||
}
|
||||
const string warnaserror = "warnaserror";
|
||||
if (b.Substring(1).StartsWith(warnaserror, StringComparison.Ordinal)) {
|
||||
return new KeyValuePair<string, string>(warnaserror, b.Substring(warnaserror.Length + 1));
|
||||
}
|
||||
|
||||
const string nullable = "nullable";
|
||||
if (b.Substring(1).StartsWith(nullable)) {
|
||||
var res = b.Substring(nullable.Length + 1);
|
||||
if (string.IsNullOrWhiteSpace(res) || res.Equals("+"))
|
||||
res = "enable";
|
||||
else if (res.Equals("-"))
|
||||
res = "disable";
|
||||
return new KeyValuePair<string, string>(nullable, res);
|
||||
}
|
||||
const string nullable = "nullable";
|
||||
if (b.Substring(1).StartsWith(nullable)) {
|
||||
var res = b.Substring(nullable.Length + 1);
|
||||
if (string.IsNullOrWhiteSpace(res) || res.Equals("+"))
|
||||
res = "enable";
|
||||
else if (res.Equals("-"))
|
||||
res = "disable";
|
||||
return new KeyValuePair<string, string>(nullable, res);
|
||||
}
|
||||
|
||||
return default(KeyValuePair<string, string>);
|
||||
});
|
||||
return default(KeyValuePair<string, string>);
|
||||
})
|
||||
.Distinct()
|
||||
.ToLookup(o => o.Key, pair => pair.Value);
|
||||
return paths;
|
||||
}
|
||||
|
||||
private string GenerateLangVersion(IEnumerable<string> langVersionList, ProjectPart assembly) {
|
||||
|
||||
-7
@@ -9,10 +9,3 @@ MonoImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/ProjectGeneration.cs
|
||||
uploadId: 870414
|
||||
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea506e49c851dbd4fa394c3ed513970c
|
||||
timeCreated: 1580820569
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/ProjectGenerationFlag.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1580820569
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3067d709488a2374aba4a7b421588fe9
|
||||
timeCreated: 1604050230
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/ProjectPart.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1604050230
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cced23b33c3f7541bb84997246eb6ca
|
||||
timeCreated: 1580717740
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/SolutionGuidGenerator.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1580717740
|
||||
-7
@@ -9,10 +9,3 @@ MonoImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/Util/FileSystemUtil.cs
|
||||
uploadId: 870414
|
||||
|
||||
+1
-8
@@ -1,10 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5418a9e29385f45488b32d5459ec2c7a
|
||||
timeCreated: 1623056718
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 254358
|
||||
packageName: Hot Reload | Edit Code Without Compiling
|
||||
packageVersion: 1.13.17
|
||||
assetPath: Packages/com.singularitygroup.hotreload/Editor/ProjectGeneration/Util/StringUtils.cs
|
||||
uploadId: 870414
|
||||
timeCreated: 1623056718
|
||||
Reference in New Issue
Block a user