diff options
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | solenv/Module_solenv.mk | 6 | ||||
-rw-r--r-- | solenv/PythonTest_solenv_python.mk | 16 | ||||
-rw-r--r-- | solenv/gbuild/extensions/post_GbuildToIde.mk | 50 | ||||
-rw-r--r-- | solenv/qa/python/gbuildtoide.py | 56 |
5 files changed, 130 insertions, 2 deletions
diff --git a/Makefile.in b/Makefile.in index 4a16e462b357..344d35731812 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,7 +15,7 @@ MAKECMDGOALS?=all build_goal:=$(if $(filter build check,$(MAKECMDGOALS)),all)\ $(if $(filter build-nocheck,$(MAKECMDGOALS)),build)\ $(if $(filter check,$(MAKECMDGOALS)),subsequentcheck)\ - $(filter all build-l10n-only build-non-l10n-only debugrun help showmodules translations $(gb_Top_MODULE_CHECK_TARGETS) check packageinfo,$(MAKECMDGOALS)) + $(filter all build-l10n-only build-non-l10n-only debugrun help showmodules translations $(gb_Top_MODULE_CHECK_TARGETS) check packageinfo gbuildtoide,$(MAKECMDGOALS)) SRCDIR := @SRC_ROOT@ BUILDDIR := @BUILDDIR@ @@ -270,7 +270,7 @@ endif build-non-l10n-only build-l10n-only build-nocheck check debugrun translations packageinfo $(gb_Top_MODULE_CHECK_TARGETS): build -help showmodules: +help showmodules gbuildtoide: $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@ cross-toolset: bootstrap fetch diff --git a/solenv/Module_solenv.mk b/solenv/Module_solenv.mk index 78008984c89d..d179771827c9 100644 --- a/solenv/Module_solenv.mk +++ b/solenv/Module_solenv.mk @@ -21,4 +21,10 @@ $(eval $(call gb_Module_add_targets,solenv,\ )) endif +ifneq ($(DISABLE_PYTHON),TRUE) +$(eval $(call gb_Module_add_subsequentcheck_targets,solenv,\ + PythonTest_solenv_python \ +)) +endif + # vim: set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/solenv/PythonTest_solenv_python.mk b/solenv/PythonTest_solenv_python.mk new file mode 100644 index 000000000000..8985ce2b5105 --- /dev/null +++ b/solenv/PythonTest_solenv_python.mk @@ -0,0 +1,16 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_PythonTest_PythonTest,solenv_python)) + +$(eval $(call gb_PythonTest_add_modules,solenv_python,$(SRCDIR)/solenv/qa/python,\ + gbuildtoide \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/extensions/post_GbuildToIde.mk b/solenv/gbuild/extensions/post_GbuildToIde.mk new file mode 100644 index 000000000000..1c242a400620 --- /dev/null +++ b/solenv/gbuild/extensions/post_GbuildToIde.mk @@ -0,0 +1,50 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +ifneq ($(filter gbuildtoide,$(MAKECMDGOALS)),) + +gbuildtoide: + true + +.PHONY : foo +foo: + true + +define gb_Postprocess_register_target +gbuildtoide : $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,$(3))) + + +$(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,$(3))): $(gb_Helper_MISCDUMMY) foo + +define gb_LinkTarget__command + mkdir -p $(WORKDIR)/GbuildToIde/Library + printf '{"LINKTARGET": "%s"' '$$(2)' > $(WORKDIR)/GbuildToIde/$$(2) + printf ', "ILIBTARGET": "%s"' '$$(ILIBTARGET)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "COBJECTS": "%s"' '$$(COBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "CXXOBJECTS": "%s"' '$$(CXXOBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "YACCOBJECTS": "%s"' '$$(YACCOBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "OBJCOBJECTS": "%s"' '$$(OBJCOBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "OBJCXXOBJECTS": "%s"' '$$(OBJCXXOBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "ASMOBJECTS": "%s"' '$$(ASMOBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "GENCOBJECTS": "%s"' '$$(GENCOBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "GENCXXOBJECTS": "%s"' '$$(GENCXXOBJECTS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "CFLAGS": "%s"' '$$(T_CFLAGS) $$(T_CFLAGS_APPEND)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "CXXFLAGS": "%s"' '$$(T_CXXFLAGS) $$(T_CXXFLAGS_APPEND)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "OBJCFLAGS": "%s"' '$$(T_OBJCFLAGS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "OBJCXXFLAGS": "%s"' '$$(T_OBJCXXFLAGS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "DEFS": "%s"' '$$(DEFS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "INCLUDE": "%s"' '$$(INCLUDE)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "LINKED_LIBS": "%s"' '$$(LINKED_LIBS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf ', "LINKED_STATIC_LIBS": "%s"' '$$(LINKED_STATIC_LIBS)' >> $(WORKDIR)/GbuildToIde/$$(2) + printf '}\n' >> $(WORKDIR)/GbuildToIde/$$(2) +endef + +endef + +endif +# vim: set noet ts=4 sw=4: diff --git a/solenv/qa/python/gbuildtoide.py b/solenv/qa/python/gbuildtoide.py new file mode 100644 index 000000000000..6184f9170115 --- /dev/null +++ b/solenv/qa/python/gbuildtoide.py @@ -0,0 +1,56 @@ +''' + This is file is part of the LibreOffice project. + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + + This file incorporates work covered by the following license notice: + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed + with this work for additional information regarding copyright + ownership. The ASF licenses this file to you under the Apache + License, Version 2.0 (the "License"); you may not use this file + except in compliance with the License. You may obtain a copy of + the License at http://www.apache.org/licenses/LICENSE-2.0 . +''' + +import subprocess +import unittest +import json +import os +import os.path + + +class CheckGbuildToIde(unittest.TestCase): + + def test_gbuildtoide(self): + os.chdir(os.path.join(os.environ['SRCDIR'], 'solenv', 'qa', 'python', 'selftest')) + subprocess.check_call(['make', 'gbuildtoide']) + jsonfiles = os.listdir(os.path.join(os.environ['WORKDIR'], 'GbuildToIde', 'Library')) + gbuildlibs = [] + for jsonfilename in jsonfiles: + with open(os.path.join(os.environ['WORKDIR'], 'GbuildToIde', 'Library', jsonfilename), 'r') as f: + print('loading %s' % jsonfilename) + gbuildlibs.append(json.load(f)) + foundlibs = set() + for lib in gbuildlibs: + self.assertEqual(set(lib.keys()), set(['ASMOBJECTS', 'CFLAGS', 'COBJECTS', 'CXXFLAGS', 'CXXOBJECTS', 'DEFS', 'GENCOBJECTS', 'GENCXXOBJECTS', 'ILIBTARGET', 'INCLUDE', 'LINKED_LIBS', 'LINKED_STATIC_LIBS', 'LINKTARGET', 'OBJCFLAGS', 'OBJCOBJECTS', 'OBJCXXFLAGS', 'OBJCXXOBJECTS', 'YACCOBJECTS'])) + if lib['LINKTARGET'].find('gbuildselftestdep') != -1: + foundlibs.add('gbuildselftestdep') + elif lib['LINKTARGET'].find('gbuildselftest') != -1: + foundlibs.add('gbuildselftest') + self.assertIn('-Igbuildtoidetestinclude', lib['INCLUDE'].split()) + self.assertIn('gbuildselftestdep', lib['LINKED_LIBS'].split()) + self.assertIn('solenv/qa/python/selftest/selftestobject', lib['CXXOBJECTS'].split()) + self.assertIn('-DGBUILDSELFTESTDEF', lib['DEFS'].split()) + self.assertIn('-DGBUILDSELFTESTCXXFLAG', lib['CXXFLAGS'].split()) + self.assertIn('-DGBUILDSELFTESTCFLAG', lib['CFLAGS'].split()) + else: + self.assertTrue(False) + self.assertEqual(foundlibs, set(['gbuildselftest', 'gbuildselftestdep'])) + self.assertEqual(len(foundlibs), 2) + +if __name__ == "__main__": + unittest.main() |