mono: introduce friend assembly
authorYeongjong Lee <yj34.lee@samsung.com>
Mon, 28 Oct 2019 20:10:48 +0000 (17:10 -0300)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 11 Nov 2019 02:20:39 +0000 (11:20 +0900)
Summary:
Friend assemblies can access efl_mono assembly's internal types and members.
If `build-tests` option is true, `efl-mono-suite.exe` and `efl_mono_test.dll`
will become friend assemblies.

Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true

Reviewers: lauromoura, segfaultxavi, Jaehyun_Cho

Reviewed By: lauromoura

Subscribers: felipealmeida, cedric, #reviewers, woohyun, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10337

meson_options.txt
src/bindings/mono/efl_mono/AssemblyInfo.cs.in [new file with mode: 0644]
src/bindings/mono/efl_mono/meson.build

index 3d9ad1a..8f640d2 100644 (file)
@@ -367,6 +367,12 @@ option('install-eo-files',
   description : 'Install any eo file'
 )
 
+option('mono-friend-assemblies',
+  type : 'array',
+  value : [],
+  description : 'List of friend assemblies that can access efl_mono assembly\'s internal types and members.'
+)
+
 option('tizen',
   type: 'boolean',
   value: false,
@@ -384,4 +390,4 @@ option('trace',
   choices : ['ttrace', 'vtune', 'none'],
   value : 'ttrace',
   description : 'Support Tracing in Efl'
-)
\ No newline at end of file
+)
diff --git a/src/bindings/mono/efl_mono/AssemblyInfo.cs.in b/src/bindings/mono/efl_mono/AssemblyInfo.cs.in
new file mode 100644 (file)
index 0000000..e22d0a4
--- /dev/null
@@ -0,0 +1,3 @@
+using System.Runtime.CompilerServices;
+
+@MONO_FRIEND_ASSEMBLIES@
index cfe53ee..6542f51 100644 (file)
@@ -34,6 +34,25 @@ efl_src = configure_file(
   configuration: efl_libs
 )
 
+friend_assemblies = ''
+mono_friend_assemblies = get_option('mono-friend-assemblies')
+if get_option('build-tests')
+   mono_friend_assemblies += 'efl-mono-suite'
+   mono_friend_assemblies += 'efl_mono_test'
+endif
+
+foreach f : mono_friend_assemblies
+   friend_assemblies += '[assembly: InternalsVisibleTo("@0@")]\n'.format(f)
+endforeach
+friend_assembly_data = configuration_data()
+friend_assembly_data.set('MONO_FRIEND_ASSEMBLIES', friend_assemblies)
+
+mono_files += configure_file(
+  input: 'AssemblyInfo.cs.in',
+  output: 'AssemblyInfo.cs',
+  configuration: friend_assembly_data
+)
+
 mono_eo_files = [
   'efl_mono_model_internal.eo',
   'efl_mono_model_internal_child.eo'