diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85f0e1953..377724abe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,12 @@ jobs: run: meson compile -C builddir - name: Install run: meson install -C builddir + - name: Dist + if: matrix.config.os == 'ubuntu-latest' + run: meson dist -C builddir - name: Build dotnet run: dotnet build Source/gtk-sharp.sln /p:Platform="Any CPU" - name: Test run: dotnet test Source/gtk-sharp.sln /p:Platform="Any CPU" + - name: Pack + run: dotnet pack Source/gtk-sharp.sln /p:Platform="Any CPU" diff --git a/Source/atk/atk.csproj b/Source/atk/atk.csproj index 79a6e5d5b..5769f53a2 100644 --- a/Source/atk/atk.csproj +++ b/Source/atk/atk.csproj @@ -3,7 +3,7 @@ Library netstandard2.0;net5.0 - false + GLibSharp.AtkSharp @@ -14,4 +14,5 @@ + \ No newline at end of file diff --git a/Source/atk/meson.build b/Source/atk/meson.build index 6d1127749..ab792106f 100644 --- a/Source/atk/meson.build +++ b/Source/atk/meson.build @@ -1,6 +1,7 @@ pkg = 'atk' - assembly_name = pkg + '-sharp' +nupkg_name = 'GLibSharp.AtkSharp.' + version + '.nupkg' +csproj_name = pkg + '.csproj' raw_api_fname = join_paths(meson.current_source_dir(), pkg + '-api.raw') metadata_fname = join_paths(meson.current_source_dir(), 'Atk.metadata') @@ -28,7 +29,6 @@ atk_sharp = shared_library(assembly_name, source_gen, sources, assemblyinfo, install_dir: lib_install_dir ) -nuget_infos += [['AtkSharp', atk_sharp, ['GlibSharp', 'GioSharp']]] install_infos += [assembly_name, atk_sharp.full_path()] atk_sharp_dep = declare_dependency(link_with: [glib_sharp, atk_sharp]) @@ -47,3 +47,7 @@ if add_languages('c', required: false) and csc.get_id() == 'mono' else message('Not running tests ' + csc.get_id()) endif + +custom_target(assembly_name + '-nugget', + command: dotnet_pack + [join_paths(meson.current_source_dir(), csproj_name)], + output: nupkg_name) \ No newline at end of file diff --git a/Source/cairo/cairo.csproj b/Source/cairo/cairo.csproj index 497db0827..fcc88f3c0 100644 --- a/Source/cairo/cairo.csproj +++ b/Source/cairo/cairo.csproj @@ -3,7 +3,7 @@ Library netstandard2.0;net5.0 - false + GLibSharp.CairoSharp @@ -14,4 +14,5 @@ + \ No newline at end of file diff --git a/Source/cairo/meson.build b/Source/cairo/meson.build index 04e1edd56..1608c14ca 100644 --- a/Source/cairo/meson.build +++ b/Source/cairo/meson.build @@ -1,5 +1,7 @@ -assembly_name = 'cairo-sharp' - +pkg = 'cairo' +assembly_name = pkg + '-sharp' +nupkg_name = 'GLibSharp.CairoSharp.' + version + '.nupkg' +csproj_name = pkg + '.csproj' raw_api_fname = join_paths(meson.current_source_dir(), 'cairo-api.raw') metadata_fname = join_paths(meson.current_source_dir(), 'cairo.metadata') @@ -69,7 +71,6 @@ cairo_sharp = shared_library(assembly_name, sources, assemblyinfo, install_dir: lib_install_dir ) -nuget_infos += [['CairoSharp', cairo_sharp, []]] install_infos += [assembly_name, cairo_sharp.full_path()] cairo_api_includes = join_paths(meson.current_source_dir(), 'cairo-api.xml') @@ -78,3 +79,7 @@ if install endif cairo_sharp_dep = declare_dependency(link_with: cairo_sharp) + +custom_target(assembly_name + '-nugget', + command: dotnet_pack + [join_paths(meson.current_source_dir(), csproj_name)], + output: nupkg_name) \ No newline at end of file diff --git a/Source/common.targets b/Source/common.targets index 8dfd7d6ab..db874171c 100644 --- a/Source/common.targets +++ b/Source/common.targets @@ -2,5 +2,20 @@ True - + GLibSharp + https://github.com/GLibSharp/GtkSharp + https://github.com/GLibSharp/GtkSharp + https://upload.wikimedia.org/wikipedia/en/5/5f/Gtk_Sharp_Logo.png + gtk bindings + false + true + true + ..\gtk-sharp.snk + LICENSE + README.md + + + + + diff --git a/Source/gdk/gdk.csproj b/Source/gdk/gdk.csproj index 66f9bf5e4..d92fec06b 100644 --- a/Source/gdk/gdk.csproj +++ b/Source/gdk/gdk.csproj @@ -3,7 +3,7 @@ Library netstandard2.0;net5.0 - false + GLibSharp.GdkSharp @@ -17,4 +17,5 @@ + \ No newline at end of file diff --git a/Source/gdk/meson.build b/Source/gdk/meson.build index deb1222b7..3b70b8b8c 100644 --- a/Source/gdk/meson.build +++ b/Source/gdk/meson.build @@ -1,5 +1,7 @@ pkg = 'gdk' assembly_name = pkg + '-sharp' +nupkg_name = 'GLibSharp.GdkSharp.' + version + '.nupkg' +csproj_name = pkg + '.csproj' symbols = join_paths(meson.current_source_dir(), 'gdk-symbols.xml') raw_api_fname = join_paths(meson.current_source_dir(), 'gdk-api.raw') @@ -70,7 +72,9 @@ gdk_sharp = shared_library(assembly_name, source_gen, sources, assemblyinfo, install_dir: lib_install_dir ) -nuget_infos += [['GdkSharp', gdk_sharp, ['GlibSharp', 'GioSharp', 'AtkSharp']]] install_infos += [assembly_name, gdk_sharp.full_path()] gdk_sharp_dep = declare_dependency(link_with: deps + [gdk_sharp]) +custom_target(assembly_name + '-nugget', + command: dotnet_pack + [join_paths(meson.current_source_dir(), csproj_name)], + output: nupkg_name) \ No newline at end of file diff --git a/Source/generator/generator.csproj b/Source/generator/generator.csproj index 463c57c1c..c7901a8ad 100644 --- a/Source/generator/generator.csproj +++ b/Source/generator/generator.csproj @@ -18,4 +18,5 @@ + \ No newline at end of file diff --git a/Source/gio/gio.csproj b/Source/gio/gio.csproj index c78b3f2a8..0e68abfea 100644 --- a/Source/gio/gio.csproj +++ b/Source/gio/gio.csproj @@ -3,7 +3,7 @@ Library netstandard2.0;net5.0 - false + GLibSharp.GioSharp @@ -14,4 +14,5 @@ + \ No newline at end of file diff --git a/Source/gio/meson.build b/Source/gio/meson.build index 7d675ae26..182dd2fcf 100644 --- a/Source/gio/meson.build +++ b/Source/gio/meson.build @@ -1,6 +1,7 @@ pkg = 'gio' assembly_name = pkg + '-sharp' - +nupkg_name = 'GLibSharp.GioSharp.' + version + '.nupkg' +csproj_name = pkg + '.csproj' raw_api_fname = join_paths(meson.current_source_dir(), pkg + '-api.raw') metadata_fname = join_paths(meson.current_source_dir(), 'Gio.metadata') @@ -35,6 +36,9 @@ gio_sharp = shared_library(assembly_name, source_gen, sources, assemblyinfo, install_dir: lib_install_dir ) -nuget_infos += [['GioSharp', gio_sharp, ['GlibSharp']]] install_infos += [assembly_name, gio_sharp.full_path()] gio_sharp_dep = declare_dependency(link_with: [glib_sharp, gio_sharp]) + +custom_target(assembly_name + '-nugget', + command: dotnet_pack + [join_paths(meson.current_source_dir(), csproj_name)], + output: nupkg_name) \ No newline at end of file diff --git a/Source/glib/glib.csproj b/Source/glib/glib.csproj index 7bf5199d4..54709c3bd 100644 --- a/Source/glib/glib.csproj +++ b/Source/glib/glib.csproj @@ -3,7 +3,7 @@ Library netstandard2.0;net5.0 - false + GLibSharp.GLibSharp @@ -11,4 +11,5 @@ + \ No newline at end of file diff --git a/Source/glib/meson.build b/Source/glib/meson.build index 9778cc8de..b42116550 100644 --- a/Source/glib/meson.build +++ b/Source/glib/meson.build @@ -1,4 +1,7 @@ -assembly_name = 'glib-sharp' +pkg = 'glib' +assembly_name = pkg + '-sharp' +nupkg_name = 'GLibSharp.GLibSharp.' + version + '.nupkg' +csproj_name = pkg + '.csproj' configure_file(input: 'glib-sharp.dll.config.in', output: 'glib-sharp.dll.config', @@ -101,7 +104,6 @@ glib_sharp = shared_library(assembly_name, sources, assemblyinfo, install_dir: lib_install_dir ) -nuget_infos += [['GlibSharp', glib_sharp, []]] install_infos += [assembly_name, glib_sharp.full_path()] glib_api_includes = join_paths(meson.current_source_dir(), 'glib-api.xml') @@ -111,3 +113,7 @@ if install endif glib_sharp_dep = declare_dependency(link_with: glib_sharp) + +custom_target(assembly_name + '-nugget', + command: dotnet_pack + [join_paths(meson.current_source_dir(), csproj_name)], + output: nupkg_name) \ No newline at end of file diff --git a/Source/gtk/gtk.csproj b/Source/gtk/gtk.csproj index f5d74214b..cfa7db943 100644 --- a/Source/gtk/gtk.csproj +++ b/Source/gtk/gtk.csproj @@ -3,7 +3,7 @@ Library netstandard2.0;net5.0 - false + GLibSharp.GtkSharp @@ -19,4 +19,5 @@ + \ No newline at end of file diff --git a/Source/gtk/meson.build b/Source/gtk/meson.build index 8269da24f..f7237e6e0 100644 --- a/Source/gtk/meson.build +++ b/Source/gtk/meson.build @@ -1,5 +1,7 @@ pkg = 'gtk' assembly_name = pkg + '-sharp' +nupkg_name = 'GLibSharp.GtkSharp.' + version + '.nupkg' +csproj_name = pkg + '.csproj' symbols = join_paths(meson.current_source_dir(), pkg + '-symbols.xml') raw_api_fname = join_paths(meson.current_source_dir(), pkg + '-api.raw') @@ -139,8 +141,6 @@ gtk_sharp = shared_library(assembly_name, source_gen, sources, assemblyinfo, install_dir: lib_install_dir ) -nuget_infos += [['GtkSharp', gtk_sharp, ['GlibSharp', 'GioSharp', - 'AtkSharp', 'GdkSharp']]] install_infos += [assembly_name, gtk_sharp.full_path()] gtk_sharp_dep = declare_dependency(link_with: deps + [gtk_sharp]) @@ -160,3 +160,7 @@ if add_languages('c', required: false) and csc.get_id() == 'mono' else message('Not running tests ' + csc.get_id()) endif + +custom_target(assembly_name + '-nugget', + command: dotnet_pack + [join_paths(meson.current_source_dir(), csproj_name)], + output: nupkg_name) \ No newline at end of file diff --git a/Source/meson.build b/Source/meson.build index a7de039e4..f00fcf806 100644 --- a/Source/meson.build +++ b/Source/meson.build @@ -63,6 +63,10 @@ assembly_data = configuration_data() assembly_data.set('API_VERSION', apiversion) assemblyinfo = configure_file(input: 'AssemblyInfo.cs.in', output: 'AssemblyInfo.cs', configuration : assembly_data) +version_props_data = configuration_data() +version_props_data.set('API_VERSION', version) +version_props_targets = configure_file(input: 'version.props.in', output: 'version.props', configuration : version_props_data) + policy_config = files('policy.config.in') if host_machine.system() == 'darwin' lib_prefix='' @@ -82,7 +86,6 @@ version_data.set('VERSION', version) version_data.set('PACKAGE_VERSION', pkg_version) install_infos = [] -nuget_infos = [] lib_install_dir = join_paths(get_option('libdir'), 'mono', pkg_version) pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig') gapi_xml_installdir = join_paths(get_option('datadir'), 'gapi-3.0') @@ -110,6 +113,8 @@ elif dep_type == 'pkgconfig' gio_girdir = join_paths(gio_dep.get_variable(pkgconfig: 'datadir'), 'gir-1.0') endif +dotnet_pack = ['dotnet', 'pack', '--configuration', 'Release'] + subdir('parser') subdir('generator') subdir('bindinator') @@ -163,29 +168,6 @@ else message('Gtk not found, not building') endif -nuget = find_program('nuget.py') -license_path = 'https://github.com/gtk-sharp' -project_uri = 'https://github.com/gtk-sharp' -icon_uri = 'https://upload.wikimedia.org/wikipedia/en/5/5f/Gtk_Sharp_Logo.png' -license_uri = 'https://github.com/gtk-sharp/gtk-sharp/blob/master/COPYING' - -deps = [] -foreach nugetinfo: nuget_infos - # FIXME - Pass proper '--owner' and '--author' - cmd = [nuget, '--package-name', nugetinfo[0], '--assembly', nugetinfo[1].full_path(), - '--project-url', project_uri, '--icon-url', icon_uri, '--license-url', - license_uri, '--version', version, '--tags', 'gtk bindings', - '--builddir', meson.current_build_dir()] - - foreach dep: nugetinfo[2] - cmd += ['--dependency=' + dep + pathsep + version] - endforeach - - deps += [custom_target(nugetinfo[0] + '-nugget', command: cmd, - depends: [nugetinfo[1]] + deps, - output: nugetinfo[0] + '.' + version + '.nupkg')] -endforeach - if install gacutil_install = join_paths(meson.current_source_dir(), 'gacutil_install.py') meson.add_install_script(gacutil_install, install_infos) diff --git a/Source/nuget.py b/Source/nuget.py deleted file mode 100644 index bfa36960e..000000000 --- a/Source/nuget.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/python3 -import argparse -import getpass -import os -import shutil -import subprocess -from datetime import datetime - -NUSPEC_TEMPLATE =""" - - - {package_name} - {author} - {owner} - {license_url} - {project_url} - {icon_url} - false - {description}. - {copyright} - {tags} - {version} - -{dependencies} - - -{files} - -""" - -TARGETS_TEMPLATE = r""" - - - - - - - - -""" - - -class Nugetifier: - def cleanup_args(self): - self.nugetdir = os.path.join(self.builddir, - self.package_name + 'nupkg') - self.frameworkdir = 'net45' - self.nuget_build_dir = os.path.join(self.nugetdir, 'build', self.frameworkdir) - self.nuget_lib_dir = os.path.join(self.nugetdir, 'lib', self.frameworkdir) - self.nuspecfile = os.path.join(self.nugetdir, '%s.nuspec' % self.package_name) - self.nugettargets = os.path.join(self.nuget_build_dir, "%s.targets" % self.package_name) - self.nuget = shutil.which('nuget') - if not self.nuget: - print("Could not find the `nuget` tool, install it and retry!") - return -1 - - for d in [self.nugetdir, self.nuget_lib_dir, self.nuget_build_dir]: - os.makedirs(d, exist_ok=True) - if not self.description: - self.description = "%s c# bindings" % self.package_name - if not self.copyright: - self.copyright = "Copyright %s" % datetime.now().year - if not self.tags: - self.tags = self.package_name - - return 0 - - def run(self): - res = self.cleanup_args() - if res: - return res - - self.files = '' - def add_file(path, target="lib"): - f = ' \n' % ( - path, os.path.join(target, os.path.basename(path))) - self.files += f - - self.dependencies = '' - for dependency in self.dependency: - _id, version = dependency.split(":") - self.dependencies += ' \n' % ( - _id, version) - - for assembly in self.assembly: - add_file(assembly, os.path.join('lib', self.frameworkdir)) - - for f in [assembly + '.config', assembly[:-3] + 'pdb']: - if os.path.exists(f): - add_file(f, os.path.join('build', self.frameworkdir)) - - with open(self.nugettargets, 'w') as _: - print(TARGETS_TEMPLATE.format(**self.__dict__), file=_) - add_file(self.nugettargets, 'build') - - with open(self.nuspecfile, 'w') as _: - print(NUSPEC_TEMPLATE.format(**self.__dict__), file=_) - - subprocess.check_call([self.nuget, 'pack', self.nuspecfile], - cwd=self.builddir) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument('--builddir') - parser.add_argument('--package-name') - parser.add_argument('--author', default=getpass.getuser()) - parser.add_argument('--owner', default=getpass.getuser()) - parser.add_argument('--native', action='append', default=[]) - parser.add_argument('--assembly', action='append', default=[]) - parser.add_argument('--out') - parser.add_argument('--description') - parser.add_argument('--copyright') - parser.add_argument('--version') - parser.add_argument('--icon-url', default='') - parser.add_argument('--project-url', default='') - parser.add_argument('--license-url', default='') - parser.add_argument('--tags', default='') - parser.add_argument('--dependency', default=[], action='append') - - nugetifier = Nugetifier() - options = parser.parse_args(namespace=nugetifier) - - exit(nugetifier.run()) diff --git a/Source/pango/meson.build b/Source/pango/meson.build index f0f04049b..9de23bfcd 100644 --- a/Source/pango/meson.build +++ b/Source/pango/meson.build @@ -1,5 +1,8 @@ pkg = 'pango' + assembly_name = pkg + '-sharp' +nupkg_name = 'GLibSharp.PangoSharp.' + version + '.nupkg' +csproj_name = pkg + '.csproj' raw_api_fname = join_paths(meson.current_source_dir(), pkg + '-api.raw') metadata_fname = join_paths(meson.current_source_dir(), 'Pango.metadata') @@ -64,6 +67,9 @@ pango_sharp = shared_library(assembly_name, source_gen, sources, assemblyinfo, install_dir: lib_install_dir ) -nuget_infos += [['PangoSharp', pango_sharp, ['GlibSharp', 'GioSharp']]] install_infos += [assembly_name, pango_sharp.full_path()] pango_sharp_dep = declare_dependency(link_with: deps + [pango_sharp]) + +custom_target(assembly_name + '-nugget', + command: dotnet_pack + [join_paths(meson.current_source_dir(), csproj_name)], + output: nupkg_name) \ No newline at end of file diff --git a/Source/pango/pango.csproj b/Source/pango/pango.csproj index 4d42581cd..84313d447 100644 --- a/Source/pango/pango.csproj +++ b/Source/pango/pango.csproj @@ -3,7 +3,7 @@ Library netstandard2.0;net5.0 - false + GLibSharp.PangoSharp @@ -15,4 +15,5 @@ + \ No newline at end of file diff --git a/Source/sample/sample.csproj b/Source/sample/sample.csproj index 39d425c47..ead93abe9 100644 --- a/Source/sample/sample.csproj +++ b/Source/sample/sample.csproj @@ -3,7 +3,6 @@ Library netstandard2.0;net5.0 - false @@ -21,4 +20,5 @@ + \ No newline at end of file diff --git a/Source/version.props.in b/Source/version.props.in new file mode 100644 index 000000000..92fde25e1 --- /dev/null +++ b/Source/version.props.in @@ -0,0 +1,6 @@ + + + + @API_VERSION@ + +