diff --git a/.github/workflows/unity-test.yml b/.github/workflows/unity-test.yml
index 2a3d496..d70a74f 100644
--- a/.github/workflows/unity-test.yml
+++ b/.github/workflows/unity-test.yml
@@ -44,6 +44,8 @@ jobs:
"2020.1.4f1",
"2020.1.5f1",
]
+ env:
+ RUN_UNITY: "xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' /opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath ."
runs-on: ubuntu-latest
container:
@@ -118,26 +120,22 @@ jobs:
# Run playmode tests
- name: "Run playmode tests"
- if: always() && steps.activation.conclusion == 'success'
- run: |
- xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
- /opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . -runTests -testPlatform playmode || exit 0
-
- # Run editmode tests
- - name: "Run editmode tests"
if: always() && steps.activation.conclusion == 'success'
run: |
# Install codecoverage
if [ -z "`echo ${{ matrix.unity }} | grep 2018.`" ]; then
npm i -g openupm-cli
openupm add com.unity.testtools.codecoverage
-
- xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
- /opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod Coffee.CSharpCompilerSettings.Menus.SetDevelopMode
fi
- xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
- /opt/Unity/Editor/Unity -batchmode -nographics -silent-crashes -logFile -projectPath . -runEditorTests -enableCodeCoverage -coverageOptions 'assemblyFilters:+CSharpCompilerSettings' || exit 0
+ $RUN_UNITY -runTests -testPlatform playmode -enableCodeCoverage || exit 0
+
+ # Run editmode tests
+ - name: "Run editmode tests"
+ if: always() && steps.activation.conclusion == 'success'
+ run: |
+ $RUN_UNITY -executeMethod Coffee.CSharpCompilerSettings.Menus.SetDevelopMode || exit 0
+ $RUN_UNITY -runTests -testPlatform editmode -enableCodeCoverage || exit 0
# Push test results
- name: Push test results
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84c5637..a11cea5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,16 @@
+# [1.3.0](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/compare/1.2.0...1.3.0) (2020-11-09)
+
+
+### Bug Fixes
+
+* support Unity 2020.2 or later ([181ea58](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/commit/181ea586feda9e3a0b8cdc86578ae95c19807123)), closes [#6](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/issues/6) [#7](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/issues/7)
+* when enabling C# Settings in asmdef inspector, edits are lost ([0d86d20](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/commit/0d86d20032e573771168d25dfc3027162027ce89))
+
+
+### Features
+
+* support all nullable settings ([789edaf](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/commit/789edaf83d2ecab152b0efd5eb1a03c7fbfbacbd)), closes [#8](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/issues/8)
+
# [1.2.0](https://github.com/mob-sakai/CSharpCompilerSettingsForUnity/compare/1.1.1...1.2.0) (2020-10-23)
diff --git a/Editor/CSharpProjectModifier.cs b/Editor/CSharpProjectModifier.cs
index 15ae233..174ed0a 100644
--- a/Editor/CSharpProjectModifier.cs
+++ b/Editor/CSharpProjectModifier.cs
@@ -28,9 +28,16 @@ private static string OnGeneratedCSProject(string path, string content)
if (!setting.UseDefaultCompiler)
content = Regex.Replace(content, ".*", "" + setting.LanguageVersion + "", RegexOptions.Multiline);
- // Enable nullable.
- if (setting.EnableNullable)
- content = Regex.Replace(content, "(\\s+)(.*)([\r\n]+)", "$1$2$3$1enable$3");
+ // Nullable.
+ var value = setting.Nullable.ToString().ToLower();
+ if (Regex.IsMatch(content, ".*"))
+ {
+ content = Regex.Replace(content, ".*", "" + value + "");
+ }
+ else
+ {
+ content = Regex.Replace(content, "(\\s+)(.*)([\r\n]+)", "$1$2$3$1" + value + "$3");
+ }
return content;
}
diff --git a/Editor/CscSettingsProvider.cs b/Editor/CscSettingsProvider.cs
index 2bf711f..9e262d6 100644
--- a/Editor/CscSettingsProvider.cs
+++ b/Editor/CscSettingsProvider.cs
@@ -36,7 +36,7 @@ private static void OnGUI(string searchContext)
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_PackageName"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_PackageVersion"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_LanguageVersion"));
- EditorGUILayout.PropertyField(serializedObject.FindProperty("m_EnableNullable"));
+ EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Nullable"));
EditorGUI.indentLevel--;
}
diff --git a/Editor/InspectorGUI.cs b/Editor/InspectorGUI.cs
index ec8e316..a371394 100644
--- a/Editor/InspectorGUI.cs
+++ b/Editor/InspectorGUI.cs
@@ -109,7 +109,7 @@ static InspectorGUI()
private static string _assetPath;
private static string[] _ignoredAssetPaths = {
"Assets/CSharpCompilerSettings/Dev/CSharpCompilerSettings.Dev.asmdef",
- "Assets/CSharpCompilerSettings/CSharpCompilerSettings.asmdef",
+ "Assets/CSharpCompilerSettings/CSharpCompilerSettings_.asmdef",
"Packages/com.coffee.csharp-compiler-settings/Editor/CSharpCompilerSettings.Editor.asmdef",
};
@@ -143,7 +143,7 @@ private static void OnPostHeaderGUI(Editor editor)
EditorGUILayout.PropertyField(_serializedObject.FindProperty("m_PackageName"));
EditorGUILayout.PropertyField(_serializedObject.FindProperty("m_PackageVersion"));
EditorGUILayout.PropertyField(_serializedObject.FindProperty("m_LanguageVersion"));
- EditorGUILayout.PropertyField(_serializedObject.FindProperty("m_EnableNullable"));
+ EditorGUILayout.PropertyField(_serializedObject.FindProperty("m_Nullable"));
EditorGUI.indentLevel--;
}
@@ -239,6 +239,8 @@ private static void EnablePortableDll(string asmdefPath, bool enabled)
AssetDatabase.DeleteAsset(path);
}
}
+
+ Core.UpdatePortableDll(asmdefPath, enabled);
}
private static void CopyFileIfNeeded(string src, string dst)
diff --git a/Plugins/CSharpCompilerSettings.dll b/Plugins/CSharpCompilerSettings.dll
index cfe8488..8685773 100644
Binary files a/Plugins/CSharpCompilerSettings.dll and b/Plugins/CSharpCompilerSettings.dll differ
diff --git a/README.md b/README.md
index 1a6dabb..dfedd21 100755
--- a/README.md
+++ b/README.md
@@ -10,9 +10,9 @@ Change the C# compiler (csc) used on your Unity project, as you like!



