diff options
author | Hossein <hossein@libreoffice.org> | 2023-11-20 12:32:26 +0100 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2023-11-20 14:59:10 +0100 |
commit | bc5c767e9aebadf12aa6a181a6ce066cbfff71ad (patch) | |
tree | e04ef76d26842601b53f2ef5394018cea901752a /odk/examples | |
parent | 13eb599d8b0f81e4024f4aa2a6dd8b074f80a9df (diff) |
Separate folders for DevelopersGuide/FirstSteps
This patch creates separate folders for 3 different SDK examples in
DevelopersGuide/FirstSteps:
1. FirstUnoContact
2. FirstLoadComponent
3. HelloTextTableShape
Each one of these are ported to 4 languages: Java, C++, BASIC, Python.
The Java Makefile in the top folder is now separated into 3 different
Makefiles for Java programs.
Change-Id: Ifb2003be2aafb4caec4810eb21fbb4708b9a0628
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159591
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'odk/examples')
16 files changed, 199 insertions, 23 deletions
diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.bas b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/basic/FirstLoadComponent.bas index e11b91b23596..e11b91b23596 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.bas +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/basic/FirstLoadComponent.bas diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.java b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/java/FirstLoadComponent.java index 70e531df3d4b..70e531df3d4b 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.java +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/java/FirstLoadComponent.java diff --git a/odk/examples/DevelopersGuide/FirstSteps/Makefile b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/java/Makefile index 53077d093366..94f2332ca066 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/Makefile +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/java/Makefile @@ -34,22 +34,18 @@ # Builds the FirstSteps examples of the Developers Guide. -PRJ=../../.. +PRJ=../../../../.. SETTINGS=$(PRJ)/settings include $(SETTINGS)/settings.mk include $(SETTINGS)/std.mk # Define non-platform/compiler specific settings -EXAMPLE_NAME=FirstStepsExamples +EXAMPLE_NAME=FirstLoadComponent OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME) -APP1_NAME=FirstUnoContact -APP1_JAR=$(OUT_APP_CLASS)/$(APP1_NAME).jar -APP2_NAME=FirstLoadComponent -APP2_JAR=$(OUT_APP_CLASS)/$(APP2_NAME).jar -APP3_NAME=HelloTextTableShape -APP3_JAR=$(OUT_APP_CLASS)/$(APP3_NAME).jar +APP_NAME=FirstLoadComponent +APP_JAR=$(OUT_APP_CLASS)/$(APP_NAME).jar SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ $(PATH_SEPARATOR)$(OUT_APP_CLASS)) @@ -79,17 +75,13 @@ $(OUT_APP_CLASS)/%.jar : $(OUT_APP_CLASS)/%.mf $(OUT_APP_CLASS)/%.class +cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) -$(APP1_JAR) : $(OUT_APP_CLASS)/$(APP1_NAME).mf $(OUT_APP_CLASS)/$(APP1_NAME).class -$(APP2_JAR) : $(OUT_APP_CLASS)/$(APP2_NAME).mf $(OUT_APP_CLASS)/$(APP2_NAME).class -$(APP3_JAR) : $(OUT_APP_CLASS)/$(APP3_NAME).mf $(OUT_APP_CLASS)/$(APP3_NAME).class +$(APP_JAR) : $(OUT_APP_CLASS)/$(APP_NAME).mf $(OUT_APP_CLASS)/$(APP_NAME).class -$(EXAMPLE_NAME) : $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) +$(EXAMPLE_NAME) : $(APP_JAR) @echo -------------------------------------------------------------------------------- - @echo Please use one of the following commands to execute the examples! + @echo Please use the following command to execute the example! @echo - - @echo $(MAKE) $(APP1_NAME).run - @echo $(MAKE) $(APP2_NAME).run - @echo $(MAKE) $(APP3_NAME).run + @echo $(MAKE) -f Example_Java.mk $(APP_NAME).run @echo -------------------------------------------------------------------------------- %.run: $(OUT_APP_CLASS)/%.jar diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.py b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/python/FirstLoadComponent.py index a5d93d799f8c..a5d93d799f8c 100755 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.py +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/python/FirstLoadComponent.py diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.bas b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/basic/FirstUnoContact.bas index ba8f542d834e..ba8f542d834e 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.bas +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/basic/FirstUnoContact.bas diff --git a/odk/examples/DevelopersGuide/FirstSteps/cxx/FirstUnoContact.cxx b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/cxx/FirstUnoContact.cxx index a19bfbb02337..a19bfbb02337 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/cxx/FirstUnoContact.cxx +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/cxx/FirstUnoContact.cxx diff --git a/odk/examples/DevelopersGuide/FirstSteps/cxx/Makefile b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/cxx/Makefile index 0ba2928e838b..dca5fa92506b 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/cxx/Makefile +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/cxx/Makefile @@ -34,7 +34,7 @@ # Builds the FirstUnoContact example of the SDK. -PRJ=../../../.. +PRJ=../../../../.. SETTINGS=$(PRJ)/settings include $(SETTINGS)/settings.mk diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.java b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/java/FirstUnoContact.java index 9f4de1a6e69c..9f4de1a6e69c 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.java +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/java/FirstUnoContact.java diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/java/Makefile b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/java/Makefile new file mode 100644 index 000000000000..4dca4468f74a --- /dev/null +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/java/Makefile @@ -0,0 +1,92 @@ +#************************************************************************* +# +# The Contents of this file are made available subject to the terms of +# the BSD license. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of Sun Microsystems, Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +#************************************************************************** + +# Builds the FirstSteps examples of the Developers Guide. + +PRJ=../../../../.. +SETTINGS=$(PRJ)/settings + +include $(SETTINGS)/settings.mk +include $(SETTINGS)/std.mk + +# Define non-platform/compiler specific settings +EXAMPLE_NAME=FirstUnoContact +OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME) + +APP_NAME=FirstUnoContact +APP_JAR=$(OUT_APP_CLASS)/$(APP_NAME).jar + +SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ + $(PATH_SEPARATOR)$(OUT_APP_CLASS)) + + +# Targets +.PHONY: ALL +ALL : \ + $(EXAMPLE_NAME) + +include $(SETTINGS)/stdtarget.mk + +$(OUT_APP_CLASS)/%.class : %.java + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $< + +$(OUT_APP_CLASS)/%.mf : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo Main-Class: com.sun.star.lib.loader.Loader> $@ + $(ECHOLINE)>> $@ + @echo Name: com/sun/star/lib/loader/Loader.class>> $@ + @echo Application-Class: $*>> $@ + +$(OUT_APP_CLASS)/%.jar : $(OUT_APP_CLASS)/%.mf $(OUT_APP_CLASS)/%.class + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + +cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class + +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) + +$(APP_JAR) : $(OUT_APP_CLASS)/$(APP_NAME).mf $(OUT_APP_CLASS)/$(APP_NAME).class + +$(EXAMPLE_NAME) : $(APP_JAR) + @echo -------------------------------------------------------------------------------- + @echo Please use the following command to execute the example! + @echo - + @echo $(MAKE) -f Example_Java.mk $(APP_NAME).run + @echo -------------------------------------------------------------------------------- + +%.run: $(OUT_APP_CLASS)/%.jar + $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< + +.PHONY: clean +clean : + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_CLASS)) diff --git a/odk/examples/DevelopersGuide/FirstSteps/build_FirstUnoContact.xml b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/java/build.xml index ec0eba70ade7..ec0eba70ade7 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/build_FirstUnoContact.xml +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/java/build.xml diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.py b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/python/FirstUnoContact.py index 06cd0bc5a719..06cd0bc5a719 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.py +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/python/FirstUnoContact.py diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.bas b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/basic/HelloTextTableShape.bas index 96d75a445fac..96d75a445fac 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.bas +++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/basic/HelloTextTableShape.bas diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/java/HelloTextTableShape.java index 66bb2d8d6420..66bb2d8d6420 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java +++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/java/HelloTextTableShape.java diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/java/Makefile b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/java/Makefile new file mode 100644 index 000000000000..a208b6eb6006 --- /dev/null +++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/java/Makefile @@ -0,0 +1,92 @@ +#************************************************************************* +# +# The Contents of this file are made available subject to the terms of +# the BSD license. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of Sun Microsystems, Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +#************************************************************************** + +# Builds the FirstSteps examples of the Developers Guide. + +PRJ=../../../../.. +SETTINGS=$(PRJ)/settings + +include $(SETTINGS)/settings.mk +include $(SETTINGS)/std.mk + +# Define non-platform/compiler specific settings +EXAMPLE_NAME=HelloTextTableShape +OUT_APP_CLASS = $(OUT_CLASS)/$(EXAMPLE_NAME) + +APP_NAME=HelloTextTableShape +APP_JAR=$(OUT_APP_CLASS)/$(APP_NAME).jar + +SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\ + $(PATH_SEPARATOR)$(OUT_APP_CLASS)) + + +# Targets +.PHONY: ALL +ALL : \ + $(EXAMPLE_NAME) + +include $(SETTINGS)/stdtarget.mk + +$(OUT_APP_CLASS)/%.class : %.java + -$(MKDIR) $(subst /,$(PS),$(@D)) + $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(OUT_APP_CLASS) $< + +$(OUT_APP_CLASS)/%.mf : + -$(MKDIR) $(subst /,$(PS),$(@D)) + @echo Main-Class: com.sun.star.lib.loader.Loader> $@ + $(ECHOLINE)>> $@ + @echo Name: com/sun/star/lib/loader/Loader.class>> $@ + @echo Application-Class: $*>> $@ + +$(OUT_APP_CLASS)/%.jar : $(OUT_APP_CLASS)/%.mf $(OUT_APP_CLASS)/%.class + -$(DEL) $(subst \\,\,$(subst /,$(PS),$@)) + -$(MKDIR) $(subst /,$(PS),$(@D)) + +cd $(subst /,$(PS),$(OUT_APP_CLASS)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class + +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES) + +$(APP_JAR) : $(OUT_APP_CLASS)/$(APP_NAME).mf $(OUT_APP_CLASS)/$(APP_NAME).class + +$(EXAMPLE_NAME) : $(APP_JAR) + @echo -------------------------------------------------------------------------------- + @echo Please use the following command to execute the example! + @echo - + @echo $(MAKE) -f Example_Java.mk $(APP_NAME).run + @echo -------------------------------------------------------------------------------- + +%.run: $(OUT_APP_CLASS)/%.jar + $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< + +.PHONY: clean +clean : + -$(DELRECURSIVE) $(subst /,$(PS),$(OUT_APP_CLASS)) diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.py b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/python/HelloTextTableShape.py index a0a101e618cc..a0a101e618cc 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.py +++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/python/HelloTextTableShape.py diff --git a/odk/examples/DevelopersGuide/examples.html b/odk/examples/DevelopersGuide/examples.html index df5a83fdd1d9..7112439f4fac 100644 --- a/odk/examples/DevelopersGuide/examples.html +++ b/odk/examples/DevelopersGuide/examples.html @@ -224,8 +224,8 @@ examples</a></td> <tr> <td class="cell20"><img src="../../docs/images/bluball.gif"/> <a - href="./FirstSteps/FirstUnoContact.java" - title="link to FirstSteps/FirstUnoContact.java">FirstUnoContact</a></td> + href="./FirstSteps/FirstUnoContact/java/FirstUnoContact.java" + title="link to FirstSteps/FirstUnoContact/java/FirstUnoContact.java">FirstUnoContact</a></td> <td class="cell80">Shows how to initialize UNO and get a remote office service manager from a running LibreOffice %PRODUCT_RELEASE% in a different process space.</td> @@ -233,16 +233,16 @@ different process space.</td> <tr> <td class="cell20"><img src="../../docs/images/bluball.gif"/> <a - href="./FirstSteps/FirstLoadComponent.java" - title="link to FirstSteps/FirstLoadComponent.java">FirstLoadComponent</a></td> + href="./FirstSteps/FirstLoadComponent/java/FirstLoadComponent.java" + title="link to FirstSteps/FirstLoadComponent/java/FirstLoadComponent.java">FirstLoadComponent</a></td> <td class="cell80">Demonstrates how to load a component into LibreOffice %PRODUCT_RELEASE% by a Java application.</td> </tr> <tr> <td class="cell20"><img src="../../docs/images/bluball.gif"/> <a - href="./FirstSteps/HelloTextTableShape.java" - title="link to FirstSteps/HelloTextTableShape.java">HelloTextTableShape</a></td> + href="./FirstSteps/HelloTextTableShape/java/HelloTextTableShape.java" + title="link to FirstSteps/HelloTextTableShape/java/HelloTextTableShape.java">HelloTextTableShape</a></td> <td class="cell80">Performs some generic text and shape operations on a text document, a spreadsheet document and a drawing document.</td> |