diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-10-12 23:42:26 +0200 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2016-10-13 09:02:25 +0000 |
commit | f2061f85bf4d3d005668c3192589f0d242a49a36 (patch) | |
tree | 7b5d71d5d7aa46f2fc22288648bccd598218519b /solenv | |
parent | 7f77e6840d73c890e9cd0a94cab32b25d77883ae (diff) |
add initial json export for gbuild data
- also add gbuild selftest to test this (and possibly more later)
Change-Id: Ia4ef41095613e596f39d107df700e929579ba45f
Reviewed-on: https://gerrit.libreoffice.org/29744
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'solenv')
-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 |
4 files changed, 128 insertions, 0 deletions
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() |