+
[](https://mob-sakai.testspace.com/spaces/130862)
[](https://mob-sakai.testspace.com/spaces/130862/current/Code%20Coverage/Code%20Coverage")
-
<< [Description](#description) | [Installation](#installation) | [Usage](#usage) | [Contributing](#contributing) >>
@@ -51,8 +51,8 @@ However, unfortunately, [there are no plans to backport to Unity 2020.1 or earli
This package changes the C# compiler (csc) used on your Unity project, to support C# 8.0.
Let's enjoy C# 8.0 features with your Unity project!
-
-
+
+
### Features
@@ -95,7 +95,15 @@ Let's enjoy C# 8.0 features with your Unity project!
* If `dotnet` is required, install it automatically.
* `CompilerType.BuiltIn` compiler option to disable this plugin.
* `Enable Logging` option to display compilation log.
-* `Allow Nullable` option to enable [Nullable reference types (C# 8.0)](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types).
+* `Nullable` option to enable [Nullable reference types (C# 8.0)](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types).
+ * `enable`: The nullable annotation context is enabled. The nullable warning context is enabled.
+ * Variables of a reference type, string for example, are non-nullable. All nullability warnings are enabled.
+ * `warnings`: The nullable annotation context is disabled. The nullable warning context is enabled.
+ * Variables of a reference type are oblivious. All nullability warnings are enabled.
+ * `annotations`: The nullable annotation context is enabled. The nullable warning context is disabled.
+ * Variables of a reference type, string for example, are non-nullable. All nullability warnings are disabled.
+ * `disable`: The nullable annotation context is disabled. The nullable warning context is disabled.
+ * Variables of a reference type are oblivious, just like earlier versions of C#. All nullability warnings are disabled.
[OpenSesame.Net.Compilers]: https://www.nuget.org/packages/OpenSesame.Net.Compilers
[OpenSesame.Net.Compilers.Toolset]: https://www.nuget.org/packages/OpenSesame.Net.Compilers.Toolset
@@ -158,11 +166,11 @@ Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension) to insta

2. Select `C# Compiler` tab
3. Set `Compiler Type` to `Custom Package`, to use custom compiler package.
-
-3. Input `Package Name`, `Package Version`, `Language Version` for compilation.
+
+1. Input `Package Name`, `Package Version`, `Language Version` for compilation.
* See [features](#features) section.
-4. Press `Apply` button to save settings.
-5. It will automatically request a recompilation.
+2. Press `Apply` button to save settings.
+3. It will automatically request a recompilation.
The selected nuget package will be used for compilation.
6. Enjoy!
@@ -187,7 +195,7 @@ The project setting asset for C# Compiler will be saved in `ProjectSettings/CSha
1. Select a `*.asmodef` file
2. Turn on `Enable C# Compilier Settings` to configure.
-
+
3. Set `Compiler Type` to `Custom Package`, to use custom compiler package.
4. Input `Package Name`, `Package Version`, `Language Version` and `Modify Symbols` for compilation.
* See [features](#features) section.
@@ -271,8 +279,7 @@ With your support, I can spend more time on development. :)
## Author
-* [mob-sakai](https://github.com/mob-sakai) [](https://twitter.com/intent/follow?screen_name=mob_sakai) 
-
+*  [mob-sakai](https://github.com/mob-sakai) [](https://twitter.com/intent/follow?screen_name=mob_sakai) 
## See Also
diff --git a/package.json b/package.json
index c6f2c45..7c33435 100755
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "com.coffee.csharp-compiler-settings",
"displayName": "C# Compiler Settings",
"description": "Change the C# compiler (csc) used in your Unity project, as you like!",
- "version": "1.2.0",
+ "version": "1.3.0",
"unity": "2018.3",
"license": "MIT",
"repository": {