Skip to content

Commit 4ac6e35

Browse files
jpobstjonpryor
authored andcommitted
[Mono.Android] Enable constants on interfaces (#4372)
Context: dotnet/java-interop#509 Context: https://gist.github.com/jpobst/31c692a67a7f0389895b59cca92480ff Beginning with C#8, interfaces may now contain constants. This allows us to better match the `android.jar` we are binding. To enable `generator` to emit interfaces which contain constants, update `$(_LangFeatures)` to contain `--lang-features=interface-constants` when `$(AndroidApiLeve)` >= 30, e.g. for API-R preview bindings. This does not remove any previously created constants. We will need to `[Obsolete]` them in a future PR.
1 parent 58f4c4f commit 4ac6e35

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Mono.Android/Mono.Android.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
<_Api>$(IntermediateOutputPath)mcw\api.xml</_Api>
109109
<_Dirs>--enumdir=$(IntermediateOutputPath)mcw</_Dirs>
110110
<_FullIntermediateOutputPath>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)'))</_FullIntermediateOutputPath>
111-
<_LangFeatures Condition="$(AndroidApiLevel) &gt;= 30">--lang-features=default-interface-methods,nested-interface-types</_LangFeatures>
111+
<_LangFeatures Condition="$(AndroidApiLevel) &gt;= 30">--lang-features=default-interface-methods,nested-interface-types,interface-constants</_LangFeatures>
112112
</PropertyGroup>
113113
<Exec
114114
Command="$(ManagedRuntime) $(ManagedRuntimeArgs) $(Generator) $(_GenFlags) $(_ApiLevel) $(_Out) $(_Codegen) $(_Fixup) $(_Enums1) $(_Enums2) $(_Versions) $(_Annotations) $(_Assembly) $(_TypeMap) $(_LangFeatures) $(_Dirs) $(_Api)"

0 commit comments

Comments
 (0)