Skip to content

Commit 1543ded

Browse files
committed
Change usage of RequiredMemberAttribute to PreserveAttribute
Unity does not preserve members marked with attributes that inherit RequiredMemberAttribute, but do preserve members with attributes that inherit PreserveAttribute.
1 parent ed2fba9 commit 1543ded

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Plugins/tools~/fix-library-path.sed

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ s/static string Quote/public static string Quote/
3030
# Make SQLite3 class partial, to extend in another file
3131
s/class SQLite3/partial class SQLite3/
3232

33-
# Make column attributes inherit Unity's RequiredMemberAttribute
33+
# Make column attributes inherit Unity's PreserveAttribute
3434
# This fixes managed code stripping removing getter/setter methods
35-
s/public class (PrimaryKey|AutoIncrement|Indexed|MaxLength|Collation|NotNull|StoreAsText)Attribute : Attribute/public class \1Attribute : UnityEngine.Scripting.RequiredMemberAttribute/
35+
s/public class (Column|PrimaryKey|AutoIncrement|Indexed|MaxLength|Collation|NotNull|StoreAsText)Attribute : Attribute/public class \1Attribute : UnityEngine.Scripting.PreserveAttribute/
3636

3737
# Use main thread TaskScheduler in WebGL
3838
s/TaskScheduler\.Default/SQLiteAsyncExtensions.TaskScheduler/

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ Third-party code:
113113
- `SQLiteConnection.Quote` is made public.
114114
This is useful for libraries making raw queries.
115115
- `SQLite3.SetDirectory` is only defined in Windows platforms.
116-
- Makes all column related attributes inherit `RequiredMemberAttribute`, fixing errors on columns when managed code stripping is enabled.
116+
- Makes all column related attributes inherit `PreserveAttribute`, fixing errors on columns when managed code stripping is enabled.
117117
- Changes the `TaskScheduler` used by the async API on WebGL to one that executes tasks on Unity's main thread.
118118
- Fix support for struct return types in queries

Runtime/sqlite-net/SQLite.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -2454,7 +2454,7 @@ public TableAttribute (string name)
24542454
}
24552455

24562456
[AttributeUsage (AttributeTargets.Property)]
2457-
public class ColumnAttribute : Attribute
2457+
public class ColumnAttribute : UnityEngine.Scripting.PreserveAttribute
24582458
{
24592459
public string Name { get; set; }
24602460

@@ -2465,17 +2465,17 @@ public ColumnAttribute (string name)
24652465
}
24662466

24672467
[AttributeUsage (AttributeTargets.Property)]
2468-
public class PrimaryKeyAttribute : UnityEngine.Scripting.RequiredMemberAttribute
2468+
public class PrimaryKeyAttribute : UnityEngine.Scripting.PreserveAttribute
24692469
{
24702470
}
24712471

24722472
[AttributeUsage (AttributeTargets.Property)]
2473-
public class AutoIncrementAttribute : UnityEngine.Scripting.RequiredMemberAttribute
2473+
public class AutoIncrementAttribute : UnityEngine.Scripting.PreserveAttribute
24742474
{
24752475
}
24762476

24772477
[AttributeUsage (AttributeTargets.Property, AllowMultiple = true)]
2478-
public class IndexedAttribute : UnityEngine.Scripting.RequiredMemberAttribute
2478+
public class IndexedAttribute : UnityEngine.Scripting.PreserveAttribute
24792479
{
24802480
public string Name { get; set; }
24812481
public int Order { get; set; }
@@ -2507,7 +2507,7 @@ public override bool Unique {
25072507
}
25082508

25092509
[AttributeUsage (AttributeTargets.Property)]
2510-
public class MaxLengthAttribute : UnityEngine.Scripting.RequiredMemberAttribute
2510+
public class MaxLengthAttribute : UnityEngine.Scripting.PreserveAttribute
25112511
{
25122512
public int Value { get; private set; }
25132513

@@ -2529,7 +2529,7 @@ public sealed class PreserveAttribute : System.Attribute
25292529
/// "BINARY" is the default.
25302530
/// </summary>
25312531
[AttributeUsage (AttributeTargets.Property)]
2532-
public class CollationAttribute : UnityEngine.Scripting.RequiredMemberAttribute
2532+
public class CollationAttribute : UnityEngine.Scripting.PreserveAttribute
25332533
{
25342534
public string Value { get; private set; }
25352535

@@ -2540,12 +2540,12 @@ public CollationAttribute (string collation)
25402540
}
25412541

25422542
[AttributeUsage (AttributeTargets.Property)]
2543-
public class NotNullAttribute : UnityEngine.Scripting.RequiredMemberAttribute
2543+
public class NotNullAttribute : UnityEngine.Scripting.PreserveAttribute
25442544
{
25452545
}
25462546

25472547
[AttributeUsage (AttributeTargets.Enum)]
2548-
public class StoreAsTextAttribute : UnityEngine.Scripting.RequiredMemberAttribute
2548+
public class StoreAsTextAttribute : UnityEngine.Scripting.PreserveAttribute
25492549
{
25502550
}
25512551

0 commit comments

Comments
 (0